Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Krüger <mkrueger@xamarin.com>2014-06-27 13:57:20 +0400
committerMike Krüger <mkrueger@xamarin.com>2014-06-27 13:57:20 +0400
commit5aaf473ee8fb097fc88165097c8cede1e362768f (patch)
treecf1e9bdc27864ca7804b51e943f47076f425d36d /main/src/addins
parent3a9df9bc6875aff7bb03f7736bee780b4f071d91 (diff)
parent29e49044b88eece48606cc128d779e7dbf2d622c (diff)
Merge branch 'master' into retina-editor
Conflicts: main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/ExportCodeGenerator.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpTextEditorIndentation.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/TypeSystemProvider.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/MDRefactoringContext.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp/ExpandSelectionHandler.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp/PathedDocumentTextEditorExtension.cs main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood/DocFoodTextEditorExtension.cs main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.csproj main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultMarker.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeAnalysisBatchRunner.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeIssuePanelWidget.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/FindDerivedSymbolsHandler.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOptions.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringPreviewDialog.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoryCommands.cs main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.cs main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskStrip.cs main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AbstractUsagesExtension.cs main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/DebugTextMarker.cs main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Gui/BaseXmlEditorExtension.cs main/src/core/Mono.Texteditor/Mono.TextEditor/TextLineMarker.cs main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbar.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Components/PathBar.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/TooltipInformationWindow.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextLinkModeEventArgs.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResult.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj main/tests/UnitTests/MonoDevelop.SourceEditor/DebugTooltipTests.cs
Diffstat (limited to 'main/src/addins')
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AspMvcProject.cs11
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Gui/FolderNodeBuilderExtension.cs37
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/MonoDevelop.AspNet.Mvc.csproj5
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/StateEngine/RazorCodeFragmentState.cs2
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/StateEngine/RazorFreeState.cs2
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/PreprocessedRazorTemplate.xft.xml1
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Deployment/WebDeployService.cs19
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Gui/BaseHtmlEditorExtension.cs2
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.StateEngine/AspNetDom.cs2
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.StateEngine/AspNetFreeState.cs2
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.StateEngine/HtmlTagState.cs63
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet/AspNetAppProject.cs30
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.Html/ElementTypes.cs11
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.Html/HtmlParser.cs2
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet/Templates/WebApplication-Empty.xpt.xml2
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet/Templates/WebApplication.xpt.xml2
-rw-r--r--main/src/addins/CBinding/CBinding.addin.xml2
-rw-r--r--main/src/addins/CBinding/Compiler/GNUCompiler.cs68
-rw-r--r--main/src/addins/CBinding/Parser/CTagsManager.cs2
-rw-r--r--main/src/addins/CBinding/Project/CProject.cs9
-rw-r--r--main/src/addins/CSharpBinding/CSharpBinding.addin.xml7
-rw-r--r--main/src/addins/CSharpBinding/CSharpBinding.csproj3
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/ExportCodeGenerator.cs3
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs224
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpTextEditorIndentation.cs21
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormatter.cs5
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/TypeSystemProvider.cs5
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs8
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/Actions/MoveTypeToFile.cs12
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/MDRefactoringContext.cs58
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/MDRefactoringScript.cs4
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/NRefactoryCodeAction.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeIssues/Issues/MonoTODOIssue.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeIssues/NamingInspection/NameConventionEditRuleDialog.cs11
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CSharpCodeGenerator.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Resolver/TextEditorResolverProvider.cs13
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Tooltips/LanguageItemTooltipProvider.cs8
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp/AstStockIcons.cs16
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp/ExpandSelectionHandler.cs18
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp/PathedDocumentTextEditorExtension.cs131
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp/SignatureMarkupCreator.cs2
-rw-r--r--main/src/addins/CSharpBinding/templates/SharedAssetsProject.xpt.xml29
-rw-r--r--main/src/addins/ChangeLogAddIn/AddLogEntryDialog.cs5
-rw-r--r--main/src/addins/ChangeLogAddIn/AddinInfo.cs2
-rw-r--r--main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/DotDesktopViewWidget.cs15
-rw-r--r--main/src/addins/Deployment/MonoDevelop.Deployment/templates/PackagingProject.xpt.xml2
-rw-r--r--main/src/addins/GnomePlatform/GnomePlatform.cs4
-rw-r--r--main/src/addins/MacPlatform/Dialogs/MacAlertDialogHandler.cs14
-rw-r--r--main/src/addins/MacPlatform/Dialogs/MacOpenFileDialogHandler.cs3
-rw-r--r--main/src/addins/MacPlatform/Dialogs/MacSelectFileDialogHandler.cs2
-rw-r--r--main/src/addins/MacPlatform/Dialogs/SelectEncodingPopUpButton.cs4
-rw-r--r--main/src/addins/MacPlatform/MacIntegrationCommands.cs40
-rw-r--r--main/src/addins/MacPlatform/MacInterop/AppleEvents/Native.cs26
-rw-r--r--main/src/addins/MacPlatform/MacInterop/Keychain.cs18
-rw-r--r--main/src/addins/MacPlatform/MacMenu/MDMenu.cs6
-rw-r--r--main/src/addins/MacPlatform/MacMenu/MDMenuItem.cs19
-rw-r--r--main/src/addins/MacPlatform/MacMenu/MDSubMenuItem.cs4
-rw-r--r--main/src/addins/MacPlatform/MacPlatform.addin.xml7
-rw-r--r--main/src/addins/MacPlatform/MacPlatform.cs34
-rw-r--r--main/src/addins/MacPlatform/MacProxyCredentialProvider.cs111
-rw-r--r--main/src/addins/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserViewContent.cs17
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs16
-rw-r--r--main/src/addins/MonoDevelop.Autotools/AddinInfo.cs1
-rw-r--r--main/src/addins/MonoDevelop.Autotools/MakefileData.cs16
-rw-r--r--main/src/addins/MonoDevelop.Autotools/MakefileProject.cs8
-rw-r--r--main/src/addins/MonoDevelop.Autotools/MakefileProjectServiceExtension.cs40
-rw-r--r--main/src/addins/MonoDevelop.Autotools/SolutionDeployer.cs60
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Gdb/AddinInfo.cs16
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Gdb/AssemblyInfo.cs9
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Gdb/ChangeLog365
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Gdb/CommandStatus.cs38
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Gdb/GdbBacktrace.cs400
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Gdb/GdbCommandResult.cs53
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Gdb/GdbEvent.cs49
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Gdb/GdbSession.cs735
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Gdb/GdbSessionFactory.cs151
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Gdb/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Gdb/Manifest.addin.xml8
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Gdb/MonoDevelop.Debugger.Gdb.csproj92
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Gdb/ResultData.cs229
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft.AspNet/AspNetSoftDebuggerEngine.cs13
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/CustomSoftDebuggerEngine.cs18
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/SoftDebuggerEngine.cs18
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Extensions/DebuggerExtensions.cs4
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Extensions/MetadataExtensions.cs9
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Metadata/MetadataPropertyInfo.cs4
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Metadata/MetadataType.cs4
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/SymStore/SymReader.cs15
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/debug/Debugger.cs2
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/ArrayAdaptor.cs3
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerBacktrace.cs165
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerSession.cs316
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorObjectAdaptor.cs162
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/MtaThread.cs46
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/PropertyReference.cs26
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests.TestApp/BreakpointsAndStepping.cs575
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests.TestApp/Main.cs143
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests.TestApp/MonoDevelop.Debugger.Tests.TestApp.csproj5
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests.TestApp/TestEvaluation.cs589
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/BreakpointsAndSteppingTests.cs1007
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorBreakpointsAndSteppingTests.cs39
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorEvaluationTests.cs14
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorStackFrameTests.cs15
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/DebugTests.cs326
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/EvaluationTests.cs1388
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj9
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbBreakpointsAndSteppingTests.cs (renamed from main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MdbEvaluationTests.cs)98
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbEvaluationTests.cs12
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbStackFrameTests.cs13
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/StackFrameTests.cs91
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/CStringVisualizer.cs9
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/IValueVisualizer.cs154
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/PixbufVisualizer.cs13
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/TextVisualizer.cs3
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.addin.xml20
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj73
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs113
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerConsoleView.cs6
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerEngine.cs17
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerEngineBackend.cs93
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerOptionsPanelWidget.cs25
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs215
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs16
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/Extensions.cs6
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/IDebuggerEngine.cs1
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/IDebuggerExpressionResolver.cs38
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/LocalsPad.cs55
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValuePad.cs2
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs147
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/PinnedWatchStore.cs7
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/StackTracePad.cs40
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ThreadsPad.cs125
-rw-r--r--main/src/addins/MonoDevelop.Debugger/gtk-gui/MonoDevelop.Debugger.DebuggerOptionsPanelWidget.cs64
-rw-r--r--main/src/addins/MonoDevelop.Debugger/gtk-gui/gui.stetic385
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/exception-icon.pngbin3634 -> 0 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/exception-icon@2x.pngbin9883 -> 0 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/breakpoint-16.pngbin871 -> 940 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/breakpoint-16@2x.pngbin2456 -> 2618 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/bug-16.pngbin744 -> 0 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/bug-16@2x.pngbin1689 -> 0 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-16.pngbin750 -> 754 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-16@2x.pngbin799 -> 807 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-22.pngbin1612 -> 1622 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-22@2x.pngbin1654 -> 1659 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-24.pngbin1618 -> 1621 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-24@2x.pngbin1666 -> 2612 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-32.pngbin1633 -> 1639 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-32@2x.pngbin1708 -> 2662 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/exception-48.pngbin0 -> 2422 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/exception-48@2x.pngbin0 -> 5549 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-15.pngbin0 -> 740 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-15@2x.pngbin0 -> 1703 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-disabled-15.pngbin0 -> 637 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-disabled-15@2x.pngbin0 -> 1372 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-invalid-15.pngbin0 -> 750 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-invalid-15@2x.pngbin0 -> 1525 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/gutter-execution-15.pngbin0 -> 242 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/gutter-execution-15@2x.pngbin0 -> 425 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/gutter-stack-15.pngbin0 -> 281 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/gutter-stack-15@2x.pngbin0 -> 669 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-15.pngbin0 -> 631 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-15@2x.pngbin0 -> 1428 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-disabled-15.pngbin0 -> 429 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-disabled-15@2x.pngbin0 -> 1084 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-invalid-15.pngbin0 -> 578 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-invalid-15@2x.pngbin0 -> 1199 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/prefs-debugger-16.pngbin0 -> 754 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/prefs-debugger-16@2x.pngbin0 -> 1835 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/stack-pointer-16.pngbin0 -> 466 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/light/stack-pointer-16@2x.pngbin0 -> 974 bytes
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/IToolboxLoader.cs4
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ItemToolboxNode.cs6
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/TextToolboxNode.cs4
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ToolboxItemToolboxLoader.cs41
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ToolboxWidget.cs20
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/ClassOutlineTextEditorExtension.cs2
-rw-r--r--main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood/DocFoodTextEditorExtension.cs12
-rw-r--r--main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood/DocGenerator.cs12
-rw-r--r--main/src/addins/MonoDevelop.Gettext/AddinInfo.cs9
-rw-r--r--main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.csproj6
-rw-r--r--main/src/addins/MonoDevelop.Gettext/gtk-gui/MonoDevelop.Gettext.Translator.LanguageChooserDialog.cs2
-rw-r--r--main/src/addins/MonoDevelop.Gettext/icons/light/done-16.pngbin846 -> 825 bytes
-rw-r--r--main/src/addins/MonoDevelop.Gettext/icons/light/done-16@2x.pngbin2003 -> 1943 bytes
-rw-r--r--main/src/addins/MonoDevelop.Gettext/icons/light/error-16.pngbin830 -> 894 bytes
-rw-r--r--main/src/addins/MonoDevelop.Gettext/icons/light/error-16@2x.pngbin1854 -> 1967 bytes
-rw-r--r--main/src/addins/MonoDevelop.Gettext/icons/light/prefs-language-16.pngbin0 -> 598 bytes
-rw-r--r--main/src/addins/MonoDevelop.Gettext/icons/light/prefs-language-16@2x.pngbin0 -> 1732 bytes
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/libstetic/Placeholder.cs2
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/libsteticui/Metacity/Preview.cs2
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/templates/ActionGroup.xft.xml2
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/templates/ActionGroupPartial.xft.xml2
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/templates/Dialog.xft.xml2
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/templates/DialogPartial.xft.xml2
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/templates/DrawingArea.xft.xml2
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/templates/Widget.xft.xml2
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/templates/WidgetPartial.xft.xml2
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/templates/Window.xft.xml2
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/templates/WindowPartial.xft.xml2
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/AddPackagesDialog.UI.cs11
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/AddPackagesDialog.cs22
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageCellView.cs26
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageSourceCellRenderer.cs12
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageSourcesOptionsPanel.cs111
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageSourcesWidget.cs40
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/PackageReferenceNode.cs4
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/PackageReferenceNodeBuilder.cs7
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/ProjectPackagesFolderNode.cs4
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/ProjectPackagesFolderNodeBuilder.cs27
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/ProjectPackagesProjectNodeBuilderExtension.cs64
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/CollectionAssert.cs (renamed from main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MdbStackFrameTests.cs)82
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/ExceptionThrowingProcessPackageAction.cs42
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/ExceptionThrowingRegisteredPackageRepositories.cs46
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeDotNetProject.cs117
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeFileService.cs63
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeFileSystem.cs150
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeInstallPackageAction.cs64
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeLogger.cs77
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeMachineCache.cs54
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeOperationAwareRepository.cs66
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackage.cs233
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageAssemblyReference.cs69
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManagementProject.cs295
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManagementProjectFactory.cs81
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManagementProjectService.cs92
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManagementSolution.cs203
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManager.cs240
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManagerFactory.cs49
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageOperation.cs48
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageOperationResolver.cs52
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageOperationResolverFactory.cs78
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackagePathResolver.cs60
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageRepository.cs96
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageRepositoryFactory.cs122
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageRepositoryFactoryEvents.cs44
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageRepositoryWithHttpClientEvents.cs44
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageViewModelFactory.cs72
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProcess.cs42
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProgressMonitor.cs126
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProgressMonitorFactory.cs44
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProject.cs61
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProjectManager.cs209
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProjectSystem.cs99
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProjectSystemFactory.cs45
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeRecentPackageRepository.cs69
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeRegisteredPackageRepositories.cs122
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeServiceBasedRepository.cs65
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSettings.cs238
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSharedPackageRepository.cs70
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSolution.cs48
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSolutionPackageRepository.cs86
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSolutionPackageRepositoryFactory.cs45
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeTask.cs89
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeTaskFactory.cs67
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeUninstallPackageAction.cs51
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeUpdatePackageAction.cs59
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeWebRequest.cs42
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FileNameAndDirectory.cs67
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FileNameAndProjectName.cs66
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/ImportAndCondition.cs43
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/InstallPackageHelper.cs83
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/OneRegisteredPackageSourceHelper.cs88
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/PackageCollectionAssert.cs62
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/PackageOperationHelper.cs52
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/PackageReferenceRepositoryHelper.cs57
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/PackageSourceCollectionAssert.cs82
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/RecentPackageInfoCollectionAssert.cs53
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/ReferenceAndProjectName.cs67
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/SelectedProjectCollectionAssert.cs61
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestPackageHelper.cs66
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableBackgroundPackageActionRunner.cs74
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableMonoDevelopProjectSystem.cs119
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestablePackageFromRepository.cs57
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestablePackageManagementEventsMonitor.cs68
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestablePackageManagementOptions.cs69
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestablePackageViewModel.cs79
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableProcessPackageAction.cs70
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableProjectManager.cs105
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableViewModelBase.cs37
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/UninstallPackageHelper.cs68
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/UpdatePackageHelper.cs82
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/WindowsPath.cs52
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.csproj131
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/AvailablePackagesViewModelTests.cs915
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/BackgroundPackageActionRunnerTests.cs438
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/DelegateCommandTests.cs94
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/IPackageExtensionsTests.cs114
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/InstallPackageActionTests.cs499
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MSBuildProjectExtensionsTests.cs (renamed from main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MSBuildProjectExtensionsTests.cs)60
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MonoDevelopPackageManagerFactoryTests.cs141
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MonoDevelopPackageManagerTests.cs1139
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MonoDevelopProjectManagerTests.cs110
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MonoDevelopProjectSystemTests.cs1129
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/NuGetPackageRestoreCommandLineTests.cs86
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/OpenDotNetProjectTests.cs90
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageFilesTests.cs170
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageFromRepositoryTests.cs467
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementEventsTests.cs463
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementLoggerTests.cs109
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementOptionsTests.cs582
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementOptionsViewModelTests.cs332
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementProjectTests.cs775
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementSelectedProjectTests.cs85
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementSelectedProjectsTests.cs536
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementSolutionTests.cs665
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageOperationMessageTests.cs73
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageRepositoryCacheTests.cs414
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageSearchCriteriaTests.cs82
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageSourceViewModelTests.cs158
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageViewModelTests.cs807
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/ProcessPackageActionTests.cs110
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/ProjectHelper.cs129
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/RecentPackageInfoTests.cs91
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/RecentPackageRepositoryTests.cs216
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/ReducedPackageOperationsTests.cs188
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/RegisteredPackageRepositoriesTests.cs314
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/RegisteredPackageSourcesViewModelTests.cs529
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/SettingProviderTests.cs102
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/SolutionPackageRepositoryPathTests.cs117
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/SolutionPackageRepositoryTests.cs247
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/ThreadSafePackageManagementEventsTests.cs607
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UninstallPackageActionTests.cs287
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UpdateAllPackagesInProjectTests.cs233
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UpdateAllPackagesInSolutionTests.cs258
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UpdatePackageActionTests.cs371
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UserAgentGeneratorForRepositoryRequestsTests.cs106
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/ViewModelBaseTests.cs71
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/WildcardVersionSpecTests.cs79
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/XmlDocumentTransformTests.cs147
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.addin.xml18
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.csproj46
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/AvailablePackagesViewModel.cs57
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/BackgroundPackageActionRunner.cs87
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ConfigSettingsFileSystem.cs3
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/DotNetProjectExtensions.cs45
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/DotNetProjectProxy.cs89
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IBackgroundPackageActionRunner.cs4
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IDotNetProject.cs48
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementEvents.cs5
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementFileService.cs1
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementProjectFactory.cs4
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementProjectService.cs12
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementSolution.cs7
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagerFactory.cs6
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IProject.cs44
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ISettingsProvider.cs38
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ISolution.cs38
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ISolutionPackageRepositoryFactory.cs3
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/InstallPackageAction.cs4
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MSBuildProjectExtensions.cs8
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ManagePackagesUserPrompts.cs124
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ManagePackagesViewModel.cs6
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopCredentialProvider.cs13
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/NuGetPackageRestoreCommandLine.cs24
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/OpenDotNetProjects.cs19
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementEvents.cs18
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementEventsMonitor.cs75
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementFileService.cs17
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementOptions.cs19
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementOptionsViewModel.cs3
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProgressMonitor.cs194
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProgressMonitorFactory.cs4
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProgressProvider.cs71
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProject.cs29
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProjectFactory.cs8
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProjectService.cs68
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementSelectedProject.cs12
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementSelectedProjects.cs21
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementServices.cs16
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementSolution.cs51
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementViewModels.cs3
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRepositoryCache.cs45
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRestoreRunner.cs15
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageSearchCriteria.cs93
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageSourceViewModel.cs5
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageSourceViewModelChecker.cs30
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageViewModel.cs34
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackagesForSelectedPageQuery.cs5
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackagesRequiringLicenseAcceptance.cs17
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackagesViewModel.cs61
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackagesViewModels.cs4
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProcessPackageAction.cs83
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProgressMonitorExtensions.cs4
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProjectProxy.cs70
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProjectTargetFramework.cs9
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProjectTemplateNuGetPackageInstaller.cs14
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RecentPackageRepository.cs14
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageRepositories.cs19
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageSourceSettings.cs69
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageSourcesViewModel.cs42
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SearchPackagesDataSource.cs9
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SettingsProvider.cs88
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SharpDevelopPackageManagerFactory.cs11
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SharpDevelopPackageRepositoryFactory.cs14
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SharpDevelopProjectSystem.cs86
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SolutionPackageRepository.cs10
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SolutionPackageRepositoryFactory.cs5
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SolutionPackageRepositoryPath.cs11
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SolutionProxy.cs51
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ThreadSafePackageManagementEvents.cs67
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UninstallPackageAction.cs4
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UpdatePackageAction.cs14
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UserAgentGeneratorForRepositoryRequests.cs4
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/WildcardVersionSpec.cs153
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/icons/PackageSourceIcon.pngbin4992 -> 0 bytes
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/icons/dark/reference-48.pngbin0 -> 1773 bytes
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/icons/dark/reference-48@2x.pngbin0 -> 3192 bytes
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/icons/light/package-source-32.pngbin0 -> 1254 bytes
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/icons/light/package-source-32@2x.pngbin0 -> 2284 bytes
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/icons/light/prefs-package-16.pngbin0 -> 589 bytes
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/icons/light/prefs-package-16@2x.pngbin0 -> 1304 bytes
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/icons/light/prefs-package-source-16.pngbin0 -> 657 bytes
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/icons/light/prefs-package-source-16@2x.pngbin0 -> 1254 bytes
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/icons/light/reference-48.pngbin0 -> 1901 bytes
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/icons/light/reference-48@2x.pngbin0 -> 3887 bytes
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/icons/packageicon.pngbin3436 -> 0 bytes
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultMarker.cs354
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs2
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeAnalysisBatchRunner.cs117
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeIssuePanelWidget.cs31
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Rename/RenameRefactoring.cs13
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml24
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj20
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/ExtensionMethods.cs48
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/FindDerivedSymbolsHandler.cs85
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/FindReferencesHandler.cs12
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOptions.cs15
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringPreviewDialog.cs21
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs5
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoryCommands.cs2
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/ResolveCommandHandler.cs48
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-actions-16.pngbin0 -> 642 bytes
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-actions-16@2x.pngbin0 -> 1841 bytes
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-analysis-16.pngbin0 -> 329 bytes
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-analysis-16@2x.pngbin0 -> 708 bytes
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-rules-16.pngbin0 -> 335 bytes
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-rules-16@2x.pngbin0 -> 697 bytes
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/HighlightingPanel.cs6
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.cs90
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskStrip.cs10
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.addin.xml45
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj54
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AutoSave.cs10
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs165
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs79
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/HoverCloseButton.cs2
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleCache.cs37
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleTextMarker.cs70
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs43
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs22
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/DebugTextMarker.cs182
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-bookmark-15.pngbin0 -> 434 bytes
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-bookmark-15@2x.pngbin0 -> 1132 bytes
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-error-15.pngbin0 -> 235 bytes
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-error-15@2x.pngbin0 -> 600 bytes
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-warning-15.pngbin0 -> 306 bytes
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-warning-15@2x.pngbin0 -> 700 bytes
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-completion-appearance-16.pngbin0 -> 318 bytes
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-completion-appearance-16@2x.pngbin0 -> 935 bytes
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-completion-behavior-16.pngbin0 -> 318 bytes
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-completion-behavior-16@2x.pngbin0 -> 935 bytes
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-markers-rulers-16.pngbin0 -> 444 bytes
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-markers-rulers-16@2x.pngbin0 -> 820 bytes
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-syntax-highlighting-16.pngbin0 -> 456 bytes
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-syntax-highlighting-16@2x.pngbin0 -> 879 bytes
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-text-editor-behavior-16.pngbin0 -> 813 bytes
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-text-editor-behavior-16@2x.pngbin0 -> 2225 bytes
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-text-editor-general-16.pngbin0 -> 389 bytes
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-text-editor-general-16@2x.pngbin0 -> 675 bytes
-rw-r--r--main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.addin.xml6
-rw-r--r--main/src/addins/MonoDevelop.WebReferences/gtk-gui/generated.cs1
-rwxr-xr-xmain/src/addins/MonoDevelop.XmlEditor/MonoDevelop.Xml.StateEngine/Parser.cs35
-rw-r--r--main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.Xml.StateEngine/XmlClosingTagState.cs5
-rwxr-xr-xmain/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Completion/XmlCompletionData.cs21
-rw-r--r--main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Gui/BaseXmlEditorExtension.cs293
-rw-r--r--main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Gui/XmlSchemasPanelWidget.cs2
-rw-r--r--main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.addin.xml9
-rw-r--r--main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.csproj14
-rw-r--r--main/src/addins/MonoDevelop.XmlEditor/icons/light/prefs-xml-16.pngbin0 -> 422 bytes
-rw-r--r--main/src/addins/MonoDevelop.XmlEditor/icons/light/prefs-xml-16@2x.pngbin0 -> 917 bytes
-rw-r--r--main/src/addins/MonoDevelop.XmlEditor/icons/light/prefs-xml-schemas-16.pngbin0 -> 422 bytes
-rw-r--r--main/src/addins/MonoDevelop.XmlEditor/icons/light/prefs-xml-schemas-16@2x.pngbin0 -> 917 bytes
-rw-r--r--main/src/addins/MonoDeveloperExtensions/AddinInfo.cs1
-rw-r--r--main/src/addins/MonoDeveloperExtensions/MonoSolutionItemHandler.cs43
-rw-r--r--main/src/addins/NUnit/Gui/AbstractUnitTestEditorExtension.cs4
-rw-r--r--main/src/addins/NUnit/Gui/TestPad.cs4
-rw-r--r--main/src/addins/NUnit/Gui/icons/light/unit-failed-16.pngbin515 -> 530 bytes
-rw-r--r--main/src/addins/NUnit/Gui/icons/light/unit-failed-16@2x.pngbin1156 -> 1163 bytes
-rw-r--r--main/src/addins/NUnit/Gui/icons/light/unit-mixed-results-16.pngbin813 -> 816 bytes
-rw-r--r--main/src/addins/NUnit/Gui/icons/light/unit-mixed-results-16@2x.pngbin1902 -> 1933 bytes
-rw-r--r--main/src/addins/NUnit/Gui/icons/light/unit-running-16.pngbin533 -> 627 bytes
-rw-r--r--main/src/addins/NUnit/Gui/icons/light/unit-running-16@2x.pngbin1242 -> 1468 bytes
-rw-r--r--main/src/addins/NUnit/Gui/icons/light/unit-success-16.pngbin565 -> 566 bytes
-rw-r--r--main/src/addins/NUnit/Gui/icons/light/unit-success-16@2x.pngbin1160 -> 1140 bytes
-rw-r--r--main/src/addins/NUnit/MonoDevelop.NUnit.csproj3
-rw-r--r--main/src/addins/NUnit/Project/NUnitAssemblyGroupProject.cs2
-rw-r--r--main/src/addins/NUnit/Services/AbstractResultsStore.cs (renamed from main/src/addins/NUnit/Services/XmlResultsStore.cs)106
-rw-r--r--main/src/addins/NUnit/Services/BinaryResultsStore.cs98
-rw-r--r--main/src/addins/NUnit/Services/NUnitProjectTestSuite.cs4
-rw-r--r--main/src/addins/NUnit/Services/SolutionFolderTestGroup.cs2
-rw-r--r--main/src/addins/NUnit/Services/WorkspaceTestGroup.cs2
-rw-r--r--main/src/addins/NUnit/templates/NUnitProject.xpt.xml2
-rw-r--r--main/src/addins/NUnit/templates/NUnitTestClass.xft.xml2
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating.nuspec19
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs4
-rw-r--r--main/src/addins/TextTemplating/TextTransform/Options.cs13
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseGitRepositoryTests.cs65
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseRepositoryTests.cs85
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/GitIntegrityTests.cs4
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/AssemblyInfo.cs1
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git.addin.xml4
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Commands.cs37
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/EditBranchDialog.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs188
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs3
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitUtil.cs23
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/MergeDialog.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/UniqueIdentifier.targets32
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/BaseSvnRepositoryTests.cs12
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/RepositoryTests.cs10
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix.dll.config2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix/SvnClient.cs70
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/SubversionRepository.cs53
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/SubversionVersionControl.cs15
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitDialog.cs10
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitMessageStylePanelWidget.cs7
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs6
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CellRendererDiff.cs9
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffWidget.cs6
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.cs12
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogView.cs35
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs26
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeView.cs16
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeWidget.cs32
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs46
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/SubviewAttachmentHandler.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/VersionControlDocumentInfo.cs26
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj32
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CommitCommand.cs46
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/FileUpdateEventHandler.cs6
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Repository.cs92
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UnknownRepository.cs6
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlCommandHandler.cs1
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlFileSystemExtension.cs21
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlItemList.cs10
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlNodeExtension.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs45
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlSystem.cs4
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionInfoCache.cs4
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/VersionControl.addin.xml23
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/gtk-gui/MonoDevelop.VersionControl.Dialogs.CommitDialog.cs1
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/gtk-gui/gui.stetic1
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/branch-16.pngbin567 -> 577 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/branch-16@2x.pngbin1298 -> 1287 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/commit-16.pngbin889 -> 885 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/commit-16@2x.pngbin2254 -> 2247 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/local-status-16.pngbin0 -> 800 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/local-status-16@2x.pngbin0 -> 1956 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/log-16.pngbin0 -> 429 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/log-16@2x.pngbin0 -> 944 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-commit-message-style-16.pngbin0 -> 885 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-commit-message-style-16@2x.pngbin0 -> 2247 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-git-16.pngbin0 -> 821 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-git-16@2x.pngbin0 -> 1909 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-version-control-general-16.pngbin0 -> 413 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-version-control-general-16@2x.pngbin0 -> 723 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/pull-16.pngbin601 -> 807 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/pull-16@2x.pngbin1935 -> 1973 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/push-16.pngbin620 -> 821 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/push-16@2x.pngbin1927 -> 1909 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/refresh-16.pngbin764 -> 892 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/refresh-16@2x.pngbin2250 -> 2231 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/remote-status-16.pngbin536 -> 828 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/remote-status-16@2x.pngbin1036 -> 1984 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/removed-overlay-16.pngbin327 -> 337 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/removed-overlay-16@2x.pngbin467 -> 497 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/repository-16.pngbin406 -> 413 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/repository-16@2x.pngbin638 -> 723 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/revert-16.pngbin733 -> 911 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/revert-16@2x.pngbin2333 -> 2242 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/tag-16.pngbin555 -> 629 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/tag-16@2x.pngbin1212 -> 1275 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/unlocked-overlay-16.pngbin297 -> 304 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/unlocked-overlay-16@2x.pngbin407 -> 400 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/vcs-removed-16.pngbin516 -> 536 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/vcs-removed-16@2x.pngbin1059 -> 1138 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/version-control-16.pngbin623 -> 833 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/version-control-16@2x.pngbin1515 -> 2042 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/menu_log.pngbin375 -> 0 bytes
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/menu_status.pngbin485 -> 0 bytes
-rw-r--r--main/src/addins/VersionControl/Subversion.Win32.Tests/RepositoryTests.cs10
-rw-r--r--main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs37
-rw-r--r--main/src/addins/WindowsPlatform/Dialogs/AddFileDialogHandler.cs70
-rw-r--r--main/src/addins/WindowsPlatform/Dialogs/CustomAddFilesDialog.Designer.cs76
-rw-r--r--main/src/addins/WindowsPlatform/Dialogs/CustomAddFilesDialog.cs68
-rw-r--r--main/src/addins/WindowsPlatform/Dialogs/CustomAddFilesDialog.resx123
-rw-r--r--main/src/addins/WindowsPlatform/Dialogs/CustomOpenFileDialog.cs275
-rw-r--r--main/src/addins/WindowsPlatform/Dialogs/EncodingComboBox.cs117
-rw-r--r--main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.Designer.cs193
-rw-r--r--main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.cs206
-rw-r--r--main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.resx120
-rw-r--r--main/src/addins/WindowsPlatform/Dialogs/OpenFileDialogEx.Designer.cs45
-rw-r--r--main/src/addins/WindowsPlatform/Dialogs/OpenFileDialogEx.cs672
-rw-r--r--main/src/addins/WindowsPlatform/Dialogs/OpenFileDialogEx.resx123
-rw-r--r--main/src/addins/WindowsPlatform/Dialogs/OpenFileDialogHandler.cs97
-rw-r--r--main/src/addins/WindowsPlatform/Dialogs/SelectFileDialogHandler.cs172
-rw-r--r--main/src/addins/WindowsPlatform/Dialogs/WinFormsRoot.cs122
-rw-r--r--main/src/addins/WindowsPlatform/Makefile.am7
-rw-r--r--main/src/addins/WindowsPlatform/Microsoft.WindowsAPICodePack.Shell.dllbin542720 -> 0 bytes
-rw-r--r--main/src/addins/WindowsPlatform/Microsoft.WindowsAPICodePack.dllbin105984 -> 0 bytes
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/ApplicationRecoveryException.cs56
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/ApplicationRestartRecoveryManager.cs163
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/RecoveryData.cs54
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/RecoverySettings.cs74
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/RestartRestrictions.cs38
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/RestartSettings.cs70
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Core.csproj214
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/CustomDictionary.xml16
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/Common/DialogControl.cs147
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/Common/DialogControlCollection.cs120
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/Common/DialogsDefaults.cs23
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/Common/IDialogControlHost.cs43
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialog.cs1253
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogBar.cs43
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogButton.cs37
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogButtonBase.cs112
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogClosingEventArgs.cs34
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogCommandLink.cs59
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogControl.cs20
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogDefaults.cs23
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogExpandedInfoMode.cs25
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogHyperlinkClickedEventArgs.cs26
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogProgressBar.cs123
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogProgressBarState.cs35
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogRadioButton.cs25
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogResult.cs50
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogStandardButton.cs49
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogStandardIcon.cs35
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogStartupLocation.cs20
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogTickEventArgs.cs26
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/GlobalSuppressions.cs100
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/AppRestartRecovery/AppRestartRecoveryNativeMethods.cs65
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/CoreErrorHelper.cs161
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/CoreHelpers.cs118
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/CoreNativeMethods.cs280
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/Dialogs/DialogShowState.cs30
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/NetworkList/INetwork.cs67
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/NetworkList/INetworkConnection.cs43
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/NetworkList/INetworkListManager.cs46
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/NetworkList/NetworkListManagerClass.cs47
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/PowerManagement/PowerManagementNativeMethods.cs227
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/TaskDialogs/NativeTaskDialog.cs612
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/TaskDialogs/NativeTaskDialogSettings.cs58
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/TaskDialogs/TaskDialogNativeMethods.cs233
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/WindowMessage.cs234
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Makefile.am5
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/Network.cs201
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/NetworkCollection.cs60
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/NetworkConnection.cs115
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/NetworkConnectionCollection.cs60
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/NetworkListEnums.cs124
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/NetworkListManager.cs132
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/BatteryState.cs113
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/EventManager.cs91
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/ExecutionState.cs41
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/MessageManager.cs180
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/PersonalityGuids.cs27
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/Power.cs72
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/PowerManager.cs404
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/PowerManagerException.cs48
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/PowerPersonality.cs33
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/PowerSource.cs34
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Properties/AssemblyInfo.cs43
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PropertySystem/PropVariant.cs808
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PropertySystem/PropVariantNativeMethods.cs107
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PropertySystem/PropertyKey.cs150
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Resources/LocalizedMessages.Designer.cs675
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Resources/LocalizedMessages.resx324
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/SafeHandles/SafeIconHandle.cs26
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/SafeHandles/SafeRegionHandle.cs27
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/SafeHandles/SafeWindowHandle.cs32
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/SafeHandles/ZeroInvalidHandle.cs32
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Makefile.am4
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/DefaultShellImageSizes.cs68
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/EnumUnknown.cs63
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/EventHandlerExtensionMethods.cs53
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/IconReference.cs168
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/NativePoint.cs78
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/NativeRect.cs96
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/SearchCondition.cs181
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/SearchConditionFactory.cs481
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellEnums.cs535
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellException.cs81
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellFile.cs64
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellFileSystemFolder.cs75
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellFolder.cs12
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellFolderItems.cs117
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellHelper.cs91
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellItemArray.cs70
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellLibrary.cs901
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellLink.cs143
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellNonFileSystemFolder.cs25
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellNonFileSystemItem.cs15
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellObject.cs532
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellObjectCollection.cs396
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellObjectContainer.cs120
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellObjectFactory.cs220
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellSavedSearchCollection.cs18
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellSearchCollection.cs16
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellSearchConnector.cs40
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellSearchFolder.cs266
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellThumbnail.cs357
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellThumbnailEnums.cs56
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/SortColumn.cs89
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialog.cs1347
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogButton.cs59
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogCheckBox.cs106
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogComboBox.cs174
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogControl.cs116
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogControlCollection.cs168
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogFilter.cs167
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogFilterCollection.cs29
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogFolderChangeEventArgs.cs28
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogGroupBox.cs93
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogLabel.cs45
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogMenu.cs102
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogProminentControl.cs47
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogRadioButtonList.cs152
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogResult.cs25
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogSeperator.cs27
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogStandardFilters.cs62
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogTextBox.cs101
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonOpenFileDialog.cs193
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonSaveFileDialog.cs305
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/ICommonFileDialogIndexedControls.cs23
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Controls/CommandLinkWPF.xaml171
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Controls/CommandLinkWPF.xaml.cs132
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Controls/CommandLinkWinforms.cs152
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CustomDictionary.xml58
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Design/ShellObjects.cd130
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Design/ShellThumbnailClassDiagram.cd39
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/DesktopWindowManager/DesktopWindowManagerNativeMethods.cs65
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/DesktopWindowManager/GlassEvents.cs22
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/DesktopWindowManager/GlassForm.cs144
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/DesktopWindowManager/GlassWindow.cs150
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/CommonControlException.cs61
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowser.WPF.xaml8
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowser.WPF.xaml.cs987
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowser.cs889
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserContentOptions.cs334
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserDiagram.cd94
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserEnums.cs162
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserEvents.cs47
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserPaneVisibility.cs57
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserViewEvents.cs161
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/NavigationLog.cs262
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/NavigationLogEnums.cs21
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/NavigationLogEvents.cs27
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/NavigationOptions.cs105
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/GlobalSuppressions.cs871
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/IntPtrExtensions.cs16
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/ShellCOMClasses.cs22
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/ShellCOMGuids.cs85
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/ShellCOMInterfaces.cs880
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/ShellNativeMethods.cs690
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/ShellNativeStructs.cs129
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/WindowUtilities.cs222
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Dialogs/DialogsCOMClasses.cs51
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Dialogs/DialogsCOMInterfaces.cs507
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/ExplorerBrowser/ExplorerBrowserCOMGuids.cs51
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/ExplorerBrowser/ExplorerBrowserCOMInterfaces.cs796
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/ExplorerBrowser/ExplorerBrowserNativeMethods.cs33
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/KnownFolders/KnownFoldersCOMGuids.cs25
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/KnownFolders/KnownFoldersCOMInterfaces.cs185
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/KnownFolders/KnownFoldersNativeMethods.cs43
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/PropertySystem/PropertySystemCOMInterfaces.cs345
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/PropertySystem/PropertySystemNativeMethods.cs62
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/ShellExtensions/HandlerNativeMethods.cs226
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/ShellObjectWatcher/ShellObjectWatcherNativeMethods.cs198
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/StockIcons/StockIconsNativeMethods.cs83
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Taskbar/TabbedThumbnailNativeMethods.cs210
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Taskbar/TaskbarCOMInterfaces.cs154
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Taskbar/TaskbarNativeMethods.cs210
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/DefinitionOptions.cs32
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/FileSystemKnownFolder.cs282
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/FolderCategory.cs45
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/FolderProperties.cs43
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/FolderTypes.cs227
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/FoldersIdentifiers.cs592
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/IKnownFolder.cs117
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/KnownFolderHelper.cs204
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/KnownFolderSettings.cs295
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/KnownFolders.cs1331
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/NonFileSystemKnownFolder.cs282
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/RedirectionCapabilities.cs45
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/RetrievalOptions.cs21
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Makefile.am5
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Properties/AssemblyInfo.cs44
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/IShellProperty.cs59
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/PropertySystemException.cs54
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellProperties.cs168
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellProperty.cs447
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyCollection.cs246
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyDescription.cs565
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyDescriptionsCache.cs39
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyEnumType.cs131
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyEnums.cs737
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyFactory.cs189
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyWriter.cs251
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/StronglyTypedProperties.cs16343
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/SystemProperties.cs12306
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/WindowProperties.cs37
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Resources/LocalizedMessages.Designer.cs1251
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Resources/LocalizedMessages.resx516
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Shell.csproj385
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ChangeNotifyEventManager.cs107
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ChangeNotifyLock.cs90
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/MessageListener.cs216
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/MessageListenerFilter.cs126
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ShellObjectNotificationEventArgs.cs79
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ShellObjectWatcher.cs561
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ShellObjectWatcherEnums.cs190
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/StockIcons/StockIcon.cs270
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/StockIcons/StockIconEnums.cs419
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/StockIcons/StockIcons.cs631
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpList.cs575
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListCustomCategory.cs92
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListCustomCategoryCollection.cs135
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListItem.cs39
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListItemCollection.cs126
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListLink.cs201
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListSeparator.cs99
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnail.cs566
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailBitmapRequestedEventArgs.cs42
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailClosedEventArgs.cs29
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailEventArgs.cs46
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailManager.cs464
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailProxyWindow.cs90
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailScreenCapture.cs181
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarEnums.cs65
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarInterfaces.cs25
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarList.cs33
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarManager.cs317
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarWindow.cs214
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarWindowManager.cs794
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/ThumbnailButton.cs362
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/ThumbnailButtonClickedEventArgs.cs55
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/ThumbnailToolbarManager.cs77
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/ThumbnailToolbarProxyWindow.cs125
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/UserRemovedJumpListItemsEventArg.cs29
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/.gitignore (renamed from main/src/addins/WindowsPlatform/.gitignore)0
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/AddinInfo.cs (renamed from main/src/addins/WindowsPlatform/AddinInfo.cs)0
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/AssemblyInfo.cs (renamed from main/src/addins/WindowsPlatform/AssemblyInfo.cs)0
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/ChangeLog (renamed from main/src/addins/WindowsPlatform/ChangeLog)0
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/CustomDialogs/CustomCommonFileDialogComboBox.cs83
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/CustomDialogs/CustomCommonOpenFileDialog.cs44
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/AddFileDialogHandler.cs73
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/OpenFileDialogHandler.cs245
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/SelectEncodingControl.xaml67
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/SelectEncodingControl.xaml.cs84
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/SelectFileDialogHandler.cs130
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/Enums.cs (renamed from main/src/addins/WindowsPlatform/Enums.cs)0
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/GdkWin32.cs (renamed from main/src/addins/WindowsPlatform/GdkWin32.cs)223
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/JumpList.cs (renamed from main/src/addins/WindowsPlatform/JumpList.cs)0
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/Makefile.am5
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/RecentFiles.cs (renamed from main/src/addins/WindowsPlatform/RecentFiles.cs)0
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/Win32.cs (renamed from main/src/addins/WindowsPlatform/Win32.cs)46
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.addin.xml (renamed from main/src/addins/WindowsPlatform/WindowsPlatform.addin.xml)14
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.cs (renamed from main/src/addins/WindowsPlatform/WindowsPlatform.cs)157
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.csproj (renamed from main/src/addins/WindowsPlatform/WindowsPlatform.csproj)78
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/WindowsProxyCredentialProvider.cs (renamed from main/src/addins/WindowsPlatform/WindowsProxyCredentialProvider.cs)70
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/WindowsSecureStoragePasswordProvider.cs (renamed from main/src/addins/WindowsPlatform/WindowsSecureStoragePasswordProvider.cs)0
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/structs.cs (renamed from main/src/addins/WindowsPlatform/structs.cs)0
873 files changed, 107988 insertions, 6669 deletions
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AspMvcProject.cs b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AspMvcProject.cs
index 0bc4c80816..c16fbe9608 100644
--- a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AspMvcProject.cs
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AspMvcProject.cs
@@ -57,11 +57,14 @@ namespace MonoDevelop.AspNet.Mvc
conf.CopyFrom (base.CreateConfiguration (name));
return conf;
}
-
- public override string ProjectType {
- get { return "AspNetMvc"; }
+
+ public override IEnumerable<string> GetProjectTypes ()
+ {
+ yield return "AspNetMvc";
+ foreach (var t in base.GetProjectTypes ())
+ yield return t;
}
-
+
public override bool SupportsFramework (MonoDevelop.Core.Assemblies.TargetFramework framework)
{
return framework.CanReferenceAssembliesTargetingFramework (MonoDevelop.Core.Assemblies.TargetFrameworkMoniker.NET_3_5);
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Gui/FolderNodeBuilderExtension.cs b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Gui/FolderNodeBuilderExtension.cs
index 9997a0eba3..26a046ac03 100644
--- a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Gui/FolderNodeBuilderExtension.cs
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Gui/FolderNodeBuilderExtension.cs
@@ -34,7 +34,6 @@ using MonoDevelop.Ide;
namespace MonoDevelop.AspNet.Mvc.Gui
{
-
class FolderNodeBuilderExtension : NodeBuilderExtension
{
public override bool CanBuildNode (Type dataType)
@@ -52,7 +51,13 @@ namespace MonoDevelop.AspNet.Mvc.Gui
[CommandUpdateHandler (AspMvcCommands.AddController)]
public void AddControllerUpdate (CommandInfo info)
{
- ProjectFolder pf = (ProjectFolder)CurrentNode.DataItem;
+ var project = CurrentNode.GetParentDataItem (typeof (AspMvcProject), true) as AspMvcProject;
+ if (project == null) {
+ info.Enabled = info.Visible = false;
+ return;
+ }
+
+ var pf = (ProjectFolder)CurrentNode.DataItem;
FilePath rootName = pf.Project.BaseDirectory.Combine ("Controllers");
info.Enabled = info.Visible = (pf.Path == rootName || pf.Path.IsChildPathOf (rootName));
}
@@ -60,13 +65,11 @@ namespace MonoDevelop.AspNet.Mvc.Gui
[CommandHandler (AspMvcCommands.AddController)]
public void AddController ()
{
- AspMvcProject project = CurrentNode.GetParentDataItem (typeof (AspMvcProject), true) as AspMvcProject;
- if (project == null)
- return;
+ var project = (AspMvcProject) CurrentNode.GetParentDataItem (typeof (AspMvcProject), true);
object currentItem = CurrentNode.DataItem;
- ProjectFolder folder = CurrentNode.GetParentDataItem (typeof (ProjectFolder), true) as ProjectFolder;
+ var folder = CurrentNode.GetParentDataItem (typeof (ProjectFolder), true) as ProjectFolder;
string path = folder != null ? folder.Path : project.BaseDirectory;
AddController (project, path, null);
@@ -76,7 +79,7 @@ namespace MonoDevelop.AspNet.Mvc.Gui
nav.Expanded = true;
}
- public static void AddController(AspMvcProject project, string path, string name)
+ public static void AddController (AspMvcProject project, string path, string name)
{
var provider = project.LanguageBinding.GetCodeDomProvider ();
if (provider == null)
@@ -93,7 +96,7 @@ namespace MonoDevelop.AspNet.Mvc.Gui
bool fileGood = false;
while (!fileGood) {
- Gtk.ResponseType resp = (Gtk.ResponseType)MessageService.RunCustomDialog (dialog);
+ var resp = (Gtk.ResponseType) MessageService.RunCustomDialog (dialog);
dialog.Hide ();
if (resp != Gtk.ResponseType.Ok || !dialog.IsValid ())
return;
@@ -134,7 +137,13 @@ namespace MonoDevelop.AspNet.Mvc.Gui
[CommandUpdateHandler (AspMvcCommands.AddView)]
public void AddViewUpdate (CommandInfo info)
{
- ProjectFolder pf = (ProjectFolder)CurrentNode.DataItem;
+ var project = CurrentNode.GetParentDataItem (typeof (AspMvcProject), true) as AspMvcProject;
+ if (project == null) {
+ info.Enabled = info.Visible = false;
+ return;
+ }
+
+ var pf = (ProjectFolder)CurrentNode.DataItem;
FilePath rootName = pf.Project.BaseDirectory.Combine ("Views");
info.Enabled = info.Visible = (pf.Path == rootName || pf.Path.IsChildPathOf (rootName));
}
@@ -142,13 +151,11 @@ namespace MonoDevelop.AspNet.Mvc.Gui
[CommandHandler (AspMvcCommands.AddView)]
public void AddView ()
{
- AspMvcProject project = CurrentNode.GetParentDataItem (typeof(AspMvcProject), true) as AspMvcProject;
- if (project == null)
- return;
-
+ var project = (AspMvcProject) CurrentNode.GetParentDataItem (typeof (AspMvcProject), true);
+
object currentItem = CurrentNode.DataItem;
- ProjectFolder folder = CurrentNode.GetParentDataItem (typeof(ProjectFolder), true) as ProjectFolder;
+ var folder = CurrentNode.GetParentDataItem (typeof(ProjectFolder), true) as ProjectFolder;
string path = folder != null? folder.Path : project.BaseDirectory;
AddView (project, path, null);
@@ -174,7 +181,7 @@ namespace MonoDevelop.AspNet.Mvc.Gui
bool fileGood = false;
while (!fileGood) {
- Gtk.ResponseType resp = (Gtk.ResponseType) MessageService.RunCustomDialog (dialog);
+ var resp = (Gtk.ResponseType) MessageService.RunCustomDialog (dialog);
dialog.Hide ();
if (resp != Gtk.ResponseType.Ok || ! dialog.IsValid ())
return;
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/MonoDevelop.AspNet.Mvc.csproj b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/MonoDevelop.AspNet.Mvc.csproj
index 0b61eb8cf3..250f115344 100644
--- a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/MonoDevelop.AspNet.Mvc.csproj
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/MonoDevelop.AspNet.Mvc.csproj
@@ -213,6 +213,11 @@
<Name>Mono.Addins</Name>
<Private>False</Private>
</ProjectReference>
+ <ProjectReference Include="..\..\MonoDevelop.Debugger\MonoDevelop.Debugger.csproj">
+ <Project>{2357AABD-08C7-4808-A495-8FF2D3CDFDB0}</Project>
+ <Name>MonoDevelop.Debugger</Name>
+ <Private>False</Private>
+ </ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Templates\Common\Index.cshtml">
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/StateEngine/RazorCodeFragmentState.cs b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/StateEngine/RazorCodeFragmentState.cs
index db17695199..1819f02b38 100644
--- a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/StateEngine/RazorCodeFragmentState.cs
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/StateEngine/RazorCodeFragmentState.cs
@@ -56,7 +56,7 @@ namespace MonoDevelop.AspNet.Mvc.StateEngine
public bool IsInsideGenerics { get; protected set; }
public RazorCodeFragmentState ()
- : this (new HtmlTagState (true), new HtmlClosingTagState (true),
+ : this (new HtmlTagState (), new HtmlClosingTagState (true),
new RazorCommentState (), new RazorExpressionState (), new RazorSpeculativeState ())
{
}
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/StateEngine/RazorFreeState.cs b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/StateEngine/RazorFreeState.cs
index 90e0c0965e..98f2acdab0 100644
--- a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/StateEngine/RazorFreeState.cs
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/StateEngine/RazorFreeState.cs
@@ -44,7 +44,7 @@ namespace MonoDevelop.AspNet.Mvc.StateEngine
public RazorFreeState ()
: this (
- new HtmlTagState (true),
+ new HtmlTagState (),
new HtmlClosingTagState (true),
new XmlCommentState (),
new XmlCDataState (),
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/PreprocessedRazorTemplate.xft.xml b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/PreprocessedRazorTemplate.xft.xml
index b25949a496..f52b6f085a 100644
--- a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/PreprocessedRazorTemplate.xft.xml
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/PreprocessedRazorTemplate.xft.xml
@@ -8,6 +8,7 @@
<Icon></Icon>
<_Category>Text Templating</_Category>
<_Description>A Razor template that will be preprocessed into a C# class.</_Description>
+ <DefaultFilename>Template</DefaultFilename>
</TemplateConfiguration>
<TemplateFiles>
<File name="${Name}.cshtml" BuildAction="None" CustomTool="RazorTemplatePreprocessor" />
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Deployment/WebDeployService.cs b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Deployment/WebDeployService.cs
index 5c98cb2245..352048d0b1 100644
--- a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Deployment/WebDeployService.cs
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Deployment/WebDeployService.cs
@@ -123,15 +123,16 @@ namespace MonoDevelop.AspNet.Deployment
ICollection<WebDeployTarget> targets = null;
var response = ResponseType.None;
- do {
- response = (ResponseType) MessageService.RunCustomDialog (dialog, MessageService.RootWindow);
- } while (response != ResponseType.Ok && response != ResponseType.Cancel && response != ResponseType.DeleteEvent);
-
- if (response == Gtk.ResponseType.Ok)
- targets = dialog.GetSelectedTargets ();
-
- dialog.Destroy ();
-
+ try {
+ do {
+ response = (ResponseType) MessageService.RunCustomDialog (dialog, MessageService.RootWindow);
+ } while (response != ResponseType.Ok && response != ResponseType.Cancel && response != ResponseType.DeleteEvent);
+
+ if (response == Gtk.ResponseType.Ok)
+ targets = dialog.GetSelectedTargets ();
+ } finally {
+ dialog.Destroy ();
+ }
if (targets != null && targets.Count > 0)
Deploy (project, targets, IdeApp.Workspace.ActiveConfiguration);
}
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Gui/BaseHtmlEditorExtension.cs b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Gui/BaseHtmlEditorExtension.cs
index 0fb2f5501f..b9f0ee1a8e 100644
--- a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Gui/BaseHtmlEditorExtension.cs
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Gui/BaseHtmlEditorExtension.cs
@@ -88,7 +88,7 @@ namespace MonoDevelop.AspNet.Gui
protected override RootState CreateRootState ()
{
- return new XmlFreeState (new HtmlTagState (true), new HtmlClosingTagState (true));
+ return new XmlFreeState (new HtmlTagState (), new HtmlClosingTagState (true));
}
protected override void Initialize ()
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.StateEngine/AspNetDom.cs b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.StateEngine/AspNetDom.cs
index 917b1ecfbc..091196955e 100644
--- a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.StateEngine/AspNetDom.cs
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.StateEngine/AspNetDom.cs
@@ -256,7 +256,7 @@ namespace MonoDevelop.AspNet.StateEngine
public static IEnumerable<T> WithName<T> (this IEnumerable<XNode> nodes, XName name, bool ignoreCase) where T : XNode, INamedXObject
{
- return nodes.OfType<T> ().Where (el => XName.Equals (el.Name, name, true));
+ return nodes.OfType<T> ().Where (el => XName.Equals (el.Name, name, ignoreCase));
}
public static IEnumerable<string> GetAllPlaceholderIds (this XDocument doc)
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.StateEngine/AspNetFreeState.cs b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.StateEngine/AspNetFreeState.cs
index a61ea867eb..f6aa07cbba 100644
--- a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.StateEngine/AspNetFreeState.cs
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.StateEngine/AspNetFreeState.cs
@@ -42,7 +42,7 @@ namespace MonoDevelop.AspNet.StateEngine
readonly AspNetServerCommentState serverCommentState;
public AspNetFreeState () : this (
- new HtmlTagState (true, new XmlAttributeState (new XmlNameState (), new AspNetAttributeValueState ())),
+ new HtmlTagState (new XmlAttributeState (new XmlNameState (), new AspNetAttributeValueState ())),
new HtmlClosingTagState (true),
new XmlCommentState (),
new XmlCDataState (),
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.StateEngine/HtmlTagState.cs b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.StateEngine/HtmlTagState.cs
index 4a29347ebd..e1d6591392 100644
--- a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.StateEngine/HtmlTagState.cs
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.StateEngine/HtmlTagState.cs
@@ -38,29 +38,26 @@ namespace MonoDevelop.AspNet.StateEngine
public class HtmlTagState : XmlTagState
{
HtmlScriptBodyState ScriptState;
- bool warnAutoClose;
+ public HtmlTagState () : this (new XmlAttributeState ()) {}
- public HtmlTagState (bool warnAutoClose) : this (warnAutoClose, new XmlAttributeState ()) {}
-
- public HtmlTagState (bool warnAutoClose, XmlAttributeState attributeState)
- : this (warnAutoClose, attributeState, new XmlNameState ())
- {
+ public HtmlTagState (XmlAttributeState attributeState)
+ : this (attributeState, new XmlNameState ())
+ {
}
- public HtmlTagState (bool warnAutoClose, XmlAttributeState attributeState, XmlNameState nameState)
- : this(warnAutoClose, attributeState, nameState, new HtmlScriptBodyState ())
- {
+ public HtmlTagState (XmlAttributeState attributeState, XmlNameState nameState)
+ : this(attributeState, nameState, new HtmlScriptBodyState ())
+ {
}
- public HtmlTagState (bool warnAutoClose, XmlAttributeState attributeState, XmlNameState nameState, HtmlScriptBodyState scriptState)
+ public HtmlTagState (XmlAttributeState attributeState, XmlNameState nameState, HtmlScriptBodyState scriptState)
: base (attributeState, nameState)
{
- this.warnAutoClose = warnAutoClose;
this.ScriptState = scriptState;
Adopt (this.ScriptState);
}
-
+
public override State PushChar (char c, IParseContext context, ref string rollback)
{
if (context.CurrentStateLength == 1 && context.PreviousState is HtmlScriptBodyState)
@@ -78,10 +75,6 @@ namespace MonoDevelop.AspNet.StateEngine
while (parent != null && parent.ValidAndNoPrefix () && parent.IsImplicitlyClosedBy (element)) {
context.Nodes.Pop ();
context.Nodes.Pop ();
- if (warnAutoClose) {
- context.LogWarning (string.Format ("Tag '{0}' implicitly closed by tag '{1}'.",
- parent.Name.Name, element.Name.Name), parent.Region);
- }
//parent.Region.End = element.Region.Start;
//parent.Region.EndColumn = Math.Max (parent.Region.EndColumn - 1, 1);
parent.Close (parent);
@@ -103,15 +96,11 @@ namespace MonoDevelop.AspNet.StateEngine
element.Close (element);
context.Nodes.Pop ();
- if (warnAutoClose) {
- context.LogWarning (string.Format ("Implicitly closed empty tag '{0}'", element.Name.Name),
- element.Region);
- }
}
}
}
- return ret;
+ return ret;
}
}
@@ -127,10 +116,34 @@ namespace MonoDevelop.AspNet.StateEngine
public static bool IsImplicitlyClosedBy (this XElement parent, INamedXObject current)
{
//inline and paragraph tags are implicitly closed by block tags and paragraph tags
- if (ElementTypes.IsInline (parent.Name.Name) || ElementTypes.IsParagraph (parent.Name.Name))
- return ElementTypes.IsBlock (current.Name.Name) || ElementTypes.IsParagraph (current.Name.Name);
-
- return false;
+ switch (parent.Name.Name) {
+ case "p":
+ return ElementTypes.IsParaOptionalClosing (current.Name.Name);
+ case "td":
+ return current.Name.Name == "td" || current.Name.Name == "th";
+ case "th":
+ return current.Name.Name == "td" || current.Name.Name == "th";
+ case "dt":
+ return current.Name.Name == "dt" || current.Name.Name == "dd";
+ case "dd":
+ return current.Name.Name == "dt" || current.Name.Name == "dd";
+ case "thead":
+ return current.Name.Name == "tbody" || current.Name.Name == "tfoot";
+ case "tbody":
+ return current.Name.Name == "tbody" || current.Name.Name == "tfoot";
+ case "option":
+ return current.Name.Name == "option" || current.Name.Name == "optgroup";
+ case "tr":
+ return current.Name.Name == "tr";
+ case "li":
+ return current.Name.Name == "li";
+ case "tfoot":
+ return current.Name.Name == "tbody";
+ case "optgroup":
+ return current.Name.Name == "optgroup";
+ default :
+ return false;
+ }
}
}
}
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet/AspNetAppProject.cs b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet/AspNetAppProject.cs
index d02a958794..53de5999e2 100644
--- a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet/AspNetAppProject.cs
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet/AspNetAppProject.cs
@@ -70,11 +70,14 @@ namespace MonoDevelop.AspNet
CodeBehindTypeNameCache codebehindTypeNameCache;
#region properties
-
- public override string ProjectType {
- get { return "AspNetApp"; }
+
+ public override IEnumerable<string> GetProjectTypes ()
+ {
+ yield return "AspNetApp";
+ foreach (var t in base.GetProjectTypes ())
+ yield return t;
}
-
+
public override bool IsLibraryBasedProjectType {
get { return true; }
}
@@ -325,6 +328,20 @@ namespace MonoDevelop.AspNet
return WebSubtype.Html;
case "JS":
return WebSubtype.JavaScript;
+ case "LESS":
+ return WebSubtype.Less;
+ case "SASS":
+ case "SCSS":
+ return WebSubtype.Sass;
+ case "EOT":
+ case "TTF":
+ case "OTF":
+ case "WOFF":
+ return WebSubtype.Font;
+ case "SVG":
+ return WebSubtype.Svg;
+ case "STYL":
+ return WebSubtype.Stylus;
default:
return WebSubtype.None;
}
@@ -751,6 +768,11 @@ namespace MonoDevelop.AspNet
Css,
Html,
JavaScript,
+ Less,
+ Font,
+ Svg,
+ Sass,
+ Stylus
}
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.Html/ElementTypes.cs b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.Html/ElementTypes.cs
index 57827674d2..9a2633061b 100644
--- a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.Html/ElementTypes.cs
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.Html/ElementTypes.cs
@@ -68,6 +68,17 @@ namespace MonoDevelop.Html
"pre", "script", "style"
};
+ public static readonly ICollection<string> ParaOptionalClosing = new String[] {
+ "address", "article", "aside", "blockquote", "div", "dl", "fieldset", "footer",
+ "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "hr", "main",
+ "nav", "ol", "p", "pre", "section", "table", "ul"
+ };
+
+ public static bool IsParaOptionalClosing (string elementName)
+ {
+ return ParaOptionalClosing.Contains (elementName.ToLower ());
+ }
+
public static bool IsInline (string elementName)
{
return Inline.Contains (elementName.ToLower ());
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.Html/HtmlParser.cs b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.Html/HtmlParser.cs
index aacc90f0c1..2840453381 100644
--- a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.Html/HtmlParser.cs
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.Html/HtmlParser.cs
@@ -47,7 +47,7 @@ namespace MonoDevelop.Html
try {
Parser xmlParser = new Parser (
- new XmlFreeState (new HtmlTagState (true), new HtmlClosingTagState (true)),
+ new XmlFreeState (new HtmlTagState (), new HtmlClosingTagState (true)),
true);
xmlParser.Parse (tr);
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet/Templates/WebApplication-Empty.xpt.xml b/main/src/addins/AspNet/MonoDevelop.AspNet/Templates/WebApplication-Empty.xpt.xml
index 59e6bb0f3e..f1befb17f6 100644
--- a/main/src/addins/AspNet/MonoDevelop.AspNet/Templates/WebApplication-Empty.xpt.xml
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet/Templates/WebApplication-Empty.xpt.xml
@@ -8,7 +8,7 @@
<_Name>Empty Web Application</_Name>
<_Category>ASP.NET</_Category>
<Icon>md-project-web</Icon>
- <LanguageName>*</LanguageName>
+ <LanguageName>C#,VBNet</LanguageName>
<_Description>Creates an empty ASP.NET Web Application project.</_Description>
</TemplateConfiguration>
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet/Templates/WebApplication.xpt.xml b/main/src/addins/AspNet/MonoDevelop.AspNet/Templates/WebApplication.xpt.xml
index 00668fc09a..665a936f5d 100644
--- a/main/src/addins/AspNet/MonoDevelop.AspNet/Templates/WebApplication.xpt.xml
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet/Templates/WebApplication.xpt.xml
@@ -8,7 +8,7 @@
<_Name>Web Application</_Name>
<_Category>ASP.NET</_Category>
<Icon>md-project-web</Icon>
- <LanguageName>*</LanguageName>
+ <LanguageName>C#,VBNet</LanguageName>
<_Description>Creates a new ASP.NET Web Application project.</_Description>
</TemplateConfiguration>
diff --git a/main/src/addins/CBinding/CBinding.addin.xml b/main/src/addins/CBinding/CBinding.addin.xml
index 59c4db45e6..35cb77e26d 100644
--- a/main/src/addins/CBinding/CBinding.addin.xml
+++ b/main/src/addins/CBinding/CBinding.addin.xml
@@ -169,7 +169,7 @@
<Extension path = "/MonoDevelop/Ide/Commands">
<Category _name = "C/C++" id = "C/C++">
<Command id = "CBinding.CProjectCommands.AddPackage" _label = "Edit Packages..." />
- <Command id = "CBinding.CProjectCommands.UpdateClassPad" _label = "Update class pad" icon = "res:update" />
+ <Command id = "CBinding.CProjectCommands.UpdateClassPad" _label = "Update class pad" />
<Command id = "CBinding.CProjectCommands.ShowPackageDetails" _label = "Details..." />
</Category>
</Extension>
diff --git a/main/src/addins/CBinding/Compiler/GNUCompiler.cs b/main/src/addins/CBinding/Compiler/GNUCompiler.cs
index ffd90e2d16..b75471a9ff 100644
--- a/main/src/addins/CBinding/Compiler/GNUCompiler.cs
+++ b/main/src/addins/CBinding/Compiler/GNUCompiler.cs
@@ -484,34 +484,33 @@ namespace CBinding
errorOutput = string.Empty;
int exitCode = -1;
- StringWriter swError = new StringWriter ();
- LogTextWriter chainedError = new LogTextWriter ();
- chainedError.ChainWriter (monitor.Log);
- chainedError.ChainWriter (swError);
+ using (var swError = new StringWriter ()) {
+ using (var chainedError = new LogTextWriter ()) {
+ chainedError.ChainWriter (monitor.Log);
+ chainedError.ChainWriter (swError);
- monitor.Log.WriteLine ("{0} {1}", command, args);
+ monitor.Log.WriteLine ("{0} {1}", command, args);
- AggregatedOperationMonitor operationMonitor = new AggregatedOperationMonitor (monitor);
-
- try {
- ProcessWrapper p = Runtime.ProcessService.StartProcess (command, args, baseDirectory, monitor.Log, chainedError, null);
- operationMonitor.AddOperation (p); //handles cancellation
+ using (var operationMonitor = new AggregatedOperationMonitor (monitor)) {
+ using (ProcessWrapper p = Runtime.ProcessService.StartProcess (command, args, baseDirectory, monitor.Log, chainedError, null)) {
+ operationMonitor.AddOperation (p); //handles cancellation
- p.WaitForOutput ();
- errorOutput = swError.ToString ();
- exitCode = p.ExitCode;
- p.Dispose ();
+ p.WaitForOutput ();
+ chainedError.UnchainWriter (monitor.Log);
+ chainedError.UnchainWriter (swError);
+
+ errorOutput = swError.ToString ();
+ exitCode = p.ExitCode;
- if (monitor.IsCancelRequested) {
- monitor.Log.WriteLine (GettextCatalog.GetString ("Build cancelled"));
- monitor.ReportError (GettextCatalog.GetString ("Build cancelled"), null);
- if (exitCode == 0)
- exitCode = -1;
+ if (monitor.IsCancelRequested) {
+ monitor.Log.WriteLine (GettextCatalog.GetString ("Build cancelled"));
+ monitor.ReportError (GettextCatalog.GetString ("Build cancelled"), null);
+ if (exitCode == 0)
+ exitCode = -1;
+ }
+ }
+ }
}
- } finally {
- chainedError.Close ();
- swError.Close ();
- operationMonitor.Dispose ();
}
return exitCode;
@@ -748,21 +747,22 @@ namespace CBinding
// expands backticked portions of the parameter-list using "sh" and "echo"
// TODO: Do this ourselves, relying on sh/echo - and launching an entire process just for this is ... excessive.
- public string ExpandBacktickedParameters(string tmp)
+ public string ExpandBacktickedParameters (string tmp)
{
// 1) Quadruple \ required, to escape both echo's and sh's escape character filtering
// 2) \\\" required inside of echo, to translate into \" in sh, so it translates back as a " to MD...
- string parameters = "-c \"echo -n " + tmp.Replace("\\", "\\\\\\\\").Replace("\"", "\\\\\\\"") + "\"";
- Process p = new Process();
-
- p.StartInfo.FileName = "sh";
- p.StartInfo.Arguments = parameters;
- p.StartInfo.UseShellExecute = false;
- p.StartInfo.RedirectStandardOutput = true;
- p.Start();
- p.WaitForExit();
+ string parameters = "-c \"echo " + tmp.Replace("\\", "\\\\\\\\").Replace("\"", "\\\\\\\"") + "\"";
+
+ var p = Process.Start (new ProcessStartInfo ("sh", parameters) {
+ UseShellExecute = false,
+ RedirectStandardOutput = true
+ });
+ p.Start ();
+ p.WaitForExit ();
- return p.StandardOutput.ReadToEnd();
+ //TODO: use async reads so we don't deadlock if stdout fills up
+ //TODO: check return code
+ return p.StandardOutput.ReadToEnd ().Trim ();
}
bool CheckApp (string app)
diff --git a/main/src/addins/CBinding/Parser/CTagsManager.cs b/main/src/addins/CBinding/Parser/CTagsManager.cs
index 5f4aa0b60f..a26645836d 100644
--- a/main/src/addins/CBinding/Parser/CTagsManager.cs
+++ b/main/src/addins/CBinding/Parser/CTagsManager.cs
@@ -51,7 +51,7 @@ namespace CBinding.Parser
static CTagsManager ()
{
try {
- FileService.EnsureDirectoryExists (SystemTagsDirectory);
+ Directory.CreateDirectory (SystemTagsDirectory);
} catch (IOException ioe) {
LoggingService.LogError ("Error creating system tags directory", ioe);
}
diff --git a/main/src/addins/CBinding/Project/CProject.cs b/main/src/addins/CBinding/Project/CProject.cs
index 01bdfe8613..231830b4f0 100644
--- a/main/src/addins/CBinding/Project/CProject.cs
+++ b/main/src/addins/CBinding/Project/CProject.cs
@@ -176,11 +176,12 @@ namespace CBinding
}
}
}
-
- public override string ProjectType {
- get { return "Native"; }
+
+ public override IEnumerable<string> GetProjectTypes ()
+ {
+ yield return "Native";
}
-
+
public override string[] SupportedLanguages {
get { return new string[] { "C", "CPP", "Objective C", "Objective C++" }; }
}
diff --git a/main/src/addins/CSharpBinding/CSharpBinding.addin.xml b/main/src/addins/CSharpBinding/CSharpBinding.addin.xml
index 6e604e59bc..8ac2fe8f96 100644
--- a/main/src/addins/CSharpBinding/CSharpBinding.addin.xml
+++ b/main/src/addins/CSharpBinding/CSharpBinding.addin.xml
@@ -38,6 +38,7 @@
<ProjectTemplate id = "CSharpEmptyProject" resource = "EmptyProject.xpt.xml"/>
<ProjectTemplate id = "CSharpGtkSharp2Project" resource = "GtkSharp2Project.xpt.xml"/>
<ProjectTemplate id = "CSharpLibrary" resource = "Library.xpt.xml"/>
+ <ProjectTemplate id = "CSharpSharedAssetsProject" resource = "SharedAssetsProject.xpt.xml"/>
<Condition id="MSBuildTargetIsAvailable" target="$(MSBuildExtensionsPath)\Microsoft\Portable\v4.0\Microsoft.Portable.CSharp.targets">
<ProjectTemplate id = "CSharpPortableLibrary" resource = "PortableLibrary.xpt.xml" />
</Condition>
@@ -246,13 +247,13 @@
</Extension>
<Extension path = "/MonoDevelop/ProjectModel/Gui/DefaultPolicyPanels/SourceCode">
- <Section id="NameConventions" _label="Name Conventions" fill = "true" class="MonoDevelop.CSharp.Refactoring.CodeIssues.NameConventionPanel" />
+ <Section id="NameConventions" _label="Name Conventions" fill = "true" class="MonoDevelop.CSharp.Refactoring.CodeIssues.NameConventionPanel" icon="md-prefs-name-conventions" />
</Extension>
<Extension path = "/MonoDevelop/ProjectModel/Gui/ItemOptionPanels/SourceCode">
- <Section id="NameConventions" _label="Name Conventions" fill = "true" class="MonoDevelop.CSharp.Refactoring.CodeIssues.NameConventionPanel" />
+ <Section id="NameConventions" _label="Name Conventions" fill = "true" class="MonoDevelop.CSharp.Refactoring.CodeIssues.NameConventionPanel" icon="md-prefs-name-conventions" />
</Extension>
<Extension path = "/MonoDevelop/Ide/GlobalOptionsDialog/SourceCode">
- <Section id="NameConventions" _label="Name Conventions" fill = "true" class="MonoDevelop.CSharp.Refactoring.CodeIssues.NameConventionPanel" />
+ <Section id="NameConventions" _label="Name Conventions" fill = "true" class="MonoDevelop.CSharp.Refactoring.CodeIssues.NameConventionPanel" icon="md-prefs-name-conventions" />
</Extension>
<Extension path = "/MonoDevelop/SourceEditor2/TooltipProviders">
diff --git a/main/src/addins/CSharpBinding/CSharpBinding.csproj b/main/src/addins/CSharpBinding/CSharpBinding.csproj
index dda339d771..9a50fb32f5 100644
--- a/main/src/addins/CSharpBinding/CSharpBinding.csproj
+++ b/main/src/addins/CSharpBinding/CSharpBinding.csproj
@@ -202,6 +202,9 @@
<EmbeddedResource Include="templates\PortableLibrary.xpt.xml">
<LogicalName>PortableLibrary.xpt.xml</LogicalName>
</EmbeddedResource>
+ <EmbeddedResource Include="templates\SharedAssetsProject.xpt.xml">
+ <LogicalName>SharedAssetsProject.xpt.xml</LogicalName>
+ </EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Include="gtk-gui\generated.cs" />
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/ExportCodeGenerator.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/ExportCodeGenerator.cs
index 3165df93b1..b582b9e287 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/ExportCodeGenerator.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/ExportCodeGenerator.cs
@@ -201,7 +201,8 @@ namespace MonoDevelop.CodeGeneration
{
var generator = Options.CreateCodeGenerator ();
generator.AutoIndent = false;
- var ctx = MDRefactoringContext.Create (Options.Document, Options.Document.Editor.CaretLocation);
+
+ var ctx = MDRefactoringContext.Create (Options.Document, Options.Document.Editor.CaretLocation).Result;
if (ctx == null)
yield break;
var builder = ctx.CreateTypeSystemAstBuilder ();
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs
index bc471546cd..2aab918560 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs
@@ -25,40 +25,44 @@
// THE SOFTWARE.
using System;
-using MonoDevelop.Ide.Gui.Content;
-using ICSharpCode.NRefactory.CSharp;
-using MonoDevelop.Core;
-using MonoDevelop.Ide.CodeCompletion;
-using ICSharpCode.NRefactory.CSharp.Resolver;
-using ICSharpCode.NRefactory.TypeSystem;
-using MonoDevelop.Ide.TypeSystem;
-using System.Collections.Generic;
-using MonoDevelop.Projects;
-using MonoDevelop.CSharp.Project;
using System.Linq;
-using MonoDevelop.CSharp.Formatting;
-using ICSharpCode.NRefactory.TypeSystem.Implementation;
-using ICSharpCode.NRefactory.CSharp.Refactoring;
using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Collections.Generic;
+
+using Mono.TextEditor;
+
+using MonoDevelop.Core;
+using MonoDevelop.Debugger;
+using MonoDevelop.Projects;
+using MonoDevelop.Ide.Gui;
+using MonoDevelop.CodeGeneration;
+using MonoDevelop.Ide.TypeSystem;
+using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Ide.CodeTemplates;
-using ICSharpCode.NRefactory.Semantics;
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Components.Commands;
+
using ICSharpCode.NRefactory;
+using ICSharpCode.NRefactory.CSharp;
+using ICSharpCode.NRefactory.Semantics;
using ICSharpCode.NRefactory.Completion;
+using ICSharpCode.NRefactory.TypeSystem;
+using ICSharpCode.NRefactory.CSharp.Resolver;
using ICSharpCode.NRefactory.CSharp.Completion;
using ICSharpCode.NRefactory.CSharp.TypeSystem;
-using MonoDevelop.Components.Commands;
-using MonoDevelop.CodeGeneration;
+using ICSharpCode.NRefactory.CSharp.Refactoring;
+
+using MonoDevelop.CSharp.Project;
+using MonoDevelop.CSharp.Formatting;
using MonoDevelop.CSharp.Refactoring.CodeActions;
-using System.Threading;
-using System.Threading.Tasks;
-using MonoDevelop.Ide.Editor;
-using Mono.TextEditor;
-using MonoDevelop.CSharp.NRefactoryWrapper;
+using MonoDevelop.Refactoring;
using MonoDevelop.Ide.Editor.Extension;
namespace MonoDevelop.CSharp.Completion
{
- public class CSharpCompletionTextEditorExtension : CompletionTextEditorExtension, IParameterCompletionDataFactory, ITextEditorMemberPositionProvider
+ public class CSharpCompletionTextEditorExtension : CompletionTextEditorExtension, IParameterCompletionDataFactory, ITextEditorMemberPositionProvider, IDebuggerExpressionResolver
{
internal MonoDevelop.Ide.Editor.TextEditor TextEditorData {
get {
@@ -174,14 +178,13 @@ namespace MonoDevelop.CSharp.Completion
void HandlePositionChanged (object sender, EventArgs e)
{
StopPositionChangedTask ();
- Task.Factory.StartNew (delegate {
- var doc = Document;
- if (doc == null || doc.Editor == null)
- return;
- var ctx = MDRefactoringContext.Create (doc, doc.Editor.CaretLocation, src.Token);
- if (ctx != null)
- MDRefactoringCtx = ctx;
- });
+
+ var doc = Document;
+ if (doc == null || doc.Editor == null)
+ return;
+ MDRefactoringContext.Create (doc, doc.Editor.CaretLocation, src.Token).ContinueWith (t => {
+ MDRefactoringCtx = t.Result;
+ }, TaskContinuationOptions.ExecuteSynchronously);
}
[CommandUpdateHandler (CodeGenerationCommands.ShowCodeGenerationWindow)]
@@ -359,7 +362,7 @@ namespace MonoDevelop.CSharp.Completion
var completionDataFactory = new CompletionDataFactory (this, new CSharpResolver (ctx));
if (MDRefactoringCtx == null) {
src.Cancel ();
- MDRefactoringCtx = MDRefactoringContext.Create (Document, Document.Editor.CaretLocation);
+ MDRefactoringCtx = MDRefactoringContext.Create (Document, Document.Editor.CaretLocation).Result;
}
var engine = new MonoCSharpCompletionEngine (
@@ -598,6 +601,9 @@ namespace MonoDevelop.CSharp.Completion
if (ctx == null)
return null;
+ if (completionChar != '(' && completionChar != ',')
+ return null;
+
try {
var engine = new CSharpParameterCompletionEngine (
new DocumentWrapper (TextEditorData),
@@ -1326,6 +1332,162 @@ namespace MonoDevelop.CSharp.Completion
return new TypeParameterDataProvider (startOffset, this, methods);
}
#endregion
+
+ #region IDebuggerExpressionResolver implementation
+
+ static string GetIdentifierName (TextEditorData editor, Identifier id, out int startOffset)
+ {
+ startOffset = editor.LocationToOffset (id.StartLocation.Line, id.StartLocation.Column);
+
+ return editor.GetTextBetween (id.StartLocation, id.EndLocation);
+ }
+
+ internal static string ResolveExpression (TextEditorData editor, ResolveResult result, AstNode node, out int startOffset)
+ {
+ //Console.WriteLine ("result is a {0}", result.GetType ().Name);
+ startOffset = -1;
+
+ if (result is NamespaceResolveResult ||
+ result is ConversionResolveResult ||
+ result is ConstantResolveResult ||
+ result is ForEachResolveResult ||
+ result is TypeIsResolveResult ||
+ result is TypeOfResolveResult ||
+ result is ErrorResolveResult)
+ return null;
+
+ if (result.IsCompileTimeConstant)
+ return null;
+
+ startOffset = editor.LocationToOffset (node.StartLocation.Line, node.StartLocation.Column);
+
+ if (result is InvocationResolveResult) {
+ var ir = (InvocationResolveResult) result;
+ if (ir.Member.Name == ".ctor") {
+ // if the user is hovering over something like "new Abc (...)", we want to show them type information for Abc
+ return ir.Member.DeclaringType.FullName;
+ }
+
+ // do not support general method invocation for tooltips because it could cause side-effects
+ return null;
+ } else if (result is LocalResolveResult) {
+ if (node is ParameterDeclaration) {
+ // user is hovering over a method parameter, but we don't want to include the parameter type
+ var param = (ParameterDeclaration) node;
+
+ return GetIdentifierName (editor, param.NameToken, out startOffset);
+ }
+
+ if (node is VariableInitializer) {
+ // user is hovering over something like "int fubar = 5;", but we don't want the expression to include the " = 5"
+ var variable = (VariableInitializer) node;
+
+ return GetIdentifierName (editor, variable.NameToken, out startOffset);
+ }
+ } else if (result is MemberResolveResult) {
+ var mr = (MemberResolveResult) result;
+
+ if (node is PropertyDeclaration) {
+ var prop = (PropertyDeclaration) node;
+ var name = GetIdentifierName (editor, prop.NameToken, out startOffset);
+
+ // if the property is static, then we want to return "Full.TypeName.Property"
+ if (prop.Modifiers.HasFlag (Modifiers.Static))
+ return mr.Member.DeclaringType.FullName + "." + name;
+
+ // otherwise we want to return "this.Property" so that it won't conflict with anything else in the local scope
+ return "this." + name;
+ }
+
+ if (node is FieldDeclaration) {
+ var field = (FieldDeclaration) node;
+ var name = GetIdentifierName (editor, field.NameToken, out startOffset);
+
+ // if the field is static, then we want to return "Full.TypeName.Field"
+ if (field.Modifiers.HasFlag (Modifiers.Static))
+ return mr.Member.DeclaringType.FullName + "." + name;
+
+ // otherwise we want to return "this.Field" so that it won't conflict with anything else in the local scope
+ return "this." + name;
+ }
+
+ if (node is VariableInitializer) {
+ // user is hovering over a field declaration that includes initialization
+ var variable = (VariableInitializer) node;
+ var name = GetIdentifierName (editor, variable.NameToken, out startOffset);
+
+ // walk up the AST to find the FieldDeclaration so that we can determine if it is static or not
+ var field = variable.GetParent<FieldDeclaration> ();
+
+ // if the field is static, then we want to return "Full.TypeName.Field"
+ if (field.Modifiers.HasFlag (Modifiers.Static))
+ return mr.Member.DeclaringType.FullName + "." + name;
+
+ // otherwise we want to return "this.Field" so that it won't conflict with anything else in the local scope
+ return "this." + name;
+ }
+
+ if (node is NamedExpression) {
+ // user is hovering over 'Property' in an expression like: var fubar = new Fubar () { Property = baz };
+ var variable = node.GetParent<VariableInitializer> ();
+ if (variable != null) {
+ var variableName = GetIdentifierName (editor, variable.NameToken, out startOffset);
+ var name = GetIdentifierName (editor, ((NamedExpression) node).NameToken, out startOffset);
+
+ return variableName + "." + name;
+ }
+ }
+ } else if (result is TypeResolveResult) {
+ return ((TypeResolveResult) result).Type.FullName;
+ }
+
+ return editor.GetTextBetween (node.StartLocation, node.EndLocation);
+ }
+
+ static bool TryResolveAt (Document doc, DocumentLocation loc, out ResolveResult result, out AstNode node)
+ {
+ if (doc == null)
+ throw new ArgumentNullException ("doc");
+
+ result = null;
+ node = null;
+
+ var parsedDocument = doc.ParsedDocument;
+ if (parsedDocument == null)
+ return false;
+
+ var unit = parsedDocument.GetAst<SyntaxTree> ();
+ var parsedFile = parsedDocument.ParsedFile as CSharpUnresolvedFile;
+
+ if (unit == null || parsedFile == null)
+ return false;
+
+ try {
+ result = ResolveAtLocation.Resolve (new Lazy<ICompilation> (() => doc.Compilation), parsedFile, unit, loc, out node);
+ if (result == null || node is Statement)
+ return false;
+ } catch {
+ return false;
+ }
+
+ return true;
+ }
+
+ string IDebuggerExpressionResolver.ResolveExpression (TextEditorData editor, Document doc, int offset, out int startOffset)
+ {
+ ResolveResult result;
+ AstNode node;
+
+ var loc = editor.OffsetToLocation (offset);
+ if (!TryResolveAt (doc, loc, out result, out node)) {
+ startOffset = -1;
+ return null;
+ }
+
+ return ResolveExpression (editor, result, node, out startOffset);
+ }
+
+ #endregion
#region TypeSystemSegmentTree
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpTextEditorIndentation.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpTextEditorIndentation.cs
index 1aa88f7034..daf0986418 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpTextEditorIndentation.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpTextEditorIndentation.cs
@@ -131,6 +131,7 @@ namespace MonoDevelop.CSharp.Formatting
IdeApp.Workspace.ActiveConfigurationChanged += HandleTextOptionsChanged;
}
+ bool indentationDisabled;
void HandleTextOptionsChanged (object sender, EventArgs e)
{
@@ -156,7 +157,8 @@ namespace MonoDevelop.CSharp.Formatting
((IInternalEditorExtensions)Editor).SetIndentationTracker (new IndentVirtualSpaceManager (Editor, stateTracker));
}
- if (Editor.Options.IndentStyle == IndentStyle.Auto || Editor.Options.IndentStyle == IndentStyle.None) {
+ indentationDisabled = DefaultSourceEditorOptions.Instance.IndentStyle == IndentStyle.Auto || DefaultSourceEditorOptions.Instance.IndentStyle == IndentStyle.None;
+ if (indentationDisabled) {
((IInternalEditorExtensions)Editor).SetTextPasteHandler (null);
} else {
((IInternalEditorExtensions)Editor).SetTextPasteHandler (new CSharpTextPasteHandler (this, stateTracker, options, policy));
@@ -368,7 +370,7 @@ namespace MonoDevelop.CSharp.Formatting
if (keyChar == ';' && Editor.EditMode == EditMode.Edit && !DoInsertTemplate () && !isSomethingSelected && PropertyService.Get (
"SmartSemicolonPlacement",
false
- )) {
+ ) && !(stateTracker.IsInsideComment || stateTracker.IsInsideString)) {
bool retval = base.KeyPress (key, keyChar, modifier);
var curLine = Editor.GetLine (Editor.CaretLine);
string text = Editor.GetTextAt (curLine);
@@ -424,7 +426,7 @@ namespace MonoDevelop.CSharp.Formatting
//do the smart indent
- if (Editor.Options.IndentStyle == IndentStyle.Smart || Editor.Options.IndentStyle == IndentStyle.Virtual) {
+ if (!indentationDisabled) {
bool retval;
//capture some of the current state
int oldBufLen = Editor.Length;
@@ -465,7 +467,8 @@ namespace MonoDevelop.CSharp.Formatting
//inserted rather than just updating the stack due to moving around
SafeUpdateIndentEngine (Editor.CaretOffset);
- automaticReindent = (stateTracker.NeedsReindent && lastCharInserted != '\0');
+ // Automatically reindent in text link mode will cause the mode exiting, therefore we need to prevent that.
+ automaticReindent = (stateTracker.NeedsReindent && lastCharInserted != '\0') && !(textEditorData.CurrentMode is TextLinkEditMode);
if (key == Gdk.Key.Return && (reIndent || automaticReindent)) {
if (Editor.Options.IndentStyle == IndentStyle.Virtual) {
if (Editor.GetLine (Editor.CaretLine).Length == 0)
@@ -476,12 +479,14 @@ namespace MonoDevelop.CSharp.Formatting
}
}
- if (reIndent || key != Gdk.Key.Return && key != Gdk.Key.Tab && automaticReindent) {
- using (var undo = Editor.OpenUndoGroup ()) {
+ const string reindentChars = ";){}";
+ if (reIndent || key != Gdk.Key.Return && key != Gdk.Key.Tab && automaticReindent && reindentChars.Contains (keyChar)) {
+ using (var undo = textEditorData.OpenUndoGroup ()) {
DoReSmartIndent ();
}
}
- if (!skipFormatting) {
+
+ if (!skipFormatting && !(stateTracker.IsInsideComment || stateTracker.IsInsideString)) {
if (keyChar == ';' || keyChar == '}') {
using (var undo = Editor.OpenUndoGroup ()) {
if (OnTheFlyFormatting && Editor != null && Editor.EditMode == EditMode.Edit) {
@@ -508,7 +513,7 @@ namespace MonoDevelop.CSharp.Formatting
//and calls HandleCodeCompletion etc to handles completion
var result = base.KeyPress (key, keyChar, modifier);
- if (key == Gdk.Key.Return || key == Gdk.Key.KP_Enter) {
+ if (!indentationDisabled && (key == Gdk.Key.Return || key == Gdk.Key.KP_Enter)) {
DoReSmartIndent ();
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormatter.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormatter.cs
index 4fbb7f1019..11d0bc07d6 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormatter.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormatter.cs
@@ -118,14 +118,15 @@ namespace MonoDevelop.CSharp.Formatting
var text = data.Editor.GetTextBetween (Math.Max (0, segmentLine.Offset), endOffset);
sb.Append (text);
var lex = new CSharpCompletionEngineBase.MiniLexer (text);
- lex.Parse (ch => {
+ lex.Parse ((ch,i) => {
if (lex.IsInString || lex.IsInChar || lex.IsInVerbatimString || lex.IsInSingleComment || lex.IsInMultiLineComment || lex.IsInPreprocessorDirective)
- return;
+ return false;
if (ch =='{') {
closingBrackets++;
} else if (ch =='}') {
closingBrackets--;
}
+ return false;
});
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/TypeSystemProvider.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/TypeSystemProvider.cs
index b28b6101a8..94c2d1259d 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/TypeSystemProvider.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/TypeSystemProvider.cs
@@ -50,7 +50,7 @@ namespace MonoDevelop.CSharp.Parser
if (project != null) {
var projectFile = project.Files.GetFile (fileName);
- if (projectFile != null && projectFile.BuildAction != BuildAction.Compile)
+ if (projectFile != null && !TypeSystemParserNode.IsCompileBuildAction (projectFile.BuildAction))
result.Flags |= ParsedDocumentFlags.NonSerializable;
}
@@ -84,7 +84,8 @@ namespace MonoDevelop.CSharp.Parser
result.ParsedFile = pf;
result.Add (GetSemanticTags (unit));
- result.CreateRefactoringContext = (doc, token) => MDRefactoringContext.Create (doc, doc.Editor.CaretLocation, token);
+
+ result.CreateRefactoringContext = (doc, token) => MDRefactoringContext.Create (doc, doc.Editor.CaretLocation, token).Result;
result.CreateRefactoringContextWithEditor = (data, resolver, token) => new MDRefactoringContext ((DotNetProject)project, data, result, (CSharpAstResolver)resolver, TextLocation.Empty, token);
if (storeAst) {
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs
index b9c7e2375b..6c528ba8f4 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs
@@ -189,14 +189,6 @@ namespace MonoDevelop.CSharp.Project
else
definesymbols = string.Empty;
}
-
- [Obsolete ("Use GetDefineSymbols")]
- public ReadOnlyCollection<string> AllDefineSymbols
- {
- get {
- return new ReadOnlyCollection<string> (GetDefineSymbols ().ToArray ());
- }
- }
public string DefineSymbols {
get {
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/Actions/MoveTypeToFile.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/Actions/MoveTypeToFile.cs
index 006690fe81..1023a2088a 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/Actions/MoveTypeToFile.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/Actions/MoveTypeToFile.cs
@@ -73,8 +73,8 @@ namespace MonoDevelop.CSharp.Refactoring.CodeActions
string correctFileName = GetCorrectFileName (ctx, type);
if (IsSingleType (ctx)) {
FileService.RenameFile (ctx.TextEditor.FileName, correctFileName);
- if (ctx.Project != null)
- ctx.Project.Save (new NullProgressMonitor ());
+ if (ctx.FileContainerProject != null)
+ ctx.FileContainerProject.Save (new NullProgressMonitor ());
return;
}
@@ -96,16 +96,16 @@ namespace MonoDevelop.CSharp.Refactoring.CodeActions
content = content.Remove (start, end - start);
}
- if (context.Project != null) {
- string header = StandardHeaderService.GetHeader (context.Project, correctFileName, true);
+ if (context.FileContainerProject != null) {
+ string header = StandardHeaderService.GetHeader (context.FileContainerProject, correctFileName, true);
if (!string.IsNullOrEmpty (header))
content = header + context.TextEditor.GetEolMarker () + StripHeader (content);
}
content = StripDoubleBlankLines (content);
File.WriteAllText (correctFileName, content);
- context.Project.AddFile (correctFileName);
- MonoDevelop.Ide.IdeApp.ProjectOperations.Save (context.Project);
+ context.FileContainerProject.AddFile (correctFileName);
+ MonoDevelop.Ide.IdeApp.ProjectOperations.Save (context.FileContainerProject);
}
static bool IsBlankLine (IReadonlyTextDocument doc, int i)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/MDRefactoringContext.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/MDRefactoringContext.cs
index 1c766f0f00..6ad0023a06 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/MDRefactoringContext.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/MDRefactoringContext.cs
@@ -25,6 +25,7 @@
// THE SOFTWARE.
using System;
+using System.Linq;
using ICSharpCode.NRefactory.CSharp;
using MonoDevelop.Projects;
using MonoDevelop.Core;
@@ -41,11 +42,14 @@ using MonoDevelop.CSharp.Formatting;
using MonoDevelop.Ide.Editor;
using MonoDevelop.CSharp.NRefactoryWrapper;
using MonoDevelop.Ide.Gui.Content;
+using System.Threading.Tasks;
namespace MonoDevelop.CSharp.Refactoring.CodeActions
{
public class MDRefactoringContext : RefactoringContext, IRefactoringContext
{
+ MonoDevelop.Projects.Project fileContainerProject;
+
public ITextDocument TextEditor {
get;
private set;
@@ -56,6 +60,33 @@ namespace MonoDevelop.CSharp.Refactoring.CodeActions
private set;
}
+ public MonoDevelop.Projects.Project FileContainerProject {
+ get {
+ if (fileContainerProject == null)
+ fileContainerProject = FindProjectContainingFile () ?? Project;
+ return fileContainerProject;
+ }
+ }
+
+ MonoDevelop.Projects.Project FindProjectContainingFile ()
+ {
+ var file = TextEditor.FileName;
+ if (string.IsNullOrEmpty (file) || Project == null)
+ return null;
+
+ var pf = Project.GetProjectFile (file);
+ if (pf != null && (pf.Flags & ProjectItemFlags.Hidden) != 0) {
+ // The file is hidden in this project, so it may also be part of another project.
+ // Try to find a project in which this file is not hidden
+ foreach (var p in Project.ParentSolution.GetAllProjects ()) {
+ pf = p.GetProjectFile (file);
+ if (pf != null && (pf.Flags & ProjectItemFlags.Hidden) == 0)
+ return p;
+ }
+ }
+ return null;
+ }
+
public bool IsInvalid {
get {
if (Resolver == null || TextEditor == null)
@@ -78,9 +109,10 @@ namespace MonoDevelop.CSharp.Refactoring.CodeActions
public override string DefaultNamespace {
get {
- if (Project == null || TextEditor == null || string.IsNullOrEmpty (TextEditor.FileName))
+ var p = FileContainerProject as IDotNetFileContainer;
+ if (p == null || TextEditor == null || string.IsNullOrEmpty (TextEditor.FileName))
return null;
- return Project.GetDefaultNamespace (TextEditor.FileName);
+ return p.GetDefaultNamespace (TextEditor.FileName);
}
}
@@ -207,15 +239,21 @@ namespace MonoDevelop.CSharp.Refactoring.CodeActions
return StartScript ();
}
- internal static MDRefactoringContext Create (Document document, TextLocation loc, CancellationToken cancellationToken = default (CancellationToken))
+ internal static Task<MDRefactoringContext> Create (Document document, TextLocation loc, CancellationToken cancellationToken = default (CancellationToken))
{
var shared = document.GetSharedResolver ();
- if (shared == null)
- return null;
- var sharedResolver = shared.Result;
- if (sharedResolver == null)
- return null;
- return new MDRefactoringContext (document, sharedResolver, loc, cancellationToken);
+ if (shared == null) {
+ var tcs = new TaskCompletionSource<MDRefactoringContext> ();
+ tcs.SetResult (null);
+ return tcs.Task;
+ }
+
+ return shared.ContinueWith (t => {
+ var sharedResolver = t.Result;
+ if (sharedResolver == null)
+ return null;
+ return new MDRefactoringContext (document, sharedResolver, loc, cancellationToken);
+ }, TaskContinuationOptions.ExecuteSynchronously);
}
internal MDRefactoringContext (Document document, CSharpAstResolver resolver, TextLocation loc, CancellationToken cancellationToken = default (CancellationToken)) : base (resolver, cancellationToken)
@@ -228,7 +266,7 @@ namespace MonoDevelop.CSharp.Refactoring.CodeActions
this.Project = document.Project as DotNetProject;
this.formattingOptions = document.GetFormattingOptions ();
this.location = loc;
- var policy = document.HasProject ? Project.Policies.Get<NameConventionPolicy> () : MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy<NameConventionPolicy> ();
+ var policy = document.HasProject ? document.Project.Policies.Get<NameConventionPolicy> () : MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy<NameConventionPolicy> ();
Services.AddService (typeof(NamingConventionService), policy.CreateNRefactoryService ());
Services.AddService (typeof(ICSharpCode.NRefactory.CSharp.CodeGenerationService), new CSharpCodeGenerationService());
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/MDRefactoringScript.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/MDRefactoringScript.cs
index a781fdd623..e5bc9ee972 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/MDRefactoringScript.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/MDRefactoringScript.cs
@@ -179,7 +179,7 @@ namespace MonoDevelop.CSharp.Refactoring.CodeActions
MDRefactoringScript script;
if (loadedDocument.Editor != context.TextEditor) {
- script = new MDRefactoringScript (MDRefactoringContext.Create (loadedDocument, loc, context.CancellationToken), FormattingOptions);
+ script = new MDRefactoringScript (MDRefactoringContext.Create (loadedDocument, loc, context.CancellationToken).Result, FormattingOptions);
startedScripts.Add (script);
} else {
script = this;
@@ -350,7 +350,7 @@ namespace MonoDevelop.CSharp.Refactoring.CodeActions
insertLocation = content.Length;
content = content.Substring (0, insertLocation) + newType.ToString (FormattingOptions) + content.Substring (insertLocation);
- var project = context.Project;
+ var project = context.FileContainerProject;
if (project != null) {
var policy = project.Policies.Get<CSharpFormattingPolicy> ();
var textPolicy = project.Policies.Get<TextStylePolicy> ();
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/NRefactoryCodeAction.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/NRefactoryCodeAction.cs
index 2d78f131e4..8eb2e1a9f0 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/NRefactoryCodeAction.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/NRefactoryCodeAction.cs
@@ -67,7 +67,7 @@ namespace MonoDevelop.CSharp.Refactoring.CodeActions
public override void BatchRun (Document document, TextLocation loc)
{
base.BatchRun (document, loc);
- var context = MDRefactoringContext.Create (document, loc);
+ var context = MDRefactoringContext.Create (document, loc).Result;
if (context == null)
return;
using (var script = context.StartScript ()) {
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeIssues/Issues/MonoTODOIssue.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeIssues/Issues/MonoTODOIssue.cs
index 8236d7a5d3..20a593d9a1 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeIssues/Issues/MonoTODOIssue.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeIssues/Issues/MonoTODOIssue.cs
@@ -51,7 +51,7 @@ namespace MonoDevelop.CSharp.Refactoring.CodeIssues
this.Category = IssueCategories.Notifications;
this.SetMimeType ("text/x-csharp");
this.IsEnabledByDefault = true;
- this.SetSeverity (ICSharpCode.NRefactory.Refactoring.Severity.Error);
+ this.SetSeverity (ICSharpCode.NRefactory.Refactoring.Severity.Warning);
this.SetIsEnabled (true);
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeIssues/NamingInspection/NameConventionEditRuleDialog.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeIssues/NamingInspection/NameConventionEditRuleDialog.cs
index 6fd7df8189..574f10de7b 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeIssues/NamingInspection/NameConventionEditRuleDialog.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeIssues/NamingInspection/NameConventionEditRuleDialog.cs
@@ -129,14 +129,13 @@ namespace MonoDevelop.CSharp.Refactoring.CodeIssues
entrySuffix.Text = rule.RequiredSuffixes.FirstOrDefault ();
styleComboBox.AppendText ("PascalCase");
styleComboBox.AppendText ("CamelCase");
- styleComboBox.AppendText ("all_lower");
- styleComboBox.AppendText ("ALL_UPPER");
- styleComboBox.AppendText ("ALL_UPPER");
- styleComboBox.AppendText ("First_upper");
- styleComboBox.AppendText ("PascalCase_UnderscoreTolerant");
+ styleComboBox.AppendText ("ALLUPPER");
+ styleComboBox.AppendText ("alllower");
+ styleComboBox.AppendText ("Firstupper");
styleComboBox.AppendText ("PascalCase_underscoreTolerant");
- styleComboBox.AppendText ("CamelCase_UnderscoreTolerant");
+ styleComboBox.AppendText ("PascalCase_UnderscoreTolerant");
styleComboBox.AppendText ("CamelCase_underscoreTolerant");
+ styleComboBox.AppendText ("CamelCase_UnderscoreTolerant");
styleComboBox.Active = (int)rule.NamingStyle - 1;
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CSharpCodeGenerator.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CSharpCodeGenerator.cs
index 0e52b9e16f..3e97ef2c07 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CSharpCodeGenerator.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CSharpCodeGenerator.cs
@@ -945,7 +945,7 @@ namespace MonoDevelop.CSharp.Refactoring
int offset = 0;
if (node != null) {
var loc = InsertUsingAfter (node) ? node.EndLocation : node.StartLocation;
- offset = doc.Editor.LocationToOffset (loc);
+ offset = Math.Max (0, doc.Editor.LocationToOffset (loc));
}
lines = policy.BlankLinesAfterUsings;
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Resolver/TextEditorResolverProvider.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Resolver/TextEditorResolverProvider.cs
index 87b478394c..b53f8c8a53 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Resolver/TextEditorResolverProvider.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Resolver/TextEditorResolverProvider.cs
@@ -111,7 +111,18 @@ namespace MonoDevelop.CSharp.Resolver
var resolver = new CSharpAstResolver (doc.Compilation, unit, parsedFile);
resolver.ApplyNavigator (new NodeListResolveVisitorNavigator (node), CancellationToken.None);
var state = resolver.GetResolverStateBefore (node, CancellationToken.None);
- return state.LookupSimpleNameOrTypeName (expression, new List<IType> (), NameLookupMode.Expression);
+
+ var list = new List<IType> ();
+ int indexOf = expression.IndexOf ('`');
+ if (indexOf != -1) {
+ var intType = new PrimitiveType ("int").ToTypeReference ().Resolve (doc.Compilation);
+ var num = expression.Substring (indexOf + 1);
+ int number = int.Parse (num);
+ for (int i = 0; i < number; i++)
+ list.Add (intType);
+ expression = expression.Remove (indexOf);
+ }
+ return state.LookupSimpleNameOrTypeName (expression, list, NameLookupMode.Expression);
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Tooltips/LanguageItemTooltipProvider.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Tooltips/LanguageItemTooltipProvider.cs
index 2bb07ff3e4..ae489f26eb 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Tooltips/LanguageItemTooltipProvider.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Tooltips/LanguageItemTooltipProvider.cs
@@ -198,6 +198,14 @@ namespace MonoDevelop.SourceEditor
return sig.GetAliasedTypeTooltip ((AliasTypeResolveResult)result);
}
+ if (data.Node is ThisReferenceExpression && result is ThisResolveResult) {
+ var resolver = file.GetResolver (doc.Compilation, doc.Editor.Caret.Location);
+ var sig = new SignatureMarkupCreator (resolver, doc.GetFormattingPolicy ().CreateOptions ());
+ sig.BreakLineAfterReturnType = false;
+
+ return sig.GetKeywordTooltip ("this", data.Node);
+ }
+
if (data.Node is TypeOfExpression) {
var resolver = file.GetResolver (doc.Compilation, doc.Editor.CaretLocation);
var sig = new SignatureMarkupCreator (resolver, doc.GetFormattingPolicy ().CreateOptions ());
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/AstStockIcons.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/AstStockIcons.cs
index da7488281a..aec03f9f17 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/AstStockIcons.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/AstStockIcons.cs
@@ -154,26 +154,24 @@ namespace MonoDevelop.CSharp
return result;
}
- public static string GetStockIcon (this EntityDeclaration element, bool showAccessibility = true)
+
+ public static string GetStockIcon (this EntityDeclaration element)
{
Accessibility acc = Accessibility.Public;
if (element is Accessor) {
- if (showAccessibility) {
- if (!GetAccessibility (element, out acc))
- GetAccessibility (element.Parent as EntityDeclaration, out acc);
- }
+ if (!GetAccessibility (element, out acc))
+ GetAccessibility (element.Parent as EntityDeclaration, out acc);
return methodIconTable [(int) (acc)];
}
- if (showAccessibility) {
- GetAccessibility (element, out acc);
- }
+ GetAccessibility (element, out acc);
if (element is TypeDeclaration) {
var type = element as TypeDeclaration;
+
switch (type.ClassType) {
case ClassType.Class:
return typeIconTable [0, (int) (acc)];
@@ -202,7 +200,7 @@ namespace MonoDevelop.CSharp
if (element is OperatorDeclaration || element is ConstructorDeclaration || element is DestructorDeclaration || element is Accessor)
return methodIconTable [(int) (acc)];
- if (element is PropertyDeclaration)
+ if (element is PropertyDeclaration || element is IndexerDeclaration)
return propertyIconTable [(int) (acc)];
if (element is EventDeclaration || element is CustomEventDeclaration)
return eventIconTable [(int) (acc)];
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/ExpandSelectionHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/ExpandSelectionHandler.cs
index 619c483978..a0b4f5e443 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/ExpandSelectionHandler.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/ExpandSelectionHandler.cs
@@ -41,9 +41,11 @@ namespace MonoDevelop.CSharp
{
protected override void Run ()
{
- MonoDevelop.Ide.Gui.Document doc = IdeApp.Workbench.ActiveDocument;
- CSharpParser parser = new CSharpParser ();
- var unit = parser.Parse (doc.Editor);
+ var doc = IdeApp.Workbench.ActiveDocument;
+ var parsedDocument = doc.ParsedDocument;
+ if (parsedDocument == null)
+ return;
+ var unit = parsedDocument.GetAst<SyntaxTree> ();
if (unit == null)
return;
var node = unit.GetNodeAt (doc.Editor.CaretLocation);
@@ -71,15 +73,17 @@ namespace MonoDevelop.CSharp
protected override void Run ()
{
- MonoDevelop.Ide.Gui.Document doc = IdeApp.Workbench.ActiveDocument;
- CSharpParser parser = new CSharpParser ();
- var unit = parser.Parse (doc.Editor);
+ var doc = IdeApp.Workbench.ActiveDocument;
+ var parsedDocument = doc.ParsedDocument;
+ if (parsedDocument == null)
+ return;
+ var unit = parsedDocument.GetAst<SyntaxTree> ();
if (unit == null)
return;
var node = unit.GetNodeAt (doc.Editor.CaretLine, doc.Editor.CaretColumn);
if (node == null)
return;
- Stack<AstNode > nodeStack = new Stack<AstNode> ();
+ var nodeStack = new Stack<AstNode> ();
nodeStack.Push (node);
if (doc.Editor.IsSomethingSelected) {
while (node != null && IsSelected (doc.Editor, node.StartLocation, node.EndLocation)) {
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/PathedDocumentTextEditorExtension.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/PathedDocumentTextEditorExtension.cs
index c0f638efdc..92a015571c 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/PathedDocumentTextEditorExtension.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/PathedDocumentTextEditorExtension.cs
@@ -38,6 +38,7 @@ using ICSharpCode.NRefactory.CSharp;
using System.Text;
using MonoDevelop.Ide.Editor;
using MonoDevelop.Ide.Editor.Extension;
+using MonoDevelop.Projects;
namespace MonoDevelop.CSharp
{
@@ -46,6 +47,13 @@ namespace MonoDevelop.CSharp
public override void Dispose ()
{
Editor.CaretPositionChanged -= UpdatePath;
+ IdeApp.Workspace.FileAddedToProject -= HandleProjectChanged;
+ IdeApp.Workspace.FileRemovedFromProject -= HandleProjectChanged;
+
+ if (caret != null) {
+ caret.PositionChanged -= UpdatePath;
+ caret = null;
+ }
if (ext != null) {
ext.TypeSegmentTreeUpdated -= HandleTypeSegmentTreeUpdated;
ext = null;
@@ -58,15 +66,25 @@ namespace MonoDevelop.CSharp
bool isPathSet;
CSharpCompletionTextEditorExtension ext;
+ List<DotNetProject> ownerProjects;
protected override void Initialize ()
{
CurrentPath = new PathEntry[] { new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = null } };
isPathSet = false;
+ UpdateOwnerProjects ();
UpdatePath (null, null);
Editor.CaretPositionChanged += UpdatePath;
ext = Document.GetContent<CSharpCompletionTextEditorExtension> ();
ext.TypeSegmentTreeUpdated += HandleTypeSegmentTreeUpdated;
+ IdeApp.Workspace.FileAddedToProject += HandleProjectChanged;
+ IdeApp.Workspace.FileRemovedFromProject += HandleProjectChanged;
+ }
+
+ void HandleProjectChanged (object sender, ProjectFileEventArgs e)
+ {
+ UpdateOwnerProjects ();
+ UpdatePath (null, null);
}
void HandleTypeSegmentTreeUpdated (object sender, EventArgs e)
@@ -74,6 +92,24 @@ namespace MonoDevelop.CSharp
UpdatePath (null, null);
}
+ void UpdateOwnerProjects ()
+ {
+ var projects = new HashSet<DotNetProject> (IdeApp.Workspace.GetAllSolutionItems<DotNetProject> ().Where (p => p.IsFileInProject (Document.FileName)));
+ if (ownerProjects == null || !projects.SetEquals (ownerProjects)) {
+ ownerProjects = projects.OrderBy (p => p.Name).ToList ();
+ var dnp = Document.Project as DotNetProject;
+ if (ownerProjects.Count > 0 && (dnp == null || !ownerProjects.Contains (dnp))) {
+ // If the project for the document is not a DotNetProject but there is a project containing this file
+ // in the current solution, then use that project
+ var pp = Document.Project != null ? ownerProjects.FirstOrDefault (p => p.ParentSolution == Document.Project.ParentSolution) : null;
+ if (pp != null)
+ Document.AttachToProject (pp);
+ }
+ }
+ if (Document.Project == null && ownerProjects.Count > 0)
+ Document.AttachToProject (ownerProjects[0]);
+ }
+
#region IPathedDocument implementation
public event EventHandler<DocumentPathChangedEventArgs> PathChanged;
@@ -138,7 +174,7 @@ namespace MonoDevelop.CSharp
if (type != null) {
AddTypeToMemberList (type);
}
- }
+ }
memberList.Sort ((x, y) => {
var result = String.Compare (GetName (x), GetName (y), StringComparison.OrdinalIgnoreCase);
@@ -209,6 +245,10 @@ namespace MonoDevelop.CSharp
public string GetMarkup (int n)
{
+ if (tag is DotNetProject) {
+ return GLib.Markup.EscapeText (ext.ownerProjects [n].Name);
+ }
+
var node = memberList [n];
if (tag is SyntaxTree) {
var type = node;
@@ -228,43 +268,60 @@ namespace MonoDevelop.CSharp
public Xwt.Drawing.Image GetIcon (int n)
{
string icon;
- var node = memberList [n];
- if (node is EntityDeclaration) {
- icon = ((EntityDeclaration)node).GetStockIcon (false);
+ if (tag is DotNetProject) {
+ icon = ext.ownerProjects [n].StockIcon;
} else {
- icon = ((EntityDeclaration)node.Parent).GetStockIcon (false);
+ var node = memberList [n];
+ if (node is EntityDeclaration) {
+ icon = ((EntityDeclaration)node).GetStockIcon ();
+ } else {
+ icon = ((EntityDeclaration)node.Parent).GetStockIcon ();
+ }
}
return ImageService.GetIcon (icon, Gtk.IconSize.Menu);
}
public object GetTag (int n)
{
- return memberList [n];
+ if (tag is DotNetProject)
+ return ext.ownerProjects [n];
+ else
+ return memberList [n];
}
public void ActivateItem (int n)
{
- var node = memberList [n];
- var extEditor = ext.Document.GetContent<TextEditor> ();
- if (extEditor != null) {
- int line, col;
- if (node is OperatorDeclaration) {
- line = Math.Max (1, ((OperatorDeclaration)node).OperatorToken.StartLocation.Line);
- col = Math.Max (1, ((OperatorDeclaration)node).OperatorToken.StartLocation.Column);
- } else if (node is EntityDeclaration && !(node is Accessor)) {
- line = Math.Max (1, ((EntityDeclaration)node).NameToken.StartLocation.Line);
- col = Math.Max (1, ((EntityDeclaration)node).NameToken.StartLocation.Column);
- } else {
- line = node.StartLocation.Line;
- col = node.StartLocation.Column;
+ if (tag is DotNetProject) {
+ ext.Document.AttachToProject (ext.ownerProjects [n]);
+ } else {
+ var node = memberList [n];
+ var extEditor = ext.Document.GetContent<TextEditor> ();
+ if (extEditor != null) {
+ int line, col;
+ if (node is OperatorDeclaration) {
+ line = Math.Max (1, ((OperatorDeclaration)node).OperatorToken.StartLocation.Line);
+ col = Math.Max (1, ((OperatorDeclaration)node).OperatorToken.StartLocation.Column);
+ } else if (node is IndexerDeclaration) {
+ line = Math.Max (1, ((IndexerDeclaration)node).ThisToken.StartLocation.Line);
+ col = Math.Max (1, ((IndexerDeclaration)node).ThisToken.StartLocation.Column);
+ } else if (node is EntityDeclaration && !(node is Accessor)) {
+ line = Math.Max (1, ((EntityDeclaration)node).NameToken.StartLocation.Line);
+ col = Math.Max (1, ((EntityDeclaration)node).NameToken.StartLocation.Column);
+ } else {
+ line = node.StartLocation.Line;
+ col = node.StartLocation.Column;
+ }
+ extEditor.SetCaretLocation (line, col, true);
}
- extEditor.SetCaretLocation (line, col, true);
}
}
public int IconCount {
get {
- return memberList.Count;
+ if (tag is DotNetProject)
+ return ext.ownerProjects.Count;
+ else
+ return memberList.Count;
}
}
@@ -384,6 +441,7 @@ namespace MonoDevelop.CSharp
string lastTypeMarkup;
EntityDeclaration lastMember;
string lastMemberMarkup;
+ MonoDevelop.Projects.Project lastProject;
AstAmbience amb;
string GetEntityMarkup (AstNode node)
@@ -413,6 +471,7 @@ namespace MonoDevelop.CSharp
var curType = (EntityDeclaration)unit.GetNodeAt (loc, n => n is TypeDeclaration || n is DelegateDeclaration);
+ var curProject = ownerProjects.Count > 1 ? Document.Project : null;
var segMember = compExt.GetMemberAt (caretOffset);
if (segMember != null) {
@@ -422,15 +481,15 @@ namespace MonoDevelop.CSharp
}
var curMember = unit.GetNodeAt<EntityDeclaration> (loc);
- if (curType == curMember)
+ if (curType == curMember || curType is DelegateDeclaration)
curMember = null;
- if (isPathSet && curType == lastType && lastMember == curMember)
+ if (isPathSet && curType == lastType && curMember == lastMember && curProject == lastProject)
return;
var curTypeMakeup = GetEntityMarkup (curType);
var curMemberMarkup = GetEntityMarkup (curMember);
if (isPathSet && curType != null && lastType != null && curType.StartLocation == lastType.StartLocation && curTypeMakeup == lastTypeMarkup &&
- curMember != null && lastMember != null && curMember.StartLocation == lastMember.StartLocation && curMemberMarkup == lastMemberMarkup)
+ curMember != null && lastMember != null && curMember.StartLocation == lastMember.StartLocation && curMemberMarkup == lastMemberMarkup && curProject == lastProject)
return;
lastType = curType;
@@ -439,33 +498,43 @@ namespace MonoDevelop.CSharp
lastMember = curMember;
lastMemberMarkup = curMemberMarkup;
+ lastProject = curProject;
+
+ var result = new List<PathEntry> ();
+
+ if (ownerProjects.Count > 1) {
+ // Current project if there is more than one
+ result.Add (new PathEntry (ImageService.GetIcon (Document.Project.StockIcon, Gtk.IconSize.Menu), GLib.Markup.EscapeText (Document.Project.Name)) { Tag = Document.Project });
+ }
+
if (curType == null) {
if (CurrentPath != null && CurrentPath.Length == 1 && CurrentPath [0].Tag is IUnresolvedFile)
return;
+ if (CurrentPath != null && CurrentPath.Length == 2 && CurrentPath [1].Tag is IUnresolvedFile)
+ return;
var prevPath = CurrentPath;
- CurrentPath = new PathEntry[] { new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = unit } };
+ result.Add (new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = unit });
+ CurrentPath = result.ToArray ();
OnPathChanged (new DocumentPathChangedEventArgs (prevPath));
return;
}
-
- // ThreadPool.QueueUserWorkItem (delegate {
- var result = new List<PathEntry> ();
if (curType != null) {
var type = curType;
+ var pos = result.Count;
while (type != null) {
var declaringType = type.Parent as TypeDeclaration;
- result.Insert (0, new PathEntry (ImageService.GetIcon (type.GetStockIcon (false), Gtk.IconSize.Menu), GetEntityMarkup (type)) { Tag = (AstNode)declaringType ?? unit });
+ result.Insert (pos, new PathEntry (ImageService.GetIcon (type.GetStockIcon (), Gtk.IconSize.Menu), GetEntityMarkup (type)) { Tag = (AstNode)declaringType ?? unit });
type = declaringType;
}
}
if (curMember != null) {
- result.Add (new PathEntry (ImageService.GetIcon (curMember.GetStockIcon (true), Gtk.IconSize.Menu), curMemberMarkup) { Tag = curMember });
+ result.Add (new PathEntry (ImageService.GetIcon (curMember.GetStockIcon (), Gtk.IconSize.Menu), curMemberMarkup) { Tag = curMember });
if (curMember is Accessor) {
var parent = curMember.Parent as EntityDeclaration;
if (parent != null)
- result.Insert (result.Count - 1, new PathEntry (ImageService.GetIcon (parent.GetStockIcon (true), Gtk.IconSize.Menu), GetEntityMarkup (parent)) { Tag = parent });
+ result.Insert (result.Count - 1, new PathEntry (ImageService.GetIcon (parent.GetStockIcon (), Gtk.IconSize.Menu), GetEntityMarkup (parent)) { Tag = parent });
}
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/SignatureMarkupCreator.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/SignatureMarkupCreator.cs
index 60a651189b..8dc65b9924 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/SignatureMarkupCreator.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/SignatureMarkupCreator.cs
@@ -1347,7 +1347,7 @@ namespace MonoDevelop.CSharp
break;
case "virtual":
result.SignatureMarkup = Highlight ("virtual", colorStyle.KeywordModifiers) + keywordSign;
- result.SummaryMarkup = "The " + Highlight ("virtual", colorStyle.KeywordModifiers) + " keyword is used to modify a method or property declaration, in which case the method or the property is called a virtual member.";
+ result.SummaryMarkup = "The " + Highlight ("virtual", colorStyle.KeywordModifiers) + " keyword is used to modify a method, property, indexer, or event declaration and allow for it to be overridden in a derived class.";
break;
case "volatile":
result.SignatureMarkup = Highlight ("volatile", colorStyle.KeywordModifiers) + keywordSign;
diff --git a/main/src/addins/CSharpBinding/templates/SharedAssetsProject.xpt.xml b/main/src/addins/CSharpBinding/templates/SharedAssetsProject.xpt.xml
new file mode 100644
index 0000000000..3081121b31
--- /dev/null
+++ b/main/src/addins/CSharpBinding/templates/SharedAssetsProject.xpt.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<Template originator = "Mike Krueger"
+ created = "02/01/2003"
+ lastModified = "02/01/2003">
+
+ <!-- Template Header -->
+ <TemplateConfiguration>
+ <_Name>Shared Project</_Name>
+ <_Category>C#</_Category>
+ <Icon>md-project-shared-assets</Icon>
+ <_Description>Creates a project that allows sharing files between projects</_Description>
+ <DefaultFilename>Shared</DefaultFilename>
+ <LanguageName>C#</LanguageName>
+ </TemplateConfiguration>
+
+ <!-- Actions -->
+ <Actions>
+ <Open filename = "MyClass.cs"/>
+ </Actions>
+
+ <!-- Template Content -->
+ <Combine name = "${ProjectName}" directory = ".">
+ <Project name = "${ProjectName}" directory = "." type = "SharedAssetsProject">
+ <Files>
+ <FileTemplateReference TemplateID="EmptyClass" name="MyClass.cs" />
+ </Files>
+ </Project>
+ </Combine>
+</Template>
diff --git a/main/src/addins/ChangeLogAddIn/AddLogEntryDialog.cs b/main/src/addins/ChangeLogAddIn/AddLogEntryDialog.cs
index 4a318731fe..9b96e905d6 100644
--- a/main/src/addins/ChangeLogAddIn/AddLogEntryDialog.cs
+++ b/main/src/addins/ChangeLogAddIn/AddLogEntryDialog.cs
@@ -31,6 +31,7 @@ using System.Collections.Generic;
using Gtk;
using MonoDevelop.Ide;
using MonoDevelop.Components;
+using MonoDevelop.Ide.Fonts;
namespace MonoDevelop.ChangeLogAddIn
{
@@ -46,8 +47,7 @@ namespace MonoDevelop.ChangeLogAddIn
{
Build ();
- Pango.FontDescription font = Pango.FontDescription.FromString (DesktopService.DefaultMonospaceFont);
- textview.ModifyFont (font);
+ textview.ModifyFont (FontService.MonospaceFont);
textview.WrapMode = WrapMode.None;
textview.AcceptsTab = true;
Pango.TabArray tabs = new Pango.TabArray (1, true);
@@ -56,7 +56,6 @@ namespace MonoDevelop.ChangeLogAddIn
textview.SizeRequested += delegate {
textview.WidthRequest = GetStringWidth (String.Empty.PadRight (80));
};
- font.Dispose ();
store = new ListStore (typeof(ChangeLogEntry), typeof(Xwt.Drawing.Image), typeof(string));
fileList.Model = store;
diff --git a/main/src/addins/ChangeLogAddIn/AddinInfo.cs b/main/src/addins/ChangeLogAddIn/AddinInfo.cs
index c6c6d29311..27bf353b35 100644
--- a/main/src/addins/ChangeLogAddIn/AddinInfo.cs
+++ b/main/src/addins/ChangeLogAddIn/AddinInfo.cs
@@ -6,7 +6,7 @@ using Mono.Addins.Description;
[assembly:Addin ("ChangeLogAddIn",
Namespace = "MonoDevelop",
Version = MonoDevelop.BuildInfo.Version,
- Flags = AddinFlags.Hidden,
+ EnabledByDefault = false,
Category = "Version Control")]
[assembly:AddinName ("ChangeLog Add-in")]
diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/DotDesktopViewWidget.cs b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/DotDesktopViewWidget.cs
index 725b7adc10..bda4d65e6c 100644
--- a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/DotDesktopViewWidget.cs
+++ b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/DotDesktopViewWidget.cs
@@ -226,13 +226,16 @@ namespace MonoDevelop.Deployment.Linux
protected virtual void OnButtonAddCategoriesClicked(object sender, System.EventArgs e)
{
MenuCategorySelectorDialog dlg = new MenuCategorySelectorDialog ();
- if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
- foreach (string s in dlg.Selection)
- entry.Categories.Add (s);
- FillCategs ();
- NotifyChanged ();
+ try {
+ if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
+ foreach (string s in dlg.Selection)
+ entry.Categories.Add (s);
+ FillCategs ();
+ NotifyChanged ();
+ }
+ } finally {
+ dlg.Destroy ();
}
- dlg.Destroy ();
}
protected virtual void OnButtonRemoveCategoryClicked(object sender, System.EventArgs e)
diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/templates/PackagingProject.xpt.xml b/main/src/addins/Deployment/MonoDevelop.Deployment/templates/PackagingProject.xpt.xml
index 9788aa37f0..2efb35ee96 100644
--- a/main/src/addins/Deployment/MonoDevelop.Deployment/templates/PackagingProject.xpt.xml
+++ b/main/src/addins/Deployment/MonoDevelop.Deployment/templates/PackagingProject.xpt.xml
@@ -5,7 +5,7 @@
<TemplateConfiguration>
<_Name>Packaging project</_Name>
<_Category>Other</_Category>
- <Icon>md-project|res:packaging-32.png</Icon>
+ <Icon>md-project-package</Icon>
<_Description>Create a project which can generate packages for a solution</_Description>
</TemplateConfiguration>
diff --git a/main/src/addins/GnomePlatform/GnomePlatform.cs b/main/src/addins/GnomePlatform/GnomePlatform.cs
index 1846e19bd4..beb5f8e4c0 100644
--- a/main/src/addins/GnomePlatform/GnomePlatform.cs
+++ b/main/src/addins/GnomePlatform/GnomePlatform.cs
@@ -386,8 +386,8 @@ namespace MonoDevelop.Platform
return true;
}
}
-
- public override void OpenInTerminal (FilePath directory)
+
+ public override void OpenTerminal (FilePath directory, IDictionary<string, string> environmentVariables, string title)
{
ProbeTerminal ();
Runtime.ProcessService.StartProcess (terminal_command, openDirectoryRunner(directory), directory, null);
diff --git a/main/src/addins/MacPlatform/Dialogs/MacAlertDialogHandler.cs b/main/src/addins/MacPlatform/Dialogs/MacAlertDialogHandler.cs
index 30b0145c7f..a40909f59a 100644
--- a/main/src/addins/MacPlatform/Dialogs/MacAlertDialogHandler.cs
+++ b/main/src/addins/MacPlatform/Dialogs/MacAlertDialogHandler.cs
@@ -47,16 +47,20 @@ namespace MonoDevelop.MacIntegration
using (var alert = new NSAlert ()) {
alert.Window.Title = data.Title ?? BrandingService.ApplicationName;
- if (data.Message.Icon == MonoDevelop.Ide.Gui.Stock.Information || data.Message.Icon == Gtk.Stock.DialogInfo) {
+ bool stockIcon = false;
+ if (data.Message.Icon == MonoDevelop.Ide.Gui.Stock.Error || data.Message.Icon == Gtk.Stock.DialogError) {
alert.AlertStyle = NSAlertStyle.Critical;
+ stockIcon = true;
} else if (data.Message.Icon == MonoDevelop.Ide.Gui.Stock.Warning || data.Message.Icon == Gtk.Stock.DialogWarning) {
- alert.AlertStyle = NSAlertStyle.Warning;
- } else { //if (data.Message.Icon == MonoDevelop.Ide.Gui.Stock.Information) {
+ alert.AlertStyle = NSAlertStyle.Critical;
+ stockIcon = true;
+ } else {
alert.AlertStyle = NSAlertStyle.Informational;
+ stockIcon = data.Message.Icon == MonoDevelop.Ide.Gui.Stock.Information;
}
//FIXME: use correct size so we don't get horrible scaling?
- if (!string.IsNullOrEmpty (data.Message.Icon)) {
+ if (!stockIcon && !string.IsNullOrEmpty (data.Message.Icon)) {
var pix = ImageService.GetIcon (data.Message.Icon, Gtk.IconSize.Dialog).ToPixbuf();
byte[] buf = pix.SaveToBuffer ("tiff");
unsafe {
@@ -68,7 +72,7 @@ namespace MonoDevelop.MacIntegration
//for some reason the NSAlert doesn't pick up the app icon by default
alert.Icon = NSApplication.SharedApplication.ApplicationIconImage;
}
-
+
alert.MessageText = data.Message.Text;
alert.InformativeText = data.Message.SecondaryText ?? "";
diff --git a/main/src/addins/MacPlatform/Dialogs/MacOpenFileDialogHandler.cs b/main/src/addins/MacPlatform/Dialogs/MacOpenFileDialogHandler.cs
index 02f4d52518..8de26a5fa2 100644
--- a/main/src/addins/MacPlatform/Dialogs/MacOpenFileDialogHandler.cs
+++ b/main/src/addins/MacPlatform/Dialogs/MacOpenFileDialogHandler.cs
@@ -188,7 +188,8 @@ namespace MonoDevelop.MacIntegration
if (viewerSelector != null ) {
if (closeSolutionButton != null)
data.CloseCurrentWorkspace = closeSolutionButton.State != NSCellStateValue.Off;
- data.SelectedViewer = currentViewers[viewerSelector.IndexOfSelectedItem];
+ data.SelectedViewer = viewerSelector.IndexOfSelectedItem >= 0 ?
+ currentViewers[viewerSelector.IndexOfSelectedItem] : null;
}
GtkQuartz.FocusWindow (data.TransientFor ?? MessageService.RootWindow);
diff --git a/main/src/addins/MacPlatform/Dialogs/MacSelectFileDialogHandler.cs b/main/src/addins/MacPlatform/Dialogs/MacSelectFileDialogHandler.cs
index 688c647d43..5ea28b6b55 100644
--- a/main/src/addins/MacPlatform/Dialogs/MacSelectFileDialogHandler.cs
+++ b/main/src/addins/MacPlatform/Dialogs/MacSelectFileDialogHandler.cs
@@ -164,7 +164,7 @@ namespace MonoDevelop.MacIntegration
globalPattern.Append (pattern);
}
- return new Regex (globalPattern.ToString (), RegexOptions.Compiled | RegexOptions.IgnoreCase);
+ return new Regex (globalPattern.ToString (), RegexOptions.IgnoreCase);
}
internal static NSPopUpButton CreateFileFilterPopup (SelectFileDialogData data, NSSavePanel panel)
diff --git a/main/src/addins/MacPlatform/Dialogs/SelectEncodingPopUpButton.cs b/main/src/addins/MacPlatform/Dialogs/SelectEncodingPopUpButton.cs
index 14a71e5795..dc7a456ca5 100644
--- a/main/src/addins/MacPlatform/Dialogs/SelectEncodingPopUpButton.cs
+++ b/main/src/addins/MacPlatform/Dialogs/SelectEncodingPopUpButton.cs
@@ -101,9 +101,9 @@ namespace MonoDevelop.MacIntegration
if (clear)
Menu.RemoveAllItems ();
- encodings = SeletedEncodings.ConversionEncodings;
+ encodings = SelectedEncodings.ConversionEncodings;
if (encodings == null || encodings.Length == 0)
- encodings = SeletedEncodings.DefaultEncodings;
+ encodings = SelectedEncodings.DefaultEncodings;
if (autoDetectedItem != null) {
Menu.AddItem (autoDetectedItem);
diff --git a/main/src/addins/MacPlatform/MacIntegrationCommands.cs b/main/src/addins/MacPlatform/MacIntegrationCommands.cs
index 0fbcb04b5b..24519e8e03 100644
--- a/main/src/addins/MacPlatform/MacIntegrationCommands.cs
+++ b/main/src/addins/MacPlatform/MacIntegrationCommands.cs
@@ -26,8 +26,8 @@
using MonoDevelop.Ide;
using MonoDevelop.Components.Commands;
-using MonoDevelop.MacInterop;
using MonoMac.AppKit;
+using System.Linq;
namespace MonoDevelop.MacIntegration
{
@@ -36,10 +36,11 @@ namespace MonoDevelop.MacIntegration
MinimizeWindow,
HideWindow,
HideOthers,
+ ShowOthers,
Services,
}
- internal class MacMinimizeWindowHandler : CommandHandler
+ class MacMinimizeWindowHandler : CommandHandler
{
protected override void Run ()
{
@@ -47,19 +48,50 @@ namespace MonoDevelop.MacIntegration
}
}
- internal class MacHideWindowHandler : CommandHandler
+ class MacHideWindowHandler : CommandHandler
{
protected override void Run ()
{
NSApplication.SharedApplication.Hide (NSApplication.SharedApplication);
}
+
+ protected override void Update (CommandInfo info)
+ {
+ info.Enabled = NSWorkspace.SharedWorkspace.RunningApplications.Any (a =>
+ !a.Hidden &&
+ a.ActivationPolicy == NSApplicationActivationPolicy.Regular &&
+ a.ProcessIdentifier != NSRunningApplication.CurrentApplication.ProcessIdentifier
+ );
+ }
}
- internal class MacHideOthersHandler : CommandHandler
+ class MacHideOthersHandler : CommandHandler
{
protected override void Run ()
{
NSApplication.SharedApplication.HideOtherApplications (NSApplication.SharedApplication);
}
+
+ protected override void Update (CommandInfo info)
+ {
+ info.Enabled = NSWorkspace.SharedWorkspace.RunningApplications.Any (a =>
+ !a.Hidden &&
+ a.ActivationPolicy == NSApplicationActivationPolicy.Regular &&
+ a.ProcessIdentifier != NSRunningApplication.CurrentApplication.ProcessIdentifier
+ );
+ }
+ }
+
+ class MacShowOthersHandler : CommandHandler
+ {
+ protected override void Run ()
+ {
+ NSApplication.SharedApplication.UnhideAllApplications (NSApplication.SharedApplication);
+ }
+
+ protected override void Update (CommandInfo info)
+ {
+ info.Enabled = NSWorkspace.SharedWorkspace.RunningApplications.Any (a => a.Hidden);
+ }
}
}
diff --git a/main/src/addins/MacPlatform/MacInterop/AppleEvents/Native.cs b/main/src/addins/MacPlatform/MacInterop/AppleEvents/Native.cs
index 49d76a776a..34d30872cd 100644
--- a/main/src/addins/MacPlatform/MacInterop/AppleEvents/Native.cs
+++ b/main/src/addins/MacPlatform/MacInterop/AppleEvents/Native.cs
@@ -497,29 +497,6 @@ namespace MonoDevelop.MacInterop.AppleEvents
{
Boolean = 0, //'bool',
- [Obsolete("Use Utf8Text")]
- Char = 0, //'TEXT'
-
- [Obsolete ("Use explicit encoding and byte order, e.g. Utf16ExternalRepresentation or Utf8Text")]
- ///<summary>Not implemented</summary>
- StyledUnicodeText = 0,//'sutx',
-
- [Obsolete ("Use explicit encoding and byte order, e.g. Utf16ExternalRepresentation or Utf8Text")]
- ///<summary>Not implemented</summary>
- EncodedString = 0,//'encs',
-
- [Obsolete ("Use explicit encoding and byte order, e.g. Utf16ExternalRepresentation or Utf8Text")]
- ///<summary>Not implemented. Native byte ordering, optional BOM.</summary>
- UnicodeText = 0,//'utxt',
-
- [Obsolete ("Use explicit encoding and byte order, e.g. Utf16ExternalRepresentation or Utf8Text")]
- ///<summary>Null terminated MacRoman char</summary>
- CString = 0,//'cstr',
-
- [Obsolete ("Use explicit encoding and byte order, e.g. Utf16ExternalRepresentation or Utf8Text")]
- ///<summary>Unsigned length byte followed by MacRoman characters</summary>
- PString = 0,//'pstr'
-
///<summary>Big-endian UTF-16 with optional BOM, or little-endian UTF16 with required BOM</summary>
///<remarks>No length byte or null termination</remarks>
Utf16ExternalRepresentation = 0,//'ut16',
@@ -570,9 +547,6 @@ namespace MonoDevelop.MacInterop.AppleEvents
/// <summary>Null or nonexistent data</summary>
Null = 0,//'null'
- [Obsolete ("Not fully supported on 64-bit, use FSRef")]
- typeFSS = 0,//'fss ' /* FSSpec */
-
CFAttributedStringRef = 0,//'cfas',
CFMutableAttributedStringRef = 0,//'cfaa',
CFStringRef = 0,//'cfst',
diff --git a/main/src/addins/MacPlatform/MacInterop/Keychain.cs b/main/src/addins/MacPlatform/MacInterop/Keychain.cs
index 8f42a6024c..47ba3b4d49 100644
--- a/main/src/addins/MacPlatform/MacInterop/Keychain.cs
+++ b/main/src/addins/MacPlatform/MacInterop/Keychain.cs
@@ -510,18 +510,24 @@ namespace MonoDevelop.MacInterop
public static unsafe Tuple<string, string> FindInternetUserNameAndPassword (Uri uri)
{
+ var protocol = GetSecProtocolType (uri.Scheme);
+ return FindInternetUserNameAndPassword (uri, protocol);
+ }
+
+ public static unsafe Tuple<string, string> FindInternetUserNameAndPassword (Uri uri, SecProtocolType protocol)
+ {
var pathStr = string.Join (string.Empty, uri.Segments);
byte[] path = pathStr.Length > 0 ? Encoding.UTF8.GetBytes (pathStr.Substring (1)) : new byte[0]; // don't include the leading '/'
byte[] host = Encoding.UTF8.GetBytes (uri.Host);
var auth = GetSecAuthenticationType (uri.Query);
- var protocol = GetSecProtocolType (uri.Scheme);
- IntPtr passwordData = IntPtr.Zero;
+ IntPtr passwordData;
IntPtr item = IntPtr.Zero;
uint passwordLength = 0;
- var result = SecKeychainFindInternetPassword (CurrentKeychain, (uint) host.Length, host, 0, null,
- 0, null, (uint) path.Length, path, (ushort) uri.Port,
- protocol, auth, out passwordLength, out passwordData, ref item);
+ var result = SecKeychainFindInternetPassword (
+ CurrentKeychain, (uint) host.Length, host, 0, null,
+ 0, null, (uint) path.Length, path, (ushort) uri.Port,
+ protocol, auth, out passwordLength, out passwordData, ref item);
if (result != OSStatus.Ok)
return null;
@@ -631,7 +637,7 @@ namespace MonoDevelop.MacInterop
Any = 0
}
- enum SecProtocolType : int
+ public enum SecProtocolType : int
{
FTP = 1718906912,
FTPAccount = 1718906977,
diff --git a/main/src/addins/MacPlatform/MacMenu/MDMenu.cs b/main/src/addins/MacPlatform/MacMenu/MDMenu.cs
index c181434c06..6a10f51b51 100644
--- a/main/src/addins/MacPlatform/MacMenu/MDMenu.cs
+++ b/main/src/addins/MacPlatform/MacMenu/MDMenu.cs
@@ -38,7 +38,7 @@ namespace MonoDevelop.MacIntegration.MacMenu
{
static readonly string servicesID = (string) CommandManager.ToCommandId (MacIntegrationCommands.Services);
- public MDMenu (CommandManager manager, CommandEntrySet ces)
+ public MDMenu (CommandManager manager, CommandEntrySet ces, CommandSource commandSource, object initialCommandTarget)
{
this.WeakDelegate = this;
@@ -59,7 +59,7 @@ namespace MonoDevelop.MacIntegration.MacMenu
var subset = ce as CommandEntrySet;
if (subset != null) {
- AddItem (new MDSubMenuItem (manager, subset));
+ AddItem (new MDSubMenuItem (manager, subset, commandSource, initialCommandTarget));
continue;
}
@@ -86,7 +86,7 @@ namespace MonoDevelop.MacIntegration.MacMenu
continue;
}
- AddItem (new MDMenuItem (manager, ce, acmd));
+ AddItem (new MDMenuItem (manager, ce, acmd, commandSource, initialCommandTarget));
}
}
diff --git a/main/src/addins/MacPlatform/MacMenu/MDMenuItem.cs b/main/src/addins/MacPlatform/MacMenu/MDMenuItem.cs
index af2df66f57..94a8289bda 100644
--- a/main/src/addins/MacPlatform/MacMenu/MDMenuItem.cs
+++ b/main/src/addins/MacPlatform/MacMenu/MDMenuItem.cs
@@ -45,11 +45,15 @@ namespace MonoDevelop.MacIntegration.MacMenu
CommandManager manager;
bool isArrayItem;
+ object initialCommandTarget;
+ CommandSource commandSource;
- public MDMenuItem (CommandManager manager, CommandEntry ce, ActionCommand command)
+ public MDMenuItem (CommandManager manager, CommandEntry ce, ActionCommand command, CommandSource commandSource, object initialCommandTarget)
{
this.ce = ce;
this.manager = manager;
+ this.initialCommandTarget = initialCommandTarget;
+ this.commandSource = commandSource;
isArrayItem = command.CommandArray;
@@ -66,9 +70,9 @@ namespace MonoDevelop.MacIntegration.MacMenu
//if the command opens a modal subloop, give cocoa a chance to unhighlight the menu item
GLib.Timeout.Add (1, () => {
if (a != null) {
- manager.DispatchCommand (ce.CommandId, a.Info.DataItem, CommandSource.MainMenu);
+ manager.DispatchCommand (ce.CommandId, a.Info.DataItem, initialCommandTarget, commandSource);
} else {
- manager.DispatchCommand (ce.CommandId, CommandSource.MainMenu);
+ manager.DispatchCommand (ce.CommandId, null, initialCommandTarget, commandSource);
}
return false;
});
@@ -84,7 +88,7 @@ namespace MonoDevelop.MacIntegration.MacMenu
public void Update (MDMenu parent, ref NSMenuItem lastSeparator, ref int index)
{
- var info = manager.GetCommandInfo (ce.CommandId);
+ var info = manager.GetCommandInfo (ce.CommandId, new CommandTargetRoute (initialCommandTarget));
if (!isArrayItem) {
SetItemValues (this, info);
@@ -110,6 +114,9 @@ namespace MonoDevelop.MacIntegration.MacMenu
void PopulateArrayItems (CommandArrayInfo infos, NSMenu parent, ref NSMenuItem lastSeparator, ref int index)
{
+ if (infos == null)
+ return;
+
foreach (CommandInfo ci in infos) {
if (ci.IsArraySeparator) {
var n = NSMenuItem.SeparatorItem;
@@ -145,10 +152,10 @@ namespace MonoDevelop.MacIntegration.MacMenu
public CommandInfo Info;
}
- static void SetItemValues (NSMenuItem item, CommandInfo info)
+ void SetItemValues (NSMenuItem item, CommandInfo info)
{
item.SetTitleWithMnemonic (GetCleanCommandText (info));
- item.Enabled = !IsGloballyDisabled && info.Enabled;
+ item.Enabled = info.Enabled && (!IsGloballyDisabled || commandSource == CommandSource.ContextMenu);
item.Hidden = !info.Visible;
SetAccel (item, info.AccelKey);
diff --git a/main/src/addins/MacPlatform/MacMenu/MDSubMenuItem.cs b/main/src/addins/MacPlatform/MacMenu/MDSubMenuItem.cs
index 84de750319..547d788ec5 100644
--- a/main/src/addins/MacPlatform/MacMenu/MDSubMenuItem.cs
+++ b/main/src/addins/MacPlatform/MacMenu/MDSubMenuItem.cs
@@ -34,11 +34,11 @@ namespace MonoDevelop.MacIntegration.MacMenu
{
CommandEntrySet ces;
- public MDSubMenuItem (CommandManager manager, CommandEntrySet ces)
+ public MDSubMenuItem (CommandManager manager, CommandEntrySet ces, CommandSource commandSource = CommandSource.MainMenu, object initialCommandTarget = null)
{
this.ces = ces;
- this.Submenu = new MDMenu (manager, ces);
+ this.Submenu = new MDMenu (manager, ces, commandSource, initialCommandTarget);
this.Title = this.Submenu.Title;
}
diff --git a/main/src/addins/MacPlatform/MacPlatform.addin.xml b/main/src/addins/MacPlatform/MacPlatform.addin.xml
index 22df364b18..defb221c11 100644
--- a/main/src/addins/MacPlatform/MacPlatform.addin.xml
+++ b/main/src/addins/MacPlatform/MacPlatform.addin.xml
@@ -27,8 +27,12 @@
<Command id = "MonoDevelop.MacIntegration.MacIntegrationCommands.HideOthers"
defaultHandler = "MonoDevelop.MacIntegration.MacHideOthersHandler"
_label = "_Hide Others"
- _description = "Hide other windows"
+ _description = "Hide other applications' windows"
macShortcut = "Meta|Alt|H" />
+ <Command id = "MonoDevelop.MacIntegration.MacIntegrationCommands.ShowOthers"
+ defaultHandler = "MonoDevelop.MacIntegration.MacShowOthersHandler"
+ _label = "Show All"
+ _description = "Show all applications' windows" />
</Condition>
</Extension>
@@ -50,6 +54,7 @@
<SeparatorItem id = "HideSeparator" insertbefore="QuitSeparator" />
<CommandItem id = "MonoDevelop.MacIntegration.MacIntegrationCommands.HideWindow" />
<CommandItem id = "MonoDevelop.MacIntegration.MacIntegrationCommands.HideOthers" />
+ <CommandItem id = "MonoDevelop.MacIntegration.MacIntegrationCommands.ShowOthers" />
</Condition>
</Extension>
diff --git a/main/src/addins/MacPlatform/MacPlatform.cs b/main/src/addins/MacPlatform/MacPlatform.cs
index 29562d662c..8800f13819 100644
--- a/main/src/addins/MacPlatform/MacPlatform.cs
+++ b/main/src/addins/MacPlatform/MacPlatform.cs
@@ -202,6 +202,31 @@ namespace MonoDevelop.MacIntegration
mimeTimer.EndTiming ();
return map;
}
+
+ public override bool ShowContextMenu (CommandManager commandManager, Gtk.Widget widget, double x, double y, CommandEntrySet entrySet, object initialCommandTarget = null)
+ {
+ Gtk.Application.Invoke (delegate {
+ // Explicitly release the grab because the menu is shown on the mouse position, and the widget doesn't get the mouse release event
+ Gdk.Pointer.Ungrab (Gtk.Global.CurrentEventTime);
+ var menu = new MDMenu (commandManager, entrySet, CommandSource.ContextMenu, initialCommandTarget);
+ var nsview = MacInterop.GtkQuartz.GetView (widget);
+ var toplevel = widget.Toplevel as Gtk.Window;
+ int trans_x, trans_y;
+ widget.TranslateCoordinates (toplevel, (int)x, (int)y, out trans_x, out trans_y);
+
+ var pt = nsview.ConvertPointFromBase (new PointF ((float)trans_x, (float)trans_y));
+
+ var tmp_event = NSEvent.MouseEvent (NSEventType.LeftMouseDown,
+ pt,
+ 0, 0,
+ MacInterop.GtkQuartz.GetWindow (toplevel).WindowNumber,
+ null, 0, 0, 0);
+
+ NSMenu.PopUpContextMenu (menu, tmp_event, nsview);
+ });
+
+ return true;
+ }
public override bool SetGlobalMenu (CommandManager commandManager, string commandMenuAddinPath, string appMenuAddinPath)
{
@@ -320,12 +345,13 @@ namespace MonoDevelop.MacIntegration
e.Handled = true;
}
};
-
+
ApplicationEvents.OpenDocuments += delegate (object sender, ApplicationDocumentEventArgs e) {
//OpenFiles may pump the mainloop, but can't do that from an AppleEvent, so use a brief timeout
GLib.Timeout.Add (10, delegate {
- IdeApp.OpenFiles (e.Documents.Select (doc =>
- new FileOpenInformation (doc.Key, doc.Value, 1, OpenDocumentOptions.Default)));
+ IdeApp.OpenFiles (e.Documents.Select (
+ doc => new FileOpenInformation (doc.Key, doc.Value, 1, OpenDocumentOptions.DefaultInternal))
+ );
return false;
});
e.Handled = true;
@@ -351,7 +377,7 @@ namespace MonoDevelop.MacIntegration
column = 1;
return new FileOpenInformation (fileUri.AbsolutePath,
- line, column, OpenDocumentOptions.Default);
+ line, column, OpenDocumentOptions.DefaultInternal);
} catch (Exception ex) {
LoggingService.LogError ("Invalid TextMate URI: " + url, ex);
return null;
diff --git a/main/src/addins/MacPlatform/MacProxyCredentialProvider.cs b/main/src/addins/MacPlatform/MacProxyCredentialProvider.cs
index 1cfe1482f1..1413de25e6 100644
--- a/main/src/addins/MacPlatform/MacProxyCredentialProvider.cs
+++ b/main/src/addins/MacPlatform/MacProxyCredentialProvider.cs
@@ -25,6 +25,7 @@
// THE SOFTWARE.
using System;
using System.Drawing;
+using System.Net;
using MonoDevelop.Core;
using MonoDevelop.Core.Web;
@@ -32,29 +33,97 @@ using MonoDevelop.Ide;
using MonoMac.AppKit;
using MonoMac.Foundation;
-using MonoDevelop.Components.MainToolbar;
-using System.Net;
+using MonoDevelop.MacInterop;
namespace MonoDevelop.MacIntegration
{
- public class MacProxyCredentialProvider : ICredentialProvider
+ class MacProxyCredentialProvider : ICredentialProvider
{
- string username, password;
+ object guiLock = new object();
+
+ public ICredentials GetCredentials (Uri uri, IWebProxy proxy, CredentialType credentialType, bool retrying)
+ {
+ // if looking for proxy credentials, we care about the proxy's URL, not the request URL
+ if (credentialType == CredentialType.ProxyCredentials) {
+ var proxyUri = proxy.GetProxy (uri);
+ if (proxyUri != null)
+ uri = proxyUri;
+ }
+
+ lock (guiLock) {
+ // If this is the first attempt, return any stored credentials. If they fail, we'll be called again.
+ if (!retrying) {
+ var creds = GetExistingCredentials (uri, credentialType);
+ if (creds != null)
+ return creds;
+ }
+
+ return GetCredentialsFromUser (uri, proxy, credentialType);
+ }
+ }
+
+ static ICredentials GetSystemProxyCredentials (Uri uri)
+ {
+ var kind = SecProtocolType.Any;
+ if (uri.Scheme == "http")
+ kind = SecProtocolType.HTTPProxy;
+ else if (uri.Scheme == "https")
+ kind = SecProtocolType.HTTPSProxy;
+
+ //TODO: get username from SystemConfiguration APIs so we don't trigger a double auth prompt
+ var existing = Keychain.FindInternetUserNameAndPassword (uri, kind);
+ if (existing != null && existing.Item1 != null && existing.Item2 != null)
+ return new NetworkCredential (existing.Item1, existing.Item2);
+
+ return null;
+ }
+
+ static ICredentials GetExistingCredentials (Uri uri, CredentialType credentialType)
+ {
+ if (credentialType == CredentialType.ProxyCredentials) {
+ var proxyCreds = GetSystemProxyCredentials (uri);
+ if (proxyCreds != null)
+ return proxyCreds;
+ }
+
+ var rootUri = new Uri (uri.GetComponents (UriComponents.SchemeAndServer, UriFormat.SafeUnescaped));
+ var existing =
+ Keychain.FindInternetUserNameAndPassword (uri) ??
+ Keychain.FindInternetUserNameAndPassword (rootUri);
+
+ return existing != null ? new NetworkCredential (existing.Item1, existing.Item2) : null;
+ }
- public ICredentials GetCredentials (Uri uri, IWebProxy proxy, CredentialType credentialType, ICredentials existingCredentials, bool retrying)
+ static ICredentials GetCredentialsFromUser (Uri uri, IWebProxy proxy, CredentialType credentialType)
{
- bool result = false;
+ NetworkCredential result = null;
+
DispatchService.GuiSyncDispatch (() => {
+
using (var ns = new NSAutoreleasePool ()) {
- var message = string.Format ("{0} needs {1} credentials to access {2}.", BrandingService.ApplicationName,
- credentialType == CredentialType.ProxyCredentials ? "proxy" : "request", uri.Host);
+ var message = credentialType == CredentialType.ProxyCredentials
+ ? GettextCatalog.GetString (
+ "{0} needs credentials to access the proxy server {1}.",
+ BrandingService.ApplicationName,
+ uri.Host
+ )
+ : GettextCatalog.GetString (
+ "{0} needs credentials to access {1}.",
+ BrandingService.ApplicationName,
+ uri.Host
+ );
- NSAlert alert = NSAlert.WithMessage ("Credentials Required", "OK", "Cancel", null, message);
- alert.Icon = NSApplication.SharedApplication.ApplicationIconImage;
+ var alert = NSAlert.WithMessage (
+ GettextCatalog.GetString ("Credentials Required"),
+ GettextCatalog.GetString ("OK"),
+ GettextCatalog.GetString ("Cancel"),
+ null,
+ message
+ );
- NSView view = new NSView (new RectangleF (0, 0, 313, 91));
+ alert.Icon = NSApplication.SharedApplication.ApplicationIconImage;
- var creds = Utility.GetCredentialsForUriFromICredentials (uri, existingCredentials);
+ var view = new NSView (new RectangleF (0, 0, 313, 91));
var usernameLabel = new NSTextField (new RectangleF (17, 55, 71, 17)) {
Identifier = "usernameLabel",
@@ -69,7 +138,6 @@ namespace MonoDevelop.MacIntegration
view.AddSubview (usernameLabel);
var usernameInput = new NSTextField (new RectangleF (93, 52, 200, 22));
- usernameInput.StringValue = creds != null ? creds.UserName : string.Empty;
view.AddSubview (usernameInput);
var passwordLabel = new NSTextField (new RectangleF (22, 23, 66, 17)) {
@@ -84,18 +152,25 @@ namespace MonoDevelop.MacIntegration
view.AddSubview (passwordLabel);
var passwordInput = new NSSecureTextField (new RectangleF (93, 20, 200, 22));
- passwordInput.StringValue = creds != null ? creds.Password : string.Empty;
view.AddSubview (passwordInput);
alert.AccessoryView = view;
- result = alert.RunModal () == 1;
- username = usernameInput.StringValue;
- password = passwordInput.StringValue;
+ if (alert.RunModal () != 1)
+ return;
+
+ var username = usernameInput.StringValue;
+ var password = passwordInput.StringValue;
+ result = new NetworkCredential (username, password);
}
});
- return result ? new NetworkCredential (username, password) : null;
+ // store the obtained credentials in the keychain
+ // but don't store for the root url since it may have other credentials
+ if (result != null)
+ Keychain.AddInternetPassword (uri, result.UserName, result.Password);
+
+ return result;
}
}
}
diff --git a/main/src/addins/Makefile.am b/main/src/addins/Makefile.am
index d1f80d1549..23aa5dfd52 100644
--- a/main/src/addins/Makefile.am
+++ b/main/src/addins/Makefile.am
@@ -5,6 +5,7 @@ SUBDIRS = \
GnomePlatform \
MonoDevelop.DesignerSupport \
MonoDevelop.Debugger \
+ MonoDevelop.Debugger.Gdb \
Deployment \
MonoDevelop.SourceEditor2 \
MonoDevelop.Refactoring \
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserViewContent.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserViewContent.cs
index d9c73ce43c..258d72c063 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserViewContent.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserViewContent.cs
@@ -35,6 +35,7 @@ using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Ide.Navigation;
using MonoDevelop.Projects;
using System.Linq;
+using MonoDevelop.Ide;
namespace MonoDevelop.AssemblyBrowser
{
@@ -123,8 +124,13 @@ namespace MonoDevelop.AssemblyBrowser
}
if (member == null)
return;
- var url = AssemblyBrowserWidget.GetIdString (member);
- widget.Open (url);
+ var url = AssemblyBrowserWidget.GetIdString (member);
+ try {
+ widget.Open (url);
+ } catch (Exception e) {
+ LoggingService.LogError ("Error while navigating to " + url, e);
+ MessageService.ShowException (e, GettextCatalog.GetString ("{0} could not be opened", url), GettextCatalog.GetString ("Error while opening assembly"));
+ }
}
#endregion
@@ -172,7 +178,7 @@ namespace MonoDevelop.AssemblyBrowser
class AssemblyBrowserNavigationPoint : NavigationPoint
{
- Document DoShow ()
+ static Document DoShow ()
{
foreach (var view in Ide.IdeApp.Workbench.Documents) {
if (view.GetContent<AssemblyBrowserViewContent> () != null) {
@@ -190,11 +196,6 @@ namespace MonoDevelop.AssemblyBrowser
#region implemented abstract members of NavigationPoint
- public override void Show ()
- {
- DoShow ();
- }
-
public override Document ShowDocument ()
{
return DoShow ();
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs
index 7ea4ddf97c..398525ffa5 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs
@@ -192,7 +192,7 @@ namespace MonoDevelop.AssemblyBrowser
new AssemblyNodeBuilder (this),
new ModuleReferenceNodeBuilder (),
new AssemblyReferenceNodeBuilder (this),
- new AssemblyReferenceFolderNodeBuilder (this),
+ //new AssemblyReferenceFolderNodeBuilder (this),
new AssemblyResourceFolderNodeBuilder (),
new ResourceNodeBuilder (),
new NamespaceBuilder (this),
@@ -305,7 +305,7 @@ namespace MonoDevelop.AssemblyBrowser
var menuSet = new CommandEntrySet ();
menuSet.AddItem (EditCommands.SelectAll);
menuSet.AddItem (EditCommands.Copy);
- IdeApp.CommandService.ShowContextMenu (menuSet, this);
+ IdeApp.CommandService.ShowContextMenu (this, args.Event, menuSet, this);
}
void SearchTreeviewhandleRowActivated (object o, RowActivatedArgs args)
@@ -356,8 +356,10 @@ namespace MonoDevelop.AssemblyBrowser
if (nav != null)
return nav;
// Constructor may be a generated default without implementation.
- if (helpUrl.StartsWith ("M:", StringComparison.Ordinal) && helpUrl.EndsWith (".#ctor", StringComparison.Ordinal))
- return SearchMember ("T" + helpUrl.Substring (1, helpUrl.Length - 1 - ".#ctor".Length));
+ var ctorIdx = helpUrl.IndexOf (".#ctor", StringComparison.Ordinal);
+ if (helpUrl.StartsWith ("M:", StringComparison.Ordinal) && ctorIdx > 0) {
+ return SearchMember ("T" + helpUrl.Substring (1, ctorIdx - 1));
+ }
return null;
}
@@ -1411,7 +1413,11 @@ namespace MonoDevelop.AssemblyBrowser
// Select the result.
if (selectReference) {
ITreeNavigator navigator = TreeView.GetNodeAtObject (result);
- navigator.Selected = true;
+ if (navigator != null) {
+ navigator.Selected = true;
+ } else {
+ LoggingService.LogWarning (result + " could not be found.");
+ }
}
return result;
diff --git a/main/src/addins/MonoDevelop.Autotools/AddinInfo.cs b/main/src/addins/MonoDevelop.Autotools/AddinInfo.cs
index b9c07978a1..88ae07efa4 100644
--- a/main/src/addins/MonoDevelop.Autotools/AddinInfo.cs
+++ b/main/src/addins/MonoDevelop.Autotools/AddinInfo.cs
@@ -6,6 +6,7 @@ using Mono.Addins.Description;
[assembly:Addin ("Autotools",
Namespace = "MonoDevelop",
Version = MonoDevelop.BuildInfo.Version,
+ EnabledByDefault = false,
Category = "Project Import and Export")]
[assembly:AddinName ("Makefile generation")]
diff --git a/main/src/addins/MonoDevelop.Autotools/MakefileData.cs b/main/src/addins/MonoDevelop.Autotools/MakefileData.cs
index b6782eb81a..8101bcfe67 100644
--- a/main/src/addins/MonoDevelop.Autotools/MakefileData.cs
+++ b/main/src/addins/MonoDevelop.Autotools/MakefileData.cs
@@ -1686,22 +1686,6 @@ namespace MonoDevelop.Autotools
lastWriteTime = finfo.LastWriteTime;
ReadPackagesList ();
}
-
- //Gets the pkg-config name from the makefile (or autoconf?) var name
- // TODO: Remove me, if unused.
- [Obsolete("Use 'GetPackageContentFromVarName' instead.")]
- public List<string> GetNamesFromVarName (string varname)
- {
- if (!pkgVarNameToPkgName.ContainsKey (varname)) {
- LoggingService.LogDebug ("pkg-config variable {0} not found in pkgVarNameToPkgName.", varname);
- return null;
- }
- List<string> result = new List<string> ();
- foreach (PackageContent content in pkgVarNameToPkgName [varname]) {
- result.Add (content.Name);
- }
- return result;
- }
//Gets the pkg-config PackageContent from the makefile (or autoconf?) var name
public List<PackageContent> GetPackageContentFromVarName (string varname)
diff --git a/main/src/addins/MonoDevelop.Autotools/MakefileProject.cs b/main/src/addins/MonoDevelop.Autotools/MakefileProject.cs
index 54e81e2bf3..91dd984bd9 100644
--- a/main/src/addins/MonoDevelop.Autotools/MakefileProject.cs
+++ b/main/src/addins/MonoDevelop.Autotools/MakefileProject.cs
@@ -1,6 +1,7 @@
using System;
using MonoDevelop.Projects;
+using System.Collections.Generic;
namespace MonoDevelop.Autotools
{
@@ -17,11 +18,10 @@ namespace MonoDevelop.Autotools
return conf;
}
- public override string ProjectType {
- get { return "MakefileProject"; }
+ public override IEnumerable<string> GetProjectTypes ()
+ {
+ yield return "MakefileProject";
}
-
-
}
public class MakefileProjectConfiguration: ProjectConfiguration
diff --git a/main/src/addins/MonoDevelop.Autotools/MakefileProjectServiceExtension.cs b/main/src/addins/MonoDevelop.Autotools/MakefileProjectServiceExtension.cs
index 8bbfc36f51..5c71be9a49 100644
--- a/main/src/addins/MonoDevelop.Autotools/MakefileProjectServiceExtension.cs
+++ b/main/src/addins/MonoDevelop.Autotools/MakefileProjectServiceExtension.cs
@@ -163,24 +163,28 @@ namespace MonoDevelop.Autotools
string baseDir = project.BaseDirectory;
string args = string.Format ("-j {0} {1}", data.ParallelProcesses, data.BuildTargetName);
- StringWriter swOutput = new StringWriter ();
- LogTextWriter chainedOutput = new LogTextWriter ();
- chainedOutput.ChainWriter (monitor.Log);
- chainedOutput.ChainWriter (swOutput);
-
- ProcessWrapper process = Runtime.ProcessService.StartProcess ("make",
- args,
- baseDir,
- chainedOutput,
- chainedOutput,
- null);
- process.WaitForOutput ();
-
- exitCode = process.ExitCode;
- output = swOutput.ToString ();
- chainedOutput.Close ();
- swOutput.Close ();
- monitor.Step ( 1 );
+ using (var swOutput = new StringWriter ()) {
+ using (var chainedOutput = new LogTextWriter ()) {
+ chainedOutput.ChainWriter (monitor.Log);
+ chainedOutput.ChainWriter (swOutput);
+
+ using (ProcessWrapper process = Runtime.ProcessService.StartProcess ("make",
+ args,
+ baseDir,
+ chainedOutput,
+ chainedOutput,
+ null)) {
+ process.WaitForOutput ();
+
+ chainedOutput.UnchainWriter (monitor.Log);
+ chainedOutput.UnchainWriter (swOutput);
+
+ exitCode = process.ExitCode;
+ output = swOutput.ToString ();
+ monitor.Step ( 1 );
+ }
+ }
+ }
}
catch ( Exception e )
{
diff --git a/main/src/addins/MonoDevelop.Autotools/SolutionDeployer.cs b/main/src/addins/MonoDevelop.Autotools/SolutionDeployer.cs
index 9d95424cdd..3bb43a271b 100644
--- a/main/src/addins/MonoDevelop.Autotools/SolutionDeployer.cs
+++ b/main/src/addins/MonoDevelop.Autotools/SolutionDeployer.cs
@@ -178,33 +178,39 @@ namespace MonoDevelop.Autotools
monitor.Step ( 1 );
- StringWriter sw = new StringWriter ();
- LogTextWriter chainedOutput = new LogTextWriter ();
- chainedOutput.ChainWriter (monitor.Log);
- chainedOutput.ChainWriter (sw);
-
- ProcessWrapper process = Runtime.ProcessService.StartProcess ( "make",
- "dist",
- baseDir,
- chainedOutput,
- monitor.Log,
- null );
- process.WaitForOutput ();
-
- if ( process.ExitCode > 0 )
- throw new Exception ( GettextCatalog.GetString ("An unspecified error occurred while running '{0}'", "make dist") );
-
- monitor.Step ( 1 );
-
- // FIXME: hackish way to get the created tarball's filename
- string output = sw.ToString();
- int targz = output.LastIndexOf ( "tar.gz" );
- int begin = output.LastIndexOf ( '>', targz );
-
- string filename = output.Substring ( begin + 1, (targz - begin) + 5 ).Trim ();
-
- FileService.CopyFile (Path.Combine (baseDir, filename), Path.Combine (targetDir, filename));
- monitor.Step ( 1 );
+ using (var sw = new StringWriter ()) {
+ using (var chainedOutput = new LogTextWriter ()) {
+ chainedOutput.ChainWriter (monitor.Log);
+ chainedOutput.ChainWriter (sw);
+
+ using (ProcessWrapper process = Runtime.ProcessService.StartProcess ("make",
+ "dist",
+ baseDir,
+ chainedOutput,
+ monitor.Log,
+ null)) {
+ process.WaitForOutput ();
+
+ chainedOutput.UnchainWriter (monitor.Log);
+ chainedOutput.UnchainWriter (sw);
+
+ if ( process.ExitCode > 0 )
+ throw new Exception ( GettextCatalog.GetString ("An unspecified error occurred while running '{0}'", "make dist") );
+ }
+
+ monitor.Step ( 1 );
+
+ // FIXME: hackish way to get the created tarball's filename
+ string output = sw.ToString();
+ int targz = output.LastIndexOf ( "tar.gz" );
+ int begin = output.LastIndexOf ( '>', targz );
+
+ string filename = output.Substring ( begin + 1, (targz - begin) + 5 ).Trim ();
+
+ FileService.CopyFile (Path.Combine (baseDir, filename), Path.Combine (targetDir, filename));
+ monitor.Step ( 1 );
+ }
+ }
}
catch ( Exception e )
{
diff --git a/main/src/addins/MonoDevelop.Debugger.Gdb/AddinInfo.cs b/main/src/addins/MonoDevelop.Debugger.Gdb/AddinInfo.cs
new file mode 100644
index 0000000000..3cd8505305
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger.Gdb/AddinInfo.cs
@@ -0,0 +1,16 @@
+
+using System;
+using Mono.Addins;
+using Mono.Addins.Description;
+
+[assembly:Addin ("Debugger.Gdb",
+ Namespace = "MonoDevelop",
+ Version = MonoDevelop.BuildInfo.Version,
+ Category = "Debugging")]
+
+[assembly:AddinName ("GDB Debugger Support")]
+[assembly:AddinDescription ("Support for debugging native applications using the GDB debugger")]
+
+[assembly:AddinDependency ("Core", MonoDevelop.BuildInfo.Version)]
+[assembly:AddinDependency ("Ide", MonoDevelop.BuildInfo.Version)]
+[assembly:AddinDependency ("Debugger", MonoDevelop.BuildInfo.Version)]
diff --git a/main/src/addins/MonoDevelop.Debugger.Gdb/AssemblyInfo.cs b/main/src/addins/MonoDevelop.Debugger.Gdb/AssemblyInfo.cs
new file mode 100644
index 0000000000..ad3b28e1a8
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger.Gdb/AssemblyInfo.cs
@@ -0,0 +1,9 @@
+// Autogenerated from Manifest.addin.xml
+
+using System.Reflection;
+
+[assembly: AssemblyProduct ("MonoDevelop")]
+[assembly: AssemblyTitle ("GDB support for Mono.Debugging")]
+[assembly: AssemblyDescription ("GNU Debugger support for Mono.Debugging")]
+[assembly: AssemblyVersion ("2.6")]
+[assembly: AssemblyCopyright ("MIT X11")]
diff --git a/main/src/addins/MonoDevelop.Debugger.Gdb/ChangeLog b/main/src/addins/MonoDevelop.Debugger.Gdb/ChangeLog
new file mode 100644
index 0000000000..ce5286dfe1
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger.Gdb/ChangeLog
@@ -0,0 +1,365 @@
+2010-06-14 Lluis Sanchez Gual <lluis@novell.com>
+
+ * configure: Bump MD version.
+
+2010-05-20 Lluis Sanchez Gual <lluis@novell.com>
+
+ * configure: Bump MD version.
+
+2010-05-20 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbBacktrace.cs: Track api changes.
+
+2010-05-07 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbBacktrace.cs: Track api changes.
+
+2010-05-03 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbSession.cs: Increased console creation timeout.
+
+2010-04-28 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbSession.cs: Track api changes.
+
+2010-04-19 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbBacktrace.cs: Track api changes.
+
+ * MonoDevelop.Debugger.csproj: Flush.
+
+2010-03-22 Lluis Sanchez Gual <lluis@novell.com>
+
+ * configure:
+ * AssemblyInfo.cs:
+ * Manifest.addin.xml: Bumped MD version.
+
+2010-03-17 Lluis Sanchez Gual <lluis@novell.com>
+
+ * MonoDevelop.Debugger.csproj: Flush.
+
+2010-03-17 Lluis Sanchez Gual <lluis@novell.com>
+
+ * MonoDevelop.Debugger.csproj: Merged MD.Projects into
+ MD.Core, and MD.Projects.Gui, MD.Core.Gui and MD.Components
+ into MD.Ide.
+
+2010-03-15 David Makovský <yakeen@sannyas-on.net>
+
+ * GdbBacktrace.cs: fixes for C++ structures (thx Martin Vejnár
+ <avakar@ratatanek.cz>)
+
+2010-03-08 Jonathan Pryor <jpryor@novell.com>
+
+ * configure: Create a $(CSC) make variable.
+ * MonoDevelop.Debugger.Gdb.make: Set $(ASSEMBLY_COMPILER_COMMAND) to
+ $(CSC). This allows a top-level CSC override to be used within this
+ module (e.g. top-level `make CSC=dmcs` for a v4 build).
+
+2010-03-03 Michael Hutchinson <mhutchinson@novell.com>
+
+ * GdbSession.cs: Name the reader thread.
+
+2010-03-01 Lluis Sanchez Gual <lluis@novell.com>
+
+ * MonoDevelop.Debugger.Gdb.sln: The invariant policy can't be
+ used anymore as base policy set.
+
+2010-02-22 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbBacktrace.cs: Track api changes.
+
+2010-02-20 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbBacktrace.cs: Add missing method.
+
+2010-02-19 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbBacktrace.cs: Track api changes.
+
+2010-02-16 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Manifest.addin.xml:
+ * GdbSessionFactory.cs: Track api changes. Some engine info is
+ now taken from extension node metadata.
+
+ * MonoDevelop.Debugger.csproj:
+ * MonoDevelop.Debugger.Gdb.sln: Flush.
+
+ * GdbSession.cs: Expressions are now printed by the debugging
+ service.
+
+2009-12-11 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbBacktrace.cs: Track api changes.
+
+2009-11-20 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbSessionFactory.cs: Implement Id property.
+
+2009-11-18 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbBacktrace.cs: Track api changes.
+
+2009-11-12 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbEvent.cs: Reason can be an array. Handle this case.
+
+ * MonoDevelop.Debugger.csproj: Flush.
+
+ * GdbSession.cs: If there is an error while initializing,
+ report that the process has exited.
+
+2009-10-30 Lluis Sanchez Gual <lluis@novell.com>
+
+ * configure:
+ * AssemblyInfo.cs:
+ * Manifest.addin.xml: Bump MD version.
+
+2009-10-18 Michael Hutchinson <mhutchinson@novell.com>
+
+ * GdbSession.cs: Fix Pocess/Process spelling.
+
+2009-10-16 Michael Hutchinson <mhutchinson@novell.com>
+
+ * GdbSessionFactory.cs: Fix spelling of GetAttachableProcesses
+ API.
+
+2009-10-07 Lluis Sanchez Gual <lluis@novell.com>
+
+ * configure:
+ * AssemblyInfo.cs:
+ * Manifest.addin.xml: Bump MD version.
+
+2009-10-05 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbSession.cs:
+ * GdbBacktrace.cs: Use long for thread and process id.
+
+2009-10-01 Lluis Sanchez Gual <lluis@novell.com>
+
+ * MonoDevelop.Debugger.Gdb.sln:
+
+ * GdbSession.cs: Don't crash if a breakpoint can't be set.
+
+2009-08-20 Lluis Sanchez Gual <lluis@novell.com>
+
+ * MonoDevelop.Debugger.csproj:
+ * MonoDevelop.Debugger.Gdb.sln: Updated.
+
+ * GdbSession.cs: Quote file names when needed.
+
+2009-05-19 Lluis Sanchez Gual <lluis@novell.com>
+
+ * MonoDevelop.Debugger.csproj: Flush.
+
+2009-04-27 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbSessionFactory.cs:
+ * MonoDevelop.Debugger.csproj:
+ * MonoDevelop.Debugger.Gdb.make: Track api changes.
+
+2009-04-15 Lluis Sanchez Gual <lluis@novell.com>
+
+ * configure:
+ * AssemblyInfo.cs:
+ * Manifest.addin.xml: Bump MD version.
+
+2009-03-04 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbSessionFactory.cs: Removed unused CanDebugPlatform and
+ rename CanDebugFile to CanDebugCommand.
+
+2009-03-04 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbSessionFactory.cs: Changed the way execution handlers
+ work. We are not using platform ids anymore. Instead, we use
+ command strings when looking for execution handlers.
+ IExecutionHandlerFactory has been removed and now everything
+ is handled by IExecutionHandler, which has a new CanExecute
+ method. This model is more simple and more generic.
+
+2009-02-26 Lluis Sanchez Gual <lluis@novell.com>
+
+ * MonoDevelop.Debugger.Gdb.sln: Flush.
+
+2009-02-25 Michael Hutchinson <mhutchinson@novell.com>
+
+ * MonoDevelop.Debugger.Gdb.sln: Set policies. Remove unused
+ name attribute.
+
+2009-02-20 Lluis Sanchez Gual <lluis@novell.com>
+
+ * MonoDevelop.Debugger.csproj: Updated references.
+
+2009/02/06 Lluis Sanchez Gual <lluis@novell.com>
+
+ * MonoDevelop.Debugger.mdp:
+ * MonoDevelop.Debugger.mds:
+ * MonoDevelop.Debugger.csproj:
+ * MonoDevelop.Debugger.Gdb.mds:
+ * MonoDevelop.Debugger.Gdb.sln: Migrated to MSBuild file format.
+
+2009/02/03 Lluis Sanchez Gual <lluis@novell.com>
+
+ * configure:
+ * AssemblyInfo.cs:
+ * Manifest.addin.xml: Bump MD version.
+
+2009-01-26 Michael Hutchinson <mhutchinson@novell.com>
+
+ * MonoDevelop.Debugger.mdp: Flush project format changes.
+
+2008-12-19 Lluis Sanchez Gual <lluis@novell.com>
+
+ * MonoDevelop.Debugger.mdp: Updated.
+
+ * GdbBacktrace.cs: Track api changes.
+
+2008-12-09 Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com>
+
+ * GdbSession.cs: Fallback to relative source file path.
+
+2008-12-04 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Manifest.addin.xml: Set correct add-in category.
+
+ * GdbSession.cs:
+ * GdbSessionFactory.cs:
+ * MonoDevelop.Debugger.mdp: Track api changes.
+
+2008-12-02 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Manifest.addin.xml: Change addin version number to match
+ configure/tarball version number.
+
+2008-12-02 Michael Hutchinson <mhutchinson@novell.com>
+
+ * AssemblyInfo.cs: Add AssemblyInfo.cs files that are autogenerated from
+ the addin manifests.
+
+2008-12-02 Lluis Sanchez Gual <lluis@novell.com>
+
+ * MonoDevelop.Debugger.mdp:
+ * MonoDevelop.Debugger.Gdb.make: Remove .pc file. It's not required.
+
+2008-11-25 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Manifest.addin.xml: Track api changes.
+
+2008-11-05 Lluis Sanchez Gual <lluis@novell.com>
+
+ * configure:
+ * Manifest.addin.xml: Bump MD version.
+
+2008-10-16 Michael Hutchinson <mhutchinson@novell.com>
+
+ * configure: Fix tarball name.
+
+2008-09-26 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbBacktrace.cs, GdbSession.cs: When debugging a mono process, try to
+ get managed method names for unknown stack frames.
+
+2008-09-17 Lluis Sanchez Gual <lluis@novell.com>
+
+ * MonoDevelop.Debugger.mdp: Updated projects.
+
+2008-09-03 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbSession.cs: Track api changes.
+
+2008-08-22 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Manifest.addin.xml, MonoDevelop.Debugger.mdp: Extension point
+ location has changed.
+
+2008-08-18 Lluis Sanchez Gual <lluis@novell.com>
+
+ * MonoDevelop.Debugger.mdp: Fix reference to Mono.TextEditor. The
+ incorrect add-in version number causes problems in the makefile
+ synchronization.
+
+2008-08-07 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbSession.cs: Implemented support for conditions, trace expressions
+ and hit counts.
+
+2008-08-05 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbSession.cs: Track api changes.
+
+2008-07-25 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbBacktrace.cs: Implement GetAllLocals.
+
+2008-07-16 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbSession.cs: Track api changes.
+
+2008-07-11 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbSessionFactory.cs: Fix construction process command line string.
+ * GdbSession.cs: Track api changes.
+
+2008-07-09 Lluis Sanchez Gual <lluis@novell.com>
+
+ * MonoDevelop.Debugger.Gdb.make: Install the assemblies to the correct
+ directory.
+
+2008-07-09 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbSession.cs: Track api changes.
+
+2008-07-09 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbBacktrace.cs: Added support for code completion.
+
+2008-07-09 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbBacktrace.cs: Track api changes.
+ * GdbSession.cs: Clean temporary variables.
+
+2008-07-07 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbBacktrace.cs: Track api changes.
+
+2008-07-02 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbBacktrace.cs: Support modifying variable values.
+ * GdbSession.cs: Implemented support for disassembling files.
+
+2008-07-01 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbSession.cs: Track api changes.
+
+2008-06-26 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbBacktrace.cs, GdbSession.cs: Allow setting the active thread.
+ Implemented GetThreads and GetProcesses.
+ * ResultData.cs: Handle weird case where a tuple can have several
+ values for a property.
+
+2008-06-20 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbSession.cs: Implemented detach.
+
+2008-06-20 Lluis Sanchez Gual <lluis@novell.com>
+
+ * GdbSessionFactory.cs, GdbBacktrace.cs, GdbSession.cs, ResultData.cs:
+ Implemented process attaching, variable query, disassemble.
+
+2008-06-17 Lluis Sanchez Gual <lluis@novell.com>
+
+ * MonoDevelop.Debugger.Gdb.make, configure, MonoDevelop.Debugger.mdp,
+ MonoDevelop.Debugger.mds, Makefile.include, rules.make,
+ monodevelop.debugger.gdb.pc.in, Makefile: Added missing build
+ files.
+
+2008-06-17 Lluis Sanchez Gual <lluis@novell.com>
+
+ * AssemblyInfo.cs, GdbBacktrace.cs, GdbEvent.cs, GdbSession.cs,
+ CommandStatus.cs, GdbSessionFactory.cs, ResultData.cs,
+ GdbCommandResult.cs, Manifest.addin.xml: Initial support for gdb
+ integration.
+
diff --git a/main/src/addins/MonoDevelop.Debugger.Gdb/CommandStatus.cs b/main/src/addins/MonoDevelop.Debugger.Gdb/CommandStatus.cs
new file mode 100644
index 0000000000..683c304cbe
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger.Gdb/CommandStatus.cs
@@ -0,0 +1,38 @@
+// CommandStatus.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+using System;
+
+namespace MonoDevelop.Debugger.Gdb
+{
+ enum CommandStatus
+ {
+ Done,
+ Running,
+ Error
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger.Gdb/GdbBacktrace.cs b/main/src/addins/MonoDevelop.Debugger.Gdb/GdbBacktrace.cs
new file mode 100644
index 0000000000..7aec2df3d0
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger.Gdb/GdbBacktrace.cs
@@ -0,0 +1,400 @@
+// GdbBacktrace.cs
+//
+// Authors: Lluis Sanchez Gual <lluis@novell.com>
+// Jeffrey Stedfast <jeff@xamarin.com>
+//
+// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
+// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using Mono.Debugging.Client;
+using Mono.Debugging.Backend;
+
+namespace MonoDevelop.Debugger.Gdb
+{
+ class GdbBacktrace: IBacktrace, IObjectValueSource
+ {
+ int fcount;
+ StackFrame firstFrame;
+ GdbSession session;
+ DissassemblyBuffer[] disBuffers;
+ int currentFrame = -1;
+ long threadId;
+
+ public GdbBacktrace (GdbSession session, long threadId, int count, ResultData firstFrame)
+ {
+ fcount = count;
+ this.threadId = threadId;
+ if (firstFrame != null)
+ this.firstFrame = CreateFrame (firstFrame);
+ this.session = session;
+ }
+
+ public int FrameCount {
+ get {
+ return fcount;
+ }
+ }
+
+ public StackFrame[] GetStackFrames (int firstIndex, int lastIndex)
+ {
+ List<StackFrame> frames = new List<StackFrame> ();
+ if (firstIndex == 0 && firstFrame != null) {
+ frames.Add (firstFrame);
+ firstIndex++;
+ }
+
+ if (lastIndex >= fcount)
+ lastIndex = fcount - 1;
+
+ if (firstIndex > lastIndex)
+ return frames.ToArray ();
+
+ session.SelectThread (threadId);
+ GdbCommandResult res = session.RunCommand ("-stack-list-frames", firstIndex.ToString (), lastIndex.ToString ());
+ ResultData stack = res.GetObject ("stack");
+ for (int n=0; n<stack.Count; n++) {
+ ResultData frd = stack.GetObject (n);
+ frames.Add (CreateFrame (frd.GetObject ("frame")));
+ }
+ return frames.ToArray ();
+ }
+
+ public ObjectValue[] GetLocalVariables (int frameIndex, EvaluationOptions options)
+ {
+ List<ObjectValue> values = new List<ObjectValue> ();
+ SelectFrame (frameIndex);
+
+ GdbCommandResult res = session.RunCommand ("-stack-list-locals", "0");
+ foreach (ResultData data in res.GetObject ("locals"))
+ values.Add (CreateVarObject (data.GetValue ("name")));
+
+ return values.ToArray ();
+ }
+
+ public ObjectValue[] GetParameters (int frameIndex, EvaluationOptions options)
+ {
+ List<ObjectValue> values = new List<ObjectValue> ();
+ SelectFrame (frameIndex);
+ GdbCommandResult res = session.RunCommand ("-stack-list-arguments", "0", frameIndex.ToString (), frameIndex.ToString ());
+ foreach (ResultData data in res.GetObject ("stack-args").GetObject (0).GetObject ("frame").GetObject ("args"))
+ values.Add (CreateVarObject (data.GetValue ("name")));
+
+ return values.ToArray ();
+ }
+
+ public ObjectValue GetThisReference (int frameIndex, EvaluationOptions options)
+ {
+ return null;
+ }
+
+ public ObjectValue[] GetAllLocals (int frameIndex, EvaluationOptions options)
+ {
+ List<ObjectValue> locals = new List<ObjectValue> ();
+ locals.AddRange (GetParameters (frameIndex, options));
+ locals.AddRange (GetLocalVariables (frameIndex, options));
+ return locals.ToArray ();
+ }
+
+ public ObjectValue[] GetExpressionValues (int frameIndex, string[] expressions, EvaluationOptions options)
+ {
+ List<ObjectValue> values = new List<ObjectValue> ();
+ SelectFrame (frameIndex);
+ foreach (string exp in expressions)
+ values.Add (CreateVarObject (exp));
+ return values.ToArray ();
+ }
+
+ public ExceptionInfo GetException (int frameIndex, EvaluationOptions options)
+ {
+ return null;
+ }
+
+ public ValidationResult ValidateExpression (int frameIndex, string expression, EvaluationOptions options)
+ {
+ return new ValidationResult (true, null);
+ }
+
+ public CompletionData GetExpressionCompletionData (int frameIndex, string exp)
+ {
+ SelectFrame (frameIndex);
+
+ bool pointer = exp.EndsWith ("->");
+ int i;
+
+ if (pointer || exp.EndsWith (".")) {
+ exp = exp.Substring (0, exp.Length - (pointer ? 2 : 1));
+ i = 0;
+ while (i < exp.Length) {
+ ObjectValue val = CreateVarObject (exp);
+ if (!val.IsUnknown && !val.IsError) {
+ CompletionData data = new CompletionData ();
+ foreach (ObjectValue cv in val.GetAllChildren ())
+ data.Items.Add (new CompletionItem (cv.Name, cv.Flags));
+ data.ExpressionLength = 0;
+ return data;
+ }
+ i++;
+ }
+ return null;
+ }
+
+ i = exp.Length - 1;
+ bool lastWastLetter = false;
+ while (i >= 0) {
+ char c = exp [i--];
+ if (!char.IsLetterOrDigit (c) && c != '_')
+ break;
+ lastWastLetter = !char.IsDigit (c);
+ }
+
+ if (lastWastLetter) {
+ string partialWord = exp.Substring (i+1);
+
+ CompletionData cdata = new CompletionData ();
+ cdata.ExpressionLength = partialWord.Length;
+
+ // Local variables
+
+ GdbCommandResult res = session.RunCommand ("-stack-list-locals", "0");
+ foreach (ResultData data in res.GetObject ("locals")) {
+ string name = data.GetValue ("name");
+ if (name.StartsWith (partialWord))
+ cdata.Items.Add (new CompletionItem (name, ObjectValueFlags.Variable));
+ }
+
+ // Parameters
+
+ res = session.RunCommand ("-stack-list-arguments", "0", frameIndex.ToString (), frameIndex.ToString ());
+ foreach (ResultData data in res.GetObject ("stack-args").GetObject (0).GetObject ("frame").GetObject ("args")) {
+ string name = data.GetValue ("name");
+ if (name.StartsWith (partialWord))
+ cdata.Items.Add (new CompletionItem (name, ObjectValueFlags.Parameter));
+ }
+
+ if (cdata.Items.Count > 0)
+ return cdata;
+ }
+ return null;
+ }
+
+
+ ObjectValue CreateVarObject (string exp)
+ {
+ try {
+ session.SelectThread (threadId);
+ exp = exp.Replace ("\"", "\\\"");
+ GdbCommandResult res = session.RunCommand ("-var-create", "-", "*", "\"" + exp + "\"");
+ string vname = res.GetValue ("name");
+ session.RegisterTempVariableObject (vname);
+ return CreateObjectValue (exp, res);
+ } catch {
+ return ObjectValue.CreateUnknown (exp);
+ }
+ }
+
+ ObjectValue CreateObjectValue (string name, ResultData data)
+ {
+ string vname = data.GetValue ("name");
+ string typeName = data.GetValue ("type");
+ string value = data.GetValue ("value");
+ int nchild = data.GetInt ("numchild");
+
+ ObjectValue val;
+ ObjectValueFlags flags = ObjectValueFlags.Variable;
+
+ // There can be 'public' et al children for C++ structures
+ if (typeName == null)
+ typeName = "none";
+
+ if (typeName.EndsWith ("]")) {
+ val = ObjectValue.CreateArray (this, new ObjectPath (vname), typeName, nchild, flags, null);
+ } else if (value == "{...}" || typeName.EndsWith ("*") || nchild > 0) {
+ val = ObjectValue.CreateObject (this, new ObjectPath (vname), typeName, value, flags, null);
+ } else {
+ val = ObjectValue.CreatePrimitive (this, new ObjectPath (vname), typeName, new EvaluationResult (value), flags);
+ }
+ val.Name = name;
+ return val;
+ }
+
+ public ObjectValue[] GetChildren (ObjectPath path, int index, int count, EvaluationOptions options)
+ {
+ List<ObjectValue> children = new List<ObjectValue> ();
+ session.SelectThread (threadId);
+ GdbCommandResult res = session.RunCommand ("-var-list-children", "2", path.Join ("."));
+ ResultData cdata = res.GetObject ("children");
+
+ // The response may not contain the "children" list at all.
+ if (cdata == null)
+ return children.ToArray ();
+
+ if (index == -1) {
+ index = 0;
+ count = cdata.Count;
+ }
+
+ for (int n=index; n<cdata.Count && n<index+count; n++) {
+ ResultData data = cdata.GetObject (n);
+ ResultData child = data.GetObject ("child");
+
+ string name = child.GetValue ("exp");
+ if (name.Length > 0 && char.IsNumber (name [0]))
+ name = "[" + name + "]";
+
+ // C++ structures may contain typeless children named
+ // "public", "private" and "protected".
+ if (child.GetValue("type") == null) {
+ ObjectPath childPath = new ObjectPath (child.GetValue ("name").Split ('.'));
+ ObjectValue[] subchildren = GetChildren (childPath, -1, -1, options);
+ children.AddRange(subchildren);
+ } else {
+ ObjectValue val = CreateObjectValue (name, child);
+ children.Add (val);
+ }
+ }
+ return children.ToArray ();
+ }
+
+ public EvaluationResult SetValue (ObjectPath path, string value, EvaluationOptions options)
+ {
+ session.SelectThread (threadId);
+ session.RunCommand ("-var-assign", path.Join ("."), value);
+ return new EvaluationResult (value);
+ }
+
+ public ObjectValue GetValue (ObjectPath path, EvaluationOptions options)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void SelectFrame (int frame)
+ {
+ session.SelectThread (threadId);
+ if (frame != currentFrame) {
+ session.RunCommand ("-stack-select-frame", frame.ToString ());
+ currentFrame = frame;
+ }
+ }
+
+ StackFrame CreateFrame (ResultData frameData)
+ {
+ string lang = "Native";
+ string func = frameData.GetValue ("func");
+ string sadr = frameData.GetValue ("addr");
+
+ if (func == "??" && session.IsMonoProcess) {
+ // Try to get the managed func name
+ try {
+ ResultData data = session.RunCommand ("-data-evaluate-expression", "mono_pmip(" + sadr + ")");
+ string val = data.GetValue ("value");
+ if (val != null) {
+ int i = val.IndexOf ('"');
+ if (i != -1) {
+ func = val.Substring (i).Trim ('"',' ');
+ lang = "Mono";
+ }
+ }
+ } catch {
+ }
+ }
+
+ int line = -1;
+ string sline = frameData.GetValue ("line");
+ if (sline != null)
+ line = int.Parse (sline);
+
+ string sfile = frameData.GetValue ("fullname");
+ if (sfile == null)
+ sfile = frameData.GetValue ("file");
+ if (sfile == null)
+ sfile = frameData.GetValue ("from");
+ SourceLocation loc = new SourceLocation (func ?? "?", sfile, line);
+
+ long addr;
+ if (!string.IsNullOrEmpty (sadr))
+ addr = long.Parse (sadr.Substring (2), NumberStyles.HexNumber);
+ else
+ addr = 0;
+
+ return new StackFrame (addr, loc, lang);
+ }
+
+ public AssemblyLine[] Disassemble (int frameIndex, int firstLine, int count)
+ {
+ SelectFrame (frameIndex);
+ if (disBuffers == null)
+ disBuffers = new DissassemblyBuffer [fcount];
+
+ DissassemblyBuffer buffer = disBuffers [frameIndex];
+ if (buffer == null) {
+ ResultData data = session.RunCommand ("-stack-info-frame");
+ long addr = long.Parse (data.GetObject ("frame").GetValue ("addr").Substring (2), NumberStyles.HexNumber);
+ buffer = new GdbDissassemblyBuffer (session, addr);
+ disBuffers [frameIndex] = buffer;
+ }
+
+ return buffer.GetLines (firstLine, firstLine + count - 1);
+ }
+
+ public object GetRawValue (ObjectPath path, EvaluationOptions options)
+ {
+ return null;
+ }
+
+ public void SetRawValue (ObjectPath path, object value, EvaluationOptions options)
+ {
+ }
+ }
+
+ class GdbDissassemblyBuffer: DissassemblyBuffer
+ {
+ GdbSession session;
+
+ public GdbDissassemblyBuffer (GdbSession session, long addr): base (addr)
+ {
+ this.session = session;
+ }
+
+ public override AssemblyLine[] GetLines (long startAddr, long endAddr)
+ {
+ try {
+ ResultData data = session.RunCommand ("-data-disassemble", "-s", startAddr.ToString (), "-e", endAddr.ToString (), "--", "0");
+ ResultData ins = data.GetObject ("asm_insns");
+
+ AssemblyLine[] alines = new AssemblyLine [ins.Count];
+ for (int n=0; n<ins.Count; n++) {
+ ResultData aline = ins.GetObject (n);
+ long addr = long.Parse (aline.GetValue ("address").Substring (2), NumberStyles.HexNumber);
+ AssemblyLine line = new AssemblyLine (addr, aline.GetValue ("inst"));
+ alines [n] = line;
+ }
+ return alines;
+ } catch {
+ return new AssemblyLine [0];
+ }
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger.Gdb/GdbCommandResult.cs b/main/src/addins/MonoDevelop.Debugger.Gdb/GdbCommandResult.cs
new file mode 100644
index 0000000000..a8790d74ad
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger.Gdb/GdbCommandResult.cs
@@ -0,0 +1,53 @@
+// GdbCommandResult.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+using System;
+
+namespace MonoDevelop.Debugger.Gdb
+{
+ class GdbCommandResult: ResultData
+ {
+ public CommandStatus Status;
+ public string ErrorMessage;
+
+ public GdbCommandResult (string line)
+ {
+ if (line.StartsWith ("^done")) {
+ Status = CommandStatus.Done;
+ ReadResults (line, 6);
+ } else if (line.StartsWith ("^error")) {
+ Status = CommandStatus.Error;
+ if (line.Length > 7) {
+ ReadResults (line, 7);
+ ErrorMessage = GetValue ("msg");
+ }
+ } else if (line.StartsWith ("^running")) {
+ Status = CommandStatus.Running;
+ }
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger.Gdb/GdbEvent.cs b/main/src/addins/MonoDevelop.Debugger.Gdb/GdbEvent.cs
new file mode 100644
index 0000000000..cf631cfb70
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger.Gdb/GdbEvent.cs
@@ -0,0 +1,49 @@
+// GdbEvent.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+using System;
+
+namespace MonoDevelop.Debugger.Gdb
+{
+ class GdbEvent: ResultData
+ {
+ public string Name;
+ public string Reason;
+
+ public GdbEvent (string line)
+ {
+ int i = line.IndexOf (',');
+ if (i == -1)
+ i = line.Length;
+ Name = line.Substring (1, i - 1);
+ ReadResults (line, i+1);
+ object[] reasons = GetAllValues ("reason");
+ if (reasons.Length > 0)
+ Reason = (string) reasons [0];
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger.Gdb/GdbSession.cs b/main/src/addins/MonoDevelop.Debugger.Gdb/GdbSession.cs
new file mode 100644
index 0000000000..f7ad8dfa67
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger.Gdb/GdbSession.cs
@@ -0,0 +1,735 @@
+// GdbSession.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+using System;
+using System.Globalization;
+using System.Text;
+using System.IO;
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Threading;
+using Mono.Debugging.Client;
+using MonoDevelop.Core;
+using MonoDevelop.Core.Execution;
+using Mono.Unix.Native;
+
+namespace MonoDevelop.Debugger.Gdb
+{
+ class GdbSession: DebuggerSession
+ {
+ Process proc;
+ StreamReader sout;
+ StreamWriter sin;
+ IProcessAsyncOperation console;
+ GdbCommandResult lastResult;
+ bool running;
+ Thread thread;
+ long currentThread = -1;
+ long activeThread = -1;
+ bool isMonoProcess;
+ string currentProcessName;
+ List<string> tempVariableObjects = new List<string> ();
+ Dictionary<int,BreakEventInfo> breakpoints = new Dictionary<int,BreakEventInfo> ();
+ List<BreakEventInfo> breakpointsWithHitCount = new List<BreakEventInfo> ();
+
+ DateTime lastBreakEventUpdate = DateTime.Now;
+ Dictionary<int, WaitCallback> breakUpdates = new Dictionary<int,WaitCallback> ();
+ bool breakUpdateEventsQueued;
+ const int BreakEventUpdateNotifyDelay = 500;
+
+ bool internalStop;
+ bool logGdb;
+
+ object syncLock = new object ();
+ object eventLock = new object ();
+ object gdbLock = new object ();
+
+ public GdbSession ()
+ {
+ logGdb = !string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("MONODEVELOP_GDB_LOG"));
+ }
+
+ protected override void OnRun (DebuggerStartInfo startInfo)
+ {
+ lock (gdbLock) {
+ // Create a script to be run in a terminal
+ string script = Path.GetTempFileName ();
+ string ttyfile = Path.GetTempFileName ();
+ string ttyfileDone = ttyfile + "_done";
+ string tty;
+
+ try {
+ File.WriteAllText (script, "tty > " + ttyfile + "\ntouch " + ttyfileDone + "\nsleep 10000d");
+ Mono.Unix.Native.Syscall.chmod (script, FilePermissions.ALLPERMS);
+
+ console = Runtime.ProcessService.StartConsoleProcess (script, "", ".", ExternalConsoleFactory.Instance.CreateConsole (true), null);
+ DateTime tim = DateTime.Now;
+ while (!File.Exists (ttyfileDone)) {
+ System.Threading.Thread.Sleep (100);
+ if ((DateTime.Now - tim).TotalSeconds > 10)
+ throw new InvalidOperationException ("Console could not be created.");
+ }
+ tty = File.ReadAllText (ttyfile).Trim (' ','\n');
+ } finally {
+ try {
+ if (File.Exists (script))
+ File.Delete (script);
+ if (File.Exists (ttyfile))
+ File.Delete (ttyfile);
+ if (File.Exists (ttyfileDone))
+ File.Delete (ttyfileDone);
+ } catch {
+ // Ignore
+ }
+ }
+
+ StartGdb ();
+
+ // Initialize the terminal
+ RunCommand ("-inferior-tty-set", Escape (tty));
+
+ try {
+ RunCommand ("-file-exec-and-symbols", Escape (startInfo.Command));
+ } catch {
+ FireTargetEvent (TargetEventType.TargetExited, null);
+ throw;
+ }
+
+ RunCommand ("-environment-cd", Escape (startInfo.WorkingDirectory));
+
+ // Set inferior arguments
+ if (!string.IsNullOrEmpty (startInfo.Arguments))
+ RunCommand ("-exec-arguments", startInfo.Arguments);
+
+ if (startInfo.EnvironmentVariables != null) {
+ foreach (var v in startInfo.EnvironmentVariables)
+ RunCommand ("-gdb-set", "environment", v.Key, v.Value);
+ }
+
+ currentProcessName = startInfo.Command + " " + startInfo.Arguments;
+
+ CheckIsMonoProcess ();
+ OnStarted ();
+
+ RunCommand ("-exec-run");
+ }
+ }
+
+ protected override void OnAttachToProcess (long processId)
+ {
+ lock (gdbLock) {
+ StartGdb ();
+ currentProcessName = "PID " + processId.ToString ();
+ RunCommand ("attach", processId.ToString ());
+ currentThread = activeThread = 1;
+ CheckIsMonoProcess ();
+ OnStarted ();
+ FireTargetEvent (TargetEventType.TargetStopped, null);
+ }
+ }
+
+ public bool IsMonoProcess {
+ get { return isMonoProcess; }
+ }
+
+ void CheckIsMonoProcess ()
+ {
+ try {
+ RunCommand ("-data-evaluate-expression", "mono_pmip");
+ isMonoProcess = true;
+ } catch {
+ isMonoProcess = false;
+ // Ignore
+ }
+ }
+
+ void StartGdb ()
+ {
+ proc = new Process ();
+ proc.StartInfo.FileName = "gdb";
+ proc.StartInfo.Arguments = "-quiet -fullname -i=mi2";
+ proc.StartInfo.UseShellExecute = false;
+ proc.StartInfo.RedirectStandardInput = true;
+ proc.StartInfo.RedirectStandardOutput = true;
+ proc.StartInfo.RedirectStandardError = true;
+ proc.Start ();
+
+ sout = proc.StandardOutput;
+ sin = proc.StandardInput;
+
+ thread = new Thread (OutputInterpreter);
+ thread.Name = "GDB output interpeter";
+ thread.IsBackground = true;
+ thread.Start ();
+ }
+
+ public override void Dispose ()
+ {
+ if (console != null && !console.IsCompleted) {
+ console.Cancel ();
+ console = null;
+ }
+
+ if (thread != null)
+ thread.Abort ();
+ }
+
+ protected override void OnSetActiveThread (long processId, long threadId)
+ {
+ activeThread = threadId;
+ }
+
+ protected override void OnStop ()
+ {
+ Syscall.kill (proc.Id, Signum.SIGINT);
+ }
+
+ protected override void OnDetach ()
+ {
+ lock (gdbLock) {
+ InternalStop ();
+ RunCommand ("detach");
+ FireTargetEvent (TargetEventType.TargetExited, null);
+ }
+ }
+
+ protected override void OnExit ()
+ {
+ lock (gdbLock) {
+ InternalStop ();
+ RunCommand ("kill");
+ TargetEventArgs args = new TargetEventArgs (TargetEventType.TargetExited);
+ OnTargetEvent (args);
+/* proc.Kill ();
+ TargetEventArgs args = new TargetEventArgs (TargetEventType.TargetExited);
+ OnTargetEvent (args);
+*/ }
+ }
+
+ protected override void OnStepLine ()
+ {
+ SelectThread (activeThread);
+ RunCommand ("-exec-step");
+ }
+
+ protected override void OnNextLine ()
+ {
+ SelectThread (activeThread);
+ RunCommand ("-exec-next");
+ }
+
+ protected override void OnStepInstruction ()
+ {
+ SelectThread (activeThread);
+ RunCommand ("-exec-step-instruction");
+ }
+
+ protected override void OnNextInstruction ()
+ {
+ SelectThread (activeThread);
+ RunCommand ("-exec-next-instruction");
+ }
+
+ protected override void OnFinish ()
+ {
+ SelectThread (activeThread);
+ GdbCommandResult res = RunCommand ("-stack-info-depth", "2");
+ if (res.GetValue ("depth") == "1") {
+ RunCommand ("-exec-continue");
+ } else {
+ RunCommand ("-stack-select-frame", "0");
+ RunCommand ("-exec-finish");
+ }
+ }
+
+ protected override BreakEventInfo OnInsertBreakEvent (BreakEvent be)
+ {
+ Breakpoint bp = be as Breakpoint;
+ if (bp == null)
+ throw new NotSupportedException ();
+
+ BreakEventInfo bi = new BreakEventInfo ();
+
+ lock (gdbLock) {
+ bool dres = InternalStop ();
+ try {
+ string extraCmd = string.Empty;
+ if (bp.HitCount > 0) {
+ extraCmd += "-i " + bp.HitCount;
+ breakpointsWithHitCount.Add (bi);
+ }
+ if (!string.IsNullOrEmpty (bp.ConditionExpression)) {
+ if (!bp.BreakIfConditionChanges)
+ extraCmd += " -c " + bp.ConditionExpression;
+ }
+
+ GdbCommandResult res = null;
+ string errorMsg = null;
+
+ if (bp is FunctionBreakpoint) {
+ try {
+ res = RunCommand ("-break-insert", extraCmd.Trim (), ((FunctionBreakpoint) bp).FunctionName);
+ } catch (Exception ex) {
+ errorMsg = ex.Message;
+ }
+ } else {
+ // Breakpoint locations must be double-quoted if files contain spaces.
+ // For example: -break-insert "\"C:/Documents and Settings/foo.c\":17"
+ RunCommand ("-environment-directory", Escape (Path.GetDirectoryName (bp.FileName)));
+
+ try {
+ res = RunCommand ("-break-insert", extraCmd.Trim (), Escape (Escape (bp.FileName) + ":" + bp.Line));
+ } catch (Exception ex) {
+ errorMsg = ex.Message;
+ }
+
+ if (res == null) {
+ try {
+ res = RunCommand ("-break-insert", extraCmd.Trim (), Escape (Escape (Path.GetFileName (bp.FileName)) + ":" + bp.Line));
+ }
+ catch {
+ // Ignore
+ }
+ }
+ }
+
+ if (res == null) {
+ bi.SetStatus (BreakEventStatus.Invalid, errorMsg);
+ return bi;
+ }
+ int bh = res.GetObject ("bkpt").GetInt ("number");
+ if (!be.Enabled)
+ RunCommand ("-break-disable", bh.ToString ());
+ breakpoints [bh] = bi;
+ bi.Handle = bh;
+ bi.SetStatus (BreakEventStatus.Bound, null);
+ return bi;
+ } finally {
+ InternalResume (dres);
+ }
+ }
+ }
+
+ bool CheckBreakpoint (int handle)
+ {
+ BreakEventInfo binfo;
+ if (!breakpoints.TryGetValue (handle, out binfo))
+ return true;
+
+ Breakpoint bp = (Breakpoint) binfo.BreakEvent;
+
+ if (!string.IsNullOrEmpty (bp.ConditionExpression) && bp.BreakIfConditionChanges) {
+ // Update the condition expression
+ GdbCommandResult res = RunCommand ("-data-evaluate-expression", Escape (bp.ConditionExpression));
+ string val = res.GetValue ("value");
+ RunCommand ("-break-condition", handle.ToString (), "(" + bp.ConditionExpression + ") != " + val);
+ }
+
+ if (!string.IsNullOrEmpty (bp.TraceExpression) && bp.HitAction == HitAction.PrintExpression) {
+ GdbCommandResult res = RunCommand ("-data-evaluate-expression", Escape (bp.TraceExpression));
+ string val = res.GetValue ("value");
+ NotifyBreakEventUpdate (binfo, 0, val);
+ return false;
+ }
+ return true;
+ }
+
+ void NotifyBreakEventUpdate (BreakEventInfo binfo, int hitCount, string lastTrace)
+ {
+ bool notify = false;
+
+ WaitCallback nc = delegate {
+ if (hitCount != -1)
+ binfo.IncrementHitCount ();
+ if (lastTrace != null)
+ binfo.UpdateLastTraceValue (lastTrace);
+ };
+
+ lock (breakUpdates)
+ {
+ int span = (int) (DateTime.Now - lastBreakEventUpdate).TotalMilliseconds;
+ if (span >= BreakEventUpdateNotifyDelay && !breakUpdateEventsQueued) {
+ // Last update was more than 0.5s ago. The update can be sent.
+ lastBreakEventUpdate = DateTime.Now;
+ notify = true;
+ } else {
+ // Queue the event notifications to avoid wasting too much time
+ breakUpdates [(int)binfo.Handle] = nc;
+ if (!breakUpdateEventsQueued) {
+ breakUpdateEventsQueued = true;
+
+ ThreadPool.QueueUserWorkItem (delegate {
+ Thread.Sleep (BreakEventUpdateNotifyDelay - span);
+ List<WaitCallback> copy;
+ lock (breakUpdates) {
+ copy = new List<WaitCallback> (breakUpdates.Values);
+ breakUpdates.Clear ();
+ breakUpdateEventsQueued = false;
+ lastBreakEventUpdate = DateTime.Now;
+ }
+ foreach (WaitCallback wc in copy)
+ wc (null);
+ });
+ }
+ }
+ }
+ if (notify)
+ nc (null);
+ }
+
+ void UpdateHitCountData ()
+ {
+ foreach (BreakEventInfo bp in breakpointsWithHitCount) {
+ GdbCommandResult res = RunCommand ("-break-info", bp.Handle.ToString ());
+ string val = res.GetObject ("BreakpointTable").GetObject ("body").GetObject (0).GetObject ("bkpt").GetValue ("ignore");
+ if (val != null)
+ NotifyBreakEventUpdate (bp, int.Parse (val), null);
+ else
+ NotifyBreakEventUpdate (bp, 0, null);
+ }
+ breakpointsWithHitCount.Clear ();
+ }
+
+ protected override void OnRemoveBreakEvent (BreakEventInfo binfo)
+ {
+ lock (gdbLock) {
+ if (binfo.Handle == null)
+ return;
+ bool dres = InternalStop ();
+ breakpointsWithHitCount.Remove (binfo);
+ breakpoints.Remove ((int)binfo.Handle);
+ try {
+ RunCommand ("-break-delete", binfo.Handle.ToString ());
+ } finally {
+ InternalResume (dres);
+ }
+ }
+ }
+
+ protected override void OnEnableBreakEvent (BreakEventInfo binfo, bool enable)
+ {
+ lock (gdbLock) {
+ if (binfo.Handle == null)
+ return;
+ bool dres = InternalStop ();
+ try {
+ if (enable)
+ RunCommand ("-break-enable", binfo.Handle.ToString ());
+ else
+ RunCommand ("-break-disable", binfo.Handle.ToString ());
+ } finally {
+ InternalResume (dres);
+ }
+ }
+ }
+
+ protected override void OnUpdateBreakEvent (BreakEventInfo binfo)
+ {
+ Breakpoint bp = binfo.BreakEvent as Breakpoint;
+ if (bp == null)
+ throw new NotSupportedException ();
+
+ if (binfo.Handle == null)
+ return;
+
+ bool ss = InternalStop ();
+
+ try {
+ if (bp.HitCount > 0) {
+ RunCommand ("-break-after", binfo.Handle.ToString (), bp.HitCount.ToString ());
+ breakpointsWithHitCount.Add (binfo);
+ } else
+ breakpointsWithHitCount.Remove (binfo);
+
+ if (!string.IsNullOrEmpty (bp.ConditionExpression) && !bp.BreakIfConditionChanges)
+ RunCommand ("-break-condition", binfo.Handle.ToString (), bp.ConditionExpression);
+ else
+ RunCommand ("-break-condition", binfo.Handle.ToString ());
+ } finally {
+ InternalResume (ss);
+ }
+ }
+
+ protected override void OnContinue ()
+ {
+ SelectThread (activeThread);
+ RunCommand ("-exec-continue");
+ }
+
+ protected override ThreadInfo[] OnGetThreads (long processId)
+ {
+ List<ThreadInfo> list = new List<ThreadInfo> ();
+ ResultData data = RunCommand ("-thread-list-ids").GetObject ("thread-ids");
+ foreach (string id in data.GetAllValues ("thread-id"))
+ list.Add (GetThread (long.Parse (id)));
+ return list.ToArray ();
+ }
+
+ protected override ProcessInfo[] OnGetProcesses ()
+ {
+ ProcessInfo p = new ProcessInfo (0, currentProcessName);
+ return new ProcessInfo [] { p };
+ }
+
+ ThreadInfo GetThread (long id)
+ {
+ return new ThreadInfo (0, id, "Thread #" + id, null);
+ }
+
+ protected override Backtrace OnGetThreadBacktrace (long processId, long threadId)
+ {
+ ResultData data = SelectThread (threadId);
+ GdbCommandResult res = RunCommand ("-stack-info-depth");
+ int fcount = int.Parse (res.GetValue ("depth"));
+ GdbBacktrace bt = new GdbBacktrace (this, threadId, fcount, data != null ? data.GetObject ("frame") : null);
+ return new Backtrace (bt);
+ }
+
+ protected override AssemblyLine[] OnDisassembleFile (string file)
+ {
+ List<AssemblyLine> lines = new List<AssemblyLine> ();
+ int cline = 1;
+ do {
+ ResultData data = null;
+ try {
+ data = RunCommand ("-data-disassemble", "-f", file, "-l", cline.ToString (), "--", "1");
+ } catch {
+ break;
+ }
+ ResultData asm_insns = data.GetObject ("asm_insns");
+ int newLine = cline;
+ for (int n=0; n<asm_insns.Count; n++) {
+ ResultData src_and_asm_line = asm_insns.GetObject (n).GetObject ("src_and_asm_line");
+ newLine = src_and_asm_line.GetInt ("line");
+ ResultData line_asm_insn = src_and_asm_line.GetObject ("line_asm_insn");
+ for (int i=0; i<line_asm_insn.Count; i++) {
+ ResultData asm = line_asm_insn.GetObject (i);
+ long addr = long.Parse (asm.GetValue ("address").Substring (2), NumberStyles.HexNumber);
+ string code = asm.GetValue ("inst");
+ lines.Add (new AssemblyLine (addr, code, newLine));
+ }
+ }
+ if (newLine <= cline)
+ break;
+ cline = newLine + 1;
+
+ } while (true);
+
+ return lines.ToArray ();
+ }
+
+ public ResultData SelectThread (long id)
+ {
+ if (id == currentThread)
+ return null;
+ currentThread = id;
+ return RunCommand ("-thread-select", id.ToString ());
+ }
+
+ string Escape (string str)
+ {
+ if (str == null)
+ return null;
+ else if (str.IndexOf (' ') != -1 || str.IndexOf ('"') != -1) {
+ str = str.Replace ("\"", "\\\"");
+ return "\"" + str + "\"";
+ }
+ else
+ return str;
+ }
+
+ public GdbCommandResult RunCommand (string command, params string[] args)
+ {
+ lock (gdbLock) {
+ lock (syncLock) {
+ lastResult = null;
+
+ lock (eventLock) {
+ running = true;
+ }
+
+ if (logGdb)
+ Console.WriteLine ("gdb<: " + command + " " + string.Join (" ", args));
+
+ sin.WriteLine (command + " " + string.Join (" ", args));
+
+ if (!Monitor.Wait (syncLock, 4000))
+ throw new InvalidOperationException ("Command execution timeout.");
+ if (lastResult.Status == CommandStatus.Error)
+ throw new InvalidOperationException (lastResult.ErrorMessage);
+ return lastResult;
+ }
+ }
+ }
+
+ bool InternalStop ()
+ {
+ lock (eventLock) {
+ if (!running)
+ return false;
+ internalStop = true;
+ Syscall.kill (proc.Id, Signum.SIGINT);
+ if (!Monitor.Wait (eventLock, 4000))
+ throw new InvalidOperationException ("Target could not be interrupted.");
+ }
+ return true;
+ }
+
+ void InternalResume (bool resume)
+ {
+ if (resume)
+ RunCommand ("-exec-continue");
+ }
+
+ void OutputInterpreter ()
+ {
+ string line;
+ while ((line = sout.ReadLine ()) != null) {
+ try {
+ ProcessOutput (line);
+ } catch (Exception ex) {
+ Console.WriteLine (ex);
+ }
+ }
+ }
+
+ void ProcessOutput (string line)
+ {
+ if (logGdb)
+ Console.WriteLine ("dbg>: '" + line + "'");
+ switch (line [0]) {
+ case '^':
+ lock (syncLock) {
+ lastResult = new GdbCommandResult (line);
+ running = (lastResult.Status == CommandStatus.Running);
+ Monitor.PulseAll (syncLock);
+ }
+ break;
+
+ case '~':
+ case '&':
+ if (line.Length > 1 && line[1] == '"')
+ line = line.Substring (2, line.Length - 5);
+ ThreadPool.QueueUserWorkItem (delegate {
+ OnTargetOutput (false, line + "\n");
+ });
+ break;
+
+ case '*':
+ GdbEvent ev;
+ lock (eventLock) {
+ running = false;
+ ev = new GdbEvent (line);
+ string ti = ev.GetValue ("thread-id");
+ if (ti != null && ti != "all")
+ currentThread = activeThread = int.Parse (ti);
+ Monitor.PulseAll (eventLock);
+ if (internalStop) {
+ internalStop = false;
+ return;
+ }
+ }
+ ThreadPool.QueueUserWorkItem (delegate {
+ try {
+ HandleEvent (ev);
+ } catch (Exception ex) {
+ Console.WriteLine (ex);
+ }
+ });
+ break;
+ }
+ }
+
+ void HandleEvent (GdbEvent ev)
+ {
+ if (ev.Name != "stopped") {
+ Console.WriteLine ("Unknown event: " + ev.Name);
+ return;
+ }
+
+ CleanTempVariableObjects ();
+
+ TargetEventType type;
+ switch (ev.Reason) {
+ case "breakpoint-hit":
+ type = TargetEventType.TargetHitBreakpoint;
+ if (!CheckBreakpoint (ev.GetInt ("bkptno"))) {
+ RunCommand ("-exec-continue");
+ return;
+ }
+ break;
+ case "signal-received":
+ if (ev.GetValue ("signal-name") == "SIGINT")
+ type = TargetEventType.TargetInterrupted;
+ else
+ type = TargetEventType.TargetSignaled;
+ break;
+ case "exited":
+ case "exited-signalled":
+ case "exited-normally":
+ type = TargetEventType.TargetExited;
+ break;
+ default:
+ type = TargetEventType.TargetStopped;
+ break;
+ }
+
+ ResultData curFrame = ev.GetObject ("frame");
+ FireTargetEvent (type, curFrame);
+ }
+
+ void FireTargetEvent (TargetEventType type, ResultData curFrame)
+ {
+ UpdateHitCountData ();
+
+ TargetEventArgs args = new TargetEventArgs (type);
+
+ if (type != TargetEventType.TargetExited) {
+ GdbCommandResult res = RunCommand ("-stack-info-depth");
+ int fcount = int.Parse (res.GetValue ("depth"));
+
+ GdbBacktrace bt = new GdbBacktrace (this, activeThread, fcount, curFrame);
+ args.Backtrace = new Backtrace (bt);
+ args.Thread = GetThread (activeThread);
+ }
+ OnTargetEvent (args);
+ }
+
+ internal void RegisterTempVariableObject (string var)
+ {
+ tempVariableObjects.Add (var);
+ }
+
+ void CleanTempVariableObjects ()
+ {
+ foreach (string s in tempVariableObjects)
+ RunCommand ("-var-delete", s);
+ tempVariableObjects.Clear ();
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger.Gdb/GdbSessionFactory.cs b/main/src/addins/MonoDevelop.Debugger.Gdb/GdbSessionFactory.cs
new file mode 100644
index 0000000000..a4e11b6877
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger.Gdb/GdbSessionFactory.cs
@@ -0,0 +1,151 @@
+// GdbSessionFactory.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Mono.Debugging.Client;
+using Mono.Debugging.Backend;
+using MonoDevelop.Core.Execution;
+
+namespace MonoDevelop.Debugger.Gdb
+{
+ public class GdbSessionFactory: IDebuggerEngine
+ {
+ struct FileData {
+ public DateTime LastCheck;
+ public bool IsExe;
+ }
+
+ Dictionary<string,FileData> fileCheckCache = new Dictionary<string, FileData> ();
+
+ public bool CanDebugCommand (ExecutionCommand command)
+ {
+ NativeExecutionCommand cmd = command as NativeExecutionCommand;
+ if (cmd == null)
+ return false;
+
+ string file = FindFile (cmd.Command);
+ if (!File.Exists (file)) {
+ // The provided file is not guaranteed to exist. If it doesn't
+ // we assume we can execute it because otherwise the run command
+ // in the IDE will be disabled, and that's not good because that
+ // command will build the project if the exec doesn't yet exist.
+ return true;
+ }
+
+ file = Path.GetFullPath (file);
+ DateTime currentTime = File.GetLastWriteTime (file);
+
+ FileData data;
+ if (fileCheckCache.TryGetValue (file, out data)) {
+ if (data.LastCheck == currentTime)
+ return data.IsExe;
+ }
+ data.LastCheck = currentTime;
+ try {
+ data.IsExe = IsExecutable (file);
+ } catch {
+ data.IsExe = false;
+ }
+ fileCheckCache [file] = data;
+ return data.IsExe;
+ }
+
+ public DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand command)
+ {
+ NativeExecutionCommand pec = (NativeExecutionCommand) command;
+ DebuggerStartInfo startInfo = new DebuggerStartInfo ();
+ startInfo.Command = pec.Command;
+ startInfo.Arguments = pec.Arguments;
+ startInfo.WorkingDirectory = pec.WorkingDirectory;
+ if (pec.EnvironmentVariables.Count > 0) {
+ foreach (KeyValuePair<string,string> val in pec.EnvironmentVariables)
+ startInfo.EnvironmentVariables [val.Key] = val.Value;
+ }
+ return startInfo;
+ }
+
+ public bool IsExecutable (string file)
+ {
+ // HACK: this is a quick but not very reliable way of checking if a file
+ // is a native executable. Actually, we are interested in checking that
+ // the file is not a script.
+ using (StreamReader sr = new StreamReader (file)) {
+ char[] chars = new char[3];
+ int n = 0, nr = 0;
+ while (n < chars.Length && (nr = sr.ReadBlock (chars, n, chars.Length - n)) != 0)
+ n += nr;
+ if (nr != chars.Length)
+ return true;
+ if (chars [0] == '#' && chars [1] == '!')
+ return false;
+ }
+ return true;
+ }
+
+ public DebuggerSession CreateSession ()
+ {
+ GdbSession ds = new GdbSession ();
+ return ds;
+ }
+
+ public ProcessInfo[] GetAttachableProcesses ()
+ {
+ List<ProcessInfo> procs = new List<ProcessInfo> ();
+ foreach (string dir in Directory.GetDirectories ("/proc")) {
+ int id;
+ if (!int.TryParse (Path.GetFileName (dir), out id))
+ continue;
+ try {
+ File.ReadAllText (Path.Combine (dir, "sessionid"));
+ } catch {
+ continue;
+ }
+ string cmdline = File.ReadAllText (Path.Combine (dir, "cmdline"));
+ cmdline = cmdline.Replace ('\0',' ');
+ ProcessInfo pi = new ProcessInfo (id, cmdline);
+ procs.Add (pi);
+ }
+ return procs.ToArray ();
+ }
+
+ string FindFile (string cmd)
+ {
+ if (Path.IsPathRooted (cmd))
+ return cmd;
+ string pathVar = Environment.GetEnvironmentVariable ("PATH");
+ string[] paths = pathVar.Split (Path.PathSeparator);
+ foreach (string path in paths) {
+ string file = Path.Combine (path, cmd);
+ if (File.Exists (file))
+ return file;
+ }
+ return cmd;
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger.Gdb/Makefile.am b/main/src/addins/MonoDevelop.Debugger.Gdb/Makefile.am
new file mode 100644
index 0000000000..c9cc87438f
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger.Gdb/Makefile.am
@@ -0,0 +1 @@
+include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.Debugger.Gdb/Manifest.addin.xml b/main/src/addins/MonoDevelop.Debugger.Gdb/Manifest.addin.xml
new file mode 100644
index 0000000000..238f37937e
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger.Gdb/Manifest.addin.xml
@@ -0,0 +1,8 @@
+<ExtensionModel>
+ <Extension path="/MonoDevelop/Debugging/DebuggerEngines">
+ <DebuggerEngine id="Mono.Debugger.Gdb"
+ name="GNU Debugger (GDB)"
+ features="ConditionalBreakpoints, Tracepoints, Catchpoints, Attaching, DebugFile, Stepping, Pause, Breakpoints, Disassembly"
+ type="MonoDevelop.Debugger.Gdb.GdbSessionFactory" />
+ </Extension>
+</ExtensionModel> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Debugger.Gdb/MonoDevelop.Debugger.Gdb.csproj b/main/src/addins/MonoDevelop.Debugger.Gdb/MonoDevelop.Debugger.Gdb.csproj
new file mode 100644
index 0000000000..7ef366b439
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger.Gdb/MonoDevelop.Debugger.Gdb.csproj
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{FA15FC26-A7E7-4932-93B7-65FAE6D5DD33}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AssemblyName>MonoDevelop.Debugger.Gdb</AssemblyName>
+ <RootNamespace>MonoDevelop.Debugger</RootNamespace>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\..\..\build\AddIns\MonoDevelop.Debugger.Gdb</OutputPath>
+ <DefineConstants>DEBUG</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ <Execution>
+ <Execution clr-version="Net_2_0" />
+ </Execution>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>none</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\..\..\build\AddIns\MonoDevelop.Debugger.Gdb</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ <Execution>
+ <Execution clr-version="Net_2_0" />
+ </Execution>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="Mono.Posix" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyInfo.cs" />
+ <Compile Include="GdbSession.cs" />
+ <Compile Include="GdbSessionFactory.cs" />
+ <Compile Include="GdbBacktrace.cs" />
+ <Compile Include="CommandStatus.cs" />
+ <Compile Include="ResultData.cs" />
+ <Compile Include="GdbEvent.cs" />
+ <Compile Include="GdbCommandResult.cs" />
+ <Compile Include="AddinInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Manifest.addin.xml">
+ <LogicalName>Manifest.addin.xml</LogicalName>
+ </EmbeddedResource>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <ProjectExtensions>
+ <MonoDevelop>
+ <Properties>
+ <Deployment.LinuxDeployData generatePcFile="False" />
+ </Properties>
+ </MonoDevelop>
+ </ProjectExtensions>
+ <ItemGroup>
+ <ProjectReference Include="..\MonoDevelop.Debugger\MonoDevelop.Debugger.csproj">
+ <Project>{2357AABD-08C7-4808-A495-8FF2D3CDFDB0}</Project>
+ <Name>MonoDevelop.Debugger</Name>
+ <Private>False</Private>
+ </ProjectReference>
+ <ProjectReference Include="..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
+ <Project>{7525BB88-6142-4A26-93B9-A30C6983390A}</Project>
+ <Name>MonoDevelop.Core</Name>
+ <Private>False</Private>
+ </ProjectReference>
+ <ProjectReference Include="..\..\core\MonoDevelop.Ide\MonoDevelop.Ide.csproj">
+ <Project>{27096E7F-C91C-4AC6-B289-6897A701DF21}</Project>
+ <Name>MonoDevelop.Ide</Name>
+ <Private>False</Private>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\external\mono-addins\Mono.Addins\Mono.Addins.csproj">
+ <Project>{91DD5A2D-9FE3-4C3C-9253-876141874DAD}</Project>
+ <Name>Mono.Addins</Name>
+ <Private>False</Private>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\external\debugger-libs\Mono.Debugging\Mono.Debugging.csproj">
+ <Project>{90C99ADB-7D4B-4EB4-98C2-40BD1B14C7D2}</Project>
+ <Name>Mono.Debugging</Name>
+ </ProjectReference>
+ </ItemGroup>
+</Project>
diff --git a/main/src/addins/MonoDevelop.Debugger.Gdb/ResultData.cs b/main/src/addins/MonoDevelop.Debugger.Gdb/ResultData.cs
new file mode 100644
index 0000000000..73c5612a6c
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger.Gdb/ResultData.cs
@@ -0,0 +1,229 @@
+// ResultData.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Text;
+using Mono.Debugging.Client;
+using Mono.Debugging.Backend;
+
+namespace MonoDevelop.Debugger.Gdb
+{
+ class ResultData: IEnumerable
+ {
+ Hashtable props;
+ object[] array;
+ bool isArrayProperty;
+
+ public int Count {
+ get {
+ if (array != null)
+ return array.Length;
+ else if (props != null)
+ return props.Count;
+ else
+ return 0;
+ }
+ }
+
+ public string GetValue (string name)
+ {
+ return (string) props [name];
+ }
+
+ public int GetInt (string name)
+ {
+ return int.Parse (GetValue (name));
+ }
+
+ public string GetValue (int index)
+ {
+ return (string) array [index];
+ }
+
+ public ResultData GetObject (string name)
+ {
+ return (ResultData) props [name];
+ }
+
+ public ResultData GetObject (int index)
+ {
+ return (ResultData) array [index];
+ }
+
+ public object[] GetAllValues (string name)
+ {
+ object ob = props [name];
+ if (ob == null)
+ return new object [0];
+ ResultData rd = ob as ResultData;
+ if (rd != null && rd.isArrayProperty)
+ return rd.array;
+ else
+ return new object[] { ob };
+ }
+
+ protected void ReadResults (string str, int pos)
+ {
+ ReadTuple (str, ref pos, this);
+ }
+
+ void ReadResult (string str, ref int pos, out string name, out object value)
+ {
+ name = null;
+ value = null;
+
+ name = ReadString (str, '=', ref pos);
+ ReadChar (str, ref pos, '=');
+ value = ReadValue (str, ref pos);
+ }
+
+ string ReadString (string str, char term, ref int pos)
+ {
+ StringBuilder sb = new StringBuilder ();
+ while (pos < str.Length && str [pos] != term) {
+ if (str [pos] == '\\') {
+ pos++;
+ if (pos >= str.Length)
+ break;
+ }
+ sb.Append (str [pos]);
+ pos++;
+ }
+ return sb.ToString ();
+ }
+
+ object ReadValue (string str, ref int pos)
+ {
+ if (str [pos] == '"') {
+ pos++;
+ string ret = ReadString (str, '"', ref pos);
+ pos++;
+ return ret;
+ }
+ if (str [pos] == '{') {
+ pos++;
+ ResultData data = new ResultData ();
+ ReadTuple (str, ref pos, data);
+ return data;
+ }
+ if (str [pos] == '[') {
+ pos++;
+ return ReadArray (str, ref pos);
+ }
+
+ // Single value tuple
+ string name;
+ object val;
+ ReadResult (str, ref pos, out name, out val);
+ ResultData sdata = new ResultData ();
+ sdata.props = new Hashtable ();
+ sdata.props [name] = val;
+ return sdata;
+ }
+
+ void ReadTuple (string str, ref int pos, ResultData data)
+ {
+ if (data.props == null)
+ data.props = new Hashtable ();
+
+ while (pos < str.Length && str [pos] != '}') {
+ string name;
+ object val;
+ ReadResult (str, ref pos, out name, out val);
+ if (data.props.ContainsKey (name)) {
+ object ob = data.props [name];
+ ResultData rd = ob as ResultData;
+ if (rd != null && rd.isArrayProperty) {
+ object[] newArr = new object [rd.array.Length + 1];
+ Array.Copy (rd.array, newArr, rd.array.Length);
+ newArr [rd.array.Length] = val;
+ rd.array = newArr;
+ } else {
+ rd = new ResultData ();
+ rd.isArrayProperty = true;
+ rd.array = new object [2];
+ rd.array [0] = ob;
+ rd.array [1] = val;
+ data.props [name] = rd;
+ }
+ } else {
+ data.props [name] = val;
+ }
+ TryReadChar (str, ref pos, ',');
+ }
+ TryReadChar (str, ref pos, '}');
+ }
+
+ ResultData ReadArray (string str, ref int pos)
+ {
+ ArrayList list = new ArrayList ();
+ while (pos < str.Length && str [pos] != ']') {
+ object val = ReadValue (str, ref pos);
+ list.Add (val);
+ TryReadChar (str, ref pos, ',');
+ }
+ TryReadChar (str, ref pos, ']');
+ ResultData arr = new ResultData ();
+ arr.array = list.ToArray ();
+ return arr;
+ }
+
+ void ReadChar (string str, ref int pos, char c)
+ {
+ if (!TryReadChar (str, ref pos, c))
+ ThrownParseError (str, pos);
+ }
+
+ bool TryReadChar (string str, ref int pos, char c)
+ {
+ if (pos >= str.Length || str [pos] != c)
+ return false;
+ pos++;
+ return true;
+ }
+
+ void ThrownParseError (string str, int pos)
+ {
+ if (pos > str.Length)
+ pos = str.Length;
+ str = str.Insert (pos, "[!]");
+ throw new InvalidOperationException ("Error parsing result: " + str);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ if (props != null)
+ return props.Values.GetEnumerator ();
+ else if (array != null)
+ return array.GetEnumerator ();
+ else
+ return new object[0].GetEnumerator ();
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft.AspNet/AspNetSoftDebuggerEngine.cs b/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft.AspNet/AspNetSoftDebuggerEngine.cs
index cafdf34ba8..1006bca8cc 100644
--- a/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft.AspNet/AspNetSoftDebuggerEngine.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft.AspNet/AspNetSoftDebuggerEngine.cs
@@ -39,9 +39,9 @@ using Mono.Debugging.Soft;
namespace MonoDevelop.Debugger.Soft.AspNet
{
- public class AspNetSoftDebuggerEngine: IDebuggerEngine
+ public class AspNetSoftDebuggerEngine: DebuggerEngineBackend
{
- public bool CanDebugCommand (ExecutionCommand command)
+ public override bool CanDebugCommand (ExecutionCommand command)
{
var cmd = command as AspNetExecutionCommand;
return cmd != null && SoftDebuggerEngine.CanDebugRuntime (cmd.TargetRuntime);
@@ -65,7 +65,7 @@ namespace MonoDevelop.Debugger.Soft.AspNet
throw new InvalidOperationException (string.Format ("Unknown runtime version '{0}'", version));
}
- public DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand command)
+ public override DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand command)
{
var cmd = (AspNetExecutionCommand) command;
var evars = new Dictionary<string, string>(cmd.EnvironmentVariables);
@@ -104,14 +104,9 @@ namespace MonoDevelop.Debugger.Soft.AspNet
return startInfo;
}
- public DebuggerSession CreateSession ()
+ public override DebuggerSession CreateSession ()
{
return new SoftDebuggerSession ();
}
-
- public ProcessInfo[] GetAttachableProcesses ()
- {
- return new ProcessInfo[0];
- }
}
}
diff --git a/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/CustomSoftDebuggerEngine.cs b/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/CustomSoftDebuggerEngine.cs
index 1c5aab67af..ca3f329233 100644
--- a/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/CustomSoftDebuggerEngine.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/CustomSoftDebuggerEngine.cs
@@ -35,11 +35,11 @@ using Mono.Debugging.Soft;
namespace MonoDevelop.Debugger.Soft
{
- class CustomSoftDebuggerEngine: IDebuggerEngine
+ class CustomSoftDebuggerEngine: DebuggerEngineBackend
{
bool? available;
- public bool CanDebugCommand (ExecutionCommand cmd)
+ public override bool CanDebugCommand (ExecutionCommand cmd)
{
// This isn't polished enough to show it by default. GUI needs work, and it should be exposed
// via "run with->custom parameters", not a toplevel command and dialog.
@@ -50,17 +50,12 @@ namespace MonoDevelop.Debugger.Soft
return available.Value;
}
- public DebuggerSession CreateSession ()
+ public override DebuggerSession CreateSession ()
{
return new CustomSoftDebuggerSession ();
}
- public ProcessInfo[] GetAttachableProcesses ()
- {
- return new ProcessInfo[0];
- }
-
- public DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand c)
+ public override DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand c)
{
//WORKAROUND: explicit generic type argument works around a gmcs 2.6.x type inference bug
return InvokeSynch<SoftDebuggerStartInfo> (GetDebuggerInfo) ??
@@ -138,6 +133,7 @@ namespace MonoDevelop.Debugger.Soft
} else {
var psi = new ProcessStartInfo (info.Command, info.Arguments) {
WorkingDirectory = info.WorkingDirectory,
+ UseShellExecute = false
};
foreach (KeyValuePair<string,string> kvp in info.EnvironmentVariables)
psi.EnvironmentVariables [kvp.Key] = kvp.Value;
@@ -148,12 +144,12 @@ namespace MonoDevelop.Debugger.Soft
void ProcessOutput (object sender, string message)
{
- OnTargetOutput (true, message);
+ OnTargetOutput (false, message);
}
void ProcessError (object sender, string message)
{
- OnTargetOutput (false, message);
+ OnTargetOutput (true, message);
}
protected override void EndSession ()
diff --git a/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/SoftDebuggerEngine.cs b/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/SoftDebuggerEngine.cs
index 4c58df2133..f04bc311f4 100644
--- a/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/SoftDebuggerEngine.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/SoftDebuggerEngine.cs
@@ -38,14 +38,14 @@ using MonoDevelop.Core.Assemblies;
namespace MonoDevelop.Debugger.Soft
{
- public class SoftDebuggerEngine: IDebuggerEngine
+ public class SoftDebuggerEngine: DebuggerEngineBackend
{
static SoftDebuggerEngine ()
{
DebuggerLoggingService.CustomLogger = new MDLogger ();
}
- public bool CanDebugCommand (ExecutionCommand cmd)
+ public override bool CanDebugCommand (ExecutionCommand cmd)
{
var netCmd = cmd as DotNetExecutionCommand;
if (netCmd == null)
@@ -54,6 +54,11 @@ namespace MonoDevelop.Debugger.Soft
return CanDebugRuntime (netCmd.TargetRuntime);
}
+ public override bool IsDefaultDebugger (ExecutionCommand cmd)
+ {
+ return true;
+ }
+
public static bool CanDebugRuntime (TargetRuntime runtime)
{
var mrun = runtime as MonoTargetRuntime;
@@ -63,7 +68,7 @@ namespace MonoDevelop.Debugger.Soft
return mrun.AssemblyContext.GetAssemblyLocation ("Mono.Debugger.Soft", null) != null;
}
- public DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand c)
+ public override DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand c)
{
var cmd = (DotNetExecutionCommand) c;
var runtime = (MonoTargetRuntime)cmd.TargetRuntime;
@@ -90,12 +95,7 @@ namespace MonoDevelop.Debugger.Soft
return dsi;
}
- public ProcessInfo[] GetAttachableProcesses ()
- {
- return new ProcessInfo [0];
- }
-
- public DebuggerSession CreateSession ()
+ public override DebuggerSession CreateSession ()
{
return new SoftDebuggerSession ();
}
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Extensions/DebuggerExtensions.cs b/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Extensions/DebuggerExtensions.cs
index c0a1192d65..e6411cc4c7 100644
--- a/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Extensions/DebuggerExtensions.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Extensions/DebuggerExtensions.cs
@@ -122,13 +122,15 @@ namespace Microsoft.Samples.Debugging.Extensions
si.hStdError = errorWritePipe;
}
- internal static void SetupOutputRedirection (STARTUPINFO si, ref int flags, SafeFileHandle outReadPipe, SafeFileHandle errorReadPipe)
+ internal static void SetupOutputRedirection (STARTUPINFO si, ref int flags, out SafeFileHandle outReadPipe, out SafeFileHandle errorReadPipe)
{
if ((flags & CREATE_REDIRECT_STD) != 0) {
CreateHandles (si, out outReadPipe, out errorReadPipe);
flags &= ~CREATE_REDIRECT_STD;
}
else {
+ outReadPipe = null;
+ errorReadPipe = null;
si.hStdInput = new SafeFileHandle (IntPtr.Zero, false);
si.hStdOutput = new SafeFileHandle (IntPtr.Zero, false);
si.hStdError = new SafeFileHandle (IntPtr.Zero, false);
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Extensions/MetadataExtensions.cs b/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Extensions/MetadataExtensions.cs
index e8b6375678..f319f95151 100644
--- a/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Extensions/MetadataExtensions.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Extensions/MetadataExtensions.cs
@@ -270,6 +270,15 @@ namespace Microsoft.Samples.Debugging.Extensions
attr = GetCustomAttribute (importer, token, typeof (System.Diagnostics.DebuggerHiddenAttribute));
if (attr != null)
attributes.Add (attr);
+ attr = GetCustomAttribute (importer, token, typeof (System.Diagnostics.DebuggerStepThroughAttribute));
+ if (attr != null)
+ attributes.Add (attr);
+ attr = GetCustomAttribute (importer, token, typeof (System.Diagnostics.DebuggerNonUserCodeAttribute));
+ if (attr != null)
+ attributes.Add (attr);
+ attr = GetCustomAttribute (importer, token, typeof (System.Diagnostics.DebuggerStepperBoundaryAttribute));
+ if (attr != null)
+ attributes.Add (attr);
return attributes.Count == 0 ? emptyAttributes : attributes.ToArray ();
}
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Metadata/MetadataPropertyInfo.cs b/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Metadata/MetadataPropertyInfo.cs
index b2caeea90b..f9ce48f076 100644
--- a/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Metadata/MetadataPropertyInfo.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Metadata/MetadataPropertyInfo.cs
@@ -163,7 +163,9 @@ namespace Microsoft.Samples.Debugging.CorMetadata
public override Type DeclaringType
{
- get { throw new NotImplementedException (); }
+ get {
+ return m_declaringType;
+ }
}
public override bool IsDefined (Type attributeType, bool inherit)
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Metadata/MetadataType.cs b/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Metadata/MetadataType.cs
index 90aa89e00e..0230f65180 100644
--- a/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Metadata/MetadataType.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Metadata/MetadataType.cs
@@ -212,7 +212,7 @@ namespace Microsoft.Samples.Debugging.CorMetadata
{
get
{
- throw new NotImplementedException();
+ return Type.GetType (FullName);
}
}
@@ -444,7 +444,7 @@ namespace Microsoft.Samples.Debugging.CorMetadata
break;
var prop = new MetadataPropertyInfo (m_importer, methodToken, this);
try {
- MethodInfo mi = prop.GetGetMethod () ?? prop.GetSetMethod ();
+ MethodInfo mi = prop.GetGetMethod (true) ?? prop.GetSetMethod (true);
if (mi == null)
continue;
if (MetadataExtensions.TypeFlagsMatch (mi.IsPublic, mi.IsStatic, bindingAttr))
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/SymStore/SymReader.cs b/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/SymStore/SymReader.cs
index 5f1d008cbf..9d31798156 100644
--- a/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/SymStore/SymReader.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/SymStore/SymReader.cs
@@ -19,6 +19,17 @@ namespace Microsoft.Samples.Debugging.CorSymbolStore
[
ComImport,
+ Guid("969708D2-05E5-4861-A3B0-96E473CDF63F"),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
+ ComVisible(false)
+ ]
+ public interface ISymUnmanagedDispose
+ {
+ int Destroy();
+ }
+
+ [
+ ComImport,
Guid("B4CE6286-2A6B-3712-A3B7-1EE1DAD467B5"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
ComVisible(false)
@@ -158,7 +169,9 @@ namespace Microsoft.Samples.Debugging.CorSymbolStore
public void Dispose()
{
- // Release our unmanaged resources
+ var disposable = m_reader as ISymUnmanagedDispose;
+ if (disposable != null)
+ disposable.Destroy();
m_reader = null;
}
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/debug/Debugger.cs b/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/debug/Debugger.cs
index 7f31cd1306..3563897f6d 100644
--- a/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/debug/Debugger.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/debug/Debugger.cs
@@ -202,7 +202,7 @@ namespace Microsoft.Samples.Debugging.CorDebug
// initialize safe handles
// [Xamarin] ASP.NET Debugging and output redirection.
SafeFileHandle outReadPipe = null, errorReadPipe = null;
- DebuggerExtensions.SetupOutputRedirection (si, ref flags, outReadPipe, errorReadPipe);
+ DebuggerExtensions.SetupOutputRedirection (si, ref flags, out outReadPipe, out errorReadPipe);
IntPtr env = DebuggerExtensions.SetupEnvironment (environment);
CorProcess ret;
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/ArrayAdaptor.cs b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/ArrayAdaptor.cs
index 2d24b28685..2a2188e8ae 100644
--- a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/ArrayAdaptor.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/ArrayAdaptor.cs
@@ -73,7 +73,7 @@ namespace MonoDevelop.Debugger.Win32
idx[i] = indices[i];
for (int i = 0; i < count; i++) {
- elements.Add (GetElement (idx));
+ elements.Add (GetElement ((int[])idx.Clone ()));
idx[idx.Length - 1]++;
}
@@ -83,6 +83,7 @@ namespace MonoDevelop.Debugger.Win32
public void SetElement (int[] indices, object val)
{
CorValRef it = (CorValRef) GetElement (indices);
+ obj.IsValid = false;
it.SetValue (ctx, (CorValRef) val);
}
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerBacktrace.cs b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerBacktrace.cs
index 373bad3e69..d8ff9db670 100644
--- a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerBacktrace.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerBacktrace.cs
@@ -6,6 +6,7 @@ using Microsoft.Samples.Debugging.CorDebug.NativeApi;
using Microsoft.Samples.Debugging.CorMetadata;
using Mono.Debugging.Client;
using Mono.Debugging.Evaluation;
+using System.Linq;
namespace MonoDevelop.Debugger.Win32
{
@@ -76,6 +77,102 @@ namespace MonoDevelop.Debugger.Win32
return array;
}
+ private const int SpecialSequencePoint = 0xfeefee;
+
+ public static SequencePoint GetSequencePoint(CorDebuggerSession session, CorFrame frame)
+ {
+ ISymbolReader reader = session.GetReaderForModule (frame.Function.Module.Name);
+ if (reader == null)
+ return null;
+
+ ISymbolMethod met = reader.GetMethod (new SymbolToken (frame.Function.Token));
+ if (met == null)
+ return null;
+
+ int SequenceCount = met.SequencePointCount;
+ if (SequenceCount <= 0)
+ return null;
+
+ CorDebugMappingResult mappingResult;
+ uint ip;
+ frame.GetIP (out ip, out mappingResult);
+ if (mappingResult == CorDebugMappingResult.MAPPING_NO_INFO || mappingResult == CorDebugMappingResult.MAPPING_UNMAPPED_ADDRESS)
+ return null;
+
+ int[] offsets = new int[SequenceCount];
+ int[] lines = new int[SequenceCount];
+ int[] endLines = new int[SequenceCount];
+ int[] columns = new int[SequenceCount];
+ int[] endColumns = new int[SequenceCount];
+ ISymbolDocument[] docs = new ISymbolDocument[SequenceCount];
+ met.GetSequencePoints (offsets, docs, lines, columns, endLines, endColumns);
+
+ if ((SequenceCount > 0) && (offsets [0] <= ip)) {
+ int i;
+ for (i = 0; i < SequenceCount; ++i) {
+ if (offsets [i] >= ip) {
+ break;
+ }
+ }
+
+ if ((i == SequenceCount) || (offsets [i] != ip)) {
+ --i;
+ }
+
+ if (lines [i] == SpecialSequencePoint) {
+ int j = i;
+ // let's try to find a sequence point that is not special somewhere earlier in the code
+ // stream.
+ while (j > 0) {
+ --j;
+ if (lines [j] != SpecialSequencePoint) {
+ return new SequencePoint () {
+ IsSpecial = true,
+ Offset = offsets [j],
+ StartLine = lines [j],
+ EndLine = endLines [j],
+ StartColumn = columns [j],
+ EndColumn = endColumns [j],
+ Document = docs [j]
+ };
+ }
+ }
+ // we didn't find any non-special seqeunce point before current one, let's try to search
+ // after.
+ j = i;
+ while (++j < SequenceCount) {
+ if (lines [j] != SpecialSequencePoint) {
+ return new SequencePoint () {
+ IsSpecial = true,
+ Offset = offsets [j],
+ StartLine = lines [j],
+ EndLine = endLines [j],
+ StartColumn = columns [j],
+ EndColumn = endColumns [j],
+ Document = docs [j]
+ };
+ }
+ }
+
+ // Even if sp is null at this point, it's a valid scenario to have only special sequence
+ // point in a function. For example, we can have a compiler-generated default ctor which
+ // doesn't have any source.
+ return null;
+ } else {
+ return new SequencePoint () {
+ IsSpecial = false,
+ Offset = offsets [i],
+ StartLine = lines [i],
+ EndLine = endLines [i],
+ StartColumn = columns [i],
+ EndColumn = endColumns [i],
+ Document = docs [i]
+ };
+ }
+ }
+ return null;
+ }
+
internal static StackFrame CreateFrame (CorDebuggerSession session, CorFrame frame)
{
// TODO: Fix remaining.
@@ -102,44 +199,52 @@ namespace MonoDevelop.Debugger.Win32
method = mi.DeclaringType.FullName + "." + mi.Name;
type = mi.DeclaringType.FullName;
addressSpace = mi.Name;
- ISymbolReader reader = session.GetReaderForModule (frame.Function.Module.Name);
- if (reader != null) {
- ISymbolMethod met = reader.GetMethod (new SymbolToken (frame.Function.Token));
- if (met != null) {
- CorDebugMappingResult mappingResult;
- frame.GetIP (out address, out mappingResult);
- SequencePoint prevSp = null;
- foreach (SequencePoint sp in met.GetSequencePoints ()) {
- if (sp.Offset > address)
- break;
- prevSp = sp;
- }
- if (prevSp != null) {
- line = prevSp.Line;
- column = prevSp.Offset;
- file = prevSp.Document.URL;
- address = (uint)prevSp.Offset;
- }
+
+ var sp = GetSequencePoint (session, frame);
+ if (sp != null) {
+ line = sp.StartLine;
+ column = sp.StartColumn;
+ file = sp.Document.URL;
+ address = (uint)sp.Offset;
+ }
+
+ if (session.IsExternalCode (file)) {
+ external = true;
+ } else {
+ if (session.Options.ProjectAssembliesOnly) {
+ external = mi.GetCustomAttributes (true).Any (v =>
+ v is System.Diagnostics.DebuggerHiddenAttribute ||
+ v is System.Diagnostics.DebuggerNonUserCodeAttribute);
+ } else {
+ external = mi.GetCustomAttributes (true).Any (v =>
+ v is System.Diagnostics.DebuggerHiddenAttribute);
}
}
- // FIXME: Still steps into.
- //hidden = mi.GetCustomAttributes (true).Any (v => v is System.Diagnostics.DebuggerHiddenAttribute);
+ hidden = mi.GetCustomAttributes (true).Any (v => v is System.Diagnostics.DebuggerHiddenAttribute);
}
lang = "Managed";
hasDebugInfo = true;
- }
- else if (frame.FrameType == CorFrameType.NativeFrame) {
+ } else if (frame.FrameType == CorFrameType.NativeFrame) {
frame.GetNativeIP (out address);
method = "<Unknown>";
lang = "Native";
- }
- else if (frame.FrameType == CorFrameType.InternalFrame) {
+ } else if (frame.FrameType == CorFrameType.InternalFrame) {
switch (frame.InternalFrameType) {
- case CorDebugInternalFrameType.STUBFRAME_M2U: method = "[Managed to Native Transition]"; break;
- case CorDebugInternalFrameType.STUBFRAME_U2M: method = "[Native to Managed Transition]"; break;
- case CorDebugInternalFrameType.STUBFRAME_LIGHTWEIGHT_FUNCTION: method = "[Lightweight Method Call]"; break;
- case CorDebugInternalFrameType.STUBFRAME_APPDOMAIN_TRANSITION: method = "[Application Domain Transition]"; break;
- case CorDebugInternalFrameType.STUBFRAME_FUNC_EVAL: method = "[Function Evaluation]"; break;
+ case CorDebugInternalFrameType.STUBFRAME_M2U:
+ method = "[Managed to Native Transition]";
+ break;
+ case CorDebugInternalFrameType.STUBFRAME_U2M:
+ method = "[Native to Managed Transition]";
+ break;
+ case CorDebugInternalFrameType.STUBFRAME_LIGHTWEIGHT_FUNCTION:
+ method = "[Lightweight Method Call]";
+ break;
+ case CorDebugInternalFrameType.STUBFRAME_APPDOMAIN_TRANSITION:
+ method = "[Application Domain Transition]";
+ break;
+ case CorDebugInternalFrameType.STUBFRAME_FUNC_EVAL:
+ method = "[Function Evaluation]";
+ break;
}
}
@@ -147,7 +252,7 @@ namespace MonoDevelop.Debugger.Win32
method = "<Unknown>";
var loc = new SourceLocation (method, file, line, column);
- return new StackFrame ((long) address, addressSpace, loc, lang, external, hasDebugInfo, hidden, null, null);
+ return new StackFrame ((long)address, addressSpace, loc, lang, external, hasDebugInfo, hidden, null, null);
}
#endregion
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerSession.cs b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerSession.cs
index ec54e33a16..7fd725f501 100644
--- a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerSession.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerSession.cs
@@ -14,6 +14,7 @@ using Microsoft.Samples.Debugging.Extensions;
using Mono.Debugging.Backend;
using Mono.Debugging.Client;
using Mono.Debugging.Evaluation;
+using System.Linq;
namespace MonoDevelop.Debugger.Win32
{
@@ -28,6 +29,8 @@ namespace MonoDevelop.Debugger.Win32
CorStepper stepper;
bool terminated;
bool evaluating;
+ bool autoStepInto;
+ bool stepInsideDebuggerHidden=false;
int processId;
static int evaluationTimestamp;
@@ -88,12 +91,34 @@ namespace MonoDevelop.Debugger.Win32
// There is no explicit way of disposing the metadata objects, so we have
// to rely on the GC to do it.
+ foreach (var module in modules.Values) {
+ var disposable = module.Reader as IDisposable;
+ if (disposable != null)
+ disposable.Dispose ();
+ }
+
+ //Same readers are already disposed in previous loop but
+ //seems more proper to do it again
+ foreach (var doc in documents.Values) {
+ var disposable = doc.Reader as IDisposable;
+ if (disposable != null)
+ disposable.Dispose ();
+ }
+
modules = null;
documents = null;
threads = null;
processes = null;
activeThread = null;
- GC.Collect ();
+
+ ThreadPool.QueueUserWorkItem (delegate {
+ Thread.Sleep (2000);
+ GC.Collect ();
+ GC.WaitForPendingFinalizers ();
+ Thread.Sleep (20000);
+ GC.Collect ();
+ GC.WaitForPendingFinalizers ();
+ });
}
void TerminateDebugger ()
@@ -184,7 +209,7 @@ namespace MonoDevelop.Debugger.Win32
void OnLogMessage (object sender, CorLogMessageEventArgs e)
{
- OnTargetOutput (false, e.Message);
+ OnTargetDebug (e.Level, e.LogSwitchName, e.Message);
e.Continue = true;
}
@@ -228,6 +253,38 @@ namespace MonoDevelop.Debugger.Win32
OnTargetEvent (args);
}
+ bool StepThrough (MethodInfo methodInfo)
+ {
+ var m = methodInfo.GetCustomAttributes (true);
+ if (Options.ProjectAssembliesOnly) {
+ return methodInfo.GetCustomAttributes (true).Any (v =>
+ v is System.Diagnostics.DebuggerHiddenAttribute ||
+ v is System.Diagnostics.DebuggerStepThroughAttribute ||
+ v is System.Diagnostics.DebuggerNonUserCodeAttribute);
+ } else {
+ return methodInfo.GetCustomAttributes (true).Any (v =>
+ v is System.Diagnostics.DebuggerHiddenAttribute ||
+ v is System.Diagnostics.DebuggerStepThroughAttribute);
+ }
+ }
+
+ bool ContinueOnStepIn(MethodInfo methodInfo)
+ {
+ return methodInfo.GetCustomAttributes (true).Any (v => v is System.Diagnostics.DebuggerStepperBoundaryAttribute);
+ }
+
+ static bool IsPropertyOrOperatorMethod (MethodInfo method)
+ {
+ if (method == null)
+ return false;
+ string name = method.Name;
+
+ return method.IsSpecialName &&
+ (name.StartsWith ("get_", StringComparison.Ordinal) ||
+ name.StartsWith ("set_", StringComparison.Ordinal) ||
+ name.StartsWith ("op_", StringComparison.Ordinal));
+ }
+
void OnStepComplete (object sender, CorStepCompleteEventArgs e)
{
lock (debugLock) {
@@ -236,6 +293,64 @@ namespace MonoDevelop.Debugger.Win32
return;
}
}
+
+ bool localAutoStepInto = autoStepInto;
+ autoStepInto = false;
+ bool localStepInsideDebuggerHidden = stepInsideDebuggerHidden;
+ stepInsideDebuggerHidden = false;
+
+ if (e.AppDomain.Process.HasQueuedCallbacks (e.Thread)) {
+ e.Continue = true;
+ return;
+ }
+
+ if (localAutoStepInto) {
+ Step (true);
+ e.Continue = true;
+ return;
+ }
+
+ if (ContinueOnStepIn (e.Thread.ActiveFrame.Function.GetMethodInfo (this))) {
+ e.Continue = true;
+ return;
+ }
+
+ var currentSequence = CorBacktrace.GetSequencePoint (this, e.Thread.ActiveFrame);
+ if (currentSequence == null) {
+ stepper.StepOut ();
+ autoStepInto = true;
+ e.Continue = true;
+ return;
+ }
+
+ if (StepThrough (e.Thread.ActiveFrame.Function.GetMethodInfo (this))) {
+ stepInsideDebuggerHidden = e.StepReason == CorDebugStepReason.STEP_CALL;
+ RawContinue (true, true);
+ e.Continue = true;
+ return;
+ }
+
+ if (Options.StepOverPropertiesAndOperators &&
+ IsPropertyOrOperatorMethod (e.Thread.ActiveFrame.Function.GetMethodInfo (this)) &&
+ e.StepReason == CorDebugStepReason.STEP_CALL) {
+ stepper.StepOut ();
+ autoStepInto = true;
+ e.Continue = true;
+ return;
+ }
+
+ if (currentSequence.IsSpecial) {
+ Step (false);
+ e.Continue = true;
+ return;
+ }
+
+ if (localStepInsideDebuggerHidden && e.StepReason == CorDebugStepReason.STEP_RETURN) {
+ Step (true);
+ e.Continue = true;
+ return;
+ }
+
OnStopped ();
e.Continue = false;
SetActiveThread (e.Thread);
@@ -270,7 +385,7 @@ namespace MonoDevelop.Debugger.Win32
binfo.IncrementHitCount();
if (!binfo.HitCountReached)
return;
-
+
if (!string.IsNullOrEmpty (bp.ConditionExpression)) {
string res = EvaluateExpression (e.Thread, bp.ConditionExpression);
if (bp.BreakIfConditionChanges) {
@@ -295,12 +410,18 @@ namespace MonoDevelop.Debugger.Win32
}
}
}
-
+
+ if (e.AppDomain.Process.HasQueuedCallbacks (e.Thread)) {
+ e.Continue = true;
+ return;
+ }
+
OnStopped ();
e.Continue = false;
// If a breakpoint is hit while stepping, cancel the stepping operation
if (stepper != null && stepper.IsActive ())
stepper.Deactivate ();
+ autoStepInto = false;
SetActiveThread (e.Thread);
TargetEventArgs args = new TargetEventArgs (TargetEventType.TargetHitBreakpoint);
args.Process = GetProcess (process);
@@ -317,12 +438,6 @@ namespace MonoDevelop.Debugger.Win32
void OnUpdateModuleSymbols (object sender, CorUpdateModuleSymbolsEventArgs e)
{
- SymbolBinder binder = new SymbolBinder ();
- CorMetadataImport mi = new CorMetadataImport (e.Module);
- ISymbolReader reader = binder.GetReaderFromStream (mi.RawCOMObject, e.Stream);
- foreach (ISymbolDocument doc in reader.GetDocuments ()) {
- Console.WriteLine (doc.URL);
- }
e.Continue = true;
}
@@ -333,6 +448,7 @@ namespace MonoDevelop.Debugger.Win32
// If the main thread stopped, terminate the debugger session
if (e.Process.Id == process.Id) {
lock (terminateLock) {
+ process.Dispose ();
process = null;
ThreadPool.QueueUserWorkItem (delegate
{
@@ -492,7 +608,7 @@ namespace MonoDevelop.Debugger.Win32
// If an exception is thrown while stepping, cancel the stepping operation
if (stepper != null && stepper.IsActive ())
stepper.Deactivate ();
-
+ autoStepInto = false;
SetActiveThread (e.Thread);
args.Process = GetProcess (process);
@@ -501,7 +617,13 @@ namespace MonoDevelop.Debugger.Win32
OnTargetEvent (args);
}
}
-
+
+ public bool IsExternalCode (string fileName)
+ {
+ return string.IsNullOrWhiteSpace (fileName)
+ || !documents.ContainsKey (fileName);
+ }
+
private bool IsCatchpoint (CorException2EventArgs e)
{
// Build up the exception type hierachy
@@ -512,10 +634,13 @@ namespace MonoDevelop.Debugger.Win32
exceptions.Add(t.GetTypeInfo(this).FullName);
t = t.Base;
}
-
+ if (exceptions.Count == 0)
+ return false;
// See if a catchpoint is set for this exception.
foreach (Catchpoint cp in Breakpoints.GetCatchpoints()) {
- if (cp.Enabled && exceptions.Contains(cp.ExceptionName)) {
+ if (cp.Enabled &&
+ ((cp.IncludeSubclasses && exceptions.Contains (cp.ExceptionName)) ||
+ (exceptions [0] == cp.ExceptionName))) {
return true;
}
}
@@ -655,8 +780,7 @@ namespace MonoDevelop.Debugger.Win32
protected override BreakEventInfo OnInsertBreakEvent (BreakEvent be)
{
- return MtaThread.Run (delegate
- {
+ return MtaThread.Run (delegate {
var binfo = new BreakEventInfo ();
lock (documents) {
@@ -666,8 +790,7 @@ namespace MonoDevelop.Debugger.Win32
// FIXME: implement breaking on function name
binfo.SetStatus (BreakEventStatus.Invalid, null);
return binfo;
- }
- else {
+ } else {
DocInfo doc;
if (!documents.TryGetValue (System.IO.Path.GetFullPath (bp.FileName), out doc)) {
binfo.SetStatus (BreakEventStatus.NotBound, null);
@@ -677,25 +800,52 @@ namespace MonoDevelop.Debugger.Win32
int line;
try {
line = doc.Document.FindClosestLine (bp.Line);
- }
- catch {
+ } catch {
// Invalid line
binfo.SetStatus (BreakEventStatus.Invalid, null);
return binfo;
}
- ISymbolMethod met = doc.Reader.GetMethodFromDocumentPosition (doc.Document, line, 0);
+ ISymbolMethod met = null;
+ if (doc.Reader is ISymbolReader2) {
+ var methods = ((ISymbolReader2)doc.Reader).GetMethodsFromDocumentPosition (doc.Document, line, 0);
+ if (methods != null && methods.Any ()) {
+ if (methods.Count () == 1) {
+ met = methods [0];
+ } else {
+ int deepest = -1;
+ foreach (var method in methods) {
+ var firstSequence = method.GetSequencePoints ().FirstOrDefault ((sp) => sp.StartLine != 0xfeefee);
+ if (firstSequence != null && firstSequence.StartLine >= deepest) {
+ deepest = firstSequence.StartLine;
+ met = method;
+ }
+ }
+ }
+ }
+ }
+ if (met == null) {
+ met = doc.Reader.GetMethodFromDocumentPosition (doc.Document, line, 0);
+ }
if (met == null) {
binfo.SetStatus (BreakEventStatus.Invalid, null);
return binfo;
}
int offset = -1;
+ int firstSpInLine = -1;
foreach (SequencePoint sp in met.GetSequencePoints ()) {
- if (sp.Line == line && sp.Document.URL == doc.Document.URL) {
+ if (sp.IsInside (doc.Document.URL, line, bp.Column)) {
offset = sp.Offset;
break;
+ } else if (firstSpInLine == -1
+ && sp.StartLine == line
+ && sp.Document.URL.Equals (doc.Document.URL, StringComparison.OrdinalIgnoreCase)) {
+ firstSpInLine = sp.Offset;
}
}
+ if (offset == -1) {//No exact match? Use first match in that line
+ offset = firstSpInLine;
+ }
if (offset == -1) {
binfo.SetStatus (BreakEventStatus.Invalid, null);
return binfo;
@@ -704,7 +854,7 @@ namespace MonoDevelop.Debugger.Win32
CorFunction func = doc.Module.GetFunctionFromToken (met.Token.GetToken ());
CorFunctionBreakpoint corBp = func.ILCode.CreateBreakpoint (offset);
corBp.Activate (bp.Enabled);
- breakpoints[corBp] = binfo;
+ breakpoints [corBp] = binfo;
binfo.Handle = corBp;
binfo.SetStatus (BreakEventStatus.Bound, null);
@@ -748,7 +898,6 @@ namespace MonoDevelop.Debugger.Win32
{
try {
if (stepper != null) {
- stepper.IsActive ();
CorFrame frame = activeThread.ActiveFrame;
ISymbolReader reader = GetReaderForModule (frame.Function.Module.Name);
if (reader == null) {
@@ -765,30 +914,23 @@ namespace MonoDevelop.Debugger.Win32
CorDebugMappingResult mappingResult;
frame.GetIP (out offset, out mappingResult);
- // Find the current line
- SequencePoint currentSeq = null;
- foreach (SequencePoint sp in met.GetSequencePoints ()) {
- if (sp.Offset > offset)
- break;
- currentSeq = sp;
- }
-
- if (currentSeq == null) {
- RawContinue (into);
- return;
- }
-
// Exclude all ranges belonging to the current line
List<COR_DEBUG_STEP_RANGE> ranges = new List<COR_DEBUG_STEP_RANGE> ();
- SequencePoint lastSeq = null;
- foreach (SequencePoint sp in met.GetSequencePoints ()) {
- if (lastSeq != null && lastSeq.Line == currentSeq.Line) {
- COR_DEBUG_STEP_RANGE r = new COR_DEBUG_STEP_RANGE ();
- r.startOffset = (uint) lastSeq.Offset;
- r.endOffset = (uint) sp.Offset;
+ var sequencePoints = met.GetSequencePoints ().ToArray ();
+ for (int i = 0; i < sequencePoints.Length; i++) {
+ if (sequencePoints [i].Offset > offset) {
+ var r = new COR_DEBUG_STEP_RANGE ();
+ r.startOffset = i == 0 ? 0 : (uint)sequencePoints [i - 1].Offset;
+ r.endOffset = (uint)sequencePoints [i].Offset;
ranges.Add (r);
+ break;
}
- lastSeq = sp;
+ }
+ if (ranges.Count == 0 && sequencePoints.Length > 0) {
+ var r = new COR_DEBUG_STEP_RANGE ();
+ r.startOffset = (uint)sequencePoints [sequencePoints.Length - 1].Offset;
+ r.endOffset = uint.MaxValue;
+ ranges.Add (r);
}
stepper.StepRange (into, ranges.ToArray ());
@@ -802,9 +944,12 @@ namespace MonoDevelop.Debugger.Win32
}
}
- private void RawContinue (bool into)
+ private void RawContinue (bool into, bool stepOverAll = false)
{
- stepper.Step (into);
+ if (stepOverAll)
+ stepper.StepRange (into, new[]{ new COR_DEBUG_STEP_RANGE (){ startOffset = 0, endOffset = uint.MaxValue } });
+ else
+ stepper.Step (into);
ClearEvalStatus ();
process.Continue (false);
}
@@ -830,6 +975,8 @@ namespace MonoDevelop.Debugger.Win32
MtaThread.Run (delegate
{
activeThread = null;
+ if (stepper != null && stepper.IsActive ())
+ stepper.Deactivate ();
stepper = null;
foreach (CorThread t in process.Threads) {
if (t.Id == threadId) {
@@ -843,6 +990,9 @@ namespace MonoDevelop.Debugger.Win32
void SetActiveThread (CorThread t)
{
activeThread = t;
+ if (stepper != null && stepper.IsActive ()) {
+ stepper.Deactivate ();
+ }
stepper = activeThread.CreateStepper ();
stepper.SetUnmappedStopMask (CorDebugUnmappedStop.STOP_NONE);
stepper.SetJmcStatus (true);
@@ -1229,13 +1379,78 @@ namespace MonoDevelop.Debugger.Win32
return (T)(object)new MtaRawValueString ((IRawValueString)obj);
return obj;
}
+
+ public override bool CanSetNextStatement {
+ get {
+ return true;
+ }
+ }
+
+ protected override void OnSetNextStatement (long threadId, string fileName, int line, int column)
+ {
+ if (!CanSetNextStatement)
+ throw new NotSupportedException ();
+ MtaThread.Run (delegate {
+ var thread = GetThread ((int)threadId);
+ if (thread == null)
+ throw new ArgumentException ("Unknown thread.");
+
+ CorFrame frame = thread.ActiveFrame;
+ if (frame == null)
+ throw new NotSupportedException ();
+
+ ISymbolMethod met = frame.Function.GetSymbolMethod (this);
+ if (met == null) {
+ throw new NotSupportedException ();
+ }
+
+ int offset = -1;
+ int firstSpInLine = -1;
+ foreach (SequencePoint sp in met.GetSequencePoints ()) {
+ if (sp.IsInside (fileName, line, column)) {
+ offset = sp.Offset;
+ break;
+ } else if (firstSpInLine == -1
+ && sp.StartLine == line
+ && sp.Document.URL.Equals (fileName, StringComparison.OrdinalIgnoreCase)) {
+ firstSpInLine = sp.Offset;
+ }
+ }
+ if (offset == -1) {//No exact match? Use first match in that line
+ offset = firstSpInLine;
+ }
+ if (offset == -1) {
+ throw new NotSupportedException ();
+ }
+ try {
+ frame.SetIP (offset);
+ } catch {
+ throw new NotSupportedException ();
+ }
+ });
+ }
}
class SequencePoint
{
- public int Line;
+ public int StartLine;
+ public int EndLine;
+ public int StartColumn;
+ public int EndColumn;
public int Offset;
+ public bool IsSpecial;
public ISymbolDocument Document;
+
+ public bool IsInside (string fileUrl, int line, int column)
+ {
+ if (!Document.URL.Equals (fileUrl, StringComparison.OrdinalIgnoreCase))
+ return false;
+ if (line < StartLine || (line == StartLine && column < StartColumn))
+ return false;
+ if (line > EndLine || (line == EndLine && column > EndColumn))
+ return false;
+ return true;
+ }
}
static class SequencePointExt
@@ -1252,11 +1467,12 @@ namespace MonoDevelop.Debugger.Win32
met.GetSequencePoints (offsets, docs, lines, columns, endLines, endColumns);
for (int n = 0; n < sc; n++) {
- if (columns[n] == 0)
- continue;
SequencePoint sp = new SequencePoint ();
sp.Document = docs[n];
- sp.Line = lines[n];
+ sp.StartLine = lines[n];
+ sp.EndLine = endLines[n];
+ sp.StartColumn = columns[n];
+ sp.EndColumn = endColumns[n];
sp.Offset = offsets[n];
yield return sp;
}
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorObjectAdaptor.cs b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorObjectAdaptor.cs
index 6c6e1203bd..5caa63f289 100644
--- a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorObjectAdaptor.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorObjectAdaptor.cs
@@ -78,15 +78,14 @@ namespace MonoDevelop.Debugger.Win32
return GetRealObject (ctx, val) is CorStringValue;
}
- public override bool IsClassInstance (EvaluationContext ctx, object val)
- {
- return GetRealObject (ctx, val) is CorObjectValue;
- }
-
public override bool IsNull (EvaluationContext ctx, object gval)
{
- CorValRef val = (CorValRef) gval;
- return val == null || ((val.Val is CorReferenceValue) && ((CorReferenceValue) val.Val).IsNull);
+ var val = (CorValRef)gval;
+ if (val == null || ((val.Val is CorReferenceValue) && ((CorReferenceValue)val.Val).IsNull))
+ return true;
+
+ var obj = GetRealObject (ctx, val);
+ return (obj is CorReferenceValue) && ((CorReferenceValue)obj).IsNull;
}
public override bool IsValueType (object type)
@@ -99,6 +98,10 @@ namespace MonoDevelop.Debugger.Win32
var t = (CorType) type;
var cctx = (CorEvaluationContext)ctx;
Type tt;
+ if (t.Type == CorElementType.ELEMENT_TYPE_STRING ||
+ t.Type == CorElementType.ELEMENT_TYPE_ARRAY ||
+ t.Type == CorElementType.ELEMENT_TYPE_SZARRAY)
+ return true;
// Primitive check
if (MetadataHelperFunctionsExtensions.CoreTypes.TryGetValue (t.Type, out tt))
return false;
@@ -149,6 +152,24 @@ namespace MonoDevelop.Debugger.Win32
return ((CorType) type).Base;
}
+ protected override object GetBaseTypeWithAttribute (EvaluationContext ctx, object type, object attrType)
+ {
+ var wctx = (CorEvaluationContext) ctx;
+ var attr = ((CorType) attrType).GetTypeInfo (wctx.Session);
+ var tm = type as CorType;
+
+ while (tm != null) {
+ var t = tm.GetTypeInfo (wctx.Session);
+
+ if (t.GetCustomAttributes (attr, false).Any ())
+ return tm;
+
+ tm = tm.Base;
+ }
+
+ return null;
+ }
+
public override object[] GetTypeArgs (EvaluationContext ctx, object type)
{
CorType[] types = ((CorType)type).TypeParameters;
@@ -167,24 +188,44 @@ namespace MonoDevelop.Debugger.Win32
}
}
- Dictionary<string, CorType> typeCache = new Dictionary<string, CorType> ();
+ Dictionary<string, CorType> nameToTypeCache = new Dictionary<string, CorType> ();
+ Dictionary<CorType, string> typeToNameCache = new Dictionary<CorType, string> ();
+
+ string GetCacheName(string name, CorType[] typeArgs)
+ {
+ if (typeArgs == null || typeArgs.Length == 0)
+ return name;
+ string result = name + "<";
+ for (int i = 0; i < typeArgs.Length; i++) {
+ string currentTypeName;
+ if (!typeToNameCache.TryGetValue (typeArgs [i], out currentTypeName))
+ return null;//Unable to resolve? Don't cache. This should never happen.
+ result += currentTypeName;
+ if (i < typeArgs.Length - 1)
+ result += ",";
+ }
+ return result + ">";
+ }
+
public override object GetType (EvaluationContext gctx, string name, object[] gtypeArgs)
{
+ CorType[] typeArgs = CastArray<CorType> (gtypeArgs);
+ string cacheName = GetCacheName (name, typeArgs);
CorType fastRet;
- if (typeCache.TryGetValue (name, out fastRet))
+ if (!string.IsNullOrEmpty (cacheName) && nameToTypeCache.TryGetValue (cacheName, out fastRet))
return fastRet;
-
- CorType[] typeArgs = CastArray<CorType> (gtypeArgs);
-
- CorEvaluationContext ctx = (CorEvaluationContext) gctx;
+ CorEvaluationContext ctx = (CorEvaluationContext)gctx;
foreach (CorModule mod in ctx.Session.GetModules ()) {
CorMetadataImport mi = ctx.Session.GetMetadataForModule (mod.Name);
if (mi != null) {
foreach (Type t in mi.DefinedTypes) {
- if (t.FullName == name) {
+ if (t.FullName.Replace ('+', '.') == name.Replace ('+', '.')) {
CorClass cls = mod.GetClassFromToken (t.MetadataToken);
fastRet = cls.GetParameterizedType (CorElementType.ELEMENT_TYPE_CLASS, typeArgs);
- typeCache [name] = fastRet;
+ if (!string.IsNullOrEmpty (cacheName)) {
+ nameToTypeCache [cacheName] = fastRet;
+ typeToNameCache [fastRet] = cacheName;
+ }
return fastRet;
}
}
@@ -277,7 +318,7 @@ namespace MonoDevelop.Debugger.Win32
MethodInfo met = OverloadResolve (cctx, "ToString", targetType, new CorType[0], BindingFlags.Public | BindingFlags.Instance, false);
if (met != null && met.DeclaringType.FullName != "System.Object") {
var args = new object[0];
- object ores = RuntimeInvoke (ctx, targetType, objr, "ToString", args, args);
+ object ores = RuntimeInvoke (ctx, targetType, objr, "ToString", new object[0], args, args);
var res = GetRealObject (ctx, ores) as CorStringValue;
if (res != null)
return res.String;
@@ -325,7 +366,7 @@ namespace MonoDevelop.Debugger.Win32
ArrayAdaptor realArr = new ArrayAdaptor (ctx, arr, array);
realArr.SetElement (new [] { 0 }, val);
-
+ arr.IsValid = true;
CorType at = (CorType) GetType (ctx, "System.Array");
object[] argTypes = { GetType (ctx, "System.Int32") };
return (CorValRef)RuntimeInvoke (ctx, at, arr, "GetValue", argTypes, new object[] { CreateValue (ctx, 0) });
@@ -361,18 +402,28 @@ namespace MonoDevelop.Debugger.Win32
ParameterInfo[] parameters = method.GetParameters ();
// TODO: Check this.
for (int n = 0; n < parameters.Length; n++) {
- if (parameters[n].ParameterType == typeof(object) && (IsValueType (ctx, argValues[n])))
+ if (parameters[n].ParameterType == typeof(object) && IsValueType (ctx, argValues[n]) && !IsEnum (ctx, argValues[n]))
argValues[n] = Box (ctx, argValues[n]);
}
try {
if (method != null) {
CorValRef v = new CorValRef (delegate {
- CorFunction func = targetType.Class.Module.GetFunctionFromToken (method.MetadataToken);
+ CorModule mod = null;
+ if (targetType.Type == CorElementType.ELEMENT_TYPE_ARRAY || targetType.Type == CorElementType.ELEMENT_TYPE_SZARRAY) {
+ mod = ((CorType)ctx.Adapter.GetType (ctx, "System.Object")).Class.Module;
+ } else {
+ mod = targetType.Class.Module;
+ }
+ CorFunction func = mod.GetFunctionFromToken (method.MetadataToken);
CorValue[] args = new CorValue[argValues.Length];
for (int n = 0; n < args.Length; n++)
args[n] = argValues[n].Val;
- return ctx.RuntimeInvoke (func, new CorType[0], target != null ? target.Val : null, args);
+ if (targetType.Type == CorElementType.ELEMENT_TYPE_ARRAY || targetType.Type == CorElementType.ELEMENT_TYPE_SZARRAY) {
+ return ctx.RuntimeInvoke (func, new CorType[0], target != null ? target.Val : null, args);
+ } else {
+ return ctx.RuntimeInvoke (func, targetType.TypeParameters, target != null ? target.Val : null, args);
+ }
});
return v.Val == null ? null : v;
}
@@ -405,10 +456,14 @@ namespace MonoDevelop.Debugger.Win32
if (methodName == ".ctor")
break; // Can't create objects using constructor from base classes
- if (rtype.BaseType == null && rtype.FullName != "System.Object")
+ if ((rtype.BaseType == null && rtype.FullName != "System.Object") ||
+ currentType.Type == CorElementType.ELEMENT_TYPE_ARRAY ||
+ currentType.Type == CorElementType.ELEMENT_TYPE_SZARRAY ||
+ currentType.Type == CorElementType.ELEMENT_TYPE_STRING) {
currentType = ctx.Adapter.GetType (ctx, "System.Object") as CorType;
- else
+ } else {
currentType = currentType.Base;
+ }
}
return OverloadResolve (ctx, GetTypeName (ctx, type), methodName, argtypes, candidates, throwIfNotFound);
@@ -679,22 +734,29 @@ namespace MonoDevelop.Debugger.Win32
public CorValue CreateCorValue (EvaluationContext ctx, CorType type, params CorValRef[] args)
{
- CorEvaluationContext cctx = (CorEvaluationContext) ctx;
+ CorEvaluationContext cctx = (CorEvaluationContext)ctx;
CorValue[] vargs = new CorValue [args.Length];
- for (int n=0; n<args.Length; n++)
+ CorType[] targs = new CorType[args.Length];
+ for (int n = 0; n < args.Length; n++) {
vargs [n] = args [n].Val;
+ targs [n] = vargs [n].ExactType;
+ }
- Type t = type.GetTypeInfo (cctx.Session);
- MethodInfo ctor = null;
- foreach (MethodInfo met in t.GetMethods ()) {
- if (met.IsSpecialName && met.Name == ".ctor") {
- ParameterInfo[] pinfos = met.GetParameters ();
- if (pinfos.Length == 1) {
- ctor = met;
- break;
+ var ctor = OverloadResolve (cctx, ".ctor", type, targs, BindingFlags.Instance | BindingFlags.Public, false);
+ if (ctor == null) {
+ //TODO: Remove this if and content when Generic method inovcation is fully implemented
+ Type t = type.GetTypeInfo (cctx.Session);
+ foreach (MethodInfo met in t.GetMethods ()) {
+ if (met.IsSpecialName && met.Name == ".ctor") {
+ ParameterInfo[] pinfos = met.GetParameters ();
+ if (pinfos.Length == 1) {
+ ctor = met;
+ break;
+ }
}
}
}
+
if (ctor == null)
return null;
@@ -858,7 +920,7 @@ namespace MonoDevelop.Debugger.Win32
foreach (PropertyInfo prop in type.GetProperties (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)) {
MethodInfo mi = null;
try {
- mi = prop.CanRead ? prop.GetGetMethod () : null;
+ mi = prop.CanRead ? prop.GetGetMethod (true) : null;
}
catch {
// Ignore
@@ -869,6 +931,8 @@ namespace MonoDevelop.Debugger.Win32
propTypes.Add (t);
}
}
+ if (cctx.Adapter.IsPrimitive (ctx, target))
+ break;
t = t.Base;
}
@@ -957,7 +1021,7 @@ namespace MonoDevelop.Debugger.Win32
foreach (PropertyInfo prop in type.GetProperties (bindingFlags)) {
MethodInfo mi = null;
try {
- mi = prop.CanRead ? prop.GetGetMethod () : null;
+ mi = prop.CanRead ? prop.GetGetMethod (true) : null;
} catch {
// Ignore
}
@@ -1028,16 +1092,16 @@ namespace MonoDevelop.Debugger.Win32
while (type != null) {
var tt = type.GetTypeInfo (cctx.Session);
- FieldInfo field = FindByName (tt.GetFields (), f => f.Name, name, ctx.CaseSensitive);
+ FieldInfo field = FindByName (tt.GetFields (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance), f => f.Name, name, ctx.CaseSensitive);
if (field != null && (field.IsStatic || co != null))
return new FieldReference (ctx, co as CorValRef, type, field);
- PropertyInfo prop = FindByName (tt.GetProperties (), p => p.Name, name, ctx.CaseSensitive);
+ PropertyInfo prop = FindByName (tt.GetProperties (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance), p => p.Name, name, ctx.CaseSensitive);
if (prop != null && (IsStatic (prop) || co != null)) {
// Optimization: if the property has a CompilerGenerated backing field, use that instead.
// This way we avoid overhead of invoking methods on the debugee when the value is requested.
string cgFieldName = string.Format ("<{0}>{1}", prop.Name, IsAnonymousType (tt) ? "" : "k__BackingField");
- if ((field = FindByName (tt.GetFields (), f => f.Name, cgFieldName, true)) != null && IsCompilerGenerated (field))
+ if ((field = FindByName (tt.GetFields (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance), f => f.Name, cgFieldName, true)) != null && IsCompilerGenerated (field))
return new FieldReference (ctx, co as CorValRef, type, field, prop.Name, ObjectValueFlags.Property);
// Backing field not available, so do things the old fashioned way.
@@ -1305,7 +1369,10 @@ namespace MonoDevelop.Debugger.Win32
try {
CorValRef vref = new CorValRef (delegate {
- return ctx.Frame.GetArgument (0);
+ var result = ctx.Frame.GetArgument (0);
+ if (result.Type == CorElementType.ELEMENT_TYPE_BYREF)
+ return result.CastToReferenceValue ().Dereference ();
+ return result;
});
return new VariableReference (ctx, vref, "this", ObjectValueFlags.Variable | ObjectValueFlags.ReadOnly);
@@ -1474,7 +1541,7 @@ namespace MonoDevelop.Debugger.Win32
foreach (ISymbolVariable var in scope.GetLocals ()) {
if (var.Name == "$site")
continue;
- if (IsClosureReferenceLocal (var) && IsGeneratedType (var.Name)) {
+ if (IsClosureReferenceLocal (var)) {
int addr = var.AddressField1;
var vref = new CorValRef (delegate {
return ctx.Frame.GetLocalVariable (addr);
@@ -1567,10 +1634,20 @@ namespace MonoDevelop.Debugger.Win32
return null;
}
- // TODO: implement in metadatatype
public override IEnumerable<object> GetNestedTypes (EvaluationContext ctx, object type)
{
- return base.GetNestedTypes (ctx, type);
+ var cType = (CorType)type;
+ var wctx = (CorEvaluationContext)ctx;
+ var mod = cType.Class.Module;
+ int token = cType.Class.Token;
+ var module = wctx.Session.GetMetadataForModule (mod.Name);
+ foreach (var t in module.DefinedTypes) {
+ if (((MetadataType)t).DeclaringType != null && ((MetadataType)t).DeclaringType.MetadataToken == token) {
+ var cls = mod.GetClassFromToken (((MetadataType)t).MetadataToken);
+ var returnType = cls.GetParameterizedType (CorElementType.ELEMENT_TYPE_CLASS, new CorType[0]);
+ yield return returnType;
+ }
+ }
}
// TODO: implement for session
@@ -1586,8 +1663,7 @@ namespace MonoDevelop.Debugger.Win32
public override bool IsTypeLoaded (EvaluationContext ctx, object type)
{
- var t = type as Type;
- return IsTypeLoaded (ctx, t.FullName);
+ return IsTypeLoaded (ctx, GetTypeName (ctx, type));
}
// TODO: Implement GetHoistedLocalVariables
}
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/MtaThread.cs b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/MtaThread.cs
index d46b7aca0b..b38101b096 100644
--- a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/MtaThread.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/MtaThread.cs
@@ -12,20 +12,19 @@ namespace MonoDevelop.Debugger.Win32
static Exception workError;
static readonly object threadLock = new object ();
- public static R Run<R> (Func<R> ts)
+ public static R Run<R> (Func<R> ts, int timeout = 15000)
{
if (Thread.CurrentThread.GetApartmentState () == ApartmentState.MTA)
return ts ();
R res = default (R);
- Run (delegate
- {
+ Run (delegate {
res = ts ();
- });
+ }, timeout);
return res;
}
- public static void Run (Action ts)
+ public static void Run (Action ts, int timeout = 15000)
{
if (Thread.CurrentThread.GetApartmentState () == ApartmentState.MTA) {
ts ();
@@ -41,12 +40,14 @@ namespace MonoDevelop.Debugger.Win32
workThread.SetApartmentState (ApartmentState.MTA);
workThread.IsBackground = true;
workThread.Start ();
- }
- else
+ } else
// Awaken the existing thread
Monitor.Pulse (threadLock);
}
- wordDoneEvent.WaitOne ();
+ if (!wordDoneEvent.WaitOne (timeout)) {
+ workThread.Abort ();
+ throw new Exception ("Debugger operation timeout on MTA thread.");
+ }
}
if (workError != null)
throw new Exception ("Debugger operation failed", workError);
@@ -54,18 +55,25 @@ namespace MonoDevelop.Debugger.Win32
static void MtaRunner ()
{
- lock (threadLock) {
- do {
- try {
- workDelegate ();
- }
- catch (Exception ex) {
- workError = ex;
- }
- wordDoneEvent.Set ();
- }
- while (Monitor.Wait (threadLock, 60000));
+ try {
+ lock (threadLock) {
+ do {
+ try {
+ workDelegate ();
+ } catch (ThreadAbortException) {
+ return;
+ } catch (Exception ex) {
+ workError = ex;
+ } finally {
+ workDelegate = null;
+ }
+ wordDoneEvent.Set ();
+ } while (Monitor.Wait (threadLock, 60000));
+ }
+ } catch {
+ //Just in case if we abort just in moment when it leaves workDelegate ();
+ } finally {
workThread = null;
}
}
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/PropertyReference.cs b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/PropertyReference.cs
index 93fd50c4f5..8ee9ab0dcc 100644
--- a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/PropertyReference.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/PropertyReference.cs
@@ -29,6 +29,7 @@ using System.Reflection;
using Mono.Debugging.Client;
using Mono.Debugging.Evaluation;
using Microsoft.Samples.Debugging.CorDebug;
+using Microsoft.Samples.Debugging.CorDebug.NativeApi;
namespace MonoDevelop.Debugger.Win32
{
@@ -53,7 +54,12 @@ namespace MonoDevelop.Debugger.Win32
{
this.prop = prop;
this.declaringType = declaringType;
- this.module = declaringType.Class.Module;
+ if (declaringType.Type == CorElementType.ELEMENT_TYPE_ARRAY ||
+ declaringType.Type == CorElementType.ELEMENT_TYPE_SZARRAY) {
+ this.module = ((CorType)((CorEvaluationContext)ctx).Adapter.GetType (ctx, "System.Object")).Class.Module;
+ } else {
+ this.module = declaringType.Class.Module;
+ }
this.index = index;
if (!prop.GetGetMethod (true).IsStatic)
this.thisobj = thisobj;
@@ -89,24 +95,30 @@ namespace MonoDevelop.Debugger.Win32
CorValue[] args;
if (index != null) {
args = new CorValue[index.Length];
- ParameterInfo[] metArgs = prop.GetGetMethod ().GetParameters ();
+ ParameterInfo[] metArgs = prop.GetGetMethod (true).GetParameters ();
for (int n = 0; n < index.Length; n++)
args[n] = ctx.Adapter.GetBoxedArg (ctx, index[n], metArgs[n].ParameterType).Val;
}
else
args = new CorValue[0];
- MethodInfo mi = prop.GetGetMethod ();
+ MethodInfo mi = prop.GetGetMethod (true);
CorFunction func = module.GetFunctionFromToken (mi.MetadataToken);
- CorValue val = ctx.RuntimeInvoke (func, declaringType.TypeParameters, thisobj != null ? thisobj.Val : null, args);
+ CorValue val = null;
+ if (declaringType.Type == CorElementType.ELEMENT_TYPE_ARRAY ||
+ declaringType.Type == CorElementType.ELEMENT_TYPE_SZARRAY) {
+ val = ctx.RuntimeInvoke (func, new CorType[0], thisobj != null ? thisobj.Val : null, args);
+ } else {
+ val = ctx.RuntimeInvoke (func, declaringType.TypeParameters, thisobj != null ? thisobj.Val : null, args);
+ }
return cachedValue = new CorValRef (val, loader);
}
set {
CorEvaluationContext ctx = (CorEvaluationContext)Context;
- CorFunction func = module.GetFunctionFromToken (prop.GetSetMethod ().MetadataToken);
+ CorFunction func = module.GetFunctionFromToken (prop.GetSetMethod (true).MetadataToken);
CorValRef val = (CorValRef) value;
CorValue[] args;
- ParameterInfo[] metArgs = prop.GetSetMethod ().GetParameters ();
+ ParameterInfo[] metArgs = prop.GetSetMethod (true).GetParameters ();
if (index == null)
args = new CorValue[1];
@@ -140,7 +152,7 @@ namespace MonoDevelop.Debugger.Win32
internal static ObjectValueFlags GetFlags (PropertyInfo prop)
{
ObjectValueFlags flags = ObjectValueFlags.Property;
- MethodInfo mi = prop.GetGetMethod () ?? prop.GetSetMethod ();
+ MethodInfo mi = prop.GetGetMethod (true) ?? prop.GetSetMethod (true);
if (prop.GetSetMethod (true) == null)
flags |= ObjectValueFlags.ReadOnly;
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests.TestApp/BreakpointsAndStepping.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests.TestApp/BreakpointsAndStepping.cs
new file mode 100644
index 0000000000..d6c64f8a04
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests.TestApp/BreakpointsAndStepping.cs
@@ -0,0 +1,575 @@
+//
+// BreakpointsAndStepping.cs
+//
+// Author:
+// David Karlaš <david.karlas@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin, Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Net.Sockets;
+using System.Diagnostics;
+
+namespace MonoDevelop.Debugger.Tests.TestApp
+{
+ public class BreakpointsAndStepping
+ {
+ public static void RunTest ()
+ {
+ var obj = new BreakpointsAndStepping ();
+ obj.Test ();
+ }
+
+ public static string NextMethodToCall = "";
+
+ public void Test ()
+ {
+ while (true) {
+ Console.Write ("");/*break*/
+ try {
+ typeof(BreakpointsAndStepping).GetMethod (NextMethodToCall).Invoke (this, null);
+ } catch {
+ }
+ }
+ }
+
+ public void OutputAndDebugWriter ()
+ {
+ Console.Write ("NormalText");
+ Debug.Write ("DebugText");
+ Debug.Write ("");
+ System.Diagnostics.Debugger.Log (3, "SomeCategory", "DebugText2");
+ Console.Error.Write ("ErrorText");
+ Console.Write ("");
+ Console.Write ("");/*5070ed1c-593d-4cbe-b4fa-b2b0c7b25289*/
+ }
+
+ public void OneLineProperty ()
+ {
+ var testClass = new TestClass ();
+ var a = testClass.OneLineProperty;/*8e7787ed-699f-4512-b52a-5a0629a0b9eb*/
+ var b = a;/*36c0a44a-44ac-4676-b99b-9a58b73bae9d*/
+ }
+
+ public void StaticConstructorStepping ()
+ {
+ var test = new DontUseThisClassInOtherTests ();
+ }
+
+ public void IfPropertyStepping ()
+ {
+ var test = new TestClass ();
+ if (test.OneLineProperty == "someInvalidValue6049e709-7271-41a1-bc0a-f1f1b80d4125")/*0c64d51c-40b3-4d20-b7e3-4e3e641ec52a*/
+ return;
+ Console.Write ("");/*ac7625ef-ebbd-4543-b7ff-c9c5d26fd8b4*/
+ }
+
+ public void SteppingInsidePropertyWhenStepInPropertyDisabled ()
+ {
+ var testClass = new TestClass ();
+ var a = testClass.MultiLineProperty;
+ var b = a;
+ }
+
+ public void CheckIfNull ()
+ {
+ var testClass = new TestClass ();
+ testClass.TestMethod (null);/*d42a19ec-98db-4166-a3b4-fc102ebd7905*/
+ testClass.TestMethod ("notNull");/*f633d197-cb92-418a-860c-4d8eadbe2342*/
+ Console.Write ("");/*6d50c480-1cd1-49a9-9758-05f65c07c037*/
+ }
+
+ public void TestOperators ()
+ {
+ var testClass = new TestClass ();
+ var output = testClass == testClass;/*6049ea77-e04a-43ba-907a-5d198727c448*/
+ var a = output;/*49737db6-e62b-4c5e-8758-1a9d655be11a*/
+ }
+
+ public void DebuggerHiddenMethod ()
+ {
+ var testClass = new TestClass ();
+ testClass.DebuggerHiddenMethod (true);/*b0abae8d-fbd0-4bde-b586-bb511b954d8a*/
+ testClass.DebuggerHiddenMethod (true, 3);
+ testClass.DebuggerHiddenMethod (false);
+ }
+
+ public void DebuggerNonUserCodeMethod ()
+ {
+ var testClass = new TestClass ();
+ testClass.DebuggerNonUserCodeMethod (true);/*02757896-0e76-40b8-8235-d09d2110da78*/
+ testClass.DebuggerNonUserCodeMethod (true, 3);
+ testClass.DebuggerNonUserCodeMethod (false);
+ }
+
+ public void DebuggerStepperBoundaryMethod ()
+ {
+ var testClass = new TestClass ();
+ testClass.DebuggerStepperBoundaryMethod (true);/*0b7eef17-af79-4b34-b4fc-cede110f20fe*/
+ var a = testClass;
+ var b = testClass;/*806c13f8-8a59-4ae0-83a2-33191368af47*/
+ testClass.DebuggerStepperBoundaryMethod (false);/*d105feb1-2cc1-49a5-a01e-f199c29ca7b7*/
+ a = testClass;
+ b = testClass;/*f86fa865-ed31-4c9f-8280-a54c3f06ee29*/
+ }
+
+ public void DebuggerStepThroughMethod ()
+ {
+ var testClass = new TestClass ();
+ testClass.DebuggerStepThroughMethod (true);/*707ccd6c-3464-4700-8487-a83c948aa0c3*/
+ testClass.DebuggerStepThroughMethod (true, 3);
+ testClass.DebuggerStepThroughMethod (false);
+ }
+
+ public void BreakpointInsideDelegate ()
+ {
+ var action = new Action (delegate {
+ int i = 0;/*ffde3c82-4310-43d3-93d1-4c39e9cf615e*/
+ });
+ action ();/*f3b6862d-732b-4f68-81f5-f362d5a092e2*/
+ }
+
+ public void ForeachEnumerable ()
+ {
+ var testClass = new TestClass ();/*b73bec88-2c43-4157-8574-ad517730bc74*/
+ foreach (var a in testClass.Iter_1()) {
+ /*69dba3ab-0941-47e9-99fa-10222a2e894d*/
+ }
+ /*e01a5428-b067-4ca3-ac8c-a19d5d800228*/
+ }
+
+ public void SimpleConstrutor ()
+ {
+ var obj = new EmptyClassWithConstructor ();/*d62ff7ab-02fa-4205-a432-b4569709eab6*/
+ }
+
+ public void NoConstructor ()
+ {
+ var obj = new EmptyClassWithoutConstructor ();/*84fc04b2-ede2-4d8b-acc4-28441e1c5f55*/
+ }
+
+ static async Task<string> AsyncBug13401 ()
+ {
+ return "Hello from Bar";
+ }
+
+ public static async Task Bug13401 ()
+ {
+ string s = await AsyncBug13401 ();
+ Console.Write ("");/*977ee8ce-ee61-4de0-9fc1-138fa164870b*/
+ }
+
+ public PListScheme PListSchemeTest ()
+ {
+ string value = "<xml></xml>";
+ using (var reader = System.Xml.XmlReader.Create (new StringReader (value)))
+ return PListScheme.Load (reader);/*41eb3a30-3b19-4ea5-a7dc-e4c76871f391*/
+ }
+
+ public class Key
+ {
+ }
+
+ public partial class PListScheme
+ {
+ public static readonly PListScheme Empty = new PListScheme () { keys = new Key [0] };
+
+ IList<Key> keys = new List<Key> ();
+
+ public IList<Key> Keys {
+ get {
+ return keys;
+ }
+ }
+
+ public static PListScheme Load (System.Xml.XmlReader reader)
+ {
+ /*c9b18785-1348-42e3-a479-9cac1e7c5360*/
+ var result = new PListScheme ();
+ var doc = new System.Xml.XmlDocument ();
+ doc.Load (reader);
+ return result;
+ }
+ }
+
+ public void Bug4433Test ()
+ {
+ Bug4433.Method ();
+ }
+
+ public class Bug4433
+ {
+ void Test ()
+ {
+ return;/*ad9b8803-eef0-438c-bf2b-9156782f4027*/
+ }
+
+ static Bug4433 Instance { get; set; }
+
+ public static void Method ()
+ {
+ Instance = new Bug4433 ();
+ Instance.Test ();/*a062e69c-e3f7-4fd7-8985-fc7abd5c27d2*/
+ }
+ }
+
+ public void EmptyForLoopTest ()
+ {
+ Thread t = new Thread (new ThreadStart (delegate {
+ try {
+ EmptyForLoop ();
+ } catch {
+ }
+ }));
+ t.Start ();
+ Thread.Sleep (1000);//This migth need to be increased
+ t.Abort ();
+ t.Join ();
+ }
+
+ private void EmptyForLoop ()
+ {
+ /*946d5781-a162-4cd9-a7b6-c320564cc594*/
+ for (; ;) {
+ /*a2ff92da-3796-47e3-886a-4bd786a07547*/
+ }
+ }
+
+ public void ForLoop10 ()
+ {
+ /*c35046f7-e87d-4b8f-b260-43e181a0a07c*/
+ for (int i = 0; i < 10; i++) {
+ Console.Write ("");/*eef5bea2-aaa6-4718-b26f-b35be6a6a13e*/
+ }
+ var a = 0;/*3e2e4759-f6d9-4839-98e6-4fa96b227458*/
+ var b = 1;
+ var c = a + b;
+ Console.Write (c);
+ }
+
+ public void CallMethodWithPropertyAsArgument ()
+ {
+ var obj = new TestClass ();
+ obj.CallMethodWithPropertyAsArgument ();
+ }
+
+ public void TestBug7901 ()
+ {
+ var obj = new TestClass ();
+ obj.Bug7901 ();
+ }
+
+ public void TestBug10782 ()
+ {
+ DoStuff (new EmptyClassWithConstructor ());/*cdcabe93-4f55-4dbb-821e-912097c4f727*/
+ }
+
+ private void DoStuff (EmptyClassWithConstructor asdf)
+ {
+ string bar = asdf.ToString ();/*3bda6643-6d06-4504-a4da-91bc8c5eb887*/
+ }
+
+ public async void TestAwaitCall ()
+ {
+ int a = 0;
+ await Task.Delay (100);/*a221c9d4-6d00-4fce-99e6-d712e9a23c02*/
+ int b = 0;
+ }
+
+ public async void StepInsideAwaitTaskRun ()
+ {
+ int a = 0;
+ await Task.Run (() => EmptyMethod ());/*a221c9d4-6d00-4fce-99e6-d712e9a23c02*/
+ int b = 0;
+ }
+
+ private void EmptyMethod ()
+ {
+ /*3c27f60f-fdfa-44c0-b58f-552ecaaa77f1*/
+ }
+
+ public void ConitionalBreakpointEnum ()
+ {
+ SomeMethod (BooleanEnum.True);
+ SomeMethod (BooleanEnum.False);
+ }
+
+ private void SomeMethod (BooleanEnum en)
+ {
+ int i = 0;/*ecf764bf-9182-48d6-adb0-0ba36e2653a7*/
+ }
+
+ public void ConditionalBreakpointString ()
+ {
+ SomeMethod ("aaa");
+ SomeMethod ("bbb");
+ SomeMethod ("ccc");
+ }
+
+ private void SomeMethod (string str)
+ {
+ int i = 0;/*033dd01d-6cb4-4e1a-b445-de6d7fa0d2a7*/
+ }
+
+ public void Catchpoint1 ()
+ {
+ try {
+ throw new NotImplementedException ();/*526795d3-ee9e-44a7-8423-df0b406e9e8d*/
+ } catch {
+ }
+ var a = 0;/*fcdc2412-c00e-4c95-b2ea-e3cf5d5bf856*/
+ }
+
+ public void Catchpoint2 ()
+ {
+ try {
+ //If you wonder why I didn't use just simple File.Open("unexistingFile.txt") is
+ //that FrameStack inside Mono and .Net are different and same goes for 10+ other calls I tried...
+ new Socket (AddressFamily.InterNetwork, SocketType.Unknown, ProtocolType.Ggp);/*d24b1c9d-3944-4f0d-be31-5556251fbdf5*/
+ } catch {
+
+ }
+ }
+
+ public void SimpleMethod ()
+ {
+ /*f4e3a214-229e-44dd-9da2-db82ddfbec11*/
+ int a = 1;
+ int b = 2;
+ int c = a + b;
+ Console.Write (c);
+ }
+
+ public void Bug13640 ()
+ {
+ var l = new List<int> ();/*b64e6497-e976-4125-9741-801909e5eeb1*/
+ foreach (var x in l)
+ foreach (var y in l) // XS hits this line if it should not
+ Console.Write (y);
+ return;/*a90ba766-0891-4837-9b1d-e5458f6b8e07*/
+ }
+
+ class EmptyClassWithConstructor
+ {
+ /*1f37aea1-77a1-40c1-9ea5-797db48a14f9*/
+ public EmptyClassWithConstructor ()
+ {
+ int i = 0;/*494fddfb-85f1-4ad0-b5b3-9b2f990bb6d0*/
+ }
+ }
+
+ class EmptyClassWithoutConstructor
+ {
+ }
+
+ class DontUseThisClassInOtherTests
+ {
+ //Or StaticConstructorStepping will fail because
+ //static constructor could be invoked in other test
+ static DontUseThisClassInOtherTests ()
+ {
+ int a = 1;/*6c42f31b-ca4f-4963-bca1-7d7c163087f1*/
+ int b = 2;/*7e6862cd-bf31-486c-94fe-19933ae46094*/
+ }
+ }
+
+ public class TestClass
+ {
+ private string oneLineProperty = "";
+
+ public string OneLineProperty {
+ get{ return oneLineProperty; }/*3722cad3-7da1-4c86-a398-bb2cf6cc65a9*/
+ set{ oneLineProperty = value; }
+ }
+
+ private string multiLineProperty = "";
+
+ public string MultiLineProperty {
+ get {
+ var b = multiLineProperty;/*e0082b9a-26d7-4279-8749-31cd13866abf*/
+ return multiLineProperty;/*04f1ce38-121a-4ce7-b4ba-14fb3f6184a2*/
+ }
+ set {
+ multiLineProperty = value;
+ }
+ }
+
+ /// <summary>
+ /// This is used only for test so don't use for compering
+ /// </summary>
+ public static bool operator == (TestClass a, TestClass b)
+ {/*5a3eb8d5-88f5-49c0-913f-65018e5a1c5c*/
+ return a.oneLineProperty == b.oneLineProperty &&
+ a.multiLineProperty == b.multiLineProperty;
+ }
+
+ /// <summary>
+ /// This is used only for test so don't use for compering
+ /// </summary>
+ public static bool operator != (TestClass a, TestClass b)
+ {
+ return !(a == b);
+ }
+
+ public object TestMethod (object obj)
+ {/*c5361deb-aff5-468f-9293-0d2e50fc62fd*/
+ if (obj == null)/*10e0f5c7-4c77-4897-8324-deef9aae0192*/
+ return null;/*40f0acc2-2de2-44c8-8e18-3867151ba8da*/
+ return null;/*ae71a41d-0c90-433d-b925-0b236b8119a9*/
+ /*3c0316e9-eace-48e8-b9ed-03a8c6306c66*/
+ }
+
+ public void EmptyTestMethod ()
+ {
+ /*49326780-f51b-4510-a52c-03e7af442dda*/
+ }
+
+ [System.Diagnostics.DebuggerHidden]
+ public void DebuggerHiddenMethod (bool callEmptyMethod, int resursive = 0)
+ {
+ if (resursive > 0) {
+ Console.Write ("");
+ DebuggerHiddenMethod (callEmptyMethod, resursive - 1);
+ Console.Write ("");
+ }
+ Console.Write ("");
+ if (callEmptyMethod)
+ EmptyTestMethod ();
+ Console.Write ("");
+ }
+
+ [System.Diagnostics.DebuggerNonUserCode]
+ public void DebuggerNonUserCodeMethod (bool callEmptyMethod, int resursive = 0)
+ {
+ /*5b9b96b6-ce24-413f-8660-715fccfc412f*/
+ if (resursive > 0) {
+ Console.Write ("");
+ DebuggerNonUserCodeMethod (callEmptyMethod, resursive - 1);/*6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7*/
+ Console.Write ("");
+ }
+ Console.Write ("");
+ if (callEmptyMethod)
+ EmptyTestMethod ();/*754272b8-a14b-4de0-9075-6a911c37e6ce*/
+ Console.Write ("");
+ }
+
+ [System.Diagnostics.DebuggerStepperBoundary]
+ public void DebuggerStepperBoundaryMethod (bool callEmptyMethod, int resursive = 0)
+ {
+ if (resursive > 0) {
+ Console.Write ("");
+ DebuggerStepThroughMethod (callEmptyMethod, resursive - 1);
+ Console.Write ("");
+ }
+ Console.Write ("");
+ if (callEmptyMethod)
+ EmptyTestMethod ();
+ Console.Write ("");
+ }
+
+ [System.Diagnostics.DebuggerStepThrough]
+ public void DebuggerStepThroughMethod (bool callEmptyMethod, int resursive = 0)
+ {
+ if (resursive > 0) {
+ Console.Write ("");
+ DebuggerStepThroughMethod (callEmptyMethod, resursive - 1);
+ Console.Write ("");
+ }
+ Console.Write ("");
+ if (callEmptyMethod)
+ EmptyTestMethod ();
+ Console.Write ("");
+ }
+
+ public IEnumerable<int> Iter_1 ()
+ {
+ yield return 1;/*1463a77d-f27e-4bcd-8f92-89a682faa1c7*/
+ yield return 2;
+ }
+
+ public void CallMethodWithPropertyAsArgument ()
+ {
+ ConsoleWriteline ("hello");/*1c3e65ca-3201-42ba-9c6e-6f9a45ddac44*/
+ ConsoleWriteline (OneLineProperty);
+ }
+
+ private void ConsoleWriteline (string arg)
+ {
+ Console.WriteLine (arg);/*c25be44e-ead3-4891-ab42-0e4cf8450f7a*/
+ }
+
+ private class ScrollView
+ {
+ public string VisbleContentRect{ get; set; }
+
+ public string ZoomScale{ get; set; }
+ }
+
+ private ScrollView myScrollView = new ScrollView ();
+
+ string curRect;
+
+ string curZoom;
+
+ bool EventsNeedRefresh {
+ get;
+ set;
+ }
+
+ DateTime CurrentDate {
+ get;
+ set;
+ }
+
+ DateTime FirstDayOfWeek {
+ get;
+ set;
+ }
+
+ public void Bug7901 ()
+ {
+ SetDayOfWeek (DateTime.UtcNow);/*956bd9fd-39fe-4587-9d9e-a2a817d76286*/
+ }
+
+ public void SetDayOfWeek (DateTime date)
+ {
+ /*f456a9b0-9c1a-4b34-bef4-d80b8541ebdb*/
+ if (myScrollView != null) {
+ curRect = myScrollView.VisbleContentRect;/*11259de1-944d-4052-b970-62662e21876a*/
+ curZoom = myScrollView.ZoomScale;
+ }
+ EventsNeedRefresh = true;/*4863ebb7-8c90-4704-af8b-66a9f53657b9*/
+ CurrentDate = date;
+ FirstDayOfWeek = date.AddDays (-1 * (int)date.DayOfWeek);
+ }
+ }
+ }
+}
+
+public enum BooleanEnum
+{
+ False,
+ True
+}
+/*invalidBreakpointAtEndOfFile*/ \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests.TestApp/Main.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests.TestApp/Main.cs
index a064c1f1dd..6ebb0c56e5 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests.TestApp/Main.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests.TestApp/Main.cs
@@ -35,145 +35,8 @@ namespace MonoDevelop.Debugger.Tests.TestApp
{
public static void Main (string[] args)
{
- MainClass mc = new MainClass ();
- typeof (MainClass).GetMethod (args[0]).Invoke (mc, null);
+ var test = Activator.CreateInstance (Type.GetType ("MonoDevelop.Debugger.Tests.TestApp." + args [0]));
+ test.GetType().GetMethod ("RunTest").Invoke (null, null);
}
-
- // Tests
-
- static string staticString = "some static";
- string someString = "hi";
- string[] numbers = { "one","two","three" };
-
- public void TestEvaluation ()
- {
- int n = 32;
- decimal dec = 123.456m;
- var alist = new ArrayList ();
- alist.Add (1);
- alist.Add ("two");
- alist.Add (3);
-
- A c = new C ();
- A b = new B ();
- A a = new A ();
-
- var withDisplayString = new WithDisplayString ();
- var withProxy = new WithProxy ();
- var withToString = new WithToString ();
-
- var numbersArrays = new int [2][];
- var numbersMulti = new int [3,4,5];
-
- var dict = new Dictionary<int, string[]> ();
- var dictArray = new Dictionary<int, string[]> [2,3];
- var thing = new Thing<string> ();
- var done = new Thing<string>.Done<int> ();
-
- Console.WriteLine (n); /*break*/
- }
-
- public int TestMethod ()
- {
- float c = 4;
- return 1;
- }
-
- public int TestMethod (string a)
- {
- return int.Parse (a) + 1;
- }
-
- public int TestMethod (int a)
- {
- return a + 1;
- }
-
- public static int TestMethod (bool b)
- {
- return b ? 1 : 2;
- }
-
- public string BoxingTestMethod (object a)
- {
- return a.ToString ();
- }
-
- public string EscapedStrings {
- get { return " \" \\ \a \b \f \v \n \r \t"; }
- }
- }
-}
-
-class A
-{
- public virtual int Prop { get { return 1; } }
- public int PropNoVirt1 { get { return 1; } }
- public virtual int PropNoVirt2 { get { return 1; } }
-}
-
-class B: A
-{
- public override int Prop { get { return 2; } }
- public new int PropNoVirt1 { get { return 2; } }
- public new int PropNoVirt2 { get { return 2; } }
-}
-
-class C: B
-{
-}
-
-[DebuggerDisplay ("Some {Val1} Value {Val2} End")]
-class WithDisplayString
-{
- internal string Val1 = "one";
- public int Val2 { get { return 2; } }
-}
-
-class WithToString
-{
- public override string ToString ()
- {
- return "SomeString";
- }
-}
-
-[DebuggerTypeProxy (typeof(TheProxy))]
-class WithProxy
-{
- public string Val1 {
- get { return "one"; }
- }
-}
-
-class TheProxy
-{
- WithProxy wp;
-
- public TheProxy (WithProxy wp)
- {
- this.wp = wp;
- }
-
- public string Val1 {
- get { return wp.Val1; }
- }
-}
-
-class Thing<T>
-{
- public class Done<U>
- {
}
-
- public Done<int>[] done = new Done<int> [1];
-}
-
-[Flags]
-enum SomeEnum
-{
- none=0,
- one=1,
- two=2,
- four=4
-}
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests.TestApp/MonoDevelop.Debugger.Tests.TestApp.csproj b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests.TestApp/MonoDevelop.Debugger.Tests.TestApp.csproj
index 802f09fcc8..1f2eed89b3 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests.TestApp/MonoDevelop.Debugger.Tests.TestApp.csproj
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests.TestApp/MonoDevelop.Debugger.Tests.TestApp.csproj
@@ -9,6 +9,7 @@
<OutputType>Exe</OutputType>
<RootNamespace>MonoDevelop.Debugger.Tests.TestApp</RootNamespace>
<AssemblyName>MonoDevelop.Debugger.Tests.TestApp</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>True</DebugSymbols>
@@ -32,10 +33,14 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
+ <Reference Include="System.Xml" />
+ <Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AssemblyInfo.cs" />
+ <Compile Include="TestEvaluation.cs" />
+ <Compile Include="BreakpointsAndStepping.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests.TestApp/TestEvaluation.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests.TestApp/TestEvaluation.cs
new file mode 100644
index 0000000000..254742d01e
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests.TestApp/TestEvaluation.cs
@@ -0,0 +1,589 @@
+//
+// TestEvaluation.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+// David Karlaš <david.karlas@xamarin.com>
+//
+// Copyright (c) 2009 Novell, Inc (http://www.novell.com)
+// Copyright (c) 2014 Xamarin, Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Dynamic;
+
+namespace MonoDevelop.Debugger.Tests.TestApp
+{
+ class TestEvaluationParent
+ {
+ public int TestMethodBase ()
+ {
+ float c = 4;
+ return 1;
+ }
+
+ protected string ProtectedStringProperty{ get; set; }
+
+ public virtual int TestMethodBase (string a)
+ {
+ return int.Parse (a) + 1;
+ }
+
+ protected int TestMethodBase (int a)
+ {
+ return a + 1;
+ }
+
+ public int TestMethodBaseNotOverrided ()
+ {
+ float c = 4;
+ return 1;
+ }
+
+ public class ParentNestedClass
+ {
+
+ }
+ }
+
+ class TestEvaluation : TestEvaluationParent
+ {
+ static string staticString = "some static";
+ string someString = "hi";
+ string[] numbers = { "one", "two", "three" };
+
+ public static void RunTest ()
+ {
+ var obj = new TestEvaluation ();
+ obj.Test ("testString", 55);
+ }
+
+ public void Test (string stringParam, int intParam = 22, int intParam2 = 66)
+ {
+ int intZero = 0, intOne = 1;
+ int n = 32;
+ decimal dec = 123.456m;
+ var stringList = new List<string> ();
+ stringList.Add ("aaa");
+ stringList.Add ("bbb");
+ stringList.Add ("ccc");
+
+ var alist = new ArrayList ();
+ alist.Add (1);
+ alist.Add ("two");
+ alist.Add (3);
+ string modifyInLamda = "";
+
+ A c = new C ();
+ A b = new B ();
+ A a = new A ();
+
+ var withDisplayString = new WithDisplayString ();
+ var withProxy = new WithProxy ();
+ var withToString = new WithToString ();
+
+ var numbersArrays = new int [2][];
+ var numbersMulti = new int [3, 4, 5];
+
+ var ops1 = new BinaryOperatorOverrides (1);
+ var ops2 = new BinaryOperatorOverrides (2);
+ var ops3 = new BinaryOperatorOverrides (2);
+
+ var dict = new Dictionary<int, string[]> ();
+ dict.Add (5, new string[]{ "a", "b" });
+ var dictArray = new Dictionary<int, string[]> [2, 3];
+ var thing = new Thing<string> ();
+ var done = new Thing<string>.Done<int> ();
+ done.Property = 54;
+
+ SimpleStruct simpleStruct = new SimpleStruct ();
+ simpleStruct.IntField = 45;
+ simpleStruct.StringField = "str";
+ SimpleStruct? nulledSimpleStruct;
+ var action = new Action (() => {
+ modifyInLamda = "modified";
+ });
+ action ();
+
+ dynamic dynObj = new ExpandoObject ();
+ dynObj.someInt = 53;
+ dynObj.someString = "Hello dynamic objects!";
+
+ var objWithMethodA = new ClassWithMethodA ();
+
+ var richObject = new RichClass ();
+ byte[] nulledByteArray = null;
+
+ Console.WriteLine (n); /*break*/
+ }
+
+ public int TestMethod ()
+ {
+ float c = 4;
+ return 1;
+ }
+
+ public int TestMethod (string a)
+ {
+ return int.Parse (a) + 1;
+ }
+
+ public int TestMethod (int a)
+ {
+ return a + 1;
+ }
+
+ public int TestMethodBase ()
+ {
+ float c = 4;
+ return 1;
+ }
+
+ public override int TestMethodBase (string a)
+ {
+ return int.Parse (a) + 1;
+ }
+
+ protected new int TestMethodBase (int a)
+ {
+ return a + 1;
+ }
+
+ public static int TestMethod (bool b)
+ {
+ return b ? 1 : 2;
+ }
+
+ public T ReturnSame<T> (T t)
+ {
+ return t;
+ }
+
+ public T ReturnNew<T> () where T:new()
+ {
+ return new T ();
+ }
+
+ public string BoxingTestMethod (object a)
+ {
+ return a.ToString ();
+ }
+
+ public string EscapedStrings {
+ get { return " \" \\ \a \b \f \v \n \r \t"; }
+ }
+
+ public static void Swap<T> (ref T a, ref T b)
+ {
+ T temp = a;
+ a = b;
+ b = temp;
+ }
+
+ public static List<T> GenerateList<T> (T value, int count)
+ {
+ var list = new List<T> ();
+ for (int i = 0; i < count; i++) {
+ list.Add (value);
+ }
+ return list;
+ }
+
+ class NestedClass
+ {
+ public class DoubleNestedClass
+ {
+
+ }
+ }
+
+ class NestedGenericClass<T1,T2>
+ {
+
+ }
+ }
+
+ public class SomeClassInNamespace
+ {
+
+ }
+}
+
+class RichClass
+{
+ public int publicInt1 = 1;
+ public int publicInt2 = 2;
+ public int publicInt3 = 3;
+
+ public string publicStringA = "stringA";
+ public string publicStringB = "stringB";
+ public string publicStringC = "stringC";
+
+ private int privateInt1 = 1;
+ private int privateInt2 = 2;
+ private int privateInt3 = 3;
+
+ private string privateStringA = "stringA";
+ private string privateStringB = "stringB";
+ private string privateStringC = "stringC";
+
+ public int publicPropInt1 { get; set; }
+
+ public int publicPropInt2 { get; set; }
+
+ public int publicPropInt3 { get; set; }
+
+ public string publicPropStringA { get; set; }
+
+ public string publicPropStringB { get; set; }
+
+ public string publicPropStringC { get; set; }
+
+ private int privatePropInt1 { get; set; }
+
+ private int privatePropInt2 { get; set; }
+
+ private int privatePropInt3 { get; set; }
+
+ private string privatePropStringA { get; set; }
+
+ private string privatePropStringB { get; set; }
+
+ private string privatePropStringC { get; set; }
+
+ public RichClass ()
+ {
+ publicPropInt1 = 1;
+ publicPropInt2 = 2;
+ publicPropInt3 = 3;
+
+ publicPropStringA = "stringA";
+ publicPropStringB = "stringB";
+ publicPropStringC = "stringC";
+
+ privatePropInt1 = 1;
+ privatePropInt2 = 2;
+ privatePropInt3 = 3;
+
+ privatePropStringA = "stringA";
+ privatePropStringB = "stringB";
+ privatePropStringC = "stringC";
+ }
+}
+
+interface IInterfaceWithMethodA
+{
+ string MethodA ();
+}
+
+abstract class AbstractClassWithMethodA
+{
+ public abstract string MethodA ();
+}
+
+class ClassWithMethodA : AbstractClassWithMethodA, IInterfaceWithMethodA
+{
+ public override string MethodA ()
+ {
+ return "AbstractImplementation";
+ }
+
+ string IInterfaceWithMethodA.MethodA ()
+ {
+ return "InterfaceImplementation";
+ }
+}
+
+class A
+{
+ public string ConstructedBy { get; private set; }
+
+ public A ()
+ {
+ ConstructedBy = "NoArg";
+ }
+
+ public A (int i)
+ {
+ ConstructedBy = "IntArg";
+ }
+
+ public A (string str)
+ {
+ ConstructedBy = "StringArg";
+ }
+
+ public virtual int Prop { get { return 1; } }
+
+ public int PropNoVirt1 { get { return 1; } }
+
+ public virtual int PropNoVirt2 { get { return 1; } }
+
+ public int IntField = 1;
+
+ public int TestMethod ()
+ {
+ float c = 4;
+ return 1;
+ }
+
+ public virtual int TestMethod (string a)
+ {
+ return int.Parse (a) + 1;
+ }
+
+ public int TestMethod (int a)
+ {
+ return a + 1;
+ }
+}
+
+class B: A
+{
+ public override int Prop { get { return 2; } }
+
+ public new int PropNoVirt1 { get { return 2; } }
+
+ public new int PropNoVirt2 { get { return 2; } }
+
+ public new int IntField = 2;
+
+ public int TestMethod ()
+ {
+ float c = 4;
+ return 2;
+ }
+
+ public override int TestMethod (string a)
+ {
+ return int.Parse (a) + 2;
+ }
+
+ public new int TestMethod (int a)
+ {
+ return a + 2;
+ }
+}
+
+class C: B
+{
+
+}
+
+[DebuggerDisplay ("Some {Val1} Value {Val2} End")]
+class WithDisplayString
+{
+ internal string Val1 = "one";
+
+ public int Val2 { get { return 2; } }
+}
+
+class WithToString
+{
+ public override string ToString ()
+ {
+ return "SomeString";
+ }
+}
+
+[DebuggerTypeProxy (typeof(TheProxy))]
+class WithProxy
+{
+ public string Val1 {
+ get { return "one"; }
+ }
+}
+
+class TheProxy
+{
+ WithProxy wp;
+
+ public TheProxy (WithProxy wp)
+ {
+ this.wp = wp;
+ }
+
+ public string Val1 {
+ get { return wp.Val1; }
+ }
+}
+
+class Thing<T>
+{
+ public class Done<U>
+ {
+ private U property;
+
+ public U Property {
+ get {
+ return property;
+ }
+ set {
+ property = value;
+ }
+ }
+
+
+ public int ReturnInt5 ()
+ {
+ return 5;
+ }
+
+ public U ReturnSame (U obj)
+ {
+ return obj;
+ }
+
+ public T ReturnSame (T obj)
+ {
+ return obj;
+ }
+
+ public U GetDefault ()
+ {
+ return default(U);
+ }
+
+ public T GetParentDefault ()
+ {
+ return default(T);
+ }
+ }
+
+ public Done<int>[] done = new Done<int> [1];
+}
+
+[Flags]
+enum SomeEnum
+{
+ none = 0,
+ one = 1,
+ two = 2,
+ four = 4
+}
+
+struct SimpleStruct
+{
+ public int IntField;
+ public string StringField;
+ public int? NulledIntField;
+
+ public override string ToString ()
+ {
+ return StringField + " " + IntField + " " + NulledIntField;
+ }
+}
+
+class BinaryOperatorOverrides
+{
+ int value;
+
+ public BinaryOperatorOverrides (int num)
+ {
+ value = num;
+ }
+
+ public override string ToString ()
+ {
+ return string.Format ("[BinaryOperatorOverrides {0}]", value);
+ }
+
+ public static bool operator== (BinaryOperatorOverrides ops1, BinaryOperatorOverrides ops2)
+ {
+ return ops1.value == ops2.value;
+ }
+
+ public static bool operator!= (BinaryOperatorOverrides ops1, BinaryOperatorOverrides ops2)
+ {
+ return ops1.value != ops2.value;
+ }
+
+ public static bool operator>= (BinaryOperatorOverrides ops1, BinaryOperatorOverrides ops2)
+ {
+ return ops1.value >= ops2.value;
+ }
+
+ public static bool operator> (BinaryOperatorOverrides ops1, BinaryOperatorOverrides ops2)
+ {
+ return ops1.value > ops2.value;
+ }
+
+ public static bool operator<= (BinaryOperatorOverrides ops1, BinaryOperatorOverrides ops2)
+ {
+ return ops1.value <= ops2.value;
+ }
+
+ public static bool operator< (BinaryOperatorOverrides ops1, BinaryOperatorOverrides ops2)
+ {
+ return ops1.value < ops2.value;
+ }
+
+ public static BinaryOperatorOverrides operator+ (BinaryOperatorOverrides ops1, BinaryOperatorOverrides ops2)
+ {
+ return new BinaryOperatorOverrides (ops1.value + ops2.value);
+ }
+
+ public static BinaryOperatorOverrides operator- (BinaryOperatorOverrides ops1, BinaryOperatorOverrides ops2)
+ {
+ return new BinaryOperatorOverrides (ops1.value - ops2.value);
+ }
+
+ public static BinaryOperatorOverrides operator* (BinaryOperatorOverrides ops1, BinaryOperatorOverrides ops2)
+ {
+ return new BinaryOperatorOverrides (ops1.value * ops2.value);
+ }
+
+ public static BinaryOperatorOverrides operator/ (BinaryOperatorOverrides ops1, BinaryOperatorOverrides ops2)
+ {
+ return new BinaryOperatorOverrides (ops1.value / ops2.value);
+ }
+
+ public static BinaryOperatorOverrides operator% (BinaryOperatorOverrides ops1, BinaryOperatorOverrides ops2)
+ {
+ return new BinaryOperatorOverrides (ops1.value % ops2.value);
+ }
+
+ public static BinaryOperatorOverrides operator& (BinaryOperatorOverrides ops1, BinaryOperatorOverrides ops2)
+ {
+ return new BinaryOperatorOverrides (ops1.value & ops2.value);
+ }
+
+ public static BinaryOperatorOverrides operator| (BinaryOperatorOverrides ops1, BinaryOperatorOverrides ops2)
+ {
+ return new BinaryOperatorOverrides (ops1.value | ops2.value);
+ }
+
+ public static BinaryOperatorOverrides operator^ (BinaryOperatorOverrides ops1, BinaryOperatorOverrides ops2)
+ {
+ return new BinaryOperatorOverrides (ops1.value ^ ops2.value);
+ }
+
+ public static BinaryOperatorOverrides operator<< (BinaryOperatorOverrides ops1, int shift)
+ {
+ return new BinaryOperatorOverrides (ops1.value << shift);
+ }
+
+ public static BinaryOperatorOverrides operator>> (BinaryOperatorOverrides ops1, int shift)
+ {
+ return new BinaryOperatorOverrides (ops1.value >> shift);
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/BreakpointsAndSteppingTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/BreakpointsAndSteppingTests.cs
new file mode 100644
index 0000000000..fcf460afb7
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/BreakpointsAndSteppingTests.cs
@@ -0,0 +1,1007 @@
+//
+// BreakpointsAndSteppingTests.cs
+//
+// Author:
+// David Karlaš <david.karlas@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin, Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using NUnit.Framework;
+using Mono.Debugging.Client;
+using System.Collections.Generic;
+
+namespace MonoDevelop.Debugger.Tests
+{
+ [TestFixture]
+ public abstract class BreakpointsAndSteppingTests:DebugTests
+ {
+ protected BreakpointsAndSteppingTests (string de)
+ : base (de)
+ {
+ }
+
+ [TestFixtureSetUp]
+ public override void SetUp ()
+ {
+ base.SetUp ();
+ Start ("BreakpointsAndStepping");
+ }
+
+ [Test]
+ public void OneLineProperty ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("8e7787ed-699f-4512-b52a-5a0629a0b9eb");
+ StartTest ("OneLineProperty");
+ CheckPosition ("8e7787ed-699f-4512-b52a-5a0629a0b9eb");
+ StepIn ("3722cad3-7da1-4c86-a398-bb2cf6cc65a9", "{");
+ StepIn ("3722cad3-7da1-4c86-a398-bb2cf6cc65a9", "return");
+ StepIn ("3722cad3-7da1-4c86-a398-bb2cf6cc65a9", "}");
+ StepIn ("8e7787ed-699f-4512-b52a-5a0629a0b9eb");
+ StepIn ("36c0a44a-44ac-4676-b99b-9a58b73bae9d");
+ }
+
+ /// <summary>
+ /// Bug 775
+ /// </summary>
+ [Test]
+ public void StepOverPropertiesAndOperatorsSetting ()
+ {
+ InitializeTest ();
+ //This is default but lets set again for code readability
+ Session.Options.StepOverPropertiesAndOperators = false;
+ AddBreakpoint ("8e7787ed-699f-4512-b52a-5a0629a0b9eb");
+ StartTest ("OneLineProperty");
+ CheckPosition ("8e7787ed-699f-4512-b52a-5a0629a0b9eb");
+ StepIn ("3722cad3-7da1-4c86-a398-bb2cf6cc65a9");
+
+
+ InitializeTest ();
+ Session.Options.StepOverPropertiesAndOperators = true;
+ AddBreakpoint ("8e7787ed-699f-4512-b52a-5a0629a0b9eb");
+ StartTest ("OneLineProperty");
+ CheckPosition ("8e7787ed-699f-4512-b52a-5a0629a0b9eb");
+ StepIn ("36c0a44a-44ac-4676-b99b-9a58b73bae9d");
+
+
+ InitializeTest ();
+ //This is default but lets set again for code readability
+ Session.Options.StepOverPropertiesAndOperators = false;
+ AddBreakpoint ("6049ea77-e04a-43ba-907a-5d198727c448");
+ StartTest ("TestOperators");
+ CheckPosition ("6049ea77-e04a-43ba-907a-5d198727c448");
+ StepIn ("5a3eb8d5-88f5-49c0-913f-65018e5a1c5c");
+
+
+ InitializeTest ();
+ Session.Options.StepOverPropertiesAndOperators = true;
+ AddBreakpoint ("6049ea77-e04a-43ba-907a-5d198727c448");
+ StartTest ("TestOperators");
+ CheckPosition ("6049ea77-e04a-43ba-907a-5d198727c448");
+ StepIn ("49737db6-e62b-4c5e-8758-1a9d655be11a");
+ }
+
+ [Test]
+ public void StaticConstructorStepping ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("6c42f31b-ca4f-4963-bca1-7d7c163087f1");
+ StartTest ("StaticConstructorStepping");
+ CheckPosition ("6c42f31b-ca4f-4963-bca1-7d7c163087f1");
+ StepOver ("7e6862cd-bf31-486c-94fe-19933ae46094");
+ }
+
+ [Test]
+ public void SteppingInsidePropertyWhenStepInPropertyDisabled ()
+ {
+ InitializeTest ();
+ Session.Options.StepOverPropertiesAndOperators = true;
+ AddBreakpoint ("e0082b9a-26d7-4279-8749-31cd13866abf");
+ StartTest ("SteppingInsidePropertyWhenStepInPropertyDisabled");
+ CheckPosition ("e0082b9a-26d7-4279-8749-31cd13866abf");
+ StepIn ("04f1ce38-121a-4ce7-b4ba-14fb3f6184a2");
+ }
+
+ [Test]
+ public void CheckIfNull ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("d42a19ec-98db-4166-a3b4-fc102ebd7905");
+ StartTest ("CheckIfNull");
+ CheckPosition ("d42a19ec-98db-4166-a3b4-fc102ebd7905");
+ StepIn ("c5361deb-aff5-468f-9293-0d2e50fc62fd");
+ StepIn ("10e0f5c7-4c77-4897-8324-deef9aae0192");
+ StepIn ("40f0acc2-2de2-44c8-8e18-3867151ba8da");
+ StepIn ("3c0316e9-eace-48e8-b9ed-03a8c6306c66", 1);
+ StepIn ("d42a19ec-98db-4166-a3b4-fc102ebd7905");
+ StepIn ("f633d197-cb92-418a-860c-4d8eadbe2342");
+ StepIn ("c5361deb-aff5-468f-9293-0d2e50fc62fd");
+ StepIn ("10e0f5c7-4c77-4897-8324-deef9aae0192");
+ StepIn ("ae71a41d-0c90-433d-b925-0b236b8119a9");
+ StepIn ("3c0316e9-eace-48e8-b9ed-03a8c6306c66", 1);
+ StepIn ("f633d197-cb92-418a-860c-4d8eadbe2342");
+ StepIn ("6d50c480-1cd1-49a9-9758-05f65c07c037");
+ }
+
+ /// <summary>
+ /// Bug 4015
+ /// </summary>
+ [Test]
+ public void SimpleConstrutor ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("d62ff7ab-02fa-4205-a432-b4569709eab6");
+ StartTest ("SimpleConstrutor");
+ CheckPosition ("d62ff7ab-02fa-4205-a432-b4569709eab6");
+ StepIn ("1f37aea1-77a1-40c1-9ea5-797db48a14f9", 1, "public");
+ StepIn ("494fddfb-85f1-4ad0-b5b3-9b2f990bb6d0", -1, "{");
+ StepIn ("494fddfb-85f1-4ad0-b5b3-9b2f990bb6d0", "int");
+ StepIn ("494fddfb-85f1-4ad0-b5b3-9b2f990bb6d0", 1, "}");
+ StepIn ("d62ff7ab-02fa-4205-a432-b4569709eab6", "var");
+ StepIn ("d62ff7ab-02fa-4205-a432-b4569709eab6", 1, "}");
+ }
+
+ /// <summary>
+ /// Bug 3262
+ /// </summary>
+ [Test]
+ public void NoConstructor ()
+ {
+ InitializeTest ();
+ Session.Options.ProjectAssembliesOnly = true;
+ AddBreakpoint ("84fc04b2-ede2-4d8b-acc4-28441e1c5f55");
+ StartTest ("NoConstructor");
+ CheckPosition ("84fc04b2-ede2-4d8b-acc4-28441e1c5f55");
+ StepIn ("84fc04b2-ede2-4d8b-acc4-28441e1c5f55", 1);
+ }
+
+ [Test]
+ public void IfPropertyStepping ()
+ {
+ InitializeTest ();
+ Session.Options.StepOverPropertiesAndOperators = true;
+ AddBreakpoint ("0c64d51c-40b3-4d20-b7e3-4e3e641ec52a");
+ StartTest ("IfPropertyStepping");
+ CheckPosition ("0c64d51c-40b3-4d20-b7e3-4e3e641ec52a");
+ StepIn ("ac7625ef-ebbd-4543-b7ff-c9c5d26fd8b4");
+ }
+
+ /// <summary>
+ /// Bug 3565
+ /// </summary>
+ [Test]
+ public void DebuggerHiddenMethod ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("b0abae8d-fbd0-4bde-b586-bb511b954d8a");
+ StartTest ("DebuggerHiddenMethod");
+ CheckPosition ("b0abae8d-fbd0-4bde-b586-bb511b954d8a");
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
+ StepIn ("b0abae8d-fbd0-4bde-b586-bb511b954d8a");
+ StepIn ("b0abae8d-fbd0-4bde-b586-bb511b954d8a", 1);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (3).IsDebuggerHidden);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (4).IsDebuggerHidden);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (5).IsDebuggerHidden);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (3).IsDebuggerHidden);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (4).IsDebuggerHidden);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (3).IsDebuggerHidden);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
+ StepIn ("b0abae8d-fbd0-4bde-b586-bb511b954d8a", 1);
+ StepIn ("b0abae8d-fbd0-4bde-b586-bb511b954d8a", 2);
+ StepIn ("b0abae8d-fbd0-4bde-b586-bb511b954d8a", 3);
+ }
+
+ /// <summary>
+ /// Bug 3565
+ /// </summary>
+ [Test]
+ public void DebuggerNonUserCodeMethod ()
+ {
+ InitializeTest ();
+ Session.Options.ProjectAssembliesOnly = false;
+ AddBreakpoint ("02757896-0e76-40b8-8235-d09d2110da78");
+ StartTest ("DebuggerNonUserCodeMethod");
+ CheckPosition ("02757896-0e76-40b8-8235-d09d2110da78");
+ //entering testClass.DebuggerNonUserCodeMethod (true);
+ StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", -1);
+ StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", 1);
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -2);
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -1);
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce");
+ //entering EmptyTestMethod
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
+ //exited EmptyTestMethod
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce");
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 1);
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 2);
+ StepIn ("02757896-0e76-40b8-8235-d09d2110da78");
+ //exited testClass.DebuggerNonUserCodeMethod (true);
+ StepIn ("02757896-0e76-40b8-8235-d09d2110da78", 1);
+ //entering testClass.DebuggerNonUserCodeMethod (true, 3); starts here
+ StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", -1);
+ StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", 1);
+ StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", -2);
+ StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", -1);
+ StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7");
+ //entering resursion
+ StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", -1);
+ StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", 1);
+ StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", -2);
+ StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", -1);
+ StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7");
+ //entering resursion
+ StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", -1);
+ StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", 1);
+ StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", -2);
+ StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", -1);
+ StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7");
+ StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", -1);
+ StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", 1);
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -2);
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -1);
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce");
+ //entering EmptyTestMethod
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
+ //exited EmptyTestMethod
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce");
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 1);
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 2);
+ //returning resursion
+ StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7");
+ StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", 1);
+ StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", 2);
+
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -2);
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -1);
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce");
+ //entering EmptyTestMethod
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
+ //exited EmptyTestMethod
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce");
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 1);
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 2);
+ //returning resursion
+ StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7");
+ StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", 1);
+ StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", 2);
+
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -2);
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -1);
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce");
+ //entering EmptyTestMethod
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
+ //exited EmptyTestMethod
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce");
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 1);
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 2);
+ //returning resursion
+ StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7");
+ StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", 1);
+ StepIn ("6b2c05cd-1cb8-48fe-b6bf-c4949121d4c7", 2);
+
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -2);
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -1);
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce");
+ //entering EmptyTestMethod
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
+ //exited EmptyTestMethod
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce");
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 1);
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 2);
+ StepIn ("02757896-0e76-40b8-8235-d09d2110da78", 1);
+ //exited testClass.DebuggerNonUserCodeMethod (true, 3);
+ StepIn ("02757896-0e76-40b8-8235-d09d2110da78", 2);
+ //entering testClass.DebuggerNonUserCodeMethod (false);
+ StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", -1);
+ StepIn ("5b9b96b6-ce24-413f-8660-715fccfc412f", 1);
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -2);
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", -1);
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 1);
+ StepIn ("754272b8-a14b-4de0-9075-6a911c37e6ce", 2);
+ StepIn ("02757896-0e76-40b8-8235-d09d2110da78", 2);
+ //exited testClass.DebuggerNonUserCodeMethod (false);
+ StepIn ("02757896-0e76-40b8-8235-d09d2110da78", 3);
+
+ InitializeTest ();
+ Session.Options.ProjectAssembliesOnly = true;
+ AddBreakpoint ("02757896-0e76-40b8-8235-d09d2110da78");
+ StartTest ("DebuggerNonUserCodeMethod");
+ CheckPosition ("02757896-0e76-40b8-8235-d09d2110da78");
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
+ StepIn ("02757896-0e76-40b8-8235-d09d2110da78");
+ StepIn ("02757896-0e76-40b8-8235-d09d2110da78", 1);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (3).IsExternalCode);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (4).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (5).IsExternalCode);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (3).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (4).IsExternalCode);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (3).IsExternalCode);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
+ StepIn ("02757896-0e76-40b8-8235-d09d2110da78", 1);
+ StepIn ("02757896-0e76-40b8-8235-d09d2110da78", 2);
+ StepIn ("02757896-0e76-40b8-8235-d09d2110da78", 3);
+ }
+
+ /// <summary>
+ /// Bug 3565
+ /// </summary>
+ [Test]
+ public void DebuggerStepperBoundaryMethod ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("0b7eef17-af79-4b34-b4fc-cede110f20fe");
+ AddBreakpoint ("806c13f8-8a59-4ae0-83a2-33191368af47");
+ StartTest ("DebuggerStepperBoundaryMethod");
+ CheckPosition ("0b7eef17-af79-4b34-b4fc-cede110f20fe");
+ StepIn ("806c13f8-8a59-4ae0-83a2-33191368af47");//This actually means it hit 2nd breakpoint
+ //because [DebuggerStepperBoundary] actually means if you step into this method
+ //its looks like pressing F5
+ }
+
+ /// <summary>
+ /// Bug 3565
+ /// </summary>
+ [Test]
+ public void DebuggerStepThroughMethod ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("707ccd6c-3464-4700-8487-a83c948aa0c3");
+ StartTest ("DebuggerStepThroughMethod");
+ CheckPosition ("707ccd6c-3464-4700-8487-a83c948aa0c3");
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsDebuggerHidden);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
+ StepIn ("707ccd6c-3464-4700-8487-a83c948aa0c3");
+ StepIn ("707ccd6c-3464-4700-8487-a83c948aa0c3", 1);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", -1);
+ StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1);
+ StepIn ("707ccd6c-3464-4700-8487-a83c948aa0c3", 1);
+ StepIn ("707ccd6c-3464-4700-8487-a83c948aa0c3", 2);
+ StepIn ("707ccd6c-3464-4700-8487-a83c948aa0c3", 3);
+ }
+
+ /// <summary>
+ /// This test is very specific because of Win32 debugger bug
+ /// Placing breakpoint inside delegate fails if some other
+ /// breakpoint adding failed before this(invalidBreakpointAtEndOfFile)
+ /// </summary>
+ [Test]
+ public void BreakpointInsideDelegate ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("f3b6862d-732b-4f68-81f5-f362d5a092e2");
+ StartTest ("BreakpointInsideDelegate");
+ CheckPosition ("f3b6862d-732b-4f68-81f5-f362d5a092e2");
+ AddBreakpoint ("invalidBreakpointAtEndOfFile");
+ AddBreakpoint ("ffde3c82-4310-43d3-93d1-4c39e9cf615e");
+ Continue ("ffde3c82-4310-43d3-93d1-4c39e9cf615e");
+ }
+
+ /// <summary>
+ /// Bug 2851
+ /// </summary>
+ [Test]
+ public void ForeachEnumerable ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("b73bec88-2c43-4157-8574-ad517730bc74");
+ StartTest ("ForeachEnumerable");
+ CheckPosition ("b73bec88-2c43-4157-8574-ad517730bc74");
+ StepOver ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "foreach");
+ StepIn ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "testClass.Iter_1");
+ StepIn ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
+ StepIn ("1463a77d-f27e-4bcd-8f92-89a682faa1c7", -1, "{");
+ StepIn ("1463a77d-f27e-4bcd-8f92-89a682faa1c7", "yield return 1;");
+ StepIn ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
+ StepIn ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "var");
+ StepIn ("69dba3ab-0941-47e9-99fa-10222a2e894d", -1, "{");
+ StepIn ("69dba3ab-0941-47e9-99fa-10222a2e894d", 1, "}");
+ StepIn ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
+ StepIn ("1463a77d-f27e-4bcd-8f92-89a682faa1c7", 1, "yield return 2;");
+ StepIn ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
+ StepIn ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "var");
+ StepIn ("69dba3ab-0941-47e9-99fa-10222a2e894d", -1, "{");
+ StepIn ("69dba3ab-0941-47e9-99fa-10222a2e894d", 1, "}");
+ StepIn ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
+ StepIn ("1463a77d-f27e-4bcd-8f92-89a682faa1c7", 2, "}");
+ StepIn ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
+ StepIn ("e01a5428-b067-4ca3-ac8c-a19d5d800228", 1, "}");
+ }
+
+ [Test]
+ public void SetBreakpointOnColumn ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "testClass.Iter_1");
+ AddBreakpoint ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
+ AddBreakpoint ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "var");
+ AddBreakpoint ("e01a5428-b067-4ca3-ac8c-a19d5d800228", 1);//end of method
+ StartTest ("ForeachEnumerable");
+ CheckPosition ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "testClass.Iter_1");
+ Continue ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
+ Continue ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "var");
+ Continue ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
+ Continue ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "var");
+ Continue ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
+ Continue ("e01a5428-b067-4ca3-ac8c-a19d5d800228", 1);//end of method
+ }
+
+ [Test]
+ public void RunToCursorTest ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("b73bec88-2c43-4157-8574-ad517730bc74");
+ StartTest ("ForeachEnumerable");
+ CheckPosition ("b73bec88-2c43-4157-8574-ad517730bc74");
+ RunToCursor ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "testClass.Iter_1");
+ RunToCursor ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "var");
+ RunToCursor ("b73bec88-2c43-4157-8574-ad517730bc74", 1, "in");
+ RunToCursor ("69dba3ab-0941-47e9-99fa-10222a2e894d", 1, "}");
+ RunToCursor ("e01a5428-b067-4ca3-ac8c-a19d5d800228", 1);
+ }
+
+ [Test]
+ public void RunToCursorTest2 ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 1);
+ StartTest ("SimpleMethod");
+ CheckPosition ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 1);
+ RunToCursor ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 3);
+ }
+
+ /// <summary>
+ /// Bug 4032
+ /// </summary>
+ [Test]
+ public void PListSchemeTest ()
+ {
+ InitializeTest ();
+ Session.Options.ProjectAssembliesOnly = true;
+ AddBreakpoint ("41eb3a30-3b19-4ea5-a7dc-e4c76871f391");
+ StartTest ("PListSchemeTest");
+ CheckPosition ("41eb3a30-3b19-4ea5-a7dc-e4c76871f391");
+ StepIn ("c9b18785-1348-42e3-a479-9cac1e7c5360", -1);
+ }
+
+ /// <summary>
+ /// Bug 4433
+ /// </summary>
+ [Test]
+ public void Bug4433 ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("a062e69c-e3f7-4fd7-8985-fc7abd5c27d2");
+ StartTest ("Bug4433Test");
+ CheckPosition ("a062e69c-e3f7-4fd7-8985-fc7abd5c27d2");
+ StepIn ("ad9b8803-eef0-438c-bf2b-9156782f4027", -1);
+ }
+
+ /// <summary>
+ /// Bug 5386
+ /// </summary>
+ [Test]
+ public void EmptyForLoopTest ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("946d5781-a162-4cd9-a7b6-c320564cc594", -1);
+ StartTest ("EmptyForLoopTest");
+ CheckPosition ("946d5781-a162-4cd9-a7b6-c320564cc594", -1);
+ //make 3 loops...
+ StepIn ("a2ff92da-3796-47e3-886a-4bd786a07547", -1);
+ StepIn ("a2ff92da-3796-47e3-886a-4bd786a07547", 1);
+ StepIn ("a2ff92da-3796-47e3-886a-4bd786a07547", -1);
+ StepIn ("a2ff92da-3796-47e3-886a-4bd786a07547", 1);
+ StepIn ("a2ff92da-3796-47e3-886a-4bd786a07547", -1);
+ StepIn ("a2ff92da-3796-47e3-886a-4bd786a07547", 1);
+ }
+
+ /// <summary>
+ /// Bug 6724
+ /// </summary>
+ [Test]
+ public void CallMethodWithPropertyAsArgument ()
+ {
+ InitializeTest ();
+ Session.Options.StepOverPropertiesAndOperators = true;
+ AddBreakpoint ("1c3e65ca-3201-42ba-9c6e-6f9a45ddac44");
+ StartTest ("CallMethodWithPropertyAsArgument");
+ CheckPosition ("1c3e65ca-3201-42ba-9c6e-6f9a45ddac44");
+ StepIn ("c25be44e-ead3-4891-ab42-0e4cf8450f7a", -1);
+ StepOut ("1c3e65ca-3201-42ba-9c6e-6f9a45ddac44");
+ StepIn ("1c3e65ca-3201-42ba-9c6e-6f9a45ddac44", 1);
+ StepIn ("c25be44e-ead3-4891-ab42-0e4cf8450f7a", -1);
+ }
+
+ /// <summary>
+ /// Bug 7901
+ /// </summary>
+ [Test]
+ public void Bug7901 ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("956bd9fd-39fe-4587-9d9e-a2a817d76286");
+ StartTest ("TestBug7901");
+ CheckPosition ("956bd9fd-39fe-4587-9d9e-a2a817d76286");
+ StepIn ("f456a9b0-9c1a-4b34-bef4-d80b8541ebdb", -1);
+ StepIn ("f456a9b0-9c1a-4b34-bef4-d80b8541ebdb", 1);
+ StepIn ("11259de1-944d-4052-b970-62662e21876a", -1);
+ StepIn ("11259de1-944d-4052-b970-62662e21876a");
+ StepIn ("11259de1-944d-4052-b970-62662e21876a", 1);
+ StepIn ("11259de1-944d-4052-b970-62662e21876a", 2);
+ StepIn ("4863ebb7-8c90-4704-af8b-66a9f53657b9");
+ StepOut ("956bd9fd-39fe-4587-9d9e-a2a817d76286");
+ }
+
+ /// <summary>
+ /// Bug 10782
+ /// </summary>
+ [Test]
+ public void Bug10782 ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("cdcabe93-4f55-4dbb-821e-912097c4f727");
+ StartTest ("TestBug10782");
+ CheckPosition ("cdcabe93-4f55-4dbb-821e-912097c4f727");
+ StepIn ("1f37aea1-77a1-40c1-9ea5-797db48a14f9", 1);
+ StepOut ("cdcabe93-4f55-4dbb-821e-912097c4f727");
+ StepIn ("3bda6643-6d06-4504-a4da-91bc8c5eb887", -1);
+ }
+
+ /// <summary>
+ /// Bug 11868
+ /// </summary>
+ [Test]
+ [Ignore ("Todo")]
+ public void AwaitCall ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("a221c9d4-6d00-4fce-99e6-d712e9a23c02", -1);
+ StartTest ("TestAwaitCall");
+ CheckPosition ("a221c9d4-6d00-4fce-99e6-d712e9a23c02", -1);
+ StepOver ("a221c9d4-6d00-4fce-99e6-d712e9a23c02");
+ StepOver ("a221c9d4-6d00-4fce-99e6-d712e9a23c02", 1);
+ StepOver ("a221c9d4-6d00-4fce-99e6-d712e9a23c02", 2);
+ }
+
+ /// <summary>
+ /// Bug 13396
+ /// </summary>
+ [Test]
+ [Ignore ("This is not working in VS as well is this doable or should bug be closed as invalid?")]
+ public void StepInsideAwaitTaskRun ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("a221c9d4-6d00-4fce-99e6-d712e9a23c02", -1);
+ StartTest ("StepInsideAwaitTaskRun");
+ CheckPosition ("a221c9d4-6d00-4fce-99e6-d712e9a23c02", -1);
+ StepIn ("a221c9d4-6d00-4fce-99e6-d712e9a23c02");
+ StepIn ("a221c9d4-6d00-4fce-99e6-d712e9a23c02");//Now we are on delegate
+ //entering EmptyMethod
+ StepIn ("3c27f60f-fdfa-44c0-b58f-552ecaaa77f1", -1);
+ StepIn ("3c27f60f-fdfa-44c0-b58f-552ecaaa77f1", 1);
+ StepIn ("a221c9d4-6d00-4fce-99e6-d712e9a23c02");//Back at delegate
+ StepIn ("a221c9d4-6d00-4fce-99e6-d712e9a23c02");//Back at await?
+ StepIn ("a221c9d4-6d00-4fce-99e6-d712e9a23c02", 1);
+ }
+
+ /// <summary>
+ /// Bug 13640
+ /// </summary>
+ [Test]
+ public void Bug13640 ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("b64e6497-e976-4125-9741-801909e5eeb1");
+ StartTest ("Bug13640");
+ CheckPosition ("b64e6497-e976-4125-9741-801909e5eeb1");
+ StepIn ("b64e6497-e976-4125-9741-801909e5eeb1", 1, "foreach");
+ StepIn ("b64e6497-e976-4125-9741-801909e5eeb1", 1, "l");
+ StepIn ("b64e6497-e976-4125-9741-801909e5eeb1", 1, "in");
+ StepIn ("a90ba766-0891-4837-9b1d-e5458f6b8e07", "return");
+ StepIn ("a90ba766-0891-4837-9b1d-e5458f6b8e07", 1, "}");
+ }
+
+ [Test]
+ public void SetNextStatementTest ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ StartTest ("ForLoop10");
+ CheckPosition ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ SetNextStatement ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
+ StepIn ("3e2e4759-f6d9-4839-98e6-4fa96b227458", 1);
+ }
+
+
+ [Test]
+ public void SetNextStatementTest2 ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ StartTest ("ForLoop10");
+ CheckPosition ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ SetNextStatement ("c35046f7-e87d-4b8f-b260-43e181a0a07c", -1, "{");
+ StepIn ("c35046f7-e87d-4b8f-b260-43e181a0a07c", 1, "int");
+ }
+
+ [Test]
+ public void SetNextStatementTest3 ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 1);
+ StartTest ("SimpleMethod");
+ CheckPosition ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 1);
+ StepOver ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 2);
+ StepOver ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 3);
+ StepOver ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 4);
+ SetNextStatement ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 1);
+ StepOver ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 2);
+ StepOver ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 3);
+ SetNextStatement ("f4e3a214-229e-44dd-9da2-db82ddfbec11", -1);
+ StepOver ("f4e3a214-229e-44dd-9da2-db82ddfbec11", 1);
+ }
+
+ [Test]
+ public void CatchPointTest1 ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("fcdc2412-c00e-4c95-b2ea-e3cf5d5bf856");
+ AddCatchpoint ("System.Exception", true);
+ StartTest ("Catchpoint1");
+ if (!CheckPosition ("526795d3-ee9e-44a7-8423-df0b406e9e8d", 1, null, true))//Workaround for Win32 debugger which stops at +1 line
+ CheckPosition ("526795d3-ee9e-44a7-8423-df0b406e9e8d");
+ var ops = Session.EvaluationOptions.Clone ();
+ ops.MemberEvaluationTimeout = 0;
+ ops.EvaluationTimeout = 0;
+ ops.EllipsizeStrings = false;
+
+ var val = Frame.GetException (ops);
+ Assert.AreEqual ("System.NotImplementedException", val.Type);
+
+ InitializeTest ();
+ AddBreakpoint ("fcdc2412-c00e-4c95-b2ea-e3cf5d5bf856");
+ AddCatchpoint ("System.Exception", false);
+ StartTest ("Catchpoint1");
+ CheckPosition ("fcdc2412-c00e-4c95-b2ea-e3cf5d5bf856");
+ }
+
+ [Test]
+ public void CatchPointTest2 ()
+ {
+ InitializeTest ();
+ AddCatchpoint ("System.Exception", true);
+ StartTest ("Catchpoint2");
+ CheckPosition ("d24b1c9d-3944-4f0d-be31-5556251fbdf5");
+ Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode);
+ Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode);
+ }
+
+ [Test]
+ public void ConditionalBreakpoints ()
+ {
+ ObjectValue val;
+ Breakpoint bp;
+
+ InitializeTest ();
+ AddBreakpoint ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
+ bp = AddBreakpoint ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ bp.ConditionExpression = "i==2";
+ StartTest ("ForLoop10");
+ CheckPosition ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ val = Eval ("i");
+ Assert.AreEqual ("2", val.Value);
+ Continue ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
+
+ Assert.Ignore ("TODO: Conditional breakpoints with compare against string or enum is not working");
+
+ InitializeTest ();
+ bp = AddBreakpoint ("033dd01d-6cb4-4e1a-b445-de6d7fa0d2a7");
+ bp.ConditionExpression = "str == \"bbb\"";
+ StartTest ("ConditionalBreakpointString");
+ CheckPosition ("033dd01d-6cb4-4e1a-b445-de6d7fa0d2a7");
+ val = Eval ("str");
+ Assert.AreEqual ("\"bbb\"", val.Value);
+
+ InitializeTest ();
+ bp = AddBreakpoint ("ecf764bf-9182-48d6-adb0-0ba36e2653a7");
+ bp.ConditionExpression = "en == BooleanEnum.False";
+ StartTest ("ConitionalBreakpointEnum");
+ CheckPosition ("ecf764bf-9182-48d6-adb0-0ba36e2653a7");
+ val = Eval ("en");
+ Assert.AreEqual ("BooleanEnum.False", val.Value);
+ }
+
+ [Test]
+ public void HitCountBreakpoints ()
+ {
+ ObjectValue val;
+ Breakpoint bp;
+
+ InitializeTest ();
+ AddBreakpoint ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
+ bp = AddBreakpoint ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ bp.HitCount = 3;
+ bp.HitCountMode = HitCountMode.EqualTo;
+ StartTest ("ForLoop10");
+ CheckPosition ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ val = Eval ("i");
+ Assert.AreEqual ("2", val.Value);
+ Continue ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
+
+ InitializeTest ();
+ AddBreakpoint ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
+ bp = AddBreakpoint ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ bp.HitCount = 3;
+ bp.HitCountMode = HitCountMode.GreaterThan;
+ StartTest ("ForLoop10");
+ CheckPosition ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ val = Eval ("i");
+ Assert.AreEqual ("3", val.Value);
+ Continue ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ val = Eval ("i");
+ Assert.AreEqual ("4", val.Value);
+ Continue ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ val = Eval ("i");
+ Assert.AreEqual ("5", val.Value);
+
+ InitializeTest ();
+ AddBreakpoint ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
+ bp = AddBreakpoint ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ bp.HitCount = 3;
+ bp.HitCountMode = HitCountMode.GreaterThanOrEqualTo;
+ StartTest ("ForLoop10");
+ CheckPosition ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ val = Eval ("i");
+ Assert.AreEqual ("2", val.Value);
+ Continue ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ val = Eval ("i");
+ Assert.AreEqual ("3", val.Value);
+ Continue ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ val = Eval ("i");
+ Assert.AreEqual ("4", val.Value);
+
+ InitializeTest ();
+ AddBreakpoint ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
+ bp = AddBreakpoint ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ bp.HitCount = 3;
+ bp.HitCountMode = HitCountMode.LessThan;
+ StartTest ("ForLoop10");
+ CheckPosition ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ val = Eval ("i");
+ Assert.AreEqual ("0", val.Value);
+ Continue ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ val = Eval ("i");
+ Assert.AreEqual ("1", val.Value);
+ Continue ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
+
+ InitializeTest ();
+ AddBreakpoint ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
+ bp = AddBreakpoint ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ bp.HitCount = 3;
+ bp.HitCountMode = HitCountMode.LessThanOrEqualTo;
+ StartTest ("ForLoop10");
+ CheckPosition ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ val = Eval ("i");
+ Assert.AreEqual ("0", val.Value);
+ Continue ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ val = Eval ("i");
+ Assert.AreEqual ("1", val.Value);
+ Continue ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ val = Eval ("i");
+ Assert.AreEqual ("2", val.Value);
+ Continue ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
+
+ InitializeTest ();
+ AddBreakpoint ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
+ bp = AddBreakpoint ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ bp.HitCount = 3;
+ bp.HitCountMode = HitCountMode.MultipleOf;
+ StartTest ("ForLoop10");
+ CheckPosition ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ val = Eval ("i");
+ Assert.AreEqual ("2", val.Value);
+ Continue ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ val = Eval ("i");
+ Assert.AreEqual ("5", val.Value);
+ Continue ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ val = Eval ("i");
+ Assert.AreEqual ("8", val.Value);
+ Continue ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
+
+ InitializeTest ();
+ AddBreakpoint ("3e2e4759-f6d9-4839-98e6-4fa96b227458");
+ bp = AddBreakpoint ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ bp.HitCount = 3;
+ bp.HitCountMode = HitCountMode.None;
+ StartTest ("ForLoop10");
+ CheckPosition ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ val = Eval ("i");
+ Assert.AreEqual ("0", val.Value);
+ Continue ("eef5bea2-aaa6-4718-b26f-b35be6a6a13e");
+ val = Eval ("i");
+ Assert.AreEqual ("1", val.Value);
+ }
+
+ [Test]
+ public void Bug13401 ()
+ {
+ InitializeTest ();
+ AddBreakpoint ("977ee8ce-ee61-4de0-9fc1-138fa164870b");
+ StartTest ("Bug13401");
+ CheckPosition ("977ee8ce-ee61-4de0-9fc1-138fa164870b");
+ var val = Eval ("s");
+ Assert.AreEqual ("string", val.TypeName);
+ Assert.AreEqual ("\"Hello from Bar\"", val.Value);
+ }
+
+ [Test]
+ public void OutputAndDebugWriter ()
+ {
+ //Interesting fact... Debug.Write(""); produces log entry
+ //but Console.Write(""); does not
+
+ InitializeTest ();
+ AddBreakpoint ("5070ed1c-593d-4cbe-b4fa-b2b0c7b25289");
+ var errorsList = new List<string> ();
+ errorsList.Add ("ErrorText");
+ var outputList = new HashSet<string> ();
+ outputList.Add ("NormalText");
+ var debugList = new List<Tuple<int,string,string>> ();
+ debugList.Add (new Tuple<int,string,string> (0, "", "DebugText"));
+ debugList.Add (new Tuple<int, string, string> (3, "SomeCategory", "DebugText2"));
+ debugList.Add (new Tuple<int,string,string> (0, "", ""));
+
+ var unexpectedOutput = new List<string> ();
+ var unexpectedError = new List<string> ();
+ var unexpectedDebug = new List<Tuple<int,string,string>> ();
+
+ Session.DebugWriter = delegate(int level, string category, string message) {
+ var entry = new Tuple<int,string,string> (level, category, message);
+ if (debugList.Contains (entry)) {
+ debugList.Remove (entry);
+ } else {
+ unexpectedDebug.Add (entry);
+ }
+ };
+ Session.OutputWriter = delegate(bool isStderr, string text) {
+ if (isStderr) {
+ if (errorsList.Contains (text))
+ errorsList.Remove (text);
+ else
+ unexpectedError.Add (text);
+ } else {
+ if (outputList.Contains (text))
+ outputList.Remove (text);
+ else
+ unexpectedOutput.Add (text);
+ }
+ };
+ StartTest ("OutputAndDebugWriter");
+ CheckPosition ("5070ed1c-593d-4cbe-b4fa-b2b0c7b25289");
+ if (outputList.Count > 0)
+ Assert.Fail ("Output list still has following items:" + string.Join (",", outputList));
+ if (errorsList.Count > 0)
+ Assert.Fail ("Error list still has following items:" + string.Join (",", errorsList));
+ if (debugList.Count > 0)
+ Assert.Fail ("Debug list still has following items:" + string.Join (",", debugList));
+ if (unexpectedOutput.Count > 0)
+ Assert.Fail ("Unexcpected Output list has following items:" + string.Join (",", unexpectedOutput));
+ if (unexpectedError.Count > 0)
+ Assert.Fail ("Unexcpected Error list has following items:" + string.Join (",", unexpectedError));
+ if (unexpectedDebug.Count > 0)
+ Assert.Fail ("Unexcpected Debug list has following items:" + string.Join (",", unexpectedDebug));
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorBreakpointsAndSteppingTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorBreakpointsAndSteppingTests.cs
new file mode 100644
index 0000000000..43eaec378d
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorBreakpointsAndSteppingTests.cs
@@ -0,0 +1,39 @@
+//
+// CorBreakpointsAndSteppingTests.cs
+//
+// Author:
+// David Karlaš <david.karlas@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin, Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using NUnit.Framework;
+
+namespace MonoDevelop.Debugger.Tests.Win32
+{
+ [TestFixture]
+ [Platform (Include = "Win")]
+ public class CorBreakpointsAndSteppingTests: BreakpointsAndSteppingTests
+ {
+ public CorBreakpointsAndSteppingTests () : base ("MonoDevelop.Debugger.Win32")
+ {
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorEvaluationTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorEvaluationTests.cs
index 4dc8c9c446..f6714b4375 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorEvaluationTests.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorEvaluationTests.cs
@@ -30,12 +30,20 @@ namespace MonoDevelop.Debugger.Tests.Win32
{
[TestFixture]
[Platform (Include = "Win")]
+ public class CorEvaluationAllowTargetInvokesTests: EvaluationTests
+ {
+ public CorEvaluationAllowTargetInvokesTests (): base ("MonoDevelop.Debugger.Win32", true)
+ {
+ }
+ }
+
+ [TestFixture]
+ [Platform (Include = "Win")]
[Ignore ("Disabled for now")]
- public class CorEvaluationTests: EvaluationTests
+ public class CorEvaluationNoTargetInvokesTests: EvaluationTests
{
- public CorEvaluationTests (): base ("MonoDevelop.Debugger.Win32")
+ public CorEvaluationNoTargetInvokesTests (): base ("MonoDevelop.Debugger.Win32", false)
{
}
}
}
-
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorStackFrameTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorStackFrameTests.cs
index ae0f541f65..41d0b3ae12 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorStackFrameTests.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/CorStackFrameTests.cs
@@ -29,12 +29,19 @@ namespace MonoDevelop.Debugger.Tests.Win32
{
[TestFixture]
[Platform (Include = "Win")]
- [Ignore ("Disabled for now")]
- public class CorStackFrameTests : StackFrameTests
+ public class CorStackFrameAllowTargetInvokesTests : StackFrameTests
{
- public CorStackFrameTests (): base ("MonoDevelop.Debugger.Win32")
+ public CorStackFrameAllowTargetInvokesTests (): base ("MonoDevelop.Debugger.Win32", true)
{
}
}
-}
+ [TestFixture]
+ [Platform (Include = "Win")]
+ public class CorStackFrameNoTargetInvokesTests : StackFrameTests
+ {
+ public CorStackFrameNoTargetInvokesTests (): base ("MonoDevelop.Debugger.Win32", false)
+ {
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/DebugTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/DebugTests.cs
index d1e9f22741..0b869a8de9 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/DebugTests.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/DebugTests.cs
@@ -25,13 +25,20 @@
// THE SOFTWARE.
using System;
+using System.IO;
+using System.Linq;
+using System.Threading;
+using System.Reflection;
+using System.Collections.Generic;
+
+using Mono.Debugging.Soft;
using Mono.Debugging.Client;
+
using MonoDevelop.Core;
using MonoDevelop.Core.Execution;
-using System.IO;
-using System.Threading;
using MonoDevelop.Projects.Text;
using MonoDevelop.Core.Assemblies;
+
using NUnit.Framework;
namespace MonoDevelop.Debugger.Tests
@@ -39,9 +46,20 @@ namespace MonoDevelop.Debugger.Tests
[TestFixture]
public abstract class DebugTests
{
- readonly protected string EngineId;
+ readonly ManualResetEvent targetStoppedEvent = new ManualResetEvent (false);
+ readonly string EngineId;
DebuggerEngine engine;
-
+ string TestName = "";
+ TextFile SourceFile;
+
+ SourceLocation lastStoppedPosition;
+
+ public bool AllowTargetInvokes { get; protected set; }
+
+ public DebuggerSession Session { get; private set; }
+
+ public StackFrame Frame { get; private set; }
+
protected DebugTests (string engineId)
{
EngineId = engineId;
@@ -50,106 +68,334 @@ namespace MonoDevelop.Debugger.Tests
[TestFixtureSetUp]
public virtual void SetUp ()
{
- foreach (DebuggerEngine e in DebuggingService.GetDebuggerEngines ()) {
+ foreach (var e in DebuggingService.GetDebuggerEngines ()) {
if (e.Id == EngineId) {
engine = e;
break;
}
}
+ if (engine == null)
+ Assert.Ignore ("Engine not found: {0}", EngineId);
}
[TestFixtureTearDown]
public virtual void TearDown ()
{
+ if (Session != null) {
+ Session.Exit ();
+ Session.Dispose ();
+ Session = null;
+ }
}
-
- protected DebuggerSession Start (string test)
+ protected void Start (string test)
{
TargetRuntime runtime;
+
switch (EngineId) {
case "MonoDevelop.Debugger.Win32":
runtime = Runtime.SystemAssemblyService.GetTargetRuntime ("MS.NET");
break;
case "Mono.Debugger.Soft":
- runtime = Runtime.SystemAssemblyService.GetTargetRuntime ("Mono");
+ runtime = Runtime.SystemAssemblyService.GetTargetRuntimes ()
+ .OfType<MonoTargetRuntime> ()
+ .OrderByDescending(o => o.Version)
+ .FirstOrDefault ();
break;
default:
runtime = Runtime.SystemAssemblyService.DefaultRuntime;
break;
}
- if (runtime == null)
- return null;
+ if (runtime == null) {
+ Assert.Ignore ("Runtime not found for: {0}", EngineId);
+ return;
+ }
+
+ Console.WriteLine ("Target Runtime: " + runtime.DisplayRuntimeName + " " + runtime.Version);
// main/build/tests
FilePath path = Path.GetDirectoryName (GetType ().Assembly.Location);
+ var exe = Path.Combine (path, "MonoDevelop.Debugger.Tests.TestApp.exe");
var cmd = new DotNetExecutionCommand ();
- cmd.Command = Path.Combine (path, "MonoDevelop.Debugger.Tests.TestApp.exe");
- cmd.Arguments = test;
cmd.TargetRuntime = runtime;
+ cmd.Command = exe;
+ cmd.Arguments = test;
+
+ if (Platform.IsWindows) {
+ var monoRuntime = runtime as MonoTargetRuntime;
+ if (monoRuntime != null) {
+ var psi = new System.Diagnostics.ProcessStartInfo (Path.Combine (monoRuntime.Prefix, "bin", "pdb2mdb.bat"), cmd.Command);
+ psi.UseShellExecute = false;
+ psi.CreateNoWindow = true;
+ System.Diagnostics.Process.Start (psi).WaitForExit ();
+ }
+ }
+
+ var dsi = engine.CreateDebuggerStartInfo (cmd);
+ var soft = dsi as SoftDebuggerStartInfo;
- DebuggerStartInfo si = engine.CreateDebuggerStartInfo (cmd);
- DebuggerSession session = engine.CreateSession ();
+ if (soft != null) {
+ var assemblyName = AssemblyName.GetAssemblyName (exe);
+
+ soft.UserAssemblyNames = new List<AssemblyName> ();
+ soft.UserAssemblyNames.Add (assemblyName);
+ }
+
+ Session = engine.CreateSession ();
var ops = new DebuggerSessionOptions ();
ops.EvaluationOptions = EvaluationOptions.DefaultOptions;
+ ops.EvaluationOptions.AllowTargetInvoke = AllowTargetInvokes;
ops.EvaluationOptions.EvaluationTimeout = 100000;
- path = path.ParentDirectory.ParentDirectory.Combine ("src","addins","MonoDevelop.Debugger","MonoDevelop.Debugger.Tests.TestApp","Main.cs").FullPath;
- TextFile file = TextFile.ReadFile (path);
- int i = file.Text.IndexOf ("void " + test, StringComparison.Ordinal);
- if (i == -1)
- throw new Exception ("Test not found: " + test);
- i = file.Text.IndexOf ("/*break*/", i, StringComparison.Ordinal);
- if (i == -1)
- throw new Exception ("Break marker not found: " + test);
- int line, col;
- file.GetLineColumnFromPosition (i, out line, out col);
- Breakpoint bp = session.Breakpoints.Add (path, line);
- bp.Enabled = true;
+ path = path.ParentDirectory.ParentDirectory.Combine ("src", "addins", "MonoDevelop.Debugger", "MonoDevelop.Debugger.Tests.TestApp", test + ".cs").FullPath;
+ SourceFile = TextFile.ReadFile (path);
+ TestName = test;
+ AddBreakpoint ("break");
var done = new ManualResetEvent (false);
-
- session.OutputWriter = (isStderr, text) => Console.WriteLine ("PROC:" + text);
-
- session.TargetHitBreakpoint += delegate {
+
+ Session.TargetHitBreakpoint += (sender, e) => {
+ Frame = e.Backtrace.GetFrame (0);
+ lastStoppedPosition = Frame.SourceLocation;
+ targetStoppedEvent.Set ();
done.Set ();
};
-
- session.Run (si, ops);
- if (!done.WaitOne (3000))
+
+ Session.TargetExceptionThrown += (sender, e) => {
+ Frame = e.Backtrace.GetFrame (0);
+ for (int i = 0; i < e.Backtrace.FrameCount; i++) {
+ if (!e.Backtrace.GetFrame (i).IsExternalCode) {
+ Frame = e.Backtrace.GetFrame (i);
+ break;
+ }
+ }
+ lastStoppedPosition = Frame.SourceLocation;
+ targetStoppedEvent.Set ();
+ };
+
+ Session.TargetStopped += (sender, e) => {
+ Frame = e.Backtrace.GetFrame (0);
+ lastStoppedPosition = Frame.SourceLocation;
+ targetStoppedEvent.Set ();
+ };
+
+ var targetExited = new ManualResetEvent (false);
+ Session.TargetExited += delegate {
+ targetExited.Set ();
+ };
+
+ Session.Run (dsi, ops);
+ switch (WaitHandle.WaitAny (new WaitHandle[]{ done, targetExited }, 30000)) {
+ case 0:
+ //Breakpoint is hit good... run tests now
+ break;
+ case 1:
+ throw new Exception ("Test application exited before hitting breakpoint");
+ default:
throw new Exception ("Timeout while waiting for initial breakpoint");
-
- return session;
+ }
+ }
+
+ void GetLineAndColumn (string breakpointMarker, int offset, string statement, out int line, out int col)
+ {
+ int i = SourceFile.Text.IndexOf ("/*" + breakpointMarker + "*/", StringComparison.Ordinal);
+ if (i == -1)
+ Assert.Fail ("Break marker not found: " + breakpointMarker + " in " + SourceFile.Name);
+ SourceFile.GetLineColumnFromPosition (i, out line, out col);
+ line += offset;
+ if (statement != null) {
+ int lineStartPosition = SourceFile.GetPositionFromLineColumn (line, 1);
+ string lineText = SourceFile.GetText (lineStartPosition, lineStartPosition + SourceFile.GetLineLength (line));
+ col = lineText.IndexOf (statement, StringComparison.Ordinal) + 1;
+ if (col == 0)
+ Assert.Fail ("Failed to find statement:" + statement + " at " + SourceFile.Name + "(" + line + ")");
+ } else {
+ col = 1;
+ }
+ }
+
+ public Breakpoint AddBreakpoint (string breakpointMarker, int offset = 0, string statement = null)
+ {
+ int col, line;
+ GetLineAndColumn (breakpointMarker, offset, statement, out line, out col);
+ var bp = new Breakpoint (SourceFile.Name, line, col);
+ Session.Breakpoints.Add (bp);
+ return bp;
+ }
+
+ public void RunToCursor (string breakpointMarker, int offset = 0, string statement = null)
+ {
+ int col, line;
+ GetLineAndColumn (breakpointMarker, offset, statement, out line, out col);
+ targetStoppedEvent.Reset ();
+ Session.Breakpoints.RemoveRunToCursorBreakpoints ();
+ var bp = new RunToCursorBreakpoint (SourceFile.Name, line, col);
+ Session.Breakpoints.Add (bp);
+ Session.Continue ();
+ CheckPosition (breakpointMarker, offset, statement);
+ }
+
+ public void InitializeTest ()
+ {
+ Session.Breakpoints.Clear ();
+ Session.Options.EvaluationOptions = EvaluationOptions.DefaultOptions;
+ Session.Options.ProjectAssembliesOnly = true;
+ Session.Options.StepOverPropertiesAndOperators = false;
+ AddBreakpoint ("break");
+ while (!CheckPosition ("break", 0, silent: true)) {
+ targetStoppedEvent.Reset ();
+ Session.Continue ();
+ }
+ }
+
+ public ObjectValue Eval (string exp)
+ {
+ return Frame.GetExpressionValue (exp, true).Sync ();
+ }
+
+ public bool CheckPosition (string guid, int offset = 0, string statement = null, bool silent = false)
+ {
+ if (!targetStoppedEvent.WaitOne (3000)) {
+ if (!silent)
+ Assert.Fail ("CheckPosition failure: Target stop timeout");
+ return false;
+ }
+ if (lastStoppedPosition.FileName == SourceFile.Name) {
+ int i = SourceFile.Text.IndexOf ("/*" + guid + "*/", StringComparison.Ordinal);
+ if (i == -1) {
+ if (!silent)
+ Assert.Fail ("CheckPosition failure: Guid marker not found:" + guid + " in file:" + SourceFile.Name);
+ return false;
+ }
+ int line, col;
+ SourceFile.GetLineColumnFromPosition (i, out line, out col);
+ if ((line + offset) != lastStoppedPosition.Line) {
+ if (!silent)
+ Assert.Fail ("CheckPosition failure: Wrong line Expected:" + (line + offset) + " Actual:" + lastStoppedPosition.Line + " in file:" + SourceFile.Name);
+ return false;
+ }
+ if (!string.IsNullOrEmpty (statement)) {
+ int position = SourceFile.GetPositionFromLineColumn (lastStoppedPosition.Line, lastStoppedPosition.Column);
+ string actualStatement = SourceFile.GetText (position, position + statement.Length);
+ if (statement != actualStatement) {
+ if (!silent)
+ Assert.AreEqual (statement, actualStatement);
+ return false;
+ }
+ }
+ } else {
+ if (!silent)
+ Assert.Fail ("CheckPosition failure: Wrong file Excpected:" + SourceFile.Name + " Actual:" + lastStoppedPosition.FileName);
+ return false;
+ }
+ return true;
+ }
+
+ public void StepIn (string guid, string statement)
+ {
+ StepIn (guid, 0, statement);
+ }
+
+ public void StepIn (string guid, int offset = 0, string statement = null)
+ {
+ targetStoppedEvent.Reset ();
+ Session.StepLine ();
+ CheckPosition (guid, offset, statement);
+ }
+
+ public void StepOver (string guid, string statement)
+ {
+ StepOver (guid, 0, statement);
+ }
+
+ public void StepOver (string guid, int offset = 0, string statement = null)
+ {
+ targetStoppedEvent.Reset ();
+ Session.NextLine ();
+ CheckPosition (guid, offset, statement);
+ }
+
+ public void StepOut (string guid, string statement)
+ {
+ StepOut (guid, 0, statement);
+ }
+
+ public void StepOut (string guid, int offset = 0, string statement = null)
+ {
+ targetStoppedEvent.Reset ();
+ Session.Finish ();
+ CheckPosition (guid, offset, statement);
+ }
+
+ public void Continue (string guid, string statement)
+ {
+ Continue (guid, 0, statement);
+ }
+
+ public void Continue (string guid, int offset = 0, string statement = null)
+ {
+ targetStoppedEvent.Reset ();
+ Session.Continue ();
+ CheckPosition (guid, offset, statement);
+ }
+
+ public void StartTest (string methodName)
+ {
+ if (!targetStoppedEvent.WaitOne (3000)) {
+ Assert.Fail ("StartTest failure: Target stop timeout");
+ }
+ Assert.AreEqual ('"' + methodName + '"', Eval ("NextMethodToCall = \"" + methodName + "\";").Value);
+ targetStoppedEvent.Reset ();
+ Session.Continue ();
+ }
+
+ public void SetNextStatement (string guid, int offset = 0, string statement = null)
+ {
+ int line, column;
+ GetLineAndColumn (guid, offset, statement, out line, out column);
+ Session.SetNextStatement (SourceFile.Name, line, column);
+ }
+
+ public void AddCatchpoint(string exceptionName, bool includeSubclasses)
+ {
+ Session.Breakpoints.Add (new Catchpoint (exceptionName, includeSubclasses));
}
}
-
+
static class EvalHelper
{
public static ObjectValue Sync (this ObjectValue val)
{
if (!val.IsEvaluating)
return val;
-
+
object locker = new object ();
EventHandler h = delegate {
lock (locker) {
Monitor.PulseAll (locker);
}
};
-
+
val.ValueChanged += h;
-
+
lock (locker) {
while (val.IsEvaluating) {
if (!Monitor.Wait (locker, 4000))
throw new Exception ("Timeout while waiting for value evaluation");
}
}
-
+
val.ValueChanged -= h;
return val;
}
+
+ public static ObjectValue GetChildSync (this ObjectValue val, string name, EvaluationOptions ops)
+ {
+ var result = val.GetChild (name, ops);
+
+ return result != null ? result.Sync () : null;
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/EvaluationTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/EvaluationTests.cs
index 0cb5e43a45..6f7f08ea25 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/EvaluationTests.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/EvaluationTests.cs
@@ -24,56 +24,76 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+using System;
+
using Mono.Debugging.Client;
using NUnit.Framework;
+using Mono.Debugging.Soft;
namespace MonoDevelop.Debugger.Tests
{
[TestFixture]
public abstract class EvaluationTests: DebugTests
{
- DebuggerSession ds;
- StackFrame frame;
-
- protected EvaluationTests (string de): base (de)
+ protected EvaluationTests (string de, bool allowTargetInvokes) : base (de)
{
+ AllowTargetInvokes = allowTargetInvokes;
}
[TestFixtureSetUp]
public override void SetUp ()
{
base.SetUp ();
- ds = Start ("TestEvaluation");
- if (ds == null)
- Assert.Ignore ("Engine not found: {0}", EngineId);
- frame = ds.ActiveThread.Backtrace.GetFrame (0);
+ Start ("TestEvaluation");
+ Session.TypeResolverHandler = ResolveType;
}
- [TestFixtureTearDown]
- public override void TearDown ()
+ static string ResolveType (string identifier, SourceLocation location)
{
- base.TearDown ();
- if (ds != null) {
- ds.Exit ();
- ds.Dispose ();
+ switch (identifier) {
+ case "SomeClassInNamespace":
+ return "MonoDevelop.Debugger.Tests.TestApp.SomeClassInNamespace";
+ case "ParentNestedClass":
+ return "MonoDevelop.Debugger.Tests.TestApp.TestEvaluationParent.ParentNestedClass";
+ case "NestedClass":
+ return "MonoDevelop.Debugger.Tests.TestApp.TestEvaluation.NestedClass";
+ case "TestEvaluation":
+ return "MonoDevelop.Debugger.Tests.TestApp.TestEvaluation";
+ case "NestedGenericClass`2":
+ return "MonoDevelop.Debugger.Tests.TestApp.TestEvaluation.NestedGenericClass";
+ case "Dictionary`2":
+ return "System.Collections.Generic.Dictionary";
+ case "Thing`1":
+ return "Thing";
+ case "A":
+ return "A";
+ case "B":
+ return "B";
+ case "C":
+ return "C";
+ case "System":
+ return "System";
+ case "MonoDevelop":
+ return "MonoDevelop";
+ case "SomeEnum":
+ return "SomeEnum";
}
+ return null;
}
-
- ObjectValue Eval (string exp)
- {
- return frame.GetExpressionValue (exp, true).Sync ();
- }
-
[Test]
public void This ()
{
+ var soft = Session as SoftDebuggerSession;
+ if (soft != null && soft.ProtocolVersion < new Version (2, 31))
+ Assert.Ignore ("A newer version of the Mono runtime is required.");
+
ObjectValue val = Eval ("this");
- Assert.AreEqual ("{MonoDevelop.Debugger.Tests.TestApp.MainClass}", val.Value);
- Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.MainClass", val.TypeName);
+ Assert.AreEqual ("{MonoDevelop.Debugger.Tests.TestApp.TestEvaluation}", val.Value);
+ Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluation", val.TypeName);
}
-
+
[Test]
public void UnaryOperators ()
{
@@ -97,84 +117,316 @@ namespace MonoDevelop.Debugger.Tests
Assert.AreEqual ("1234", val.Value);
Assert.AreEqual ("int", val.TypeName);
}
-
+
[Test]
public void TypeReference ()
{
- ObjectValue val = Eval ("System.String");
+ ObjectValue val;
+ val = Eval ("System.String");
Assert.AreEqual ("string", val.Value);
Assert.AreEqual ("<type>", val.TypeName);
Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask);
- val = Eval ("MainClass");
- Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.MainClass", val.Value);
+ val = Eval ("TestEvaluation");
+ Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluation", val.Value);
Assert.AreEqual ("<type>", val.TypeName);
Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask);
-
- val = Eval ("MonoDevelop.Debugger.Tests.TestApp.MainClass");
- Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.MainClass", val.Value);
+
+ val = Eval ("A");
+ Assert.AreEqual ("A", val.Value);
+ Assert.AreEqual ("<type>", val.TypeName);
+ Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask);
+
+ val = Eval ("NestedClass");
+ Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluation.NestedClass", val.Value);
+ Assert.AreEqual ("<type>", val.TypeName);
+ Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask);
+
+ val = Eval ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluation");
+ Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluation", val.Value);
+ Assert.AreEqual ("<type>", val.TypeName);
+ Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask);
+
+ val = Eval ("NestedClass.DoubleNestedClass");
+ Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluation.NestedClass.DoubleNestedClass", val.Value);
+ Assert.AreEqual ("<type>", val.TypeName);
+ Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask);
+
+ val = Eval ("ParentNestedClass");
+ Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluationParent.ParentNestedClass", val.Value);
+ Assert.AreEqual ("<type>", val.TypeName);
+ Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask);
+
+ val = Eval ("SomeClassInNamespace");
+ Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.SomeClassInNamespace", val.Value);
Assert.AreEqual ("<type>", val.TypeName);
Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask);
}
-
+
[Test]
public virtual void TypeReferenceGeneric ()
{
- ObjectValue val = Eval ("System.Collections.Generic.Dictionary<string,int>");
+ ObjectValue val;
+ val = Eval ("System.Collections.Generic.Dictionary<string,int>");
Assert.AreEqual ("System.Collections.Generic.Dictionary<string,int>", val.Value);
Assert.AreEqual ("<type>", val.TypeName);
Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask);
+
+ val = Eval ("Thing<string>.Done<int>");
+ Assert.AreEqual ("Thing<string>.Done<int>", val.Value);
+ Assert.AreEqual ("<type>", val.TypeName);
+ Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask);
}
-
+
[Test]
public virtual void Typeof ()
{
- ObjectValue val = Eval ("typeof(System.Console)");
+ var soft = Session as SoftDebuggerSession;
+ if (soft != null && soft.ProtocolVersion < new Version (2, 31))
+ Assert.Ignore ("A newer version of the Mono runtime is required.");
+
+ var val = Eval ("typeof(System.Console)");
Assert.IsTrue (val.TypeName == "System.MonoType" || val.TypeName == "System.RuntimeType", "Incorrect type name: " + val.TypeName);
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.Value == "{System.MonoType}" || val.Value == "{System.RuntimeType}");
+ val.Refresh (options);
+ val = val.Sync ();
+ }
Assert.AreEqual ("{System.Console}", val.Value);
}
-
+
[Test]
public void MethodInvoke ()
{
ObjectValue val;
+
+ var soft = Session as SoftDebuggerSession;
+ if (soft != null && soft.ProtocolVersion < new Version (2, 31))
+ Assert.Ignore ("A newer version of the Mono runtime is required.");
+
val = Eval ("TestMethod ()");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
Assert.AreEqual ("1", val.Value);
Assert.AreEqual ("int", val.TypeName);
val = Eval ("TestMethod (\"23\")");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
Assert.AreEqual ("24", val.Value);
Assert.AreEqual ("int", val.TypeName);
val = Eval ("TestMethod (42)");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
Assert.AreEqual ("43", val.Value);
Assert.AreEqual ("int", val.TypeName);
-
+
val = Eval ("TestMethod (false)");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
Assert.AreEqual ("2", val.Value);
Assert.AreEqual ("int", val.TypeName);
val = Eval ("this.TestMethod ()");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
Assert.AreEqual ("1", val.Value);
Assert.AreEqual ("int", val.TypeName);
val = Eval ("this.TestMethod (\"23\")");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
Assert.AreEqual ("24", val.Value);
Assert.AreEqual ("int", val.TypeName);
val = Eval ("this.TestMethod (42)");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
Assert.AreEqual ("43", val.Value);
Assert.AreEqual ("int", val.TypeName);
val = Eval ("System.Int32.Parse (\"67\")");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
Assert.AreEqual ("67", val.Value);
Assert.AreEqual ("int", val.TypeName);
val = Eval ("this.BoxingTestMethod (43)");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
Assert.AreEqual ("\"43\"", val.Value);
Assert.AreEqual ("string", val.TypeName);
+
+ val = Eval ("objWithMethodA.MethodA()");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("\"AbstractImplementation\"", val.Value);
+ Assert.AreEqual ("string", val.TypeName);
+
+ // FIXME: failing on CorDebugger
+ if (Session is SoftDebuggerSession) {
+ val = Eval ("true.ToString()");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+
+ Assert.AreEqual ("\"True\"", val.Value);
+ Assert.AreEqual ("string", val.TypeName);
+ }
+ }
+
+ [Test]
+ public void GenericMethodInvoke ()
+ {
+ var soft = Session as SoftDebuggerSession;
+ if (soft != null && soft.ProtocolVersion < new Version (2, 31))
+ Assert.Ignore ("A newer version of the Mono runtime is required.");
+
+ if (Session.GetType ().Name == "CorDebuggerSession")
+ Assert.Ignore ("TODO: Win32 support generic invokes");
+
+ if (!AllowTargetInvokes)
+ return;
+
+ ObjectValue val;
+ val = Eval ("done.ReturnInt5()");
+ Assert.AreEqual ("5", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("done.ReturnSame(3)");
+ Assert.AreEqual ("3", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("ReturnSame(4)");
+ Assert.AreEqual ("4", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("ReturnSame(\"someString\")");
+ Assert.AreEqual ("\"someString\"", val.Value);
+ Assert.AreEqual ("string", val.TypeName);
+
+ val = Eval ("ReturnNew<WithToString>()");
+ Assert.AreEqual ("{SomeString}", val.Value);
+ Assert.AreEqual ("WithToString", val.TypeName);
+
+ val = Eval ("intZero");
+ Assert.AreEqual ("0", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("intOne");
+ Assert.AreEqual ("1", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ // TODO: in, out, and ref params are not currently supported
+ //val = Eval ("Swap (ref intZero, ref intOne)");
+ //Assert.AreEqual ("", val.Value);
+
+ //val = Eval ("intZero");
+ //Assert.AreEqual ("1", val.Value);
+ //Assert.AreEqual ("int", val.TypeName);
+
+ //val = Eval ("intOne");
+ //Assert.AreEqual ("0", val.Value);
+ //Assert.AreEqual ("int", val.TypeName);
+
+ //Lets return in same state as before in case some other test will use
+ //val = Eval ("Swap (ref intZero, ref intOne)");
+ //Assert.AreEqual ("", val.Value);
+
+ val = Eval ("GenerateList(\"someString\", 5)");
+ Assert.AreEqual ("Count=5", val.Value);
+ Assert.AreEqual ("System.Collections.Generic.List<string>", val.TypeName);
+
+ val = Eval ("GenerateList(2.0, 6)");
+ Assert.AreEqual ("Count=6", val.Value);
+ Assert.AreEqual ("System.Collections.Generic.List<double>", val.TypeName);
+
+ val = Eval ("done.GetDefault()");
+ Assert.AreEqual ("0", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("done.GetParentDefault()");
+ Assert.AreEqual ("(null)", val.Value);
+ Assert.AreEqual ("object", val.TypeName);
+
+ val = Eval ("new Dictionary<int,string>()");
+ Assert.AreEqual ("Count=0", val.Value);
+ Assert.AreEqual ("System.Collections.Generic.Dictionary<int,string>", val.TypeName);
+
+ val = Eval ("done.Property");
+ Assert.AreEqual ("54", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
}
-
+
[Test]
public void Indexers ()
{
@@ -191,48 +443,265 @@ namespace MonoDevelop.Debugger.Tests
Assert.AreEqual ("string", val.TypeName);
val = Eval ("staticString[2]");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
Assert.AreEqual ("'m'", val.Value);
Assert.AreEqual ("char", val.TypeName);
val = Eval ("alist[0]");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
Assert.AreEqual ("1", val.Value);
Assert.AreEqual ("int", val.TypeName);
val = Eval ("alist[1]");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
Assert.AreEqual ("\"two\"", val.Value);
Assert.AreEqual ("string", val.TypeName);
val = Eval ("alist[2]");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
Assert.AreEqual ("3", val.Value);
Assert.AreEqual ("int", val.TypeName);
}
-
+
+ void CheckValue (string expected, string actual, bool isSimpleProperty)
+ {
+ if (AllowTargetInvokes || isSimpleProperty)
+ Assert.AreEqual (expected, actual);
+ else
+ Assert.AreEqual ("Implicit evaluation is disabled", actual);
+ }
+
[Test]
public void MemberReference ()
{
- ObjectValue val = Eval ("alist.Count");
+ ObjectValue val;
+
+ var soft = Session as SoftDebuggerSession;
+ if (soft != null && soft.ProtocolVersion < new Version (2, 31))
+ Assert.Ignore ("A newer version of the Mono runtime is required.");
+
+ val = Eval ("\"someString\".Length");
+ if (!AllowTargetInvokes && soft == null) {
+ // Note: this is a simple property which gets evaluated client-side by the SDB backend
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("10", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("numbers.Length");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("3", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("\"someString\".GetHashCode()");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("numbers.GetHashCode()");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("\"someString\".EndsWith (\"ing\")");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("true", val.Value);
+ Assert.AreEqual ("bool", val.TypeName);
+
+ val = Eval ("alist.Count");
+ if (!AllowTargetInvokes && soft == null) {
+ // Note: this is a simple property which gets evaluated client-side by the SDB backend
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
Assert.AreEqual ("3", val.Value);
Assert.AreEqual ("int", val.TypeName);
Eval ("var tt = this");
-
- val = Eval ("tt.someString");
- Assert.AreEqual ("\"hi\"", val.Value);
- Assert.AreEqual ("string", val.TypeName);
-
+
+ // FIXME: this errors out when target invokes are disabled
+ if (AllowTargetInvokes) {
+ val = Eval ("tt.someString");
+ Assert.AreEqual ("\"hi\"", val.Value);
+ Assert.AreEqual ("string", val.TypeName);
+ }
+
val = Eval ("MonoDevelop.Debugger.Tests");
Assert.AreEqual ("MonoDevelop.Debugger.Tests", val.Value);
Assert.AreEqual ("<namespace>", val.TypeName);
- val = Eval ("MonoDevelop.Debugger.Tests.TestApp.MainClass");
- Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.MainClass", val.Value);
+ val = Eval ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluation");
+ Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluation", val.Value);
Assert.AreEqual ("<type>", val.TypeName);
- val = Eval ("MonoDevelop.Debugger.Tests.TestApp.MainClass.staticString");
+ val = Eval ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluation.staticString");
Assert.AreEqual ("\"some static\"", val.Value);
Assert.AreEqual ("string", val.TypeName);
+
+ val = Eval ("richObject");
+ Assert.AreEqual ("{RichClass}", val.Value);
+ Assert.AreEqual ("RichClass", val.TypeName);
+
+ var richChildren = val.GetAllChildren ();
+ Assert.AreEqual (13, richChildren.Length);
+ Assert.AreEqual ("publicInt1", richChildren [0].Name);
+ Assert.AreEqual ("int", richChildren [0].TypeName);
+ Assert.AreEqual ("1", richChildren [0].Value);
+ Assert.AreEqual ("publicInt2", richChildren [1].Name);
+ Assert.AreEqual ("int", richChildren [1].TypeName);
+ Assert.AreEqual ("2", richChildren [1].Value);
+ Assert.AreEqual ("publicInt3", richChildren [2].Name);
+ Assert.AreEqual ("int", richChildren [2].TypeName);
+ Assert.AreEqual ("3", richChildren [2].Value);
+ Assert.AreEqual ("publicPropInt1", richChildren [3].Name);
+ Assert.AreEqual ("int", richChildren [3].TypeName);
+ CheckValue ("1", richChildren [3].Value, soft != null);
+ Assert.AreEqual ("publicPropInt2", richChildren [4].Name);
+ Assert.AreEqual ("int", richChildren [4].TypeName);
+ CheckValue ("2", richChildren [4].Value, soft != null);
+ Assert.AreEqual ("publicPropInt3", richChildren [5].Name);
+ Assert.AreEqual ("int", richChildren [5].TypeName);
+ CheckValue ("3", richChildren [5].Value, soft != null);
+ Assert.AreEqual ("publicPropStringA", richChildren [6].Name);
+ Assert.AreEqual ("string", richChildren [6].TypeName);
+ CheckValue ("\"stringA\"", richChildren [6].Value, soft != null);
+ Assert.AreEqual ("publicPropStringB", richChildren [7].Name);
+ Assert.AreEqual ("string", richChildren [7].TypeName);
+ CheckValue ("\"stringB\"", richChildren [7].Value, soft != null);
+ Assert.AreEqual ("publicPropStringC", richChildren [8].Name);
+ Assert.AreEqual ("string", richChildren [8].TypeName);
+ CheckValue ("\"stringC\"", richChildren [8].Value, soft != null);
+ Assert.AreEqual ("publicStringA", richChildren [9].Name);
+ Assert.AreEqual ("string", richChildren [9].TypeName);
+ Assert.AreEqual ("\"stringA\"", richChildren [9].Value);
+ Assert.AreEqual ("publicStringB", richChildren [10].Name);
+ Assert.AreEqual ("string", richChildren [10].TypeName);
+ Assert.AreEqual ("\"stringB\"", richChildren [10].Value);
+ Assert.AreEqual ("publicStringC", richChildren [11].Name);
+ Assert.AreEqual ("string", richChildren [11].TypeName);
+ Assert.AreEqual ("\"stringC\"", richChildren [11].Value);
+ Assert.AreEqual ("Non-public members", richChildren [12].Name);
+
+ richChildren = richChildren [12].GetAllChildren ();
+ Assert.AreEqual (12, richChildren.Length);
+ Assert.AreEqual ("privateInt1", richChildren [0].Name);
+ Assert.AreEqual ("int", richChildren [0].TypeName);
+ Assert.AreEqual ("1", richChildren [0].Value);
+ Assert.AreEqual ("privateInt2", richChildren [1].Name);
+ Assert.AreEqual ("int", richChildren [1].TypeName);
+ Assert.AreEqual ("2", richChildren [1].Value);
+ Assert.AreEqual ("privateInt3", richChildren [2].Name);
+ Assert.AreEqual ("int", richChildren [2].TypeName);
+ Assert.AreEqual ("3", richChildren [2].Value);
+ Assert.AreEqual ("privatePropInt1", richChildren [3].Name);
+ Assert.AreEqual ("int", richChildren [3].TypeName);
+ CheckValue ("1", richChildren [3].Value, soft != null);
+ Assert.AreEqual ("privatePropInt2", richChildren [4].Name);
+ Assert.AreEqual ("int", richChildren [4].TypeName);
+ CheckValue ("2", richChildren [4].Value, soft != null);
+ Assert.AreEqual ("privatePropInt3", richChildren [5].Name);
+ Assert.AreEqual ("int", richChildren [5].TypeName);
+ CheckValue ("3", richChildren [5].Value, soft != null);
+ Assert.AreEqual ("privatePropStringA", richChildren [6].Name);
+ Assert.AreEqual ("string", richChildren [6].TypeName);
+ CheckValue ("\"stringA\"", richChildren [6].Value, soft != null);
+ Assert.AreEqual ("privatePropStringB", richChildren [7].Name);
+ Assert.AreEqual ("string", richChildren [7].TypeName);
+ CheckValue ("\"stringB\"", richChildren [7].Value, soft != null);
+ Assert.AreEqual ("privatePropStringC", richChildren [8].Name);
+ Assert.AreEqual ("string", richChildren [8].TypeName);
+ CheckValue ("\"stringC\"", richChildren [8].Value, soft != null);
+ Assert.AreEqual ("privateStringA", richChildren [9].Name);
+ Assert.AreEqual ("string", richChildren [9].TypeName);
+ Assert.AreEqual ("\"stringA\"", richChildren [9].Value);
+ Assert.AreEqual ("privateStringB", richChildren [10].Name);
+ Assert.AreEqual ("string", richChildren [10].TypeName);
+ Assert.AreEqual ("\"stringB\"", richChildren [10].Value);
+ Assert.AreEqual ("privateStringC", richChildren [11].Name);
+ Assert.AreEqual ("string", richChildren [11].TypeName);
+ Assert.AreEqual ("\"stringC\"", richChildren [11].Value);
+
+ if (AllowTargetInvokes) {
+ val = Eval ("richObject.publicStringB=\"changedTextB\"");
+ Assert.AreEqual ("string", val.TypeName);
+ Assert.AreEqual ("\"changedTextB\"", val.Value);
+ val = Eval ("richObject.publicStringB");
+ Assert.AreEqual ("string", val.TypeName);
+ Assert.AreEqual ("\"changedTextB\"", val.Value);
+
+ val = Eval ("richObject");
+ Assert.AreEqual ("{RichClass}", val.Value);
+ Assert.AreEqual ("RichClass", val.TypeName);
+ richChildren = val.GetAllChildren ();
+ Assert.AreEqual ("publicPropStringB", richChildren [7].Name);
+ Assert.AreEqual ("string", richChildren [7].TypeName);
+ Assert.AreEqual ("\"stringB\"", richChildren [7].Value);
+ }
}
-
+
[Test]
public void ConditionalExpression ()
{
@@ -244,11 +713,16 @@ namespace MonoDevelop.Debugger.Tests
Assert.AreEqual ("\"no\"", val.Value);
Assert.AreEqual ("string", val.TypeName);
}
-
+
[Test]
public void Cast ()
{
ObjectValue val;
+
+ var soft = Session as SoftDebuggerSession;
+ if (soft != null && soft.ProtocolVersion < new Version (2, 31))
+ Assert.Ignore ("A newer version of the Mono runtime is required.");
+
val = Eval ("(byte)n");
Assert.AreEqual ("32", val.Value);
Assert.AreEqual ("byte", val.TypeName);
@@ -370,11 +844,15 @@ namespace MonoDevelop.Debugger.Tests
Assert.AreEqual ("one|two", val.DisplayValue);
Assert.AreEqual ("SomeEnum", val.TypeName);
}
-
+
[Test]
public void BinaryOperators ()
{
ObjectValue val;
+
+ var soft = Session as SoftDebuggerSession;
+ if (soft != null && soft.ProtocolVersion < new Version (2, 31))
+ Assert.Ignore ("A newer version of the Mono runtime is required.");
// Boolean
@@ -437,7 +915,7 @@ namespace MonoDevelop.Debugger.Tests
Assert.AreEqual ("string", val.TypeName);
val = Eval ("this + \"a\"");
- Assert.AreEqual ("\"MonoDevelop.Debugger.Tests.TestApp.MainClassa\"", val.Value);
+ Assert.AreEqual ("\"MonoDevelop.Debugger.Tests.TestApp.TestEvaluationa\"", val.Value);
Assert.AreEqual ("string", val.TypeName);
// Equality
@@ -453,6 +931,28 @@ namespace MonoDevelop.Debugger.Tests
val = Eval ("(long)2 == (int)2");
Assert.AreEqual ("true", val.Value);
Assert.AreEqual ("bool", val.TypeName);
+
+ val = Eval ("SomeEnum.two == SomeEnum.one");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("false", val.Value);
+ Assert.AreEqual ("bool", val.TypeName);
+
+ val = Eval ("SomeEnum.one != SomeEnum.one");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("false", val.Value);
+ Assert.AreEqual ("bool", val.TypeName);
// Arithmetic
@@ -463,68 +963,177 @@ namespace MonoDevelop.Debugger.Tests
Assert.AreEqual ("true", val.Value);
Assert.AreEqual ("bool", val.TypeName);
}
-
+
[Test]
- public virtual void Assignment ()
+ public void BinaryOperatorOverrides ()
{
ObjectValue val;
- Eval ("n = 6");
- val = Eval ("n");
- Assert.AreEqual ("6", val.Value);
- Assert.AreEqual ("int", val.TypeName);
- Eval ("n = 32");
- val = Eval ("n");
- Assert.AreEqual ("32", val.Value);
-
- Eval ("someString = \"test\"");
- val = Eval ("someString");
- Assert.AreEqual ("\"test\"", val.Value);
- Assert.AreEqual ("string", val.TypeName);
- Eval ("someString = \"hi\"");
- val = Eval ("someString");
- Assert.AreEqual ("\"hi\"", val.Value);
-
- Eval ("numbers[0] = \"test\"");
- val = Eval ("numbers[0]");
- Assert.AreEqual ("\"test\"", val.Value);
+
+ if (!AllowTargetInvokes)
+ return;
+
+ var soft = Session as SoftDebuggerSession;
+ if (soft != null && soft.ProtocolVersion < new Version (2, 31))
+ Assert.Ignore ("Requires a newer version of the Mono runtime.");
+
+ val = Eval ("ops1 == ops3");
+ Assert.AreEqual ("false", val.Value);
+ Assert.AreEqual ("bool", val.TypeName);
+
+ val = Eval ("ops1 != ops3");
+ Assert.AreEqual ("true", val.Value);
+ Assert.AreEqual ("bool", val.TypeName);
+
+ val = Eval ("ops2 == ops3");
+ Assert.AreEqual ("true", val.Value);
+ Assert.AreEqual ("bool", val.TypeName);
+
+ val = Eval ("ops2 != ops3");
+ Assert.AreEqual ("false", val.Value);
+ Assert.AreEqual ("bool", val.TypeName);
+
+ val = Eval ("ops1 <= ops2");
+ Assert.AreEqual ("true", val.Value);
+ Assert.AreEqual ("bool", val.TypeName);
+
+ val = Eval ("ops1 < ops2");
+ Assert.AreEqual ("true", val.Value);
+ Assert.AreEqual ("bool", val.TypeName);
+
+ val = Eval ("ops1 >= ops2");
+ Assert.AreEqual ("false", val.Value);
+ Assert.AreEqual ("bool", val.TypeName);
+
+ val = Eval ("ops1 > ops2");
+ Assert.AreEqual ("false", val.Value);
+ Assert.AreEqual ("bool", val.TypeName);
+
+ val = Eval ("ops1 + ops2");
+ Assert.AreEqual ("{[BinaryOperatorOverrides 3]}", val.Value);
+ Assert.AreEqual ("BinaryOperatorOverrides", val.TypeName);
+
+ val = Eval ("ops1 - ops2");
+ Assert.AreEqual ("{[BinaryOperatorOverrides -1]}", val.Value);
+ Assert.AreEqual ("BinaryOperatorOverrides", val.TypeName);
+
+ val = Eval ("ops1 * ops2");
+ Assert.AreEqual ("{[BinaryOperatorOverrides 2]}", val.Value);
+ Assert.AreEqual ("BinaryOperatorOverrides", val.TypeName);
+
+ val = Eval ("ops2 / ops1");
+ Assert.AreEqual ("{[BinaryOperatorOverrides 2]}", val.Value);
+ Assert.AreEqual ("BinaryOperatorOverrides", val.TypeName);
+
+ val = Eval ("ops1 % ops2");
+ Assert.AreEqual ("{[BinaryOperatorOverrides 1]}", val.Value);
+ Assert.AreEqual ("BinaryOperatorOverrides", val.TypeName);
+
+ val = Eval ("ops1 & ops2");
+ Assert.AreEqual ("{[BinaryOperatorOverrides 0]}", val.Value);
+ Assert.AreEqual ("BinaryOperatorOverrides", val.TypeName);
+
+ val = Eval ("ops1 | ops2");
+ Assert.AreEqual ("{[BinaryOperatorOverrides 3]}", val.Value);
+ Assert.AreEqual ("BinaryOperatorOverrides", val.TypeName);
+
+ val = Eval ("ops1 ^ ops2");
+ Assert.AreEqual ("{[BinaryOperatorOverrides 3]}", val.Value);
+ Assert.AreEqual ("BinaryOperatorOverrides", val.TypeName);
+
+ val = Eval ("ops1 << 1");
+ Assert.AreEqual ("{[BinaryOperatorOverrides 2]}", val.Value);
+ Assert.AreEqual ("BinaryOperatorOverrides", val.TypeName);
+
+ val = Eval ("ops2 >> 1");
+ Assert.AreEqual ("{[BinaryOperatorOverrides 1]}", val.Value);
+ Assert.AreEqual ("BinaryOperatorOverrides", val.TypeName);
+ }
+
+ void AssertAssignment (string assignment, string variable, string value, string type)
+ {
+ ObjectValue val;
+
+ val = Eval (assignment);
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+
+ Assert.AreEqual (value, val.Value);
+ Assert.AreEqual (type, val.TypeName);
+
+ val = Eval (variable);
+ if (!AllowTargetInvokes && val.IsNotSupported) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+
+ Assert.AreEqual (value, val.Value);
+ Assert.AreEqual (type, val.TypeName);
+ }
+
+ [Test]
+ public void MethodParameters ()
+ {
+ ObjectValue val;
+ val = Eval ("stringParam");
+ Assert.AreEqual ("\"testString\"", val.Value);
Assert.AreEqual ("string", val.TypeName);
- Eval ("numbers[0] = \"one\"");
- val = Eval ("numbers[0]");
- Assert.AreEqual ("\"one\"", val.Value);
- Eval ("alist[0] = 6");
- val = Eval ("alist[0]");
- Assert.AreEqual ("6", val.Value);
+ val = Eval ("intParam");
+ Assert.AreEqual ("55", val.Value);
Assert.AreEqual ("int", val.TypeName);
- Eval ("alist[0] = 1");
- val = Eval ("alist[0]");
- Assert.AreEqual ("1", val.Value);
+
+ val = Eval ("intParam2");
+ Assert.AreEqual ("66", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+ }
+
+ [Test]
+ public virtual void Assignment ()
+ {
+ AssertAssignment ("n = 6", "n", "6", "int");
+ AssertAssignment ("n = 32", "n", "32", "int");
+
+ AssertAssignment ("someString = \"test\"", "someString", "\"test\"", "string");
+ AssertAssignment ("someString = \"hi\"", "someString", "\"hi\"", "string");
+
+ AssertAssignment ("numbers[0] = \"test\"", "numbers[0]", "\"test\"", "string");
+ AssertAssignment ("numbers[0] = \"one\"", "numbers[0]", "\"one\"", "string");
+
+ AssertAssignment ("alist[0] = 6", "alist[0]", "6", "int");
+ AssertAssignment ("alist[0] = 1", "alist[0]", "1", "int");
+
+ AssertAssignment ("ProtectedStringProperty = \"test\"", "ProtectedStringProperty", "\"test\"", "string");
+ AssertAssignment ("ProtectedStringProperty = \"hi\"", "ProtectedStringProperty", "\"hi\"", "string");
}
-
+
[Test]
public virtual void AssignmentStatic ()
{
- ObjectValue val;
-
- Eval ("staticString = \"test\"");
- val = Eval ("staticString");
- Assert.AreEqual ("\"test\"", val.Value);
- Assert.AreEqual ("string", val.TypeName);
- Eval ("staticString = \"some static\"");
- val = Eval ("staticString");
- Assert.AreEqual ("\"some static\"", val.Value);
+ AssertAssignment ("staticString = \"test\"", "staticString", "\"test\"", "string");
+ AssertAssignment ("staticString = \"some static\"", "staticString", "\"some static\"", "string");
}
-
+
[Test]
public void FormatBool ()
{
ObjectValue val;
+
val = Eval ("true");
Assert.AreEqual ("true", val.Value);
+
val = Eval ("false");
Assert.AreEqual ("false", val.Value);
}
-
+
[Test]
public void FormatNumber ()
{
@@ -547,11 +1156,15 @@ namespace MonoDevelop.Debugger.Tests
val = Eval ("(ulong)123");
Assert.AreEqual ("123", val.Value);
+
+ var soft = Session as SoftDebuggerSession;
+ if (soft != null && soft.ProtocolVersion < new Version (2, 31))
+ return;
val = Eval ("dec");
Assert.AreEqual ("123.456", val.Value);
}
-
+
[Test]
public void FormatString ()
{
@@ -560,12 +1173,20 @@ namespace MonoDevelop.Debugger.Tests
Assert.AreEqual ("\"hi\"", val.Value);
val = Eval ("EscapedStrings");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
Assert.AreEqual ("\" \\\" \\\\ \\a \\b \\f \\v \\n \\r \\t\"", val.Value);
val = Eval ("\" \\\" \\\\ \\a \\b \\f \\v \\n \\r \\t\"");
Assert.AreEqual ("\" \\\" \\\\ \\a \\b \\f \\v \\n \\r \\t\"", val.Value);
}
-
+
[Test]
public void FormatChar ()
{
@@ -618,17 +1239,29 @@ namespace MonoDevelop.Debugger.Tests
Assert.AreEqual ("'\\t'", val.Value);
Assert.AreEqual ("9 '\\t'", val.DisplayValue);
}
-
+
[Test]
public void FormatObject ()
{
ObjectValue val;
+
+ var soft = Session as SoftDebuggerSession;
+ if (soft != null && soft.ProtocolVersion < new Version (2, 31))
+ Assert.Ignore ("A newer version of the Mono runtime is required.");
val = Eval ("c");
Assert.AreEqual ("{C}", val.Value);
Assert.AreEqual ("C", val.TypeName);
val = Eval ("withDisplayString");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.AreEqual ("{WithDisplayString}", val.Value);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
Assert.AreEqual ("Some one Value 2 End", val.Value);
Assert.AreEqual ("WithDisplayString", val.TypeName);
@@ -640,7 +1273,7 @@ namespace MonoDevelop.Debugger.Tests
Assert.AreEqual ("{SomeString}", val.Value);
Assert.AreEqual ("WithToString", val.TypeName);*/
}
-
+
[Test]
public void FormatArray ()
{
@@ -649,46 +1282,67 @@ namespace MonoDevelop.Debugger.Tests
val = Eval ("numbers");
Assert.AreEqual ("{string[3]}", val.Value);
Assert.AreEqual ("string[]", val.TypeName);
-
+
val = Eval ("numbersArrays");
Assert.AreEqual ("{int[2][]}", val.Value);
Assert.AreEqual ("int[][]", val.TypeName);
-
+
val = Eval ("numbersMulti");
Assert.AreEqual ("{int[3,4,5]}", val.Value);
Assert.AreEqual ("int[,,]", val.TypeName);
+ Assert.IsFalse (val.IsNull);
+
+ val = Eval ("nulledByteArray");
+ Assert.AreEqual ("(null)", val.Value);
+ Assert.AreEqual ("byte[]", val.TypeName);
+ Assert.IsTrue (val.IsNull);
}
-
+
[Test]
public void FormatGeneric ()
{
ObjectValue val;
-
- ds.Options.EvaluationOptions.AllowTargetInvoke = false;
- val = Eval ("dict");
- ds.Options.EvaluationOptions.AllowTargetInvoke = true;
+
+ try {
+ Session.Options.EvaluationOptions.AllowTargetInvoke = false;
+ val = Eval ("dict");
+ } finally {
+ Session.Options.EvaluationOptions.AllowTargetInvoke = AllowTargetInvokes;
+ }
Assert.AreEqual ("{System.Collections.Generic.Dictionary<int,string[]>}", val.Value);
Assert.AreEqual ("System.Collections.Generic.Dictionary<int,string[]>", val.TypeName);
-
- ds.Options.EvaluationOptions.AllowTargetInvoke = false;
- val = Eval ("dictArray");
- ds.Options.EvaluationOptions.AllowTargetInvoke = true;
+
+ try {
+ Session.Options.EvaluationOptions.AllowTargetInvoke = false;
+ val = Eval ("dictArray");
+ } finally {
+ Session.Options.EvaluationOptions.AllowTargetInvoke = AllowTargetInvokes;
+ }
Assert.AreEqual ("{System.Collections.Generic.Dictionary<int,string[]>[2,3]}", val.Value);
Assert.AreEqual ("System.Collections.Generic.Dictionary<int,string[]>[,]", val.TypeName);
-
+
+
+ var soft = Session as SoftDebuggerSession;
+ if (soft != null && soft.ProtocolVersion < new Version (2, 31))
+ return;
+
val = Eval ("thing.done");
Assert.AreEqual ("{Thing<string>.Done<int>[1]}", val.Value);
Assert.AreEqual ("Thing<string>.Done<int>[]", val.TypeName);
-
+
val = Eval ("done");
Assert.AreEqual ("{Thing<string>.Done<int>}", val.Value);
Assert.AreEqual ("Thing<string>.Done<int>", val.TypeName);
}
-
+
[Test]
public void FormatEnum ()
{
ObjectValue val;
+
+ var soft = Session as SoftDebuggerSession;
+ if (soft != null && soft.ProtocolVersion < new Version (2, 31))
+ Assert.Ignore ("A newer version of the Mono runtime is required.");
val = Eval ("SomeEnum.one");
Assert.AreEqual ("SomeEnum.one", val.Value);
@@ -702,5 +1356,517 @@ namespace MonoDevelop.Debugger.Tests
Assert.AreEqual ("SomeEnum.one|SomeEnum.two", val.Value);
Assert.AreEqual ("one|two", val.DisplayValue);
}
+
+ [Test]
+ public void LambdaInvoke ()
+ {
+ ObjectValue val;
+
+ var soft = Session as SoftDebuggerSession;
+ if (soft != null && soft.ProtocolVersion < new Version (2, 31))
+ Assert.Ignore ("A newer version of the Mono runtime is required.");
+
+ val = Eval ("action");
+ Assert.AreEqual ("{System.Action}", val.Value);
+ Assert.AreEqual ("System.Action", val.TypeName);
+
+ val = Eval ("modifyInLamda");
+ Assert.AreEqual ("\"modified\"", val.Value);
+ Assert.AreEqual ("string", val.TypeName);
+
+ }
+
+ [Test]
+ public void Structures ()
+ {
+ ObjectValue val;
+
+ var soft = Session as SoftDebuggerSession;
+ if (soft != null && soft.ProtocolVersion < new Version (2, 31))
+ Assert.Ignore ("A newer version of the Mono runtime is required.");
+
+ val = Eval ("simpleStruct");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.AreEqual ("{SimpleStruct}", val.Value);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("{str 45 }", val.Value);
+ Assert.AreEqual ("SimpleStruct", val.TypeName);
+
+ val = Eval ("nulledSimpleStruct");
+ Assert.AreEqual ("null", val.Value);
+ Assert.AreEqual ("SimpleStruct?", val.TypeName);
+ }
+
+ [Test]
+ [Ignore ("TODO")]
+ public void SdbFailingTests ()
+ {
+ ObjectValue val;
+
+ //When fixed put into Inheriting test
+ val = Eval ("b.TestMethod ()");
+ Assert.AreEqual ("2", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ //When fixed put into Inheriting test
+ val = Eval ("b.TestMethod (\"23\")");
+ Assert.AreEqual ("25", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ //When fixed put into Inheriting test
+ val = Eval ("b.TestMethod (42)");
+ Assert.AreEqual ("44", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ //When fixed put into Inheriting test
+ val = Eval ("base.TestMethodBase ()");
+ Assert.AreEqual ("2", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("base.TestMethodBase (\"23\")");
+ Assert.AreEqual ("25", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("base.TestMethodBase (42)");
+ Assert.AreEqual ("44", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("base.TestMethodBaseNotOverrided ()");
+ Assert.AreEqual ("1", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ //When fixed put into MemberReference
+ val = Eval ("numbers.GetLength(0)");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("3", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ //When fixed put into TypeReferenceGeneric
+ val = Eval ("Dictionary<string,NestedClass>");
+ Assert.AreEqual ("System.Collections.Generic.Dictionary<string,MonoDevelop.Debugger.Tests.TestApp.TestEvaluation.NestedClass>", val.Value);
+ Assert.AreEqual ("<type>", val.TypeName);
+ Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask);
+
+ //When fixed put into TypeReferenceGeneric
+ val = Eval ("NestedGenericClass<int,string>");
+ Assert.AreEqual ("MonoDevelop.Debugger.Tests.TestApp.TestEvaluation.NestedGenericClass<int,string>", val.Value);
+ Assert.AreEqual ("<type>", val.TypeName);
+ Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask);
+
+ //When fixed put into MethodInvoke(failing also on CorDebugger)
+ val = Eval ("((IInterfaceWithMethodA)objWithMethodA).MethodA()");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("\"InterfaceImplementation\"", val.Value);
+ Assert.AreEqual ("string", val.TypeName);
+ }
+
+ [Test]
+ public void ObjectCreation ()
+ {
+ ObjectValue val;
+
+ var soft = Session as SoftDebuggerSession;
+ if (soft != null && soft.ProtocolVersion < new Version (2, 31))
+ Assert.Ignore ("A newer version of the Mono runtime is required.");
+
+ val = Eval ("new A().ConstructedBy");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("\"NoArg\"", val.Value);
+
+ val = Eval ("new A(7).ConstructedBy");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("\"IntArg\"", val.Value);
+
+ val = Eval ("new A(\"someString\").ConstructedBy");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("\"StringArg\"", val.Value);
+ }
+
+ [Test]
+ public void StructCreation ()
+ {
+ if (!AllowTargetInvokes)
+ return;
+
+ var soft = Session as SoftDebuggerSession;
+
+ if (soft == null)
+ Assert.Ignore ("TODO: Win32 support generic invokes");
+
+ if (soft != null && soft.ProtocolVersion < new Version (2, 31))
+ Assert.Inconclusive ("A newer version of the Mono runtime is required.");
+
+ ObjectValue val;
+
+ val = Eval ("new SimpleStruct()");
+ Assert.AreEqual ("SimpleStruct", val.TypeName);
+ }
+
+ [Test]
+ public void Inheriting ()
+ {
+ ObjectValue val;
+
+ var soft = Session as SoftDebuggerSession;
+ if (soft != null && soft.ProtocolVersion < new Version (2, 31))
+ Assert.Ignore ("A newer version of the Mono runtime is required.");
+
+ val = Eval ("a.Prop");
+ if (!AllowTargetInvokes && soft == null) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("1", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("a.PropNoVirt1");
+ if (!AllowTargetInvokes && soft == null) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("1", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("a.PropNoVirt2");
+ if (!AllowTargetInvokes && soft == null) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("1", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("a.IntField");
+ Assert.AreEqual ("1", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("a.TestMethod ()");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("1", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("a.TestMethod (\"23\")");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("24", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("a.TestMethod (42)");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("43", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("b.Prop");
+ if (!AllowTargetInvokes && soft == null) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("2", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("b.PropNoVirt1");
+ if (!AllowTargetInvokes && soft == null) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("2", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("b.PropNoVirt2");
+ if (!AllowTargetInvokes && soft == null) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("2", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("b.IntField");
+ Assert.AreEqual ("2", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("this.TestMethodBase ()");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("1", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("this.TestMethodBase (\"23\")");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("24", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("this.TestMethodBase (42)");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("43", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("this.TestMethodBaseNotOverrided ()");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("1", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("TestMethodBase ()");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("1", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("TestMethodBase (\"23\")");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("24", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("TestMethodBase (42)");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("43", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+
+ val = Eval ("TestMethodBaseNotOverrided ()");
+ if (!AllowTargetInvokes) {
+ var options = Session.Options.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
+ Assert.IsTrue (val.IsNotSupported);
+ val.Refresh (options);
+ val = val.Sync ();
+ }
+ Assert.AreEqual ("1", val.Value);
+ Assert.AreEqual ("int", val.TypeName);
+ }
+
+ [Test]
+ public void Lists ()
+ {
+ ObjectValue[] children;
+ ObjectValue val;
+
+ var soft = Session as SoftDebuggerSession;
+ if (soft != null && soft.ProtocolVersion < new Version (2, 31))
+ Assert.Ignore ("A newer version of the Mono runtime is required.");
+
+ val = Eval ("dict");
+ children = val.GetAllChildren ();
+
+ if (AllowTargetInvokes) {
+ // AllowTargetInvokes also allows debugger proxies
+ Assert.AreEqual (2, children.Length);
+ Assert.AreEqual ("[0]", children [0].Name);
+ Assert.AreEqual ("{[5, System.String[]]}", children [0].Value);
+ Assert.AreEqual ("Raw View", children [1].Name);
+
+ children = children [0].GetAllChildren ();
+ Assert.AreEqual ("Key", children [0].Name);
+ Assert.AreEqual ("5", children [0].Value);
+ Assert.AreEqual ("int", children [0].TypeName);
+ Assert.AreEqual ("Value", children [1].Name);
+ Assert.AreEqual ("{string[2]}", children [1].Value);
+
+ children = children [1].GetAllChildren ();
+ Assert.AreEqual ("\"a\"", children [0].Value);
+ Assert.AreEqual ("string", children [0].TypeName);
+ Assert.AreEqual ("\"b\"", children [1].Value);
+ } else {
+ // when AllowTargetInvokes is disabled, it also disables debugger proxies
+ Assert.AreEqual (6, children.Length);
+ Assert.AreEqual ("Comparer", children [0].Name);
+ Assert.AreEqual ("Count", children [1].Name);
+ Assert.AreEqual ("Keys", children [2].Name);
+ Assert.AreEqual ("Values", children [3].Name);
+ Assert.AreEqual ("Static members", children [4].Name);
+ Assert.AreEqual ("Non-public members", children [5].Name);
+ }
+
+ val = Eval ("stringList");
+ children = val.GetAllChildren ();
+
+ if (AllowTargetInvokes) {
+ // AllowTargetInvokes also allows debugger proxies
+ Assert.AreEqual (4, children.Length);
+ Assert.AreEqual ("[0]", children [0].Name);
+ Assert.AreEqual ("[1]", children [1].Name);
+ Assert.AreEqual ("[2]", children [2].Name);
+ Assert.AreEqual ("Raw View", children [3].Name);
+ Assert.AreEqual ("\"aaa\"", children [0].Value);
+ Assert.AreEqual ("\"bbb\"", children [1].Value);
+ Assert.AreEqual ("\"ccc\"", children [2].Value);
+ } else {
+ // when AllowTargetInvokes is disabled, it also disables debugger proxies
+ Assert.AreEqual (4, children.Length);
+ Assert.AreEqual ("Capacity", children [0].Name);
+ Assert.AreEqual ("Count", children [1].Name);
+ Assert.AreEqual ("Static members", children [2].Name);
+ Assert.AreEqual ("Non-public members", children [3].Name);
+ }
+
+ val = Eval ("alist");
+ children = val.GetAllChildren ();
+
+ if (AllowTargetInvokes) {
+ // AllowTargetInvokes also allows debugger proxies
+ Assert.AreEqual (4, children.Length);
+ Assert.AreEqual ("[0]", children [0].Name);
+ Assert.AreEqual ("[1]", children [1].Name);
+ Assert.AreEqual ("[2]", children [2].Name);
+ Assert.AreEqual ("Raw View", children [3].Name);
+ Assert.AreEqual ("1", children [0].Value);
+ Assert.AreEqual ("\"two\"", children [1].Value);
+ Assert.AreEqual ("3", children [2].Value);
+ } else {
+ // when AllowTargetInvokes is disabled, it also disables debugger proxies
+ Assert.AreEqual (8, children.Length);
+ Assert.AreEqual ("Capacity", children [0].Name);
+ Assert.AreEqual ("Count", children [1].Name);
+ Assert.AreEqual ("IsFixedSize", children [2].Name);
+ Assert.AreEqual ("IsReadOnly", children [3].Name);
+ Assert.AreEqual ("IsSynchronized", children [4].Name);
+ Assert.AreEqual ("SyncRoot", children [5].Name);
+ Assert.AreEqual ("Static members", children [6].Name);
+ Assert.AreEqual ("Non-public members", children [7].Name);
+ }
+ }
+
+ [Test]
+ [Ignore ("TODO: Evaluating dynamic objects")]
+ public void DynamicObjects ()
+ {
+ ObjectValue val;
+ val = Eval ("dynObj.someInt");
+ Assert.AreEqual ("dynamic {int}", val.TypeName);
+ Assert.AreEqual ("53", val.Value);
+
+ val = Eval ("dynObj.someString");
+ Assert.AreEqual ("dynamic {string}", val.TypeName);
+ Assert.AreEqual ("\"Hello dynamic objects!\"", val.Value);
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj
index 2a7769dc66..4ce8ad56be 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj
@@ -38,13 +38,14 @@
<ItemGroup>
<Compile Include="DebugTests.cs" />
<Compile Include="SdbEvaluationTests.cs" />
- <Compile Include="MdbEvaluationTests.cs" />
<Compile Include="EvaluationTests.cs" />
<Compile Include="StackFrameTests.cs" />
- <Compile Include="MdbStackFrameTests.cs" />
<Compile Include="SdbStackFrameTests.cs" />
<Compile Include="CorEvaluationTests.cs" />
<Compile Include="CorStackFrameTests.cs" />
+ <Compile Include="BreakpointsAndSteppingTests.cs" />
+ <Compile Include="CorBreakpointsAndSteppingTests.cs" />
+ <Compile Include="SdbBreakpointsAndSteppingTests.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MonoDevelop.Debugger.csproj">
@@ -86,6 +87,10 @@
<Project>{E13A0A7B-4DE6-43ED-A139-41052D065A9B}</Project>
<Name>GuiUnit_NET_4_0</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\..\..\external\debugger-libs\Mono.Debugging.Soft\Mono.Debugging.Soft.csproj">
+ <Project>{DE40756E-57F6-4AF2-B155-55E3A88CCED8}</Project>
+ <Name>Mono.Debugging.Soft</Name>
+ </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MdbEvaluationTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbBreakpointsAndSteppingTests.cs
index 5b7cd68b68..0b63c22913 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MdbEvaluationTests.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbBreakpointsAndSteppingTests.cs
@@ -1,58 +1,40 @@
-//
-// MdbEvaluationTests.cs
-//
-// Author:
-// Lluis Sanchez Gual <lluis@novell.com>
-//
-// Copyright (c) 2009 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using NUnit.Framework;
-
-namespace MonoDevelop.Debugger.Tests.Mdb
-{
-// [TestFixture()]
-// [Ignore ("Mdb is unmaintained and currently all tests fail")]
-// public class MdbEvaluationTests: EvaluationTests
-// {
-// public MdbEvaluationTests (): base ("Mono.Debugger.Mdb")
-// {
-// }
-//
-// [Test()]
-// [Ignore ("Not working due to bug #584306")]
-// public override void Assignment ()
-// {
-// }
-//
-// [Test()]
-// [Ignore ("Not working due to bug #584306")]
-// public override void AssignmentStatic ()
-// {
-// }
-//
-// [Test()]
-// [Ignore ("Not yet implemented")]
-// public override void TypeReferenceGeneric ()
-// {
-// }
-// }
-}
+//
+// SdbBreakpointsAndSteppingTests.cs
+//
+// Author:
+// David Karlaš <david.karlas@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin, Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using NUnit.Framework;
+
+namespace MonoDevelop.Debugger.Tests.Soft
+{
+ [TestFixture]
+ [Ignore("Sdb has many failings until resolved ignore all")]
+ public class SdbBreakpointsAndSteppingTests: BreakpointsAndSteppingTests
+ {
+ public SdbBreakpointsAndSteppingTests () : base ("Mono.Debugger.Soft")
+ {
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbEvaluationTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbEvaluationTests.cs
index 29af13b1c6..d475c985d9 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbEvaluationTests.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbEvaluationTests.cs
@@ -29,9 +29,17 @@ using NUnit.Framework;
namespace MonoDevelop.Debugger.Tests.Soft
{
[TestFixture]
- public class SdbEvaluationTests: EvaluationTests
+ public class SdbEvaluationAllowTargetInvokesTests: EvaluationTests
{
- public SdbEvaluationTests (): base ("Mono.Debugger.Soft")
+ public SdbEvaluationAllowTargetInvokesTests (): base ("Mono.Debugger.Soft", true)
+ {
+ }
+ }
+
+ [TestFixture]
+ public class SdbEvaluationNoTargetInvokesTests: EvaluationTests
+ {
+ public SdbEvaluationNoTargetInvokesTests (): base ("Mono.Debugger.Soft", false)
{
}
}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbStackFrameTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbStackFrameTests.cs
index 3fc8554b2c..4ce7bf1490 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbStackFrameTests.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/SdbStackFrameTests.cs
@@ -29,11 +29,18 @@ using NUnit.Framework;
namespace MonoDevelop.Debugger.Tests.Soft
{
[TestFixture]
- public class SdbStackFrameTests: StackFrameTests
+ public class SdbStackFrameAllowTargetInvokesTests : StackFrameTests
{
- public SdbStackFrameTests (): base ("Mono.Debugger.Soft")
+ public SdbStackFrameAllowTargetInvokesTests (): base ("Mono.Debugger.Soft", true)
{
}
}
-}
+ [TestFixture]
+ public class SdbStackFrameNoTargetInvokesTests : StackFrameTests
+ {
+ public SdbStackFrameNoTargetInvokesTests (): base ("Mono.Debugger.Soft", false)
+ {
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/StackFrameTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/StackFrameTests.cs
index ec5c751ac4..79fa7ca824 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/StackFrameTests.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/StackFrameTests.cs
@@ -24,7 +24,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+using System;
+
+using Mono.Debugging.Soft;
using Mono.Debugging.Client;
+
using NUnit.Framework;
namespace MonoDevelop.Debugger.Tests
@@ -32,102 +36,85 @@ namespace MonoDevelop.Debugger.Tests
[TestFixture]
public abstract class StackFrameTests: DebugTests
{
- DebuggerSession ds;
- StackFrame frame;
-
- protected StackFrameTests (string de): base (de)
+ protected StackFrameTests (string de, bool allowTargetInvoke): base (de)
{
+ AllowTargetInvokes = allowTargetInvoke;
}
[TestFixtureSetUp]
public override void SetUp ()
{
base.SetUp ();
- ds = Start ("TestEvaluation");
- if (ds == null)
- Assert.Ignore ("Engine not found: {0}", EngineId);
- frame = ds.ActiveThread.Backtrace.GetFrame (0);
+ Start ("TestEvaluation");
}
- [TestFixtureTearDown]
- public override void TearDown ()
- {
- base.TearDown ();
- if (ds != null) {
- ds.Exit ();
- ds.Dispose ();
- }
- }
-
- public StackFrame Frame {
- get { return frame; }
- }
-
[Test]
public void VirtualProperty ()
{
- EvaluationOptions ops = EvaluationOptions.DefaultOptions.Clone ();
+ var soft = Session as SoftDebuggerSession;
+ if (soft != null && soft.ProtocolVersion < new Version (2, 31))
+ Assert.Ignore ("A newer version of the Mono runtime is required.");
+
+ var ops = EvaluationOptions.DefaultOptions.Clone ();
ops.FlattenHierarchy = false;
-
+
ObjectValue val = Frame.GetExpressionValue ("c", ops);
Assert.IsNotNull (val);
- val.WaitHandle.WaitOne ();
+ val = val.Sync ();
Assert.IsFalse (val.IsError);
Assert.IsFalse (val.IsUnknown);
-
+
// The C class does not have a Prop property
-
- ObjectValue prop = val.GetChild ("Prop", ops);
+
+ ObjectValue prop = val.GetChildSync ("Prop", ops);
Assert.IsNull (prop);
-
- prop = val.GetChild ("PropNoVirt1", ops);
+
+ prop = val.GetChildSync ("PropNoVirt1", ops);
Assert.IsNull (prop);
-
- prop = val.GetChild ("PropNoVirt2", ops);
+
+ prop = val.GetChildSync ("PropNoVirt2", ops);
Assert.IsNull (prop);
-
- val = val.GetChild ("base", ops);
+
+ val = val.GetChildSync ("base", ops);
Assert.IsNotNull (val);
val.WaitHandle.WaitOne ();
Assert.IsFalse (val.IsError);
Assert.IsFalse (val.IsUnknown);
-
+
// The B class has a Prop property, value is 2
-
- prop = val.GetChild ("Prop", ops);
+
+ prop = val.GetChildSync ("Prop", ops);
Assert.IsNotNull (prop);
Assert.AreEqual ("2", prop.Value);
-
- prop = val.GetChild ("PropNoVirt1", ops);
+
+ prop = val.GetChildSync ("PropNoVirt1", ops);
Assert.IsNotNull (prop);
Assert.AreEqual ("2", prop.Value);
-
- prop = val.GetChild ("PropNoVirt2", ops);
+
+ prop = val.GetChildSync ("PropNoVirt2", ops);
Assert.IsNotNull (prop);
Assert.AreEqual ("2", prop.Value);
-
- val = val.GetChild ("base", ops);
+
+ val = val.GetChildSync ("base", ops);
Assert.IsNotNull (val);
val.WaitHandle.WaitOne ();
Assert.IsFalse (val.IsError);
Assert.IsFalse (val.IsUnknown);
-
+
// The A class has a Prop property, value is 1, but must return 2 becasue it is overriden
-
- prop = val.GetChild ("Prop", ops);
+
+ prop = val.GetChildSync ("Prop", ops);
Assert.IsNotNull (prop);
Assert.AreEqual ("2", prop.Value);
-
- prop = val.GetChild ("PropNoVirt1", ops);
+
+ prop = val.GetChildSync ("PropNoVirt1", ops);
Assert.IsNotNull (prop);
Assert.AreEqual ("1", prop.Value);
-
- prop = val.GetChild ("PropNoVirt2", ops);
+
+ prop = val.GetChildSync ("PropNoVirt2", ops);
Assert.IsNotNull (prop);
Assert.AreEqual ("1", prop.Value);
}
-
}
}
-
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/CStringVisualizer.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/CStringVisualizer.cs
index 7da4df1746..f152492731 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/CStringVisualizer.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/CStringVisualizer.cs
@@ -83,7 +83,7 @@ namespace MonoDevelop.Debugger.Visualizer
static string ByteArrayToCString (byte[] buf)
{
- StringBuilder text = new StringBuilder ();
+ var text = new StringBuilder ();
for (int i = 0; i < buf.Length; i++)
AppendByte (text, buf[i]);
@@ -93,7 +93,7 @@ namespace MonoDevelop.Debugger.Visualizer
static string SByteArrayToCString (sbyte[] buf)
{
- StringBuilder text = new StringBuilder ();
+ var text = new StringBuilder ();
for (int i = 0; i < buf.Length; i++)
AppendByte (text, (byte) buf[i]);
@@ -141,7 +141,10 @@ namespace MonoDevelop.Debugger.Visualizer
void PopulateTextView (ObjectValue value)
{
- rawArray = value.GetRawValue () as RawValueArray;
+ var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone ();
+ ops.AllowTargetInvoke = true;
+
+ rawArray = value.GetRawValue (ops) as RawValueArray;
length = rawArray.Length;
offset = 0;
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/IValueVisualizer.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/IValueVisualizer.cs
deleted file mode 100644
index a83810bf4e..0000000000
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/IValueVisualizer.cs
+++ /dev/null
@@ -1,154 +0,0 @@
-//
-// ValueVisualizer.cs
-//
-// Author:
-// Lluis Sanchez Gual <lluis@novell.com>
-//
-// Copyright (c) 2010 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using Mono.Debugging.Client;
-
-namespace MonoDevelop.Debugger
-{
- [Obsolete ("Please use the ValueVisualizer class")]
- public interface IValueVisualizer
- {
- /// <summary>
- /// Display name of the visualizer
- /// </summary>
- /// <remarks>
- /// This name is shown in a combo box at the top of the visualizer dialog when
- /// there is more than one visualizer available for a value
- /// </remarks>
- string Name { get; }
-
- /// <summary>
- /// Determines whether this instance can visualize the specified value
- /// </summary>
- /// <returns>
- /// <c>true</c> if this instance can visualize the specified value; otherwise, <c>false</c>.
- /// </returns>
- /// <param name='val'>
- /// The value
- /// </param>
- /// <remarks>
- /// This method must check the value and return <c>true</c> if it is able to display that value.
- /// Typically, this method will check the TypeName of the value.
- /// </remarks>
- bool CanVisualize (ObjectValue val);
-
- /// <summary>
- /// Gets a visualizer widget for a value
- /// </summary>
- /// <returns>
- /// The visualizer widget.
- /// </returns>
- /// <param name='val'>
- /// A value
- /// </param>
- /// <remarks>
- /// This method is called to get a widget for displaying the specified value.
- /// The method should create the widget and load the required information from
- /// the value. Notice that the ObjectValue.Value property returns a string
- /// representation of the value. If the visualizer needs to get values from
- /// the object properties, it can use the ObjectValue.GetRawValue method.
- /// </remarks>
- Gtk.Widget GetVisualizerWidget (ObjectValue val);
-
- /// <summary>
- /// Saves changes done in the visualizer
- /// </summary>
- /// <returns>
- /// <c>true</c> if the changes could be saved
- /// </returns>
- /// <param name='val'>
- /// The value on which to store changes
- /// </param>
- /// <remarks>
- /// This method is called to save changes done in the visualizer.
- /// The implementation should use ObjectValue.SetRawValue to store the changes.
- /// </remarks>
- bool StoreValue (ObjectValue val);
-
- /// <summary>
- /// Determines whether this instance supports editing the specified value
- /// </summary>
- /// <returns>
- /// <c>true</c> if this instance can edit the specified value; otherwise, <c>false</c>.
- /// </returns>
- /// <param name='val'>
- /// The value
- /// </param>
- /// <remarks>
- /// This method is called to determine if this visualizer supports value editing,
- /// in addition to visualization.
- /// The method is called only if CanVisualize returns <c>true</c> for the value, and
- /// if the value doesn't have the ReadOnly flag.
- /// Editing support is optional.
- /// </remarks>
- bool CanEdit (ObjectValue val);
- }
-
- class ValueVisualizerWrapper: ValueVisualizer
- {
-#pragma warning disable 618
- IValueVisualizer wrapped;
-
- public ValueVisualizerWrapper (IValueVisualizer wrapped)
- {
- this.wrapped = wrapped;
- }
-#pragma warning restore 618
-
- public override bool CanVisualize (ObjectValue val)
- {
- return wrapped.CanVisualize (val);
- }
-
- public override Gtk.Widget GetVisualizerWidget (ObjectValue val)
- {
- return wrapped.GetVisualizerWidget (val);
- }
-
- public override string Name {
- get {
- return wrapped.Name;
- }
- }
-
- public override bool CanEdit (ObjectValue val)
- {
- return wrapped.CanEdit (val);
- }
-
- public override bool IsDefaultVisualizer (ObjectValue val)
- {
- return false;
- }
-
- public override bool StoreValue (ObjectValue val)
- {
- return wrapped.StoreValue (val);
- }
- }
-}
-
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/PixbufVisualizer.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/PixbufVisualizer.cs
index 1937ffc3e1..24ee614a5e 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/PixbufVisualizer.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/PixbufVisualizer.cs
@@ -45,20 +45,25 @@ namespace MonoDevelop.Debugger.Visualizer
public override Gtk.Widget GetVisualizerWidget (ObjectValue val)
{
- Gdk.Pixbuf pixbuf;
+ var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone ();
string file = Path.GetTempFileName ();
+ Gdk.Pixbuf pixbuf;
+
+ ops.AllowTargetInvoke = true;
+
try {
- RawValue pix = (RawValue) val.GetRawValue ();
+ var pix = (RawValue) val.GetRawValue (ops);
pix.CallMethod ("Save", file, "png");
pixbuf = new Gdk.Pixbuf (file);
} finally {
File.Delete (file);
}
- Gtk.ScrolledWindow sc = new Gtk.ScrolledWindow ();
+
+ var sc = new Gtk.ScrolledWindow ();
sc.ShadowType = Gtk.ShadowType.In;
sc.HscrollbarPolicy = Gtk.PolicyType.Automatic;
sc.VscrollbarPolicy = Gtk.PolicyType.Automatic;
- Gtk.Image image = new Gtk.Image (pixbuf);
+ var image = new Gtk.Image (pixbuf);
sc.AddWithViewport (image);
sc.ShowAll ();
return sc;
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/TextVisualizer.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/TextVisualizer.cs
index d0fb039ec5..cb2b881229 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/TextVisualizer.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/TextVisualizer.cs
@@ -107,6 +107,7 @@ namespace MonoDevelop.Debugger.Visualizer
void PopulateTextView (ObjectValue value)
{
var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone ();
+ ops.AllowTargetInvoke = true;
ops.ChunkRawStrings = true;
if (value.TypeName == "string") {
@@ -124,7 +125,7 @@ namespace MonoDevelop.Debugger.Visualizer
};
}
} else if (value.TypeName == "char[]") {
- rawArray = value.GetRawValue () as RawValueArray;
+ rawArray = value.GetRawValue (ops) as RawValueArray;
length = rawArray.Length;
offset = 0;
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.addin.xml b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.addin.xml
index 58fbfc9fe2..8825b30565 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.addin.xml
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.addin.xml
@@ -11,7 +11,7 @@
</ExtensionPoint>
<ExtensionPoint path="/MonoDevelop/Debugging/ValueVisualizers">
- <Description>Value visualizers. Specified classes must implement MonoDevelop.Debugger.IValueVisualizer</Description>
+ <Description>Value visualizers. Specified classes must extend MonoDevelop.Debugger.ValueVisualizer</Description>
<ExtensionNode name="Type"/>
</ExtensionPoint>
@@ -159,6 +159,19 @@
_description = "Stops the execution of the expression being evaluated by the debugger"
defaultHandler = "MonoDevelop.Debugger.StopEvaluationHandler"
_label = "Stop Evaluation" />
+ <Command id = "MonoDevelop.Debugger.DebugCommands.RunToCursor"
+ defaultHandler = "MonoDevelop.Debugger.RunToCursorHandler"
+ _label = "Run To Cursor"
+ _description = "Run To Cursor"
+ shortcut = "Control|F10" />
+ <Command id = "MonoDevelop.Debugger.DebugCommands.SetNextStatement"
+ defaultHandler = "MonoDevelop.Debugger.SetNextStatementHandler"
+ _label = "Set Next Statement"
+ _description = "Set Next Statement"
+ shortcut = "Control|Shift|F10" />
+ <Command id = "MonoDevelop.Debugger.DebugCommands.ShowNextStatement"
+ _label = "Show Next Statement"
+ defaultHandler = "MonoDevelop.Debugger.ShowNextStatementHandler" />
</Category>
</Extension>
@@ -217,7 +230,8 @@
<StockIcon stockid = "md-view-debug-threads" resource = "pad-threads-light-16.png" size="Menu" />
<StockIcon stockid = "md-view-debug-watch" resource = "pad-watch-light-16.png" size="Menu" />
<StockIcon stockid = "md-view-debug-immediate" resource = "pad-immediate-light-16.png" size="Menu" />
- <StockIcon stockid = "md-bug" resource = "bug-light-16.png" size="Menu" />
+ <StockIcon stockid = "md-prefs-debugger" resource = "prefs-debugger-light-16.png" size="Menu" />
+ <StockIcon stockid = "md-stack-pointer" resource = "stack-pointer-light-16.png" size="Menu" />
</Extension>
<Extension path = "/MonoDevelop/Ide/CommandBar">
@@ -231,7 +245,7 @@
</Extension>
<Extension path = "/MonoDevelop/Ide/GlobalOptionsDialog/Projects">
- <Section id = "Debugger" _label = "Debugger" icon="md-bug" fill="true" class = "MonoDevelop.Debugger.DebuggerOptionsPanel" />
+ <Section id="Debugger" _label="Debugger" fill="true" class="MonoDevelop.Debugger.DebuggerOptionsPanel" icon="md-prefs-debugger" />
</Extension>
<Extension path = "/MonoDevelop/Ide/TextEditorExtensions">
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj
index 2c7bcfd798..71ecfe5c48 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj
@@ -140,7 +140,6 @@
<Compile Include="gtk-gui\MonoDevelop.Debugger.Viewers.ValueVisualizerDialog.cs" />
<Compile Include="MonoDevelop.Debugger.Visualizer\TextVisualizer.cs" />
<Compile Include="MonoDevelop.Debugger.Visualizer\PixbufVisualizer.cs" />
- <Compile Include="MonoDevelop.Debugger.Visualizer\IValueVisualizer.cs" />
<Compile Include="MonoDevelop.Debugger\ExpressionEvaluatorExtensionNode.cs" />
<Compile Include="MonoDevelop.Debugger\TreePathComparer.cs" />
<Compile Include="MonoDevelop.Debugger\TreePathReference.cs" />
@@ -149,6 +148,8 @@
<Compile Include="MonoDevelop.Debugger.Visualizer\ValueVisualizer.cs" />
<Compile Include="MonoDevelop.Debugger\InfoFrame.cs" />
<Compile Include="AddinInfo.cs" />
+ <Compile Include="MonoDevelop.Debugger\IDebuggerExpressionResolver.cs" />
+ <Compile Include="MonoDevelop.Debugger\DebuggerEngineBackend.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="MonoDevelop.Debugger.addin.xml">
@@ -241,11 +242,11 @@
<EmbeddedResource Include="icons\light\continue-16%402x.png">
<LogicalName>continue-light-16@2x.png</LogicalName>
</EmbeddedResource>
- <EmbeddedResource Include="icons\light\bug-16.png">
- <LogicalName>bug-light-16.png</LogicalName>
+ <EmbeddedResource Include="icons\light\prefs-debugger-16.png">
+ <LogicalName>prefs-debugger-light-16.png</LogicalName>
</EmbeddedResource>
- <EmbeddedResource Include="icons\light\bug-16%402x.png">
- <LogicalName>bug-light-16@2x.png</LogicalName>
+ <EmbeddedResource Include="icons\light\prefs-debugger-16%402x.png">
+ <LogicalName>prefs-debugger-light-16@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\light\lightning-16.png">
<LogicalName>lightning-light-16.png</LogicalName>
@@ -253,11 +254,65 @@
<EmbeddedResource Include="icons\light\lightning-16%402x.png">
<LogicalName>lightning-light-16@2x.png</LogicalName>
</EmbeddedResource>
- <EmbeddedResource Include="icons\exception-icon.png">
- <LogicalName>exception-icon.png</LogicalName>
+ <EmbeddedResource Include="icons\light\exception-48.png">
+ <LogicalName>exception-light-48.png</LogicalName>
</EmbeddedResource>
- <EmbeddedResource Include="icons\exception-icon%402x.png">
- <LogicalName>exception-icon@2x.png</LogicalName>
+ <EmbeddedResource Include="icons\light\exception-48%402x.png">
+ <LogicalName>exception-light-48@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-breakpoint-15.png">
+ <LogicalName>gutter-breakpoint-light-15.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-breakpoint-15%402x.png">
+ <LogicalName>gutter-breakpoint-light-15@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-breakpoint-disabled-15.png">
+ <LogicalName>gutter-breakpoint-disabled-light-15.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-breakpoint-disabled-15%402x.png">
+ <LogicalName>gutter-breakpoint-disabled-light-15@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-breakpoint-invalid-15.png">
+ <LogicalName>gutter-breakpoint-invalid-light-15.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-breakpoint-invalid-15%402x.png">
+ <LogicalName>gutter-breakpoint-invalid-light-15@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-execution-15.png">
+ <LogicalName>gutter-execution-light-15.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-execution-15%402x.png">
+ <LogicalName>gutter-execution-light-15@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-stack-15.png">
+ <LogicalName>gutter-stack-light-15.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-stack-15%402x.png">
+ <LogicalName>gutter-stack-light-15@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-tracepoint-15.png">
+ <LogicalName>gutter-tracepoint-light-15.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-tracepoint-15%402x.png">
+ <LogicalName>gutter-tracepoint-light-15@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-tracepoint-disabled-15.png">
+ <LogicalName>gutter-tracepoint-disabled-light-15.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-tracepoint-disabled-15%402x.png">
+ <LogicalName>gutter-tracepoint-disabled-light-15@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-tracepoint-invalid-15.png">
+ <LogicalName>gutter-tracepoint-invalid-light-15.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-tracepoint-invalid-15%402x.png">
+ <LogicalName>gutter-tracepoint-invalid-light-15@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\stack-pointer-16.png">
+ <LogicalName>stack-pointer-light-16.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\stack-pointer-16%402x.png">
+ <LogicalName>stack-pointer-light-16@2x.png</LogicalName>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs
index 1bbec11f95..2fd5f50cd3 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs
@@ -25,7 +25,7 @@
//
//
-
+using System;
using System.Collections.Generic;
using MonoDevelop.Core;
using Mono.Debugging.Client;
@@ -63,30 +63,28 @@ namespace MonoDevelop.Debugger
ShowCurrentExecutionLine,
AddTracepoint,
AddWatch,
- StopEvaluation
+ StopEvaluation,
+ RunToCursor,
+ SetNextStatement,
+ ShowNextStatement
}
class DebugHandler: CommandHandler
{
- static IBuildTarget GetRunTarget ()
+ internal static IBuildTarget GetRunTarget ()
{
return IdeApp.ProjectOperations.CurrentSelectedSolution != null && IdeApp.ProjectOperations.CurrentSelectedSolution.StartupItem != null ?
IdeApp.ProjectOperations.CurrentSelectedSolution.StartupItem :
IdeApp.ProjectOperations.CurrentSelectedBuildTarget;
}
- protected override void Run ()
+ internal static void BuildAndDebug ()
{
- if (DebuggingService.IsPaused) {
- DebuggingService.Resume ();
- return;
- }
-
if (!DebuggingService.IsDebuggingSupported && !IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted) {
MonoDevelop.Ide.Commands.StopHandler.StopBuildOperations ();
IdeApp.ProjectOperations.CurrentRunOperation.WaitForCompleted ();
}
-
+
if (!IdeApp.Preferences.BuildBeforeExecuting) {
if (IdeApp.Workspace.IsOpen) {
var it = GetRunTarget ();
@@ -104,7 +102,7 @@ namespace MonoDevelop.Debugger
return;
}
}
-
+
if (IdeApp.Workspace.IsOpen) {
var it = GetRunTarget ();
IAsyncOperation op = IdeApp.ProjectOperations.Build (it);
@@ -144,6 +142,16 @@ namespace MonoDevelop.Debugger
else
doc.Run ();
}
+
+ protected override void Run ()
+ {
+ if (DebuggingService.IsPaused) {
+ DebuggingService.Resume ();
+ return;
+ }
+
+ BuildAndDebug ();
+ }
protected override void Update (CommandInfo info)
{
@@ -217,7 +225,6 @@ namespace MonoDevelop.Debugger
BuildBeforeRun,
Run
}
-
}
class DebugEntryHandler: CommandHandler
@@ -597,6 +604,47 @@ namespace MonoDevelop.Debugger
info.Enabled = !DebuggingService.Breakpoints.IsReadOnly && IdeApp.Workspace.IsOpen;
}
}
+
+ class RunToCursorHandler : CommandHandler
+ {
+ protected override void Run ()
+ {
+ var doc = IdeApp.Workbench.ActiveDocument;
+
+ if (DebuggingService.IsPaused) {
+ DebuggingService.RunToCursor (doc.FileName, doc.Editor.Caret.Line, doc.Editor.Caret.Column);
+ return;
+ }
+
+ var bp = new RunToCursorBreakpoint (doc.FileName, doc.Editor.Caret.Line, doc.Editor.Caret.Column);
+ DebuggingService.Breakpoints.Add (bp);
+ DebugHandler.BuildAndDebug ();
+ }
+
+ protected override void Update (CommandInfo info)
+ {
+ info.Visible = true;
+
+ if (!DebuggingService.IsDebuggingSupported || !DebuggingService.IsFeatureSupported (DebuggerFeatures.Breakpoints) || DebuggingService.Breakpoints.IsReadOnly) {
+ info.Enabled = false;
+ return;
+ }
+
+ var doc = IdeApp.Workbench.ActiveDocument;
+
+ if (doc != null && doc.Editor != null && doc.FileName != FilePath.Null) {
+ if (IdeApp.Workspace.IsOpen) {
+ var target = DebugHandler.GetRunTarget ();
+
+ info.Enabled = target != null && IdeApp.ProjectOperations.CanDebug (target);
+ } else {
+ info.Enabled = doc.IsBuildTarget && doc.CanDebug ();
+ }
+ } else {
+ info.Enabled = false;
+ }
+ }
+ }
class ShowBreakpointPropertiesHandler: CommandHandler
{
@@ -685,4 +733,45 @@ namespace MonoDevelop.Debugger
info.Visible = DebuggingService.IsDebugging && DebuggingService.IsPaused && DebuggingService.DebuggerSession.CanCancelAsyncEvaluations;
}
}
+
+ class SetNextStatementHandler : CommandHandler
+ {
+ protected override void Update (CommandInfo info)
+ {
+ var doc = IdeApp.Workbench.ActiveDocument;
+
+ if (doc != null && doc.FileName != FilePath.Null && doc.Editor != null && DebuggingService.IsDebuggingSupported) {
+ info.Enabled = DebuggingService.IsPaused && DebuggingService.DebuggerSession.CanSetNextStatement;
+ info.Visible = DebuggingService.IsPaused;
+ } else {
+ info.Visible = false;
+ info.Enabled = false;
+ }
+ }
+
+ protected override void Run ()
+ {
+ var doc = IdeApp.Workbench.ActiveDocument;
+
+ try {
+ DebuggingService.SetNextStatement (doc.FileName, doc.Editor.Caret.Line, doc.Editor.Caret.Column);
+ } catch (NotSupportedException) {
+ MessageService.ShowError ("Unable to set the next statement to this location.");
+ }
+ }
+ }
+
+ class ShowNextStatementHandler : CommandHandler
+ {
+ protected override void Update (CommandInfo info)
+ {
+ info.Enabled = DebuggingService.IsPaused && DebuggingService.DebuggerSession.CanSetNextStatement;
+ info.Visible = DebuggingService.IsPaused;
+ }
+
+ protected override void Run ()
+ {
+ DebuggingService.ShowNextStatement ();
+ }
+ }
}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerConsoleView.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerConsoleView.cs
index 09699a0b41..6038296e67 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerConsoleView.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerConsoleView.cs
@@ -151,7 +151,7 @@ namespace MonoDevelop.Debugger
return index < text.Length;
}
- static readonly string[] SyntaxTokens = new string[] {
+ static readonly string[] SyntaxTokens = {
"=", "+=", "-=", "*=", "/=", "%=", "&=", "|=", "~=",
"+", "-", "*", "/", "%", "&", "|", "~",
"==", "!=", ">", ">=", "<", "<=",
@@ -372,7 +372,7 @@ namespace MonoDevelop.Debugger
CodeCompletionContext ICompletionWidget.CreateCodeCompletionContext (int triggerOffset)
{
- CodeCompletionContext c = new CodeCompletionContext ();
+ var c = new CodeCompletionContext ();
c.TriggerLine = 0;
c.TriggerOffset = triggerOffset;
c.TriggerLineOffset = c.TriggerOffset;
@@ -384,7 +384,7 @@ namespace MonoDevelop.Debugger
var rect = GetIterLocation (Cursor);
- c.TriggerYCoord = y + lineY + height;
+ c.TriggerYCoord = y + lineY + height - (int)Vadjustment.Value;
c.TriggerXCoord = x + rect.X;
c.TriggerTextHeight = height;
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerEngine.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerEngine.cs
index 0fc870c018..605a3c3906 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerEngine.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerEngine.cs
@@ -33,7 +33,7 @@ namespace MonoDevelop.Debugger
{
public class DebuggerEngine
{
- IDebuggerEngine engine;
+ DebuggerEngineBackend engine;
DebuggerEngineExtensionNode node;
bool gotEngine;
@@ -66,7 +66,14 @@ namespace MonoDevelop.Debugger
{
if (!gotEngine) {
gotEngine = true;
- engine = (IDebuggerEngine) node.GetInstance ();
+ var ob = node.GetInstance ();
+ #pragma warning disable 618
+ var legacyEngine = ob as IDebuggerEngine;
+ #pragma warning restore 618
+ if (legacyEngine != null)
+ engine = new LegacyDebuggerEngineBackend (legacyEngine);
+ else
+ engine = (DebuggerEngineBackend) node.GetInstance ();
}
}
@@ -76,6 +83,12 @@ namespace MonoDevelop.Debugger
return engine != null && engine.CanDebugCommand (cmd);
}
+ public bool IsDefaultDebugger (ExecutionCommand cmd)
+ {
+ LoadEngine ();
+ return engine != null && engine.IsDefaultDebugger (cmd);
+ }
+
public DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand cmd)
{
LoadEngine ();
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerEngineBackend.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerEngineBackend.cs
new file mode 100644
index 0000000000..be5e10e002
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerEngineBackend.cs
@@ -0,0 +1,93 @@
+//
+// DebuggerEngineBackend.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin, Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using MonoDevelop.Core.Execution;
+using Mono.Debugging.Client;
+
+namespace MonoDevelop.Debugger
+{
+ public abstract class DebuggerEngineBackend
+ {
+ public abstract bool CanDebugCommand (ExecutionCommand cmd);
+
+ /// <summary>
+ /// Determines whether this instance is default debugger for the provided command
+ /// </summary>
+ /// <remarks>The default implementation returns false.</remarks>
+ public virtual bool IsDefaultDebugger (ExecutionCommand cmd)
+ {
+ return false;
+ }
+
+ public abstract DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand cmd);
+
+ public virtual ProcessInfo[] GetAttachableProcesses ()
+ {
+ return new ProcessInfo[0];
+ }
+
+ public abstract DebuggerSession CreateSession ();
+ }
+
+ #pragma warning disable 618
+ class LegacyDebuggerEngineBackend: DebuggerEngineBackend
+ {
+ IDebuggerEngine engine;
+
+ public LegacyDebuggerEngineBackend (IDebuggerEngine engine)
+ {
+ this.engine = engine;
+ }
+
+ public override bool CanDebugCommand (ExecutionCommand cmd)
+ {
+ return engine.CanDebugCommand (cmd);
+ }
+
+ public override bool IsDefaultDebugger (ExecutionCommand cmd)
+ {
+ return false;
+ }
+
+ public override DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand cmd)
+ {
+ return engine.CreateDebuggerStartInfo (cmd);
+ }
+
+ public override ProcessInfo[] GetAttachableProcesses ()
+ {
+ return engine.GetAttachableProcesses ();
+ }
+
+ public override DebuggerSession CreateSession ()
+ {
+ return engine.CreateSession ();
+ }
+ }
+ #pragma warning restore 618
+}
+
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerOptionsPanelWidget.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerOptionsPanelWidget.cs
index 70a40ee81e..f4f86afdd1 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerOptionsPanelWidget.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerOptionsPanelWidget.cs
@@ -24,8 +24,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
using Mono.Debugging.Client;
using MonoDevelop.Ide.Gui.Dialogs;
@@ -53,7 +51,8 @@ namespace MonoDevelop.Debugger
public DebuggerOptionsPanelWidget ()
{
- this.Build ();
+ Build ();
+
options = DebuggingService.GetUserOptions ();
checkProjectCodeOnly.Active = options.ProjectAssembliesOnly;
checkStepOverPropertiesAndOperators.Active = options.StepOverPropertiesAndOperators;
@@ -64,19 +63,11 @@ namespace MonoDevelop.Debugger
checkGroupStatic.Active = options.EvaluationOptions.GroupStaticMembers;
checkAllowToString.Sensitive = checkAllowEval.Active;
spinTimeout.Value = options.EvaluationOptions.EvaluationTimeout;
-
- // Debugger priorities
- prioritylist.Model = new Gtk.ListStore (typeof(string), typeof(string));
- prioritylist.AppendColumn ("", new Gtk.CellRendererText (), "text", 1);
-
- foreach (DebuggerEngine engine in DebuggingService.GetDebuggerEngines ()) {
- prioritylist.Model.AppendValues (engine.Id, engine.Name);
- }
}
public void Store ()
{
- EvaluationOptions ops = options.EvaluationOptions;
+ var ops = options.EvaluationOptions;
ops.AllowTargetInvoke = checkAllowEval.Active;
ops.AllowToStringCalls = checkAllowToString.Active;
@@ -90,16 +81,6 @@ namespace MonoDevelop.Debugger
options.EvaluationOptions = ops;
DebuggingService.SetUserOptions (options);
-
- Gtk.TreeIter it;
- List<string> prios = new List<string> ();
- if (prioritylist.Model.GetIterFirst (out it)) {
- do {
- string id = (string) prioritylist.Model.GetValue (it, 0);
- prios.Add (id);
- } while (prioritylist.Model.IterNext (ref it));
- }
- DebuggingService.EnginePriority = prios.ToArray ();
}
protected virtual void OnCheckAllowEvalToggled (object sender, System.EventArgs e)
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
index 9fb8e140ee..e6d56b2a36 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
@@ -49,7 +49,6 @@ using System.Linq;
namespace MonoDevelop.Debugger
{
-
public static class DebuggingService
{
const string FactoriesPath = "/MonoDevelop/Debugging/DebuggerEngines";
@@ -64,7 +63,8 @@ namespace MonoDevelop.Debugger
static IConsole console;
static string oldLayout;
-
+
+ static Dictionary<long, SourceLocation> nextStatementLocations = new Dictionary<long, SourceLocation> ();
static DebuggerEngine currentEngine;
static DebuggerSession session;
static Backtrace currentBacktrace;
@@ -73,8 +73,8 @@ namespace MonoDevelop.Debugger
static ExceptionCaughtMessage exceptionDialog;
static BusyEvaluatorDialog busyDialog;
- static bool isBusy;
static StatusBarIcon busyStatusIcon;
+ static bool isBusy;
static public event EventHandler DebugSessionStarted;
static public event EventHandler PausedEvent;
@@ -154,33 +154,13 @@ namespace MonoDevelop.Debugger
if (pinnedWatches.UpdateLiveWatch ((Breakpoint) be, trace))
return; // No need to log the value. It is shown in the watch.
}
- console.Log.Write (trace + "\n");
+ DebugWriter (0, "", trace + Environment.NewLine);
}
-
+
+ [Obsolete]
public static string[] EnginePriority {
- get {
- string s = PropertyService.Get ("MonoDevelop.Debugger.DebuggingService.EnginePriority", "");
- if (s.Length == 0) {
- // Set the initial priorities
- var prios = new List<string> ();
- int i = 0;
-
- foreach (DebuggerEngineExtensionNode de in AddinManager.GetExtensionNodes (FactoriesPath)) {
- if (de.Id.StartsWith ("Mono.Debugger.Soft", StringComparison.Ordinal)) // Give priority to soft debugger by default
- prios.Insert (i++, de.Id);
- else
- prios.Add (de.Id);
- }
- string[] parray = prios.ToArray ();
- EnginePriority = parray;
- return parray;
- }
- return s.Split (new [] {','}, StringSplitOptions.RemoveEmptyEntries);
- }
+ get { return new string[0]; }
set {
- string s = string.Join (",", value);
- PropertyService.Set ("MonoDevelop.Debugger.DebuggingService.EnginePriority", s);
- engines = null;
}
}
@@ -192,13 +172,6 @@ namespace MonoDevelop.Debugger
if (vv.CanVisualize (val))
yield return vv;
}
-#pragma warning disable 618
- if (v is IValueVisualizer) {
- var vv = (IValueVisualizer)v;
- if (vv.CanVisualize (val))
- yield return new ValueVisualizerWrapper (vv);
- }
-#pragma warning restore 618
}
}
@@ -225,15 +198,18 @@ namespace MonoDevelop.Debugger
{
var dlg = new AddTracePointDialog ();
- if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok && dlg.Text.Length > 0) {
- var bp = new Breakpoint (file, line);
- bp.HitAction = HitAction.PrintExpression;
- bp.TraceExpression = dlg.Text;
- bp.ConditionExpression = dlg.Condition;
- lock (breakpoints)
- breakpoints.Add (bp);
+ try {
+ if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok && dlg.Text.Length > 0) {
+ var bp = new Breakpoint (file, line);
+ bp.HitAction = HitAction.PrintExpression;
+ bp.TraceExpression = dlg.Text;
+ bp.ConditionExpression = dlg.Condition;
+ lock (breakpoints)
+ breakpoints.Add (bp);
+ }
+ } finally {
+ dlg.Destroy ();
}
- dlg.Destroy ();
}
public static void AddWatch (string expression)
@@ -272,7 +248,7 @@ namespace MonoDevelop.Debugger
public static DebuggerFeatures GetSupportedFeatures (IBuildTarget target)
{
var fc = new FeatureCheckerHandlerFactory ();
- var ctx = new ExecutionContext (fc, null);
+ var ctx = new ExecutionContext (fc, null, IdeApp.Workspace.ActiveExecutionTarget);
target.CanExecute (ctx, IdeApp.Workspace.ActiveConfiguration);
@@ -308,9 +284,7 @@ namespace MonoDevelop.Debugger
HideExceptionCaughtDialog ();
exceptionDialog = new ExceptionCaughtMessage (val, CurrentFrame.SourceLocation.FileName, CurrentFrame.SourceLocation.Line, CurrentFrame.SourceLocation.Column);
exceptionDialog.ShowButton ();
- exceptionDialog.Closed += (o, args) => {
- exceptionDialog = null;
- };
+ exceptionDialog.Closed += (o, args) => exceptionDialog = null;
}
}
@@ -341,6 +315,7 @@ namespace MonoDevelop.Debugger
session.TargetStarted += OnStarted;
session.OutputWriter = OutputWriter;
session.LogWriter = LogWriter;
+ session.DebugWriter = DebugWriter;
session.BusyStateChanged += OnBusyStateChanged;
session.TypeResolverHandler = ResolveType;
session.BreakpointTraceHandler = BreakpointTraceHandler;
@@ -374,10 +349,12 @@ namespace MonoDevelop.Debugger
currentSession = session;
currentConsole = console;
+ nextStatementLocations.Clear ();
currentBacktrace = null;
busyStatusIcon = null;
session = null;
console = null;
+ pinnedWatches.InvalidateAll ();
}
if (oldLayout != null) {
@@ -474,10 +451,35 @@ namespace MonoDevelop.Debugger
{
if (CheckIsBusy ())
return;
+
+ session.Continue ();
+ NotifyLocationChanged ();
+ }
+
+ public static void RunToCursor (string fileName, int line, int column)
+ {
+ if (CheckIsBusy ())
+ return;
+
+ var bp = new RunToCursorBreakpoint (fileName, line, column);
+ Breakpoints.Add (bp);
+
session.Continue ();
NotifyLocationChanged ();
}
+ public static void SetNextStatement (string fileName, int line, int column)
+ {
+ if (!IsDebugging || IsRunning || CheckIsBusy ())
+ return;
+
+ session.SetNextStatement (fileName, line, column);
+
+ var location = new SourceLocation (CurrentFrame.SourceLocation.MethodName, fileName, line);
+ nextStatementLocations[session.ActiveThread.Id] = location;
+ NotifyLocationChanged ();
+ }
+
public static IProcessAsyncOperation Run (string file, IConsole console)
{
var h = new DebugExecutionHandler (null);
@@ -602,7 +604,25 @@ namespace MonoDevelop.Debugger
if (logger != null)
logger.Log.Write (text);
}
-
+
+ static void DebugWriter (int level, string category, string message)
+ {
+ var logger = console;
+ var debugLogger = logger as IDebugConsole;
+
+ if (logger != null) {
+ if (debugLogger != null) {
+ debugLogger.Debug (level, category, message);
+ } else {
+ if (level == 0 && string.IsNullOrEmpty (category)) {
+ logger.Log.Write (message);
+ } else {
+ logger.Log.Write (string.Format ("[{0}:{1}] {2}", level, category, message));
+ }
+ }
+ }
+ }
+
static void OutputWriter (bool iserr, string text)
{
var logger = console;
@@ -647,7 +667,9 @@ namespace MonoDevelop.Debugger
static void OnStarted (object s, EventArgs a)
{
+ nextStatementLocations.Clear ();
currentBacktrace = null;
+
DispatchService.GuiDispatch (delegate {
HideExceptionCaughtDialog ();
if (ResumedEvent != null)
@@ -660,21 +682,25 @@ namespace MonoDevelop.Debugger
static void OnTargetEvent (object sender, TargetEventArgs args)
{
+ nextStatementLocations.Clear ();
+
try {
switch (args.Type) {
- case TargetEventType.TargetExited:
- Cleanup ();
- break;
- case TargetEventType.TargetSignaled:
- case TargetEventType.TargetStopped:
- case TargetEventType.TargetHitBreakpoint:
- case TargetEventType.TargetInterrupted:
- case TargetEventType.UnhandledException:
- case TargetEventType.ExceptionThrown:
- SetCurrentBacktrace (args.Backtrace);
- NotifyPaused ();
- NotifyException (args);
- break;
+ case TargetEventType.TargetExited:
+ Breakpoints.RemoveRunToCursorBreakpoints ();
+ Cleanup ();
+ break;
+ case TargetEventType.TargetSignaled:
+ case TargetEventType.TargetStopped:
+ case TargetEventType.TargetHitBreakpoint:
+ case TargetEventType.TargetInterrupted:
+ case TargetEventType.UnhandledException:
+ case TargetEventType.ExceptionThrown:
+ Breakpoints.RemoveRunToCursorBreakpoints ();
+ SetCurrentBacktrace (args.Backtrace);
+ NotifyPaused ();
+ NotifyException (args);
+ break;
}
} catch (Exception ex) {
LoggingService.LogError ("Error handling debugger target event", ex);
@@ -774,6 +800,17 @@ namespace MonoDevelop.Debugger
get { return currentBacktrace; }
}
+ public static SourceLocation NextStatementLocation {
+ get {
+ SourceLocation location = null;
+
+ if (IsPaused)
+ nextStatementLocations.TryGetValue (session.ActiveThread.Id, out location);
+
+ return location;
+ }
+ }
+
public static StackFrame CurrentFrame {
get {
if (currentBacktrace != null && currentFrame != -1)
@@ -835,6 +872,7 @@ namespace MonoDevelop.Debugger
DispatchService.GuiDispatch (delegate {
NotifyCallStackChanged ();
NotifyCurrentFrameChanged ();
+ NotifyLocationChanged ();
});
}
@@ -843,11 +881,23 @@ namespace MonoDevelop.Debugger
if (currentBacktrace != null) {
var sf = GetCurrentVisibleFrame ();
if (sf != null && !string.IsNullOrEmpty (sf.SourceLocation.FileName) && System.IO.File.Exists (sf.SourceLocation.FileName) && sf.SourceLocation.Line != -1) {
- Document document = IdeApp.Workbench.OpenDocument (sf.SourceLocation.FileName, sf.SourceLocation.Line, 1, OpenDocumentOptions.Debugger);
+ Document document = IdeApp.Workbench.OpenDocument (sf.SourceLocation.FileName, null, sf.SourceLocation.Line, 1, OpenDocumentOptions.Debugger);
OnDisableConditionalCompilation (new DocumentEventArgs (document));
}
}
}
+
+ public static void ShowNextStatement ()
+ {
+ var location = NextStatementLocation;
+
+ if (location != null && System.IO.File.Exists (location.FileName)) {
+ Document document = IdeApp.Workbench.OpenDocument (location.FileName, null, location.Line, 1, OpenDocumentOptions.Debugger);
+ OnDisableConditionalCompilation (new DocumentEventArgs (document));
+ } else {
+ ShowCurrentExecutionLine ();
+ }
+ }
public static bool CanDebugCommand (ExecutionCommand command)
{
@@ -857,30 +907,14 @@ namespace MonoDevelop.Debugger
public static DebuggerEngine[] GetDebuggerEngines ()
{
if (engines == null) {
- var engs = new List<DebuggerEngine> ();
+ var list = new List<DebuggerEngine> ();
+
foreach (DebuggerEngineExtensionNode node in AddinManager.GetExtensionNodes (FactoriesPath))
- engs.Add (new DebuggerEngine (node));
-
- string[] priorities = EnginePriority;
- var count = engs.Count;
-
- engs.Sort (delegate (DebuggerEngine d1, DebuggerEngine d2) {
- int i1 = Array.IndexOf (priorities, d1.Id);
- int i2 = Array.IndexOf (priorities, d2.Id);
-
- //ensure that soft debugger is prioritised over newly installed debuggers
- if (i1 < 0)
- i1 = d1.Id.StartsWith ("Mono.Debugger.Soft", StringComparison.Ordinal) ? 0 : count;
- if (i2 < 0)
- i2 = d2.Id.StartsWith ("Mono.Debugger.Soft", StringComparison.Ordinal) ? 0 : count;
-
- if (i1 == i2)
- return string.Compare (d1.Name, d2.Name, StringComparison.InvariantCulture);
-
- return i1.CompareTo (i2);
- });
- engines = engs.ToArray ();
+ list.Add (new DebuggerEngine (node));
+
+ engines = list.ToArray ();
}
+
return engines;
}
@@ -898,11 +932,20 @@ namespace MonoDevelop.Debugger
static DebuggerEngine GetFactoryForCommand (ExecutionCommand cmd)
{
+ DebuggerEngine supportedEngine = null;
+
+ // Get the default engine for the command if available,
+ // or the first engine that supports the command otherwise
+
foreach (DebuggerEngine factory in GetDebuggerEngines ()) {
- if (factory.CanDebugCommand (cmd))
- return factory;
+ if (factory.CanDebugCommand (cmd)) {
+ if (factory.IsDefaultDebugger (cmd))
+ return factory;
+ if (supportedEngine == null)
+ supportedEngine = factory;
+ }
}
- return null;
+ return supportedEngine;
}
static void OnLineCountChanged (object ob, LineCountEventArgs a)
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs
index 842f7afa80..6aeb73e47a 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs
@@ -26,6 +26,7 @@
// THE SOFTWARE.
using System;
+using System.IO;
using Gtk;
@@ -37,12 +38,13 @@ using MonoDevelop.Components;
using MonoDevelop.Ide.TextEditing;
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Ide.Editor.Extension;
+using MonoDevelop.Ide.Fonts;
namespace MonoDevelop.Debugger
{
class ExceptionCaughtDialog : Dialog
{
- static readonly Xwt.Drawing.Image WarningIconPixbuf = Xwt.Drawing.Image.FromResource ("exception-icon.png");
+ static readonly Xwt.Drawing.Image WarningIconPixbuf = Xwt.Drawing.Image.FromResource ("exception-light-48.png");
protected ObjectValueTreeView ExceptionValueTreeView { get; private set; }
protected TreeView StackTraceTreeView { get; private set; }
protected CheckButton OnlyShowMyCodeCheckbox { get; private set; }
@@ -274,7 +276,7 @@ namespace MonoDevelop.Debugger
var selectedRows = ExceptionValueTreeView.Selection.GetSelectedRows ();
ExceptionInfo ex;
- if (TryGetExceptionInfo (selectedRows[0], out ex)) {
+ if (selectedRows.Length > 0 && TryGetExceptionInfo (selectedRows[0], out ex)) {
ShowStackTrace (ex);
selected = ex;
} else if (selected != exception) {
@@ -293,8 +295,12 @@ namespace MonoDevelop.Debugger
var frame = (ExceptionStackFrame) model.GetValue (iter, (int) ModelColumn.StackFrame);
- if (frame != null && !string.IsNullOrEmpty (frame.File))
- IdeApp.Workbench.OpenDocument (frame.File, frame.Line, frame.Column);
+ if (frame != null && !string.IsNullOrEmpty (frame.File) && File.Exists (frame.File)) {
+ try {
+ IdeApp.Workbench.OpenDocument (frame.File, null, frame.Line, frame.Column);
+ } catch (FileNotFoundException) {
+ }
+ }
}
static bool IsUserCode (ExceptionStackFrame frame)
@@ -409,7 +415,7 @@ namespace MonoDevelop.Debugger
class StackFrameCellRenderer : CellRenderer
{
- static readonly Pango.FontDescription LineNumberFont = Pango.FontDescription.FromString ("Menlo 9");
+ static readonly Pango.FontDescription LineNumberFont = FontService.MonospaceFont.CopyModified (0.9d);
const int RoundedRectangleRadius = 2;
const int RoundedRectangleHeight = 14;
const int RoundedRectangleWidth = 28;
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/Extensions.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/Extensions.cs
index d230723907..12d1eb8c51 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/Extensions.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/Extensions.cs
@@ -38,7 +38,7 @@ namespace MonoDevelop.Debugger
{
public static bool CanDebug (this ProjectOperations opers, IBuildTarget entry)
{
- ExecutionContext context = new ExecutionContext (DebuggingService.GetExecutionHandler (), IdeApp.Workbench.ProgressMonitors);
+ ExecutionContext context = new ExecutionContext (DebuggingService.GetExecutionHandler (), IdeApp.Workbench.ProgressMonitors, IdeApp.Workspace.ActiveExecutionTarget);
return opers.CanExecute (entry, context);
}
@@ -56,13 +56,13 @@ namespace MonoDevelop.Debugger
public static bool CanDebugFile (this ProjectOperations opers, string file)
{
- var context = new ExecutionContext (DebuggingService.GetExecutionHandler (), IdeApp.Workbench.ProgressMonitors);
+ var context = new ExecutionContext (DebuggingService.GetExecutionHandler (), IdeApp.Workbench.ProgressMonitors, IdeApp.Workspace.ActiveExecutionTarget);
return opers.CanExecuteFile (file, context);
}
public static IAsyncOperation DebugFile (this ProjectOperations opers, string file)
{
- var context = new ExecutionContext (DebuggingService.GetExecutionHandler (), IdeApp.Workbench.ProgressMonitors);
+ var context = new ExecutionContext (DebuggingService.GetExecutionHandler (), IdeApp.Workbench.ProgressMonitors, IdeApp.Workspace.ActiveExecutionTarget);
return opers.ExecuteFile (file, context);
}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/IDebuggerEngine.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/IDebuggerEngine.cs
index a6ae18e365..789ef65612 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/IDebuggerEngine.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/IDebuggerEngine.cs
@@ -31,6 +31,7 @@ using MonoDevelop.Core.Execution;
namespace MonoDevelop.Debugger
{
+ [Obsolete ("This interface is going to be removed. Please use MonoDevelop.Debugger.DebuggerEngineBackend")]
public interface IDebuggerEngine
{
bool CanDebugCommand (ExecutionCommand cmd);
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/IDebuggerExpressionResolver.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/IDebuggerExpressionResolver.cs
new file mode 100644
index 0000000000..5844aa54ae
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/IDebuggerExpressionResolver.cs
@@ -0,0 +1,38 @@
+//
+// IDebuggerExpressionResolver.cs
+//
+// Author:
+// Jeffrey Stedfast <jeff@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+
+using Mono.TextEditor;
+using MonoDevelop.Ide.Gui;
+
+namespace MonoDevelop.Debugger
+{
+ public interface IDebuggerExpressionResolver
+ {
+ string ResolveExpression (TextEditorData editor, Document doc, int offset, out int startOffset);
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/LocalsPad.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/LocalsPad.cs
index d3b132d4f8..dab33bbb60 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/LocalsPad.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/LocalsPad.cs
@@ -32,10 +32,10 @@ using System.Collections.Generic;
namespace MonoDevelop.Debugger
{
- public class LocalsPad: ObjectValuePad
+ public class LocalsPad : ObjectValuePad
{
+ Dictionary<string, ObjectValue> lastLookup = new Dictionary<string, ObjectValue> ();
StackFrame lastFrame;
- HashSet<string> lastExpressions = new HashSet<string> ();
public LocalsPad ()
{
@@ -46,32 +46,53 @@ namespace MonoDevelop.Debugger
public override void OnUpdateList ()
{
base.OnUpdateList ();
- StackFrame frame = DebuggingService.CurrentFrame;
+
+ var frame = DebuggingService.CurrentFrame;
if (frame == null || !FrameEquals (frame, lastFrame)) {
tree.ClearExpressions ();
- lastExpressions = null;
+ lastLookup = null;
}
+
lastFrame = frame;
if (frame == null)
return;
-
- //FIXME: tree should use the local refs rather than expressions. ATM we exclude items without names
- var expr = new HashSet<string> (frame.GetAllLocals ().Select (i => i.Name)
- .Where (n => !string.IsNullOrEmpty (n) && n != "?"));
-
+
//add expressions not in tree already, remove expressions that are longer valid
- if (lastExpressions != null) {
- foreach (string rem in lastExpressions.Except (expr))
- tree.RemoveExpression (rem);
- foreach (string rem in expr.Except (lastExpressions))
- tree.AddExpression (rem);
+ var frameLocals = frame.GetAllLocals ();
+ var lookup = new Dictionary<string, ObjectValue> (frameLocals.Length);
+
+ foreach (var local in frameLocals) {
+ var variableName = local.Name;
+
+ //not sure if there is a use case for duplicate variable names, or blanks
+ if (string.IsNullOrWhiteSpace (variableName) || variableName == "?" || lookup.ContainsKey (variableName))
+ continue;
+
+ lookup.Add (variableName, local);
+
+ if (lastLookup != null) {
+ ObjectValue priorValue;
+ if (lastLookup.TryGetValue (variableName, out priorValue))
+ tree.ReplaceValue (priorValue, local);
+ else
+ tree.AddValue (local);
+ }
+ }
+
+ if (lastLookup != null) {
+ //get rid of the values that didnt survive from the last refresh
+ foreach (var prior in lastLookup) {
+ if (!lookup.ContainsKey (prior.Key))
+ tree.RemoveValue (prior.Value);
+ }
} else {
- tree.AddExpressions (expr);
+ tree.ClearValues ();
+ tree.AddValues (lookup.Values);
}
-
- lastExpressions = expr;
+
+ lastLookup = lookup;
}
static bool FrameEquals (StackFrame a, StackFrame z)
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValuePad.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValuePad.cs
index c8b0b533aa..877bbe355e 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValuePad.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValuePad.cs
@@ -133,6 +133,8 @@ namespace MonoDevelop.Debugger
protected virtual void OnDebuggerStopped (object s, EventArgs a)
{
tree.ResetChangeTracking ();
+ tree.Frame = null;
+ lastFrame = null;
initialResume = true;
}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs
index 852f2c38bc..c637ba7e3a 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs
@@ -37,7 +37,6 @@ using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide;
using MonoDevelop.Ide.CodeCompletion;
-using MonoDevelop.Ide.Gui.Components;
using MonoDevelop.Components.Commands;
using MonoDevelop.Ide.Commands;
@@ -60,7 +59,7 @@ namespace MonoDevelop.Debugger
readonly TreeViewState state;
readonly TreeStore store;
readonly string createMsg;
- bool restoringState = false;
+ bool restoringState;
bool compact;
StackFrame frame;
bool disposed;
@@ -138,15 +137,15 @@ namespace MonoDevelop.Debugger
Selection.Mode = Gtk.SelectionMode.Multiple;
ResetColumnSizes ();
- Pango.FontDescription newFont = this.Style.FontDescription.Copy ();
+ Pango.FontDescription newFont = Style.FontDescription.Copy ();
newFont.Size = (newFont.Size * 8) / 10;
-
+
liveIcon = ImageService.GetIcon (Stock.Execute, IconSize.Menu);
noLiveIcon = liveIcon.WithAlpha (0.5);
expCol = new TreeViewColumn ();
expCol.Title = GettextCatalog.GetString ("Name");
- CellRendererImage crp = new CellRendererImage ();
+ var crp = new CellRendererImage ();
expCol.PackStart (crp, false);
expCol.AddAttribute (crp, "stock_id", IconColumn);
crtExp = new CellRendererText ();
@@ -164,11 +163,11 @@ namespace MonoDevelop.Debugger
valueCol = new TreeViewColumn ();
valueCol.Title = GettextCatalog.GetString ("Value");
crpViewer = new CellRendererImage ();
- crpViewer.Image = ImageService.GetIcon (Stock.ZoomIn, Gtk.IconSize.Menu);
+ crpViewer.Image = ImageService.GetIcon (Stock.ZoomIn, IconSize.Menu);
valueCol.PackStart (crpViewer, false);
valueCol.AddAttribute (crpViewer, "visible", ViewerButtonVisibleColumn);
crpButton = new CellRendererImage ();
- crpButton.Image = ImageService.GetIcon (Stock.Refresh, Gtk.IconSize.Menu);
+ crpButton.Image = ImageService.GetIcon (Stock.Refresh, IconSize.Menu);
valueCol.PackStart (crpButton, false);
valueCol.AddAttribute (crpButton, "visible", ValueButtonVisibleColumn);
crtValue = new CellRendererText ();
@@ -237,6 +236,14 @@ namespace MonoDevelop.Debugger
crtValue.Edited -= OnValueEdited;
crtValue.EditingCanceled -= OnEditingCancelled;
+ typeCol.RemoveNotification ("width", OnColumnWidthChanged);
+ valueCol.RemoveNotification ("width", OnColumnWidthChanged);
+ expCol.RemoveNotification ("width", OnColumnWidthChanged);
+
+ values.Clear ();
+ valueNames.Clear ();
+ Frame = null;
+
disposed = true;
cancellationTokenSource.Cancel ();
@@ -380,7 +387,7 @@ namespace MonoDevelop.Debugger
get; set;
}
- bool CanQueryDebugger {
+ static bool CanQueryDebugger {
get {
return DebuggingService.IsConnected && DebuggingService.IsPaused;
}
@@ -517,9 +524,9 @@ namespace MonoDevelop.Debugger
if (valueNames.Count > 0) {
ObjectValue[] expValues = GetValues (valueNames.ToArray ());
- for (int n=0; n<expValues.Length; n++) {
- AppendValue (TreeIter.Zero, valueNames [n], expValues [n]);
- if (expValues [n].HasChildren)
+ for (int n = 0; n < expValues.Length; n++) {
+ AppendValue (TreeIter.Zero, valueNames[n], expValues[n]);
+ if (expValues[n].HasChildren)
showExpanders = true;
}
}
@@ -540,7 +547,7 @@ namespace MonoDevelop.Debugger
void RefreshRow (TreeIter iter)
{
- ObjectValue val = (ObjectValue) store.GetValue (iter, ObjectColumn);
+ var val = (ObjectValue) store.GetValue (iter, ObjectColumn);
UnregisterValue (val);
RemoveChildren (iter);
@@ -566,13 +573,13 @@ namespace MonoDevelop.Debugger
SetValues (parent, iter, val.Name, val);
RegisterValue (val, iter);
}
-
+
void RemoveChildren (TreeIter iter)
{
TreeIter citer;
while (store.IterChildren (out citer, iter)) {
- ObjectValue val = (ObjectValue) store.GetValue (citer, ObjectColumn);
+ var val = (ObjectValue) store.GetValue (citer, ObjectColumn);
if (val != null)
UnregisterValue (val);
RemoveChildren (citer);
@@ -599,14 +606,18 @@ namespace MonoDevelop.Debugger
Application.Invoke (delegate {
if (disposed)
return;
- ObjectValue val = (ObjectValue) o;
+
+ var val = (ObjectValue) o;
TreeIter it;
+
if (FindValue (val, out it)) {
// Keep the expression name entered by the user
if (store.IterDepth (it) == 0)
val.Name = (string) store.GetValue (it, NameColumn);
+
RemoveChildren (it);
TreeIter parent;
+
if (!store.IterParent (out parent, it))
parent = TreeIter.Zero;
@@ -674,13 +685,15 @@ namespace MonoDevelop.Debugger
void AppendValue (TreeIter parent, string name, ObjectValue val)
{
- TreeIter it;
+ TreeIter iter;
+
if (parent.Equals (TreeIter.Zero))
- it = store.AppendNode ();
+ iter = store.AppendNode ();
else
- it = store.AppendNode (parent);
- SetValues (parent, it, name, val);
- RegisterValue (val, it);
+ iter = store.AppendNode (parent);
+
+ SetValues (parent, iter, name, val);
+ RegisterValue (val, iter);
}
void SetValues (TreeIter parent, TreeIter it, string name, ObjectValue val)
@@ -691,10 +704,10 @@ namespace MonoDevelop.Debugger
string valueColor = null;
string valueButton = null;
- if (name == null)
- name = val.Name;
+ name = name ?? val.Name;
bool hasParent = !parent.Equals (TreeIter.Zero);
+ bool showViewerButton = false;
string valPath;
if (!hasParent)
@@ -714,23 +727,20 @@ namespace MonoDevelop.Debugger
canEdit = !val.IsReadOnly;
strval = string.Empty;
}
- }
- else if (val.IsError) {
+ } else if (val.IsError) {
strval = val.Value;
int i = strval.IndexOf ('\n');
if (i != -1)
strval = strval.Substring (0, i);
valueColor = errorColor;
canEdit = false;
- }
- else if (val.IsNotSupported) {
+ } else if (val.IsNotSupported) {
strval = val.Value;
valueColor = disabledColor;
if (val.CanRefresh)
valueButton = Stock.Refresh;
canEdit = false;
- }
- else if (val.IsEvaluating) {
+ } else if (val.IsEvaluating) {
strval = GettextCatalog.GetString ("Evaluating...");
valueColor = disabledColor;
if (val.IsEvaluatingGroup) {
@@ -738,8 +748,8 @@ namespace MonoDevelop.Debugger
name = val.Name;
}
canEdit = false;
- }
- else {
+ } else {
+ showViewerButton = !val.IsNull && DebuggingService.HasValueVisualizers (val);
canEdit = val.IsPrimitive && !val.IsReadOnly;
strval = val.DisplayValue ?? "(null)";
if (oldValue != null && strval != oldValue)
@@ -747,8 +757,6 @@ namespace MonoDevelop.Debugger
}
strval = strval.Replace (Environment.NewLine, " ");
-
- bool showViewerButton = DebuggingService.HasValueVisualizers (val);
bool hasChildren = val.HasChildren;
string icon = GetIcon (val.Flags);
@@ -787,13 +795,13 @@ namespace MonoDevelop.Debugger
{
if ((flags & ObjectValueFlags.Field) != 0 && (flags & ObjectValueFlags.ReadOnly) != 0)
return "md-literal";
-
+
+ string global = (flags & ObjectValueFlags.Global) != 0 ? "static-" : string.Empty;
string source;
- string stic = (flags & ObjectValueFlags.Global) != 0 ? "static-" : string.Empty;
-
+
switch (flags & ObjectValueFlags.OriginMask) {
case ObjectValueFlags.Property: source = "property"; break;
- case ObjectValueFlags.Type: source = "class"; stic = string.Empty; break;
+ case ObjectValueFlags.Type: source = "class"; global = string.Empty; break;
case ObjectValueFlags.Method: source = "method"; break;
case ObjectValueFlags.Literal: return "md-literal";
case ObjectValueFlags.Namespace: return "md-name-space";
@@ -812,7 +820,7 @@ namespace MonoDevelop.Debugger
default: access = string.Empty; break;
}
- return "md-" + access + stic + source;
+ return "md-" + access + global + source;
}
protected override bool OnTestExpandRow (TreeIter iter, TreePath path)
@@ -891,10 +899,10 @@ namespace MonoDevelop.Debugger
protected override void OnRowExpanded (TreeIter iter, TreePath path)
{
- TreeIter it;
+ TreeIter child;
- if (store.IterChildren (out it, iter)) {
- ObjectValue value = (ObjectValue) store.GetValue (it, ObjectColumn);
+ if (store.IterChildren (out child, iter)) {
+ var value = (ObjectValue) store.GetValue (child, ObjectColumn);
if (value == null) {
value = (ObjectValue) store.GetValue (iter, ObjectColumn);
AddChildrenAsync (value, new TreePathReference (store, store.GetPath (iter)));
@@ -908,22 +916,26 @@ namespace MonoDevelop.Debugger
string GetIterPath (TreeIter iter)
{
- StringBuilder sb = new StringBuilder ();
+ var path = new StringBuilder ();
+
do {
string name = (string) store.GetValue (iter, NameColumn);
- sb.Insert (0, "/" + name);
+ path.Insert (0, "/" + name);
} while (store.IterParent (out iter, iter));
- return sb.ToString ();
+
+ return path.ToString ();
}
void OnExpEditing (object s, EditingStartedArgs args)
{
- TreeIter it;
- if (!store.GetIterFromString (out it, args.Path))
+ TreeIter iter;
+
+ if (!store.GetIterFromString (out iter, args.Path))
return;
- Entry e = (Entry) args.Editable;
- if (e.Text == createMsg)
- e.Text = string.Empty;
+
+ var entry = (Entry) args.Editable;
+ if (entry.Text == createMsg)
+ entry.Text = string.Empty;
OnStartEditing (args);
}
@@ -932,16 +944,17 @@ namespace MonoDevelop.Debugger
{
OnEndEditing ();
- TreeIter it;
- if (!store.GetIterFromString (out it, args.Path))
+ TreeIter iter;
+ if (!store.GetIterFromString (out iter, args.Path))
return;
- if (store.GetValue (it, ObjectColumn) == null) {
+
+ if (store.GetValue (iter, ObjectColumn) == null) {
if (args.NewText.Length > 0) {
valueNames.Add (args.NewText);
Refresh (false);
}
} else {
- string exp = (string) store.GetValue (it, NameColumn);
+ string exp = (string) store.GetValue (iter, NameColumn);
if (args.NewText == exp)
return;
@@ -969,7 +982,7 @@ namespace MonoDevelop.Debugger
var entry = (Entry) args.Editable;
- ObjectValue val = store.GetValue (it, ObjectColumn) as ObjectValue;
+ var val = store.GetValue (it, ObjectColumn) as ObjectValue;
string strVal = val != null ? val.Value : null;
if (!string.IsNullOrEmpty (strVal))
entry.Text = strVal;
@@ -986,7 +999,10 @@ namespace MonoDevelop.Debugger
if (!store.GetIterFromString (out it, args.Path))
return;
- ObjectValue val = (ObjectValue) store.GetValue (it, ObjectColumn);
+ var val = (ObjectValue) store.GetValue (it, ObjectColumn);
+
+ if (val == null)
+ return;
try {
string newVal = args.NewText;
@@ -1054,7 +1070,7 @@ namespace MonoDevelop.Debugger
}
}
- bool wasHandled = false;
+ bool wasHandled;
CodeCompletionContext ctx;
Gdk.Key key;
char keyChar;
@@ -1089,7 +1105,7 @@ namespace MonoDevelop.Debugger
string exp = entry.Text.Substring (0, entry.CursorPosition);
currentCompletionData = GetCompletionData (exp);
if (currentCompletionData != null) {
- DebugCompletionDataList dataList = new DebugCompletionDataList (currentCompletionData);
+ var dataList = new DebugCompletionDataList (currentCompletionData);
ctx = ((ICompletionWidget)this).CreateCodeCompletionContext (entry.CursorPosition - currentCompletionData.ExpressionLength);
CompletionWindowManager.ShowWindow (null, c, dataList, this, ctx);
} else {
@@ -1211,10 +1227,7 @@ namespace MonoDevelop.Debugger
break;
}
- if (changed)
- return true;
-
- return base.OnKeyPressEvent (evnt);
+ return changed || base.OnKeyPressEvent (evnt);
}
protected override bool OnButtonPressEvent (Gdk.EventButton evnt)
@@ -1236,7 +1249,7 @@ namespace MonoDevelop.Debugger
TreeIter it;
store.GetIter (out it, path);
if (cr == crpViewer) {
- ObjectValue val = (ObjectValue) store.GetValue (it, ObjectColumn);
+ var val = (ObjectValue) store.GetValue (it, ObjectColumn);
DebuggingService.ShowValueVisualizer (val);
} else if (!editing) {
if (cr == crpButton) {
@@ -1458,7 +1471,7 @@ namespace MonoDevelop.Debugger
if (!store.GetIter (out iter, selected[0]))
return;
- ObjectValue val = (ObjectValue) store.GetValue (iter, ObjectColumn);
+ var val = (ObjectValue) store.GetValue (iter, ObjectColumn);
if (val != null && val.Name == DebuggingService.DebuggerSession.EvaluationOptions.CurrentExceptionTag)
DebuggingService.ShowExceptionCaughtDialog ();
}
@@ -1587,15 +1600,13 @@ namespace MonoDevelop.Debugger
char ICompletionWidget.GetChar (int offset)
{
string txt = editEntry.Text;
- if (offset >= txt.Length)
- return '\0';
- return txt [offset];
+ return offset >= txt.Length ? '\0' : txt[offset];
}
CodeCompletionContext ICompletionWidget.CreateCodeCompletionContext (int triggerOffset)
{
- CodeCompletionContext c = new CodeCompletionContext ();
+ var c = new CodeCompletionContext ();
c.TriggerLine = 0;
c.TriggerOffset = triggerOffset;
c.TriggerLineOffset = c.TriggerOffset;
@@ -1658,8 +1669,8 @@ namespace MonoDevelop.Debugger
ObjectValue[] GetValues (string[] names)
{
- ObjectValue[] values = new ObjectValue [names.Length];
- List<string> list = new List<string> ();
+ var values = new ObjectValue [names.Length];
+ var list = new List<string> ();
for (int n=0; n<names.Length; n++) {
ObjectValue val;
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/PinnedWatchStore.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/PinnedWatchStore.cs
index b040e0ffa9..0567e4e352 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/PinnedWatchStore.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/PinnedWatchStore.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
using MonoDevelop.Core.Serialization;
using MonoDevelop.Core;
using Mono.Debugging.Client;
+using MonoDevelop.Ide;
namespace MonoDevelop.Debugger
{
@@ -270,8 +271,10 @@ namespace MonoDevelop.Debugger
batchChanged.Add (watch);
return;
}
- if (WatchChanged != null)
- WatchChanged (this, new PinnedWatchEventArgs (watch));
+ DispatchService.GuiDispatch (() => {
+ if (WatchChanged != null)
+ WatchChanged (this, new PinnedWatchEventArgs (watch));
+ });
}
void OnChanged ()
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/StackTracePad.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/StackTracePad.cs
index 84d1d203bd..0db033efbb 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/StackTracePad.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/StackTracePad.cs
@@ -64,6 +64,8 @@ namespace MonoDevelop.Debugger
IPadWindow window;
bool needsUpdate;
+ static Xwt.Drawing.Image pointerImage = Xwt.Drawing.Image.FromResource ("stack-pointer-light-16.png");
+
public StackTracePad ()
{
this.ShadowType = ShadowType.None;
@@ -78,7 +80,7 @@ namespace MonoDevelop.Debugger
menuSet.AddItem (EditCommands.SelectAll);
menuSet.AddItem (EditCommands.Copy);
- store = new ListStore (typeof (string), typeof (string), typeof (string), typeof (string), typeof (string), typeof (string), typeof (Pango.Style), typeof (object), typeof (int), typeof (bool));
+ store = new ListStore (typeof (bool), typeof (string), typeof (string), typeof (string), typeof (string), typeof (string), typeof (Pango.Style), typeof (object), typeof (int), typeof (bool));
tree = new PadTreeView (store);
tree.RulesHint = true;
@@ -93,7 +95,8 @@ namespace MonoDevelop.Debugger
var col = new TreeViewColumn ();
var crp = new CellRendererImage ();
col.PackStart (crp, false);
- col.AddAttribute (crp, "stock_id", IconColumn);
+ crp.Image = pointerImage;
+ col.AddAttribute (crp, "visible", IconColumn);
tree.AppendColumn (col);
col = new TreeViewColumn ();
@@ -135,9 +138,17 @@ namespace MonoDevelop.Debugger
ShowAll ();
UpdateDisplay ();
- DebuggingService.CallStackChanged += DispatchService.GuiDispatch (new EventHandler (OnClassStackChanged));
- DebuggingService.CurrentFrameChanged += DispatchService.GuiDispatch (new EventHandler (OnFrameChanged));
+ DebuggingService.CallStackChanged += OnClassStackChanged;
+ DebuggingService.CurrentFrameChanged += OnFrameChanged;
+ DebuggingService.StoppedEvent += OnDebuggingServiceStopped;
+
tree.RowActivated += OnRowActivated;
+ }
+
+ void OnDebuggingServiceStopped(object sender, EventArgs e)
+ {
+ if (store != null)
+ store.Clear();
}
static bool Search (TreeModel model, int column, string key, TreeIter iter)
@@ -197,11 +208,7 @@ namespace MonoDevelop.Debugger
var backtrace = DebuggingService.CurrentCallStack;
for (int i = 0; i < backtrace.FrameCount; i++) {
- string icon;
- if (i == DebuggingService.CurrentFrameIndex)
- icon = Gtk.Stock.GoForward;
- else
- icon = null;
+ bool icon = i == DebuggingService.CurrentFrameIndex;
StackFrame frame = backtrace.GetFrame (i);
if (frame.IsDebuggerHidden)
@@ -284,9 +291,9 @@ namespace MonoDevelop.Debugger
int frame = (int) store.GetValue (iter, FrameIndexColumn);
if (frame == DebuggingService.CurrentFrameIndex)
- store.SetValue (iter, IconColumn, Gtk.Stock.GoForward);
+ store.SetValue (iter, IconColumn, true);
else
- store.SetValue (iter, IconColumn, null);
+ store.SetValue (iter, IconColumn, false);
} while (store.IterNext (ref iter));
}
@@ -340,6 +347,7 @@ namespace MonoDevelop.Debugger
var options = DebuggingService.DebuggerSession.Options.EvaluationOptions.Clone ();
options.AllowMethodEvaluation = true;
options.AllowToStringCalls = true;
+ options.AllowTargetInvoke = true;
do {
if ((bool) store.GetValue (iter, CanRefreshColumn)) {
@@ -392,6 +400,14 @@ namespace MonoDevelop.Debugger
clipboard.Text = txt.ToString ();
clipboard = Clipboard.Get (Gdk.Atom.Intern ("PRIMARY", false));
clipboard.Text = txt.ToString ();
- }
+ }
+
+ protected override void OnDestroyed ()
+ {
+ DebuggingService.CallStackChanged -= OnClassStackChanged;
+ DebuggingService.CurrentFrameChanged -= OnFrameChanged;
+ DebuggingService.StoppedEvent -= OnDebuggingServiceStopped;
+ base.OnDestroyed ();
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ThreadsPad.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ThreadsPad.cs
index a04b54b01d..b20d6f1952 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ThreadsPad.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ThreadsPad.cs
@@ -46,6 +46,8 @@ namespace MonoDevelop.Debugger
TreeViewState treeViewState;
PadTreeView tree;
TreeStore store;
+ bool needsUpdate;
+ IPadWindow window;
enum Columns
{
@@ -127,10 +129,23 @@ namespace MonoDevelop.Debugger
void IPadContent.Initialize (IPadWindow window)
{
+ this.window = window;
+ window.PadContentShown += delegate {
+ if (needsUpdate)
+ Update ();
+ };
}
public void UpdateDisplay ()
{
+ if (window != null && window.ContentVisible)
+ Update ();
+ else
+ needsUpdate = true;
+ }
+
+ void Update ()
+ {
if (tree.IsRealized)
tree.ScrollToPoint (0, 0);
@@ -140,17 +155,16 @@ namespace MonoDevelop.Debugger
if (!DebuggingService.IsPaused)
return;
-
+
try {
- ProcessInfo[] currentProcesses = DebuggingService.DebuggerSession.GetProcesses ();
+ var processes = DebuggingService.DebuggerSession.GetProcesses ();
- if (currentProcesses.Length == 1) {
- AppendThreads (TreeIter.Zero, currentProcesses [0]);
- }
- else {
- foreach (ProcessInfo p in currentProcesses) {
- TreeIter it = store.AppendValues (null, p.Id.ToString (), p.Name, p, (int) Pango.Weight.Normal, "");
- AppendThreads (it, p);
+ if (processes.Length == 1) {
+ AppendThreads (TreeIter.Zero, processes[0]);
+ } else {
+ foreach (var process in processes) {
+ TreeIter iter = store.AppendValues (null, process.Id.ToString (), process.Name, process, (int) Pango.Weight.Normal, "");
+ AppendThreads (iter, process);
}
}
} catch (Exception ex) {
@@ -161,39 +175,88 @@ namespace MonoDevelop.Debugger
treeViewState.Load ();
}
-
- void AppendThreads (TreeIter it, ProcessInfo p)
+
+ void AppendThreads (TreeIter iter, ProcessInfo process)
{
- ThreadInfo[] threads = p.GetThreads ();
- Array.Sort (threads, delegate (ThreadInfo t1, ThreadInfo t2) {
- return t1.Id.CompareTo (t2.Id);
- });
- foreach (ThreadInfo t in threads) {
+ var threads = process.GetThreads ();
+
+ Array.Sort (threads, (ThreadInfo t1, ThreadInfo t2) => t1.Id.CompareTo (t2.Id));
+
+ DebuggingService.DebuggerSession.FetchFrames (threads);
+
+ foreach (var thread in threads) {
ThreadInfo activeThread = DebuggingService.DebuggerSession.ActiveThread;
- Pango.Weight wi = t == activeThread ? Pango.Weight.Bold : Pango.Weight.Normal;
- string icon = t == activeThread ? Gtk.Stock.GoForward : null;
- if (it.Equals (TreeIter.Zero))
- store.AppendValues (icon, t.Id.ToString (), t.Name, t, (int) wi, t.Location);
+ var weight = thread == activeThread ? Pango.Weight.Bold : Pango.Weight.Normal;
+ var icon = thread == activeThread ? Gtk.Stock.GoForward : null;
+
+ if (iter.Equals (TreeIter.Zero))
+ store.AppendValues (icon, thread.Id.ToString (), thread.Name, thread, (int) weight, thread.Location);
else
- store.AppendValues (it, icon, t.Id.ToString (), t.Name, t, (int) wi, t.Location);
+ store.AppendValues (iter, icon, thread.Id.ToString (), thread.Name, thread, (int) weight, thread.Location);
}
}
-
- void OnRowActivated (object s, Gtk.RowActivatedArgs args)
+
+ void UpdateThread (TreeIter iter, ThreadInfo thread, ThreadInfo activeThread)
+ {
+ var weight = thread == activeThread ? Pango.Weight.Bold : Pango.Weight.Normal;
+ var icon = thread == activeThread ? Gtk.Stock.GoForward : null;
+
+ store.SetValue (iter, (int) Columns.Weight, (int) weight);
+ store.SetValue (iter, (int) Columns.Icon, icon);
+ }
+
+ void UpdateThreads (ThreadInfo activeThread)
{
- TreeIter it;
- tree.Selection.GetSelected (out it);
- ThreadInfo t = store.GetValue (it, (int)Columns.Object) as ThreadInfo;
- if (t != null)
- DebuggingService.ActiveThread = t;
+ TreeIter iter;
+
+ if (!store.GetIterFirst (out iter))
+ return;
+
+ do {
+ var thread = store.GetValue (iter, (int) Columns.Object) as ThreadInfo;
+
+ if (thread == null) {
+ // this is a process... descend into our children
+ TreeIter child;
+
+ if (store.IterChildren (out child)) {
+ do {
+ thread = store.GetValue (iter, (int) Columns.Object) as ThreadInfo;
+ UpdateThread (child, thread, activeThread);
+ } while (store.IterNext (ref child));
+ }
+ } else {
+ UpdateThread (iter, thread, activeThread);
+ }
+ } while (store.IterNext (ref iter));
}
- public Gtk.Widget Control {
- get {
- return this;
+ void OnRowActivated (object s, RowActivatedArgs args)
+ {
+ TreeIter iter, selected;
+
+ if (!tree.Selection.GetSelected (out selected))
+ return;
+
+ var thread = store.GetValue (selected, (int) Columns.Object) as ThreadInfo;
+
+ if (thread != null) {
+ DebuggingService.CallStackChanged -= OnStackChanged;
+
+ try {
+ // Note: setting the active thread causes CallStackChanged to be emitted, but we don't want to refresh our thread list.
+ DebuggingService.ActiveThread = thread;
+ UpdateThreads (thread);
+ } finally {
+ DebuggingService.CallStackChanged += OnStackChanged;
+ }
}
}
+ public Widget Control {
+ get { return this; }
+ }
+
public string Id {
get { return "MonoDevelop.Debugger.ThreadsPad"; }
}
diff --git a/main/src/addins/MonoDevelop.Debugger/gtk-gui/MonoDevelop.Debugger.DebuggerOptionsPanelWidget.cs b/main/src/addins/MonoDevelop.Debugger/gtk-gui/MonoDevelop.Debugger.DebuggerOptionsPanelWidget.cs
index c74d68d24e..ddefc1bfbf 100644
--- a/main/src/addins/MonoDevelop.Debugger/gtk-gui/MonoDevelop.Debugger.DebuggerOptionsPanelWidget.cs
+++ b/main/src/addins/MonoDevelop.Debugger/gtk-gui/MonoDevelop.Debugger.DebuggerOptionsPanelWidget.cs
@@ -4,25 +4,31 @@ namespace MonoDevelop.Debugger
{
public partial class DebuggerOptionsPanelWidget
{
- private global::Gtk.Notebook notebook1;
private global::Gtk.VBox vbox3;
+
private global::Gtk.CheckButton checkProjectCodeOnly;
+
private global::Gtk.CheckButton checkStepOverPropertiesAndOperators;
+
private global::Gtk.CheckButton checkAllowEval;
+
private global::Gtk.Alignment alignmentAllowToString;
+
private global::Gtk.CheckButton checkAllowToString;
+
private global::Gtk.CheckButton checkShowBaseGroup;
+
private global::Gtk.CheckButton checkGroupPrivate;
+
private global::Gtk.CheckButton checkGroupStatic;
+
private global::Gtk.Table tableEval;
+
private global::Gtk.Label label3;
+
private global::Gtk.Label labelEvalTimeout;
+
private global::Gtk.SpinButton spinTimeout;
- private global::Gtk.Label label4;
- private global::Gtk.VBox vbox2;
- private global::Gtk.Label labelPriorityList;
- private global::MonoDevelop.Ide.Gui.Components.PriorityList prioritylist;
- private global::Gtk.Label labelPreferredDebuggers;
protected virtual void Build ()
{
@@ -31,11 +37,6 @@ namespace MonoDevelop.Debugger
global::Stetic.BinContainer.Attach (this);
this.Name = "MonoDevelop.Debugger.DebuggerOptionsPanelWidget";
// Container child MonoDevelop.Debugger.DebuggerOptionsPanelWidget.Gtk.Container+ContainerChild
- this.notebook1 = new global::Gtk.Notebook ();
- this.notebook1.CanFocus = true;
- this.notebook1.Name = "notebook1";
- this.notebook1.CurrentPage = 0;
- // Container child notebook1.Gtk.Notebook+NotebookChild
this.vbox3 = new global::Gtk.VBox ();
this.vbox3.Name = "vbox3";
this.vbox3.Spacing = 6;
@@ -175,46 +176,7 @@ namespace MonoDevelop.Debugger
w12.Position = 7;
w12.Expand = false;
w12.Fill = false;
- this.notebook1.Add (this.vbox3);
- // Notebook tab
- this.label4 = new global::Gtk.Label ();
- this.label4.Name = "label4";
- this.label4.LabelProp = global::Mono.Unix.Catalog.GetString ("General");
- this.notebook1.SetTabLabel (this.vbox3, this.label4);
- this.label4.ShowAll ();
- // Container child notebook1.Gtk.Notebook+NotebookChild
- this.vbox2 = new global::Gtk.VBox ();
- this.vbox2.Name = "vbox2";
- this.vbox2.Spacing = 6;
- this.vbox2.BorderWidth = ((uint)(6));
- // Container child vbox2.Gtk.Box+BoxChild
- this.labelPriorityList = new global::Gtk.Label ();
- this.labelPriorityList.WidthRequest = 417;
- this.labelPriorityList.Name = "labelPriorityList";
- this.labelPriorityList.Xalign = 0F;
- this.labelPriorityList.LabelProp = global::Mono.Unix.Catalog.GetString ("This priority list will be used when selecting the engine to be used for debugging an application.");
- this.labelPriorityList.Wrap = true;
- this.vbox2.Add (this.labelPriorityList);
- global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.labelPriorityList]));
- w14.Position = 0;
- w14.Expand = false;
- w14.Fill = false;
- // Container child vbox2.Gtk.Box+BoxChild
- this.prioritylist = new global::MonoDevelop.Ide.Gui.Components.PriorityList ();
- this.prioritylist.Name = "prioritylist";
- this.vbox2.Add (this.prioritylist);
- global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.prioritylist]));
- w15.Position = 1;
- this.notebook1.Add (this.vbox2);
- global::Gtk.Notebook.NotebookChild w16 = ((global::Gtk.Notebook.NotebookChild)(this.notebook1 [this.vbox2]));
- w16.Position = 1;
- // Notebook tab
- this.labelPreferredDebuggers = new global::Gtk.Label ();
- this.labelPreferredDebuggers.Name = "labelPreferredDebuggers";
- this.labelPreferredDebuggers.LabelProp = global::Mono.Unix.Catalog.GetString ("Preferred Debuggers");
- this.notebook1.SetTabLabel (this.vbox2, this.labelPreferredDebuggers);
- this.labelPreferredDebuggers.ShowAll ();
- this.Add (this.notebook1);
+ this.Add (this.vbox3);
if ((this.Child != null)) {
this.Child.ShowAll ();
}
diff --git a/main/src/addins/MonoDevelop.Debugger/gtk-gui/gui.stetic b/main/src/addins/MonoDevelop.Debugger/gtk-gui/gui.stetic
index 70fbd02db2..18ec72f205 100644
--- a/main/src/addins/MonoDevelop.Debugger/gtk-gui/gui.stetic
+++ b/main/src/addins/MonoDevelop.Debugger/gtk-gui/gui.stetic
@@ -1268,266 +1268,207 @@ Break when the hit count is a multiple of</property>
<property name="MemberName" />
<property name="Visible">False</property>
<child>
- <widget class="Gtk.Notebook" id="notebook1">
+ <widget class="Gtk.VBox" id="vbox3">
<property name="MemberName" />
- <property name="CanFocus">True</property>
- <property name="CurrentPage">0</property>
+ <property name="Spacing">6</property>
+ <property name="BorderWidth">9</property>
<child>
- <widget class="Gtk.VBox" id="vbox3">
+ <widget class="Gtk.CheckButton" id="checkProjectCodeOnly">
<property name="MemberName" />
- <property name="Spacing">6</property>
- <property name="BorderWidth">9</property>
- <child>
- <widget class="Gtk.CheckButton" id="checkProjectCodeOnly">
- <property name="MemberName" />
- <property name="CanFocus">True</property>
- <property name="Label" translatable="yes">Debug project code only; do not step into framework code.</property>
- <property name="Active">True</property>
- <property name="DrawIndicator">True</property>
- <property name="HasLabel">True</property>
- <property name="UseUnderline">True</property>
- </widget>
- <packing>
- <property name="Position">0</property>
- <property name="AutoSize">True</property>
- <property name="Expand">False</property>
- <property name="Fill">False</property>
- </packing>
- </child>
- <child>
- <widget class="Gtk.CheckButton" id="checkStepOverPropertiesAndOperators">
- <property name="MemberName" />
- <property name="CanFocus">True</property>
- <property name="Label" translatable="yes">Step over properties and operators</property>
- <property name="Active">True</property>
- <property name="DrawIndicator">True</property>
- <property name="HasLabel">True</property>
- <property name="UseUnderline">True</property>
- </widget>
- <packing>
- <property name="Position">1</property>
- <property name="AutoSize">True</property>
- <property name="Expand">False</property>
- <property name="Fill">False</property>
- </packing>
- </child>
+ <property name="CanFocus">True</property>
+ <property name="Label" translatable="yes">Debug project code only; do not step into framework code.</property>
+ <property name="Active">True</property>
+ <property name="DrawIndicator">True</property>
+ <property name="HasLabel">True</property>
+ <property name="UseUnderline">True</property>
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.CheckButton" id="checkStepOverPropertiesAndOperators">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="Label" translatable="yes">Step over properties and operators</property>
+ <property name="Active">True</property>
+ <property name="DrawIndicator">True</property>
+ <property name="HasLabel">True</property>
+ <property name="UseUnderline">True</property>
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.CheckButton" id="checkAllowEval">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="Label" translatable="yes">Allow implicit property evaluation and method invocation</property>
+ <property name="Active">True</property>
+ <property name="DrawIndicator">True</property>
+ <property name="HasLabel">True</property>
+ <property name="UseUnderline">True</property>
+ <signal name="Toggled" handler="OnCheckAllowEvalToggled" />
+ </widget>
+ <packing>
+ <property name="Position">2</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Alignment" id="alignmentAllowToString">
+ <property name="MemberName" />
+ <property name="Xalign">0</property>
+ <property name="LeftPadding">18</property>
<child>
- <widget class="Gtk.CheckButton" id="checkAllowEval">
+ <widget class="Gtk.CheckButton" id="checkAllowToString">
<property name="MemberName" />
<property name="CanFocus">True</property>
- <property name="Label" translatable="yes">Allow implicit property evaluation and method invocation</property>
+ <property name="Label" translatable="yes">Call string-conversion function on objects in variables windows</property>
<property name="Active">True</property>
<property name="DrawIndicator">True</property>
<property name="HasLabel">True</property>
<property name="UseUnderline">True</property>
- <signal name="Toggled" handler="OnCheckAllowEvalToggled" />
- </widget>
- <packing>
- <property name="Position">2</property>
- <property name="AutoSize">True</property>
- <property name="Expand">False</property>
- <property name="Fill">False</property>
- </packing>
- </child>
- <child>
- <widget class="Gtk.Alignment" id="alignmentAllowToString">
- <property name="MemberName" />
- <property name="Xalign">0</property>
- <property name="LeftPadding">18</property>
- <child>
- <widget class="Gtk.CheckButton" id="checkAllowToString">
- <property name="MemberName" />
- <property name="CanFocus">True</property>
- <property name="Label" translatable="yes">Call string-conversion function on objects in variables windows</property>
- <property name="Active">True</property>
- <property name="DrawIndicator">True</property>
- <property name="HasLabel">True</property>
- <property name="UseUnderline">True</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="Position">3</property>
- <property name="AutoSize">True</property>
- <property name="Expand">False</property>
- <property name="Fill">False</property>
- </packing>
- </child>
- <child>
- <widget class="Gtk.CheckButton" id="checkShowBaseGroup">
- <property name="MemberName" />
- <property name="CanFocus">True</property>
- <property name="Label" translatable="yes">Show inherited class members in a base class group</property>
- <property name="DrawIndicator">True</property>
- <property name="HasLabel">True</property>
- <property name="UseUnderline">True</property>
- </widget>
- <packing>
- <property name="Position">4</property>
- <property name="AutoSize">True</property>
- <property name="Expand">False</property>
- <property name="Fill">False</property>
- </packing>
- </child>
- <child>
- <widget class="Gtk.CheckButton" id="checkGroupPrivate">
- <property name="MemberName" />
- <property name="CanFocus">True</property>
- <property name="Label" translatable="yes">Group non-public members</property>
- <property name="DrawIndicator">True</property>
- <property name="HasLabel">True</property>
- <property name="UseUnderline">True</property>
- </widget>
- <packing>
- <property name="Position">5</property>
- <property name="AutoSize">True</property>
- <property name="Expand">False</property>
- <property name="Fill">False</property>
- </packing>
- </child>
- <child>
- <widget class="Gtk.CheckButton" id="checkGroupStatic">
- <property name="MemberName" />
- <property name="CanFocus">True</property>
- <property name="Label" translatable="yes">Group static members</property>
- <property name="DrawIndicator">True</property>
- <property name="HasLabel">True</property>
- <property name="UseUnderline">True</property>
</widget>
- <packing>
- <property name="Position">6</property>
- <property name="AutoSize">True</property>
- <property name="Expand">False</property>
- <property name="Fill">False</property>
- </packing>
- </child>
- <child>
- <widget class="Gtk.Table" id="tableEval">
- <property name="MemberName" />
- <property name="NColumns">3</property>
- <property name="RowSpacing">6</property>
- <property name="ColumnSpacing">6</property>
- <child>
- <widget class="Gtk.Label" id="label3">
- <property name="MemberName" />
- <property name="LabelProp" translatable="yes">ms</property>
- </widget>
- <packing>
- <property name="LeftAttach">2</property>
- <property name="RightAttach">3</property>
- <property name="AutoSize">True</property>
- <property name="XOptions">Fill</property>
- <property name="YOptions">Fill</property>
- <property name="XExpand">False</property>
- <property name="XFill">True</property>
- <property name="XShrink">False</property>
- <property name="YExpand">False</property>
- <property name="YFill">True</property>
- <property name="YShrink">False</property>
- </packing>
- </child>
- <child>
- <widget class="Gtk.Label" id="labelEvalTimeout">
- <property name="MemberName" />
- <property name="Xalign">0</property>
- <property name="LabelProp" translatable="yes">Evaluation Timeout:</property>
- </widget>
- <packing>
- <property name="AutoSize">True</property>
- <property name="XOptions">Fill</property>
- <property name="YOptions">Fill</property>
- <property name="XExpand">False</property>
- <property name="XFill">True</property>
- <property name="XShrink">False</property>
- <property name="YExpand">False</property>
- <property name="YFill">True</property>
- <property name="YShrink">False</property>
- </packing>
- </child>
- <child>
- <widget class="Gtk.SpinButton" id="spinTimeout">
- <property name="MemberName" />
- <property name="CanFocus">True</property>
- <property name="Upper">1000000</property>
- <property name="PageIncrement">10</property>
- <property name="StepIncrement">100</property>
- <property name="ClimbRate">100</property>
- <property name="Numeric">True</property>
- </widget>
- <packing>
- <property name="LeftAttach">1</property>
- <property name="RightAttach">2</property>
- <property name="AutoSize">True</property>
- <property name="XOptions">Fill</property>
- <property name="YOptions">Fill</property>
- <property name="XExpand">False</property>
- <property name="XFill">True</property>
- <property name="XShrink">False</property>
- <property name="YExpand">False</property>
- <property name="YFill">True</property>
- <property name="YShrink">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="Position">7</property>
- <property name="AutoSize">True</property>
- <property name="Expand">False</property>
- <property name="Fill">False</property>
- </packing>
</child>
</widget>
+ <packing>
+ <property name="Position">3</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
</child>
<child>
- <widget class="Gtk.Label" id="label4">
+ <widget class="Gtk.CheckButton" id="checkShowBaseGroup">
<property name="MemberName" />
- <property name="LabelProp" translatable="yes">General</property>
+ <property name="CanFocus">True</property>
+ <property name="Label" translatable="yes">Show inherited class members in a base class group</property>
+ <property name="DrawIndicator">True</property>
+ <property name="HasLabel">True</property>
+ <property name="UseUnderline">True</property>
</widget>
<packing>
- <property name="type">tab</property>
+ <property name="Position">4</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
</packing>
</child>
<child>
- <widget class="Gtk.VBox" id="vbox2">
+ <widget class="Gtk.CheckButton" id="checkGroupPrivate">
<property name="MemberName" />
- <property name="Spacing">6</property>
- <property name="BorderWidth">6</property>
+ <property name="CanFocus">True</property>
+ <property name="Label" translatable="yes">Group non-public members</property>
+ <property name="DrawIndicator">True</property>
+ <property name="HasLabel">True</property>
+ <property name="UseUnderline">True</property>
+ </widget>
+ <packing>
+ <property name="Position">5</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.CheckButton" id="checkGroupStatic">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="Label" translatable="yes">Group static members</property>
+ <property name="DrawIndicator">True</property>
+ <property name="HasLabel">True</property>
+ <property name="UseUnderline">True</property>
+ </widget>
+ <packing>
+ <property name="Position">6</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Table" id="tableEval">
+ <property name="MemberName" />
+ <property name="NColumns">3</property>
+ <property name="RowSpacing">6</property>
+ <property name="ColumnSpacing">6</property>
+ <child>
+ <widget class="Gtk.Label" id="label3">
+ <property name="MemberName" />
+ <property name="LabelProp" translatable="yes">ms</property>
+ </widget>
+ <packing>
+ <property name="LeftAttach">2</property>
+ <property name="RightAttach">3</property>
+ <property name="AutoSize">True</property>
+ <property name="XOptions">Fill</property>
+ <property name="YOptions">Fill</property>
+ <property name="XExpand">False</property>
+ <property name="XFill">True</property>
+ <property name="XShrink">False</property>
+ <property name="YExpand">False</property>
+ <property name="YFill">True</property>
+ <property name="YShrink">False</property>
+ </packing>
+ </child>
<child>
- <widget class="Gtk.Label" id="labelPriorityList">
+ <widget class="Gtk.Label" id="labelEvalTimeout">
<property name="MemberName" />
- <property name="WidthRequest">417</property>
<property name="Xalign">0</property>
- <property name="LabelProp" translatable="yes">This priority list will be used when selecting the engine to be used for debugging an application.</property>
- <property name="Wrap">True</property>
+ <property name="LabelProp" translatable="yes">Evaluation Timeout:</property>
</widget>
<packing>
- <property name="Position">0</property>
<property name="AutoSize">True</property>
- <property name="Expand">False</property>
- <property name="Fill">False</property>
+ <property name="XOptions">Fill</property>
+ <property name="YOptions">Fill</property>
+ <property name="XExpand">False</property>
+ <property name="XFill">True</property>
+ <property name="XShrink">False</property>
+ <property name="YExpand">False</property>
+ <property name="YFill">True</property>
+ <property name="YShrink">False</property>
</packing>
</child>
<child>
- <widget class="MonoDevelop.Ide.Gui.Components.PriorityList" id="prioritylist">
+ <widget class="Gtk.SpinButton" id="spinTimeout">
<property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="Upper">1000000</property>
+ <property name="PageIncrement">10</property>
+ <property name="StepIncrement">100</property>
+ <property name="ClimbRate">100</property>
+ <property name="Numeric">True</property>
</widget>
<packing>
- <property name="Position">1</property>
- <property name="AutoSize">False</property>
+ <property name="LeftAttach">1</property>
+ <property name="RightAttach">2</property>
+ <property name="AutoSize">True</property>
+ <property name="XOptions">Fill</property>
+ <property name="YOptions">Fill</property>
+ <property name="XExpand">False</property>
+ <property name="XFill">True</property>
+ <property name="XShrink">False</property>
+ <property name="YExpand">False</property>
+ <property name="YFill">True</property>
+ <property name="YShrink">False</property>
</packing>
</child>
</widget>
<packing>
- <property name="Position">1</property>
- </packing>
- </child>
- <child>
- <widget class="Gtk.Label" id="labelPreferredDebuggers">
- <property name="MemberName" />
- <property name="LabelProp" translatable="yes">Preferred Debuggers</property>
- </widget>
- <packing>
- <property name="type">tab</property>
+ <property name="Position">7</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
</packing>
</child>
</widget>
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/exception-icon.png b/main/src/addins/MonoDevelop.Debugger/icons/exception-icon.png
deleted file mode 100644
index 84656b52bd..0000000000
--- a/main/src/addins/MonoDevelop.Debugger/icons/exception-icon.png
+++ /dev/null
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/exception-icon@2x.png b/main/src/addins/MonoDevelop.Debugger/icons/exception-icon@2x.png
deleted file mode 100644
index cf73280443..0000000000
--- a/main/src/addins/MonoDevelop.Debugger/icons/exception-icon@2x.png
+++ /dev/null
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/breakpoint-16.png b/main/src/addins/MonoDevelop.Debugger/icons/light/breakpoint-16.png
index cc19a5ade7..c0c017eb32 100644
--- a/main/src/addins/MonoDevelop.Debugger/icons/light/breakpoint-16.png
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/breakpoint-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/breakpoint-16@2x.png b/main/src/addins/MonoDevelop.Debugger/icons/light/breakpoint-16@2x.png
index 53c8edb69a..9f68a52e2f 100644
--- a/main/src/addins/MonoDevelop.Debugger/icons/light/breakpoint-16@2x.png
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/breakpoint-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/bug-16.png b/main/src/addins/MonoDevelop.Debugger/icons/light/bug-16.png
deleted file mode 100644
index e3d9c070d5..0000000000
--- a/main/src/addins/MonoDevelop.Debugger/icons/light/bug-16.png
+++ /dev/null
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/bug-16@2x.png b/main/src/addins/MonoDevelop.Debugger/icons/light/bug-16@2x.png
deleted file mode 100644
index 2e1398c5cd..0000000000
--- a/main/src/addins/MonoDevelop.Debugger/icons/light/bug-16@2x.png
+++ /dev/null
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-16.png b/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-16.png
index 3478d1012a..f26e32207e 100644
--- a/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-16.png
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-16@2x.png b/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-16@2x.png
index 17066eb0ff..158308d290 100644
--- a/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-16@2x.png
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-22.png b/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-22.png
index 11ebc922f9..610440161f 100644
--- a/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-22.png
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-22.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-22@2x.png b/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-22@2x.png
index 31f70bf5fa..fae72407dd 100644
--- a/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-22@2x.png
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-22@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-24.png b/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-24.png
index a8111762a1..80cd6238a2 100644
--- a/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-24.png
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-24.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-24@2x.png b/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-24@2x.png
index d7e398c037..ef83576302 100644
--- a/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-24@2x.png
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-24@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-32.png b/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-32.png
index 890d9c21d4..e17cb11f60 100644
--- a/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-32.png
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-32.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-32@2x.png b/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-32@2x.png
index 52c13afc05..07f213f055 100644
--- a/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-32@2x.png
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/debug-overlay-32@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/exception-48.png b/main/src/addins/MonoDevelop.Debugger/icons/light/exception-48.png
new file mode 100644
index 0000000000..6702abf19a
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/exception-48.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/exception-48@2x.png b/main/src/addins/MonoDevelop.Debugger/icons/light/exception-48@2x.png
new file mode 100644
index 0000000000..c402042406
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/exception-48@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-15.png b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-15.png
new file mode 100644
index 0000000000..20ecca2fc7
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-15.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-15@2x.png b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-15@2x.png
new file mode 100644
index 0000000000..872a5ff363
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-15@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-disabled-15.png b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-disabled-15.png
new file mode 100644
index 0000000000..ada1ad3fb5
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-disabled-15.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-disabled-15@2x.png b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-disabled-15@2x.png
new file mode 100644
index 0000000000..a56d3aef2d
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-disabled-15@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-invalid-15.png b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-invalid-15.png
new file mode 100644
index 0000000000..bfaf88cf34
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-invalid-15.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-invalid-15@2x.png b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-invalid-15@2x.png
new file mode 100644
index 0000000000..cbf06776a2
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-breakpoint-invalid-15@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-execution-15.png b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-execution-15.png
new file mode 100644
index 0000000000..d66862ca68
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-execution-15.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-execution-15@2x.png b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-execution-15@2x.png
new file mode 100644
index 0000000000..493c4c5647
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-execution-15@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-stack-15.png b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-stack-15.png
new file mode 100644
index 0000000000..04730ee9f5
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-stack-15.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-stack-15@2x.png b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-stack-15@2x.png
new file mode 100644
index 0000000000..d731b20293
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-stack-15@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-15.png b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-15.png
new file mode 100644
index 0000000000..e17b374a94
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-15.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-15@2x.png b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-15@2x.png
new file mode 100644
index 0000000000..dc4002600d
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-15@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-disabled-15.png b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-disabled-15.png
new file mode 100644
index 0000000000..d06ef8747f
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-disabled-15.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-disabled-15@2x.png b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-disabled-15@2x.png
new file mode 100644
index 0000000000..66f4d95b84
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-disabled-15@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-invalid-15.png b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-invalid-15.png
new file mode 100644
index 0000000000..4f126b81b3
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-invalid-15.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-invalid-15@2x.png b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-invalid-15@2x.png
new file mode 100644
index 0000000000..e100e3de2c
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/gutter-tracepoint-invalid-15@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/prefs-debugger-16.png b/main/src/addins/MonoDevelop.Debugger/icons/light/prefs-debugger-16.png
new file mode 100644
index 0000000000..f26e32207e
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/prefs-debugger-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/prefs-debugger-16@2x.png b/main/src/addins/MonoDevelop.Debugger/icons/light/prefs-debugger-16@2x.png
new file mode 100644
index 0000000000..b8681ba963
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/prefs-debugger-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/stack-pointer-16.png b/main/src/addins/MonoDevelop.Debugger/icons/light/stack-pointer-16.png
new file mode 100644
index 0000000000..a9c99d7ea1
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/stack-pointer-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/light/stack-pointer-16@2x.png b/main/src/addins/MonoDevelop.Debugger/icons/light/stack-pointer-16@2x.png
new file mode 100644
index 0000000000..2379b82339
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/light/stack-pointer-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/IToolboxLoader.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/IToolboxLoader.cs
index bd624d51f5..f7fad29038 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/IToolboxLoader.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/IToolboxLoader.cs
@@ -48,12 +48,12 @@ namespace MonoDevelop.DesignerSupport.Toolbox
get;
}
- System.Collections.Generic.IList<ItemToolboxNode> Load (LoaderContext context, string filename);
+ IList<ItemToolboxNode> Load (LoaderContext context, string filename);
}
public class LoaderContext
{
- Hashtable values = new Hashtable ();
+ readonly Hashtable values = new Hashtable ();
Dictionary<TargetRuntime, ExternalLoader> externalLoaders;
int counter;
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ItemToolboxNode.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ItemToolboxNode.cs
index e218e0b85c..f719a3468b 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ItemToolboxNode.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ItemToolboxNode.cs
@@ -112,10 +112,8 @@ namespace MonoDevelop.DesignerSupport.Toolbox
public virtual bool Filter (string keyword)
{
- return ((Name==null)? false :
- (Name.ToLower ().IndexOf (keyword, StringComparison.InvariantCultureIgnoreCase) >= 0))
- || ((Description == null)? false :
- (Description.ToLower ().IndexOf (keyword, StringComparison.InvariantCultureIgnoreCase) >= 0));
+ return ((Name != null) && (Name.IndexOf (keyword, StringComparison.InvariantCultureIgnoreCase) >= 0))
+ || ((Description != null) && (Description.IndexOf (keyword, StringComparison.InvariantCultureIgnoreCase) >= 0));
}
public override bool Equals (object o)
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/TextToolboxNode.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/TextToolboxNode.cs
index 7b6a2f8857..181160287d 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/TextToolboxNode.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/TextToolboxNode.cs
@@ -38,8 +38,8 @@ namespace MonoDevelop.DesignerSupport.Toolbox
[Serializable]
public class TextToolboxNode : ItemToolboxNode, ITextToolboxNode
{
- private string text = string.Empty;
- string domain = MonoDevelop.Core.GettextCatalog.GetString ("Text Snippets");
+ string text = string.Empty;
+ string domain = GettextCatalog.GetString ("Text Snippets");
public TextToolboxNode (string text)
{
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ToolboxItemToolboxLoader.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ToolboxItemToolboxLoader.cs
index 2130487c19..348d29ee7b 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ToolboxItemToolboxLoader.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ToolboxItemToolboxLoader.cs
@@ -46,7 +46,7 @@ namespace MonoDevelop.DesignerSupport.Toolbox
bool initialized;
public string[] FileTypes {
- get { return new string[] {"dll", "exe"}; }
+ get { return new [] {"dll", "exe"}; }
}
public IList<ItemToolboxNode> Load (LoaderContext ctx, string filename)
@@ -70,7 +70,7 @@ namespace MonoDevelop.DesignerSupport.Toolbox
}
if (!found) {
// If the file does not belong to any known package, assume it is a wild assembly and make it
- // avaliable to all frameworks
+ // available to all runtimes
foreach (TargetRuntime runtime in Runtime.SystemAssemblyService.GetTargetRuntimes ())
yield return runtime;
}
@@ -87,7 +87,7 @@ namespace MonoDevelop.DesignerSupport.Toolbox
else
scanAssem = System.Reflection.Assembly.LoadFile (filename);
} catch (Exception ex) {
- MonoDevelop.Core.LoggingService.LogError ("ToolboxItemToolboxLoader: Could not load assembly '"
+ LoggingService.LogError ("ToolboxItemToolboxLoader: Could not load assembly '"
+ filename + "'", ex);
return list;
}
@@ -102,25 +102,29 @@ namespace MonoDevelop.DesignerSupport.Toolbox
}
//detect the runtime version
- MonoDevelop.Core.ClrVersion clrVersion = MonoDevelop.Core.ClrVersion.Default;
- byte[] corlibKey = new byte[] { 0xb7, 0x7a, 0x5c, 0x56, 0x19, 0x34, 0xe0, 0x89 };
- //the other system.{...} key:
- //{ 0xb0, 0x3f, 0x5f, 0x7f, 0x11, 0xd5, 0x0a, 0x3a };
+ var clrVersion = ClrVersion.Default;
+ byte[] corlibKey = { 0xb7, 0x7a, 0x5c, 0x56, 0x19, 0x34, 0xe0, 0x89 };
foreach (System.Reflection.AssemblyName an in scanAssem.GetReferencedAssemblies ()) {
if (an.Name == "mscorlib" && byteArraysEqual (corlibKey, an.GetPublicKeyToken ())) {
+ if (an.Version == new Version (4, 0, 0, 0)) {
+ clrVersion = ClrVersion.Net_4_0;
+ break;
+ }
if (an.Version == new Version (2, 0, 0, 0)) {
- clrVersion = MonoDevelop.Core.ClrVersion.Net_2_0;
+ clrVersion = ClrVersion.Net_2_0;
break;
- } else if (an.Version == new Version (1, 0, 5000, 0)) {
- clrVersion = MonoDevelop.Core.ClrVersion.Net_1_1;
+ }
+ if (an.Version == new Version (1, 0, 5000, 0)) {
+ clrVersion = ClrVersion.Net_1_1;
break;
}
}
}
- if (clrVersion == MonoDevelop.Core.ClrVersion.Default) {
- MonoDevelop.Core.LoggingService.LogError ("ToolboxItemToolboxLoader: assembly '"
- + filename + "' references unknown runtime version.");
+ if (clrVersion == ClrVersion.Default) {
+ LoggingService.LogError (
+ "ToolboxItemToolboxLoader: assembly '{0}' references unknown runtime version.", filename
+ );
return list;
}
@@ -128,7 +132,8 @@ namespace MonoDevelop.DesignerSupport.Toolbox
foreach (Type t in types) {
//skip inaccessible types
- if (t.IsAbstract || !t.IsPublic || !t.IsClass) continue;
+ if (t.IsAbstract || !t.IsPublic || !t.IsClass)
+ continue;
//get the ToolboxItemAttribute if present
object[] atts = t.GetCustomAttributes (typeof (ToolboxItemAttribute), true);
@@ -154,7 +159,7 @@ namespace MonoDevelop.DesignerSupport.Toolbox
list.Add (node);
}
} catch (Exception ex) {
- MonoDevelop.Core.LoggingService.LogError (
+ LoggingService.LogError (
"Unhandled error in toolbox node loader '" + GetType ().FullName
+ "' with type '" + t.FullName
+ "' in assembly '" + scanAssem.FullName + "'",
@@ -165,7 +170,7 @@ namespace MonoDevelop.DesignerSupport.Toolbox
return list;// Load (scanAssem);
}
- bool byteArraysEqual (byte[] a, byte[] b)
+ static bool byteArraysEqual (byte[] a, byte[] b)
{
if (a == null)
return b == null;
@@ -193,7 +198,7 @@ namespace MonoDevelop.DesignerSupport.Toolbox
ToolboxItemAttribute attribute,
string attributeCategory,
string assemblyPath,
- MonoDevelop.Core.ClrVersion referencedRuntime
- );
+ ClrVersion referencedRuntime
+ );
}
}
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ToolboxWidget.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ToolboxWidget.cs
index bf388a49d4..19c9b6819e 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ToolboxWidget.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ToolboxWidget.cs
@@ -109,14 +109,14 @@ namespace MonoDevelop.DesignerSupport.Toolbox
get { return categories; }
}
- public IEnumerable<Item> AllItems {
- get {
+ public IEnumerable<Item> AllItems {
+ get {
foreach (Category category in this.categories) {
foreach (Item item in category.Items) {
- yield return item;
+ yield return item;
}
- }
- }
+ }
+ }
}
public void ClearCategories ()
@@ -268,11 +268,11 @@ namespace MonoDevelop.DesignerSupport.Toolbox
int width, height;
cr.SetSourceColor (CategoryLabelColor);
layout.GetPixelSize (out width, out height);
- cr.MoveTo (xpos + CategoryLeftPadding, ypos + (itemDimension.Height - height) / 2);
+ cr.MoveTo (xpos + CategoryLeftPadding, ypos + (double)(Math.Round ((double)(itemDimension.Height - height) / 2)));
Pango.CairoHelper.ShowLayout (cr, headerLayout);
var img = category.IsExpanded ? discloseUp : discloseDown;
- cr.DrawImage (this, img, Allocation.Width - img.Width - CategoryRightPadding, ypos + (itemDimension.Height - img.Height) / 2);
+ cr.DrawImage (this, img, Allocation.Width - img.Width - CategoryRightPadding, ypos + Math.Round ((itemDimension.Height - img.Height) / 2));
lastCategory = category;
lastCategoryYpos = ypos + itemDimension.Height;
@@ -284,15 +284,15 @@ namespace MonoDevelop.DesignerSupport.Toolbox
cr.Fill ();
}
if (listMode || !curCategory.CanIconizeItems) {
- cr.DrawImage (this, item.Icon, xpos + ItemLeftPadding, ypos + (itemDimension.Height - item.Icon.Height) / 2);
+ cr.DrawImage (this, item.Icon, xpos + ItemLeftPadding, ypos + Math.Round ((itemDimension.Height - item.Icon.Height) / 2));
layout.SetText (item.Text);
int width, height;
layout.GetPixelSize (out width, out height);
cr.SetSourceColor (Style.Text (item != this.SelectedItem ? StateType.Normal : StateType.Selected).ToCairoColor ());
- cr.MoveTo (xpos + ItemLeftPadding + IconSize.Width + ItemIconTextItemSpacing, ypos + (itemDimension.Height - height) / 2);
+ cr.MoveTo (xpos + ItemLeftPadding + IconSize.Width + ItemIconTextItemSpacing, ypos + (double)(Math.Round ((double)(itemDimension.Height - height) / 2)));
Pango.CairoHelper.ShowLayout (cr, layout);
} else {
- cr.DrawImage (this, item.Icon, xpos + (itemDimension.Width - item.Icon.Width) / 2, ypos + (itemDimension.Height - item.Icon.Height) / 2);
+ cr.DrawImage (this, item.Icon, xpos + Math.Round ((itemDimension.Width - item.Icon.Width) / 2), ypos + Math.Round ((itemDimension.Height - item.Icon.Height) / 2));
}
if (item == mouseOverItem) {
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/ClassOutlineTextEditorExtension.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/ClassOutlineTextEditorExtension.cs
index 9642dff1ea..568e2e4d94 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/ClassOutlineTextEditorExtension.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/ClassOutlineTextEditorExtension.cs
@@ -270,7 +270,7 @@ namespace MonoDevelop.DesignerSupport
outlineTreeView = null;
settings = null;
foreach (var tw in toolbarWidgets)
- w.Destroy ();
+ tw.Destroy ();
toolbarWidgets = null;
comparer = null;
}
diff --git a/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood/DocFoodTextEditorExtension.cs b/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood/DocFoodTextEditorExtension.cs
index b271794136..7160af0c28 100644
--- a/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood/DocFoodTextEditorExtension.cs
+++ b/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood/DocFoodTextEditorExtension.cs
@@ -1,6 +1,6 @@
//
// TextEditorExtension.cs
-//
+// =
// Author:
// Mike Krüger <mkrueger@novell.com>
//
@@ -33,6 +33,7 @@ using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.CSharp.TypeSystem;
using MonoDevelop.Ide.Editor;
using MonoDevelop.Ide.Editor.Extension;
+using System.Linq;
namespace MonoDevelop.DocFood
{
@@ -180,13 +181,20 @@ namespace MonoDevelop.DocFood
return null;
}
- IMember result = null;
+ IEntity result = null;
foreach (var member in type.Members) {
if (member.Region.Begin > new TextLocation (textEditorData.CaretLine, textEditorData.CaretColumn) && (result == null || member.Region.Begin < result.Region.Begin) && IsEmptyBetweenLines (textEditorData.CaretLine, member.Region.BeginLine)) {
var ctx = (parsedDocument.ParsedFile as CSharpUnresolvedFile).GetTypeResolveContext (Document.Compilation, member.Region.Begin);
result = member.CreateResolved (ctx);
}
}
+
+ foreach (var member in type.NestedTypes) {
+ if (member.Region.Begin > new TextLocation (textEditorData.Caret.Line, textEditorData.Caret.Column) && (result == null || member.Region.Begin < result.Region.Begin) && IsEmptyBetweenLines (textEditorData.Caret.Line, member.Region.BeginLine)) {
+ var ctx = (parsedDocument.ParsedFile as CSharpUnresolvedFile).GetTypeResolveContext (Document.Compilation, member.Region.Begin);
+ result = member.Resolve (ctx).GetDefinition ();
+ }
+ }
return result;
}
}
diff --git a/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood/DocGenerator.cs b/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood/DocGenerator.cs
index eb1a0e9d9a..b5bc3384df 100644
--- a/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood/DocGenerator.cs
+++ b/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood/DocGenerator.cs
@@ -876,10 +876,15 @@ namespace MonoDevelop.DocFood
void SplitWords (object obj, string name)
{
StringBuilder result = new StringBuilder ();
+ bool wasUnderscore = false;
for (int i = 0; i < name.Length; i++) {
- char ch = name[i];
-
- if (char.IsUpper (ch)) {
+ char ch = name [i];
+ if (ch == '_') {
+ wasUnderscore = true;
+ continue;
+ }
+ if (char.IsUpper (ch) || wasUnderscore) {
+ wasUnderscore = false;
if (result.Length > 0)
result.Append (" ");
if (i + 1 < name.Length && char.IsUpper (name[i + 1])) {
@@ -894,6 +899,7 @@ namespace MonoDevelop.DocFood
continue;
}
}
+ wasUnderscore = false;
result.Append (char.ToLower (ch));
}
diff --git a/main/src/addins/MonoDevelop.Gettext/AddinInfo.cs b/main/src/addins/MonoDevelop.Gettext/AddinInfo.cs
index 696b918077..6dcdd9c8fb 100644
--- a/main/src/addins/MonoDevelop.Gettext/AddinInfo.cs
+++ b/main/src/addins/MonoDevelop.Gettext/AddinInfo.cs
@@ -3,10 +3,11 @@ using System;
using Mono.Addins;
using Mono.Addins.Description;
-[assembly:Addin ("Gettext",
- Namespace = "MonoDevelop",
- Version = MonoDevelop.BuildInfo.Version,
- Category = "IDE extensions")]
+[assembly:Addin ("Gettext",
+ Namespace = "MonoDevelop",
+ Version = MonoDevelop.BuildInfo.Version,
+ EnabledByDefault = false,
+ Category = "IDE extensions")]
[assembly:AddinName ("Gettext Translations Support")]
[assembly:AddinDescription ("Provides support for adding/editing PO files")]
diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.csproj b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.csproj
index 24d5dfc12c..b36c02c2a8 100644
--- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.csproj
+++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.csproj
@@ -194,6 +194,12 @@
<EmbeddedResource Include="icons\light\warning-16%402x.png">
<LogicalName>warning-light-16@2x.png</LogicalName>
</EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-language-16.png">
+ <LogicalName>prefs-language-light-16.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-language-16%402x.png">
+ <LogicalName>prefs-language-light-16@2x.png</LogicalName>
+ </EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="Makefile.am" />
diff --git a/main/src/addins/MonoDevelop.Gettext/gtk-gui/MonoDevelop.Gettext.Translator.LanguageChooserDialog.cs b/main/src/addins/MonoDevelop.Gettext/gtk-gui/MonoDevelop.Gettext.Translator.LanguageChooserDialog.cs
index baae1624fc..47ee64563e 100644
--- a/main/src/addins/MonoDevelop.Gettext/gtk-gui/MonoDevelop.Gettext.Translator.LanguageChooserDialog.cs
+++ b/main/src/addins/MonoDevelop.Gettext/gtk-gui/MonoDevelop.Gettext.Translator.LanguageChooserDialog.cs
@@ -34,7 +34,7 @@ namespace MonoDevelop.Gettext.Translator
this.Events = ((global::Gdk.EventMask)(256));
this.Name = "MonoDevelop.Gettext.Translator.LanguageChooserDialog";
this.Title = global::Mono.Unix.Catalog.GetString ("Create New Localization");
- this.Icon = global::Gdk.Pixbuf.LoadFromResource ("locale-16.png");
+ this.Icon = global::Gdk.Pixbuf.LoadFromResource ("prefs-language-light-16.png");
this.TypeHint = ((global::Gdk.WindowTypeHint)(1));
this.WindowPosition = ((global::Gtk.WindowPosition)(4));
this.Modal = true;
diff --git a/main/src/addins/MonoDevelop.Gettext/icons/light/done-16.png b/main/src/addins/MonoDevelop.Gettext/icons/light/done-16.png
index 469f60c5e3..7799066c43 100644
--- a/main/src/addins/MonoDevelop.Gettext/icons/light/done-16.png
+++ b/main/src/addins/MonoDevelop.Gettext/icons/light/done-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Gettext/icons/light/done-16@2x.png b/main/src/addins/MonoDevelop.Gettext/icons/light/done-16@2x.png
index 7b24c97916..c63d3974d1 100644
--- a/main/src/addins/MonoDevelop.Gettext/icons/light/done-16@2x.png
+++ b/main/src/addins/MonoDevelop.Gettext/icons/light/done-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Gettext/icons/light/error-16.png b/main/src/addins/MonoDevelop.Gettext/icons/light/error-16.png
index d9c4c975f2..30b5da6e9b 100644
--- a/main/src/addins/MonoDevelop.Gettext/icons/light/error-16.png
+++ b/main/src/addins/MonoDevelop.Gettext/icons/light/error-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Gettext/icons/light/error-16@2x.png b/main/src/addins/MonoDevelop.Gettext/icons/light/error-16@2x.png
index 22dfe0c16c..adfd2b7b19 100644
--- a/main/src/addins/MonoDevelop.Gettext/icons/light/error-16@2x.png
+++ b/main/src/addins/MonoDevelop.Gettext/icons/light/error-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Gettext/icons/light/prefs-language-16.png b/main/src/addins/MonoDevelop.Gettext/icons/light/prefs-language-16.png
new file mode 100644
index 0000000000..19f2663360
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Gettext/icons/light/prefs-language-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Gettext/icons/light/prefs-language-16@2x.png b/main/src/addins/MonoDevelop.Gettext/icons/light/prefs-language-16@2x.png
new file mode 100644
index 0000000000..1e4d00deb6
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Gettext/icons/light/prefs-language-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.GtkCore/libstetic/Placeholder.cs b/main/src/addins/MonoDevelop.GtkCore/libstetic/Placeholder.cs
index 877f7381dc..c1aced580b 100644
--- a/main/src/addins/MonoDevelop.GtkCore/libstetic/Placeholder.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/libstetic/Placeholder.cs
@@ -106,7 +106,7 @@ namespace Stetic {
using (var pat = new Cairo.LinearGradient (rect.X + rect.Width*fx, rect.Y + rect.Height*fy, rect.X + rect.Width*fw, rect.Y + rect.Height*fh)) {
pat.AddColorStop (0, c1);
pat.AddColorStop (1, c2);
- cr.Pattern = pat;
+ cr.Source = pat;
cr.FillPreserve ();
}
}
diff --git a/main/src/addins/MonoDevelop.GtkCore/libsteticui/Metacity/Preview.cs b/main/src/addins/MonoDevelop.GtkCore/libsteticui/Metacity/Preview.cs
index 6d9d5b4e9e..b0bd5ba026 100644
--- a/main/src/addins/MonoDevelop.GtkCore/libsteticui/Metacity/Preview.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/libsteticui/Metacity/Preview.cs
@@ -120,8 +120,6 @@ namespace Stetic.Metacity {
Dispose();
}
- [Obsolete]
- protected Preview(GLib.GType gtype) : base(gtype) {}
public Preview(IntPtr raw) : base(raw) {}
[DllImport(LIBMETACITY)]
diff --git a/main/src/addins/MonoDevelop.GtkCore/templates/ActionGroup.xft.xml b/main/src/addins/MonoDevelop.GtkCore/templates/ActionGroup.xft.xml
index ebac9f6ea8..c1d256519b 100644
--- a/main/src/addins/MonoDevelop.GtkCore/templates/ActionGroup.xft.xml
+++ b/main/src/addins/MonoDevelop.GtkCore/templates/ActionGroup.xft.xml
@@ -6,7 +6,7 @@
<Icon>md-gui-file</Icon>
<_Category>Gtk</_Category>
<LanguageName>*</LanguageName>
- <ProjectType>DotNet</ProjectType>
+ <ProjectType>DotNetAssembly</ProjectType>
<_Description>Creates a global Action Group.</_Description>
<DefaultFilename>ActionGroup</DefaultFilename>
</TemplateConfiguration>
diff --git a/main/src/addins/MonoDevelop.GtkCore/templates/ActionGroupPartial.xft.xml b/main/src/addins/MonoDevelop.GtkCore/templates/ActionGroupPartial.xft.xml
index 64e6f8fd8b..d05cc4dd35 100644
--- a/main/src/addins/MonoDevelop.GtkCore/templates/ActionGroupPartial.xft.xml
+++ b/main/src/addins/MonoDevelop.GtkCore/templates/ActionGroupPartial.xft.xml
@@ -6,7 +6,7 @@
<Icon>md-gui-file</Icon>
<_Category>Gtk</_Category>
<LanguageName>*</LanguageName>
- <ProjectType>DotNet</ProjectType>
+ <ProjectType>DotNetAssembly</ProjectType>
<_Description>Creates a global Action Group.</_Description>
<DefaultFilename>ActionGroup</DefaultFilename>
</TemplateConfiguration>
diff --git a/main/src/addins/MonoDevelop.GtkCore/templates/Dialog.xft.xml b/main/src/addins/MonoDevelop.GtkCore/templates/Dialog.xft.xml
index ebb5716024..e8aa208671 100644
--- a/main/src/addins/MonoDevelop.GtkCore/templates/Dialog.xft.xml
+++ b/main/src/addins/MonoDevelop.GtkCore/templates/Dialog.xft.xml
@@ -6,7 +6,7 @@
<Icon>md-gui-file</Icon>
<_Category>Gtk</_Category>
<LanguageName>*</LanguageName>
- <ProjectType>DotNet</ProjectType>
+ <ProjectType>DotNetAssembly</ProjectType>
<_Description>Creates a Gtk dialog.</_Description>
<DefaultFilename>Dialog</DefaultFilename>
</TemplateConfiguration>
diff --git a/main/src/addins/MonoDevelop.GtkCore/templates/DialogPartial.xft.xml b/main/src/addins/MonoDevelop.GtkCore/templates/DialogPartial.xft.xml
index 69f7d18bb1..fdb11da595 100644
--- a/main/src/addins/MonoDevelop.GtkCore/templates/DialogPartial.xft.xml
+++ b/main/src/addins/MonoDevelop.GtkCore/templates/DialogPartial.xft.xml
@@ -6,7 +6,7 @@
<Icon>md-gui-file</Icon>
<_Category>Gtk</_Category>
<LanguageName>*</LanguageName>
- <ProjectType>DotNet</ProjectType>
+ <ProjectType>DotNetAssembly</ProjectType>
<_Description>Creates a Gtk dialog.</_Description>
<DefaultFilename>Dialog</DefaultFilename>
</TemplateConfiguration>
diff --git a/main/src/addins/MonoDevelop.GtkCore/templates/DrawingArea.xft.xml b/main/src/addins/MonoDevelop.GtkCore/templates/DrawingArea.xft.xml
index 78de0bc995..b6a983055c 100644
--- a/main/src/addins/MonoDevelop.GtkCore/templates/DrawingArea.xft.xml
+++ b/main/src/addins/MonoDevelop.GtkCore/templates/DrawingArea.xft.xml
@@ -5,7 +5,7 @@
<Icon>md-gui-file</Icon>
<_Category>Gtk</_Category>
<LanguageName>*</LanguageName>
- <ProjectType>DotNet</ProjectType>
+ <ProjectType>DotNetAssembly</ProjectType>
<_Description>Creates a custom Gtk.DrawingArea subclass.</_Description>
<DefaultFilename>DrawingArea</DefaultFilename>
</TemplateConfiguration>
diff --git a/main/src/addins/MonoDevelop.GtkCore/templates/Widget.xft.xml b/main/src/addins/MonoDevelop.GtkCore/templates/Widget.xft.xml
index e2701bde79..7935b4f18d 100644
--- a/main/src/addins/MonoDevelop.GtkCore/templates/Widget.xft.xml
+++ b/main/src/addins/MonoDevelop.GtkCore/templates/Widget.xft.xml
@@ -6,7 +6,7 @@
<Icon>md-gui-file</Icon>
<_Category>Gtk</_Category>
<LanguageName>*</LanguageName>
- <ProjectType>DotNet</ProjectType>
+ <ProjectType>DotNetAssembly</ProjectType>
<_Description>Creates a custom Gtk Widget.</_Description>
<DefaultFilename>Widget</DefaultFilename>
</TemplateConfiguration>
diff --git a/main/src/addins/MonoDevelop.GtkCore/templates/WidgetPartial.xft.xml b/main/src/addins/MonoDevelop.GtkCore/templates/WidgetPartial.xft.xml
index 72941c79bf..7da4c74494 100644
--- a/main/src/addins/MonoDevelop.GtkCore/templates/WidgetPartial.xft.xml
+++ b/main/src/addins/MonoDevelop.GtkCore/templates/WidgetPartial.xft.xml
@@ -6,7 +6,7 @@
<Icon>md-gui-file</Icon>
<_Category>Gtk</_Category>
<LanguageName>*</LanguageName>
- <ProjectType>DotNet</ProjectType>
+ <ProjectType>DotNetAssembly</ProjectType>
<_Description>Creates a custom Gtk Widget.</_Description>
<DefaultFilename>Widget</DefaultFilename>
</TemplateConfiguration>
diff --git a/main/src/addins/MonoDevelop.GtkCore/templates/Window.xft.xml b/main/src/addins/MonoDevelop.GtkCore/templates/Window.xft.xml
index e7bdf2c636..6e39d2d8eb 100644
--- a/main/src/addins/MonoDevelop.GtkCore/templates/Window.xft.xml
+++ b/main/src/addins/MonoDevelop.GtkCore/templates/Window.xft.xml
@@ -6,7 +6,7 @@
<Icon>md-gui-file</Icon>
<_Category>Gtk</_Category>
<LanguageName>*</LanguageName>
- <ProjectType>DotNet</ProjectType>
+ <ProjectType>DotNetAssembly</ProjectType>
<_Description>Creates a Gtk Window</_Description>
<DefaultFilename>Window</DefaultFilename>
</TemplateConfiguration>
diff --git a/main/src/addins/MonoDevelop.GtkCore/templates/WindowPartial.xft.xml b/main/src/addins/MonoDevelop.GtkCore/templates/WindowPartial.xft.xml
index cc0fe732ef..d0fc35229c 100644
--- a/main/src/addins/MonoDevelop.GtkCore/templates/WindowPartial.xft.xml
+++ b/main/src/addins/MonoDevelop.GtkCore/templates/WindowPartial.xft.xml
@@ -6,7 +6,7 @@
<Icon>md-gui-file</Icon>
<_Category>Gtk</_Category>
<LanguageName>*</LanguageName>
- <ProjectType>DotNet</ProjectType>
+ <ProjectType>DotNetAssembly</ProjectType>
<_Description>Creates a Gtk Window</_Description>
<DefaultFilename>Window</DefaultFilename>
</TemplateConfiguration>
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/AddPackagesDialog.UI.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/AddPackagesDialog.UI.cs
index 26cfd370ae..7fe0956497 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/AddPackagesDialog.UI.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/AddPackagesDialog.UI.cs
@@ -162,8 +162,7 @@ namespace MonoDevelop.PackageManagement
packageInfoVBox = new VBox ();
var packageInfoFrame = new FrameBox ();
packageInfoFrame.BackgroundColor = packageInfoBackgroundColor;
- packageInfoFrame.BorderWidth = new WidgetSpacing (1, 0, 0, 0);
- packageInfoFrame.BorderColor = lineBorderColor;
+ packageInfoFrame.BorderWidth = new WidgetSpacing ();
packageInfoFrame.Content = packageInfoVBox;
packageInfoVBox.Margin = new WidgetSpacing (15, 12, 15, 12);
var packageInfoContainerVBox = new VBox ();
@@ -174,7 +173,13 @@ namespace MonoDevelop.PackageManagement
packageInfoScrollView.BorderVisible = false;
packageInfoScrollView.HorizontalScrollPolicy = ScrollPolicy.Never;
packageInfoScrollView.Content = packageInfoContainerVBox;
- middleHBox.PackEnd (packageInfoScrollView);
+ packageInfoScrollView.BackgroundColor = packageInfoBackgroundColor;
+ var packageInfoScrollViewFrame = new FrameBox ();
+ packageInfoScrollViewFrame.BackgroundColor = packageInfoBackgroundColor;
+ packageInfoScrollViewFrame.BorderWidth = new WidgetSpacing (1, 0, 0, 0);
+ packageInfoScrollViewFrame.BorderColor = lineBorderColor;
+ packageInfoScrollViewFrame.Content = packageInfoScrollView;
+ middleHBox.PackEnd (packageInfoScrollViewFrame);
// Package name and version.
var packageNameHBox = new HBox ();
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/AddPackagesDialog.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/AddPackagesDialog.cs
index 82c59a2521..70a56c29bf 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/AddPackagesDialog.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/AddPackagesDialog.cs
@@ -43,6 +43,7 @@ namespace MonoDevelop.PackageManagement
public partial class AddPackagesDialog
{
IBackgroundPackageActionRunner backgroundActionRunner;
+ IRecentPackageRepository recentPackageRepository;
ManagePackagesViewModel parentViewModel;
PackagesViewModel viewModel;
List<PackageSource> packageSources;
@@ -61,18 +62,24 @@ namespace MonoDevelop.PackageManagement
ImageLoader imageLoader = new ImageLoader ();
public AddPackagesDialog (ManagePackagesViewModel parentViewModel, string initialSearch = null)
- : this (parentViewModel, initialSearch, PackageManagementServices.BackgroundPackageActionRunner)
+ : this (
+ parentViewModel,
+ initialSearch,
+ PackageManagementServices.BackgroundPackageActionRunner,
+ PackageManagementServices.RecentPackageRepository)
{
}
public AddPackagesDialog (
ManagePackagesViewModel parentViewModel,
string initialSearch,
- IBackgroundPackageActionRunner backgroundActionRunner)
+ IBackgroundPackageActionRunner backgroundActionRunner,
+ IRecentPackageRepository recentPackageRepository)
{
this.parentViewModel = parentViewModel;
this.viewModel = parentViewModel.AvailablePackagesViewModel;
this.backgroundActionRunner = backgroundActionRunner;
+ this.recentPackageRepository = recentPackageRepository;
Build ();
@@ -268,7 +275,7 @@ namespace MonoDevelop.PackageManagement
this.packageVersionLabel.Text = packageViewModel.Version.ToString ();
this.packageAuthor.Text = packageViewModel.GetAuthors ();
this.packagePublishedDate.Text = packageViewModel.GetLastPublishedDisplayText ();
- this.packageDownloads.Text = packageViewModel.GetDownloadCountDisplayText ();
+ this.packageDownloads.Text = packageViewModel.GetDownloadCountOrVersionDisplayText ();
this.packageDescription.Text = packageViewModel.Description;
this.packageId.Text = packageViewModel.Id;
this.packageId.Visible = packageViewModel.HasNoGalleryUrl;
@@ -455,12 +462,21 @@ namespace MonoDevelop.PackageManagement
void InstallPackages (List<IPackageAction> packageActions)
{
if (packageActions.Count > 0) {
+ AddRecentPackages (packageActions);
+
ProgressMonitorStatusMessage progressMessage = GetProgressMonitorStatusMessages (packageActions);
backgroundActionRunner.Run (progressMessage, packageActions);
Close ();
}
}
+ void AddRecentPackages (List<IPackageAction> packageActions)
+ {
+ foreach (InstallPackageAction action in packageActions.OfType<InstallPackageAction> ()) {
+ recentPackageRepository.AddPackage (action.Package);
+ }
+ }
+
List<IPackageAction> CreateInstallPackageActionsForSelectedPackages ()
{
List<PackageViewModel> packageViewModels = GetSelectedPackageViewModels ();
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageCellView.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageCellView.cs
index 08f583a6e6..614bd2bccf 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageCellView.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageCellView.cs
@@ -77,7 +77,7 @@ namespace MonoDevelop.PackageManagement
// Package download count.
if (packageViewModel.HasDownloadCount) {
var downloadCountTextLayout = new TextLayout ();
- downloadCountTextLayout.Text = packageViewModel.GetDownloadCountDisplayText ();
+ downloadCountTextLayout.Text = packageViewModel.GetDownloadCountOrVersionDisplayText ();
Size size = downloadCountTextLayout.GetSize ();
Point location = new Point (cellArea.Right - packageDescriptionPadding.Right, cellArea.Top + packageDescriptionPadding.Top);
Point downloadLocation = location.Offset (-size.Width, 0);
@@ -224,11 +224,10 @@ namespace MonoDevelop.PackageManagement
void DrawPackageImage (Context ctx, Rectangle cellArea)
{
- double imageAlpha = 1;
Image image = GetValue (ImageField);
+
if (image == null) {
- image = defaultPackageImage;
- imageAlpha = GetImageAlphaForDefaultPackageImage ();
+ image = Selected ? defaultPackageImageDark : defaultPackageImageLight;
}
if (PackageImageNeedsResizing (image)) {
@@ -236,26 +235,16 @@ namespace MonoDevelop.PackageManagement
ctx.DrawImage (
image,
cellArea.Left + packageImagePadding.Left + checkBoxAreaWidth + imageLocation.X,
- cellArea.Top + packageImagePadding.Top + imageLocation.Y,
+ Math.Round( cellArea.Top + packageImagePadding.Top + imageLocation.Y),
maxPackageImageSize.Width,
- maxPackageImageSize.Height,
- imageAlpha);
+ maxPackageImageSize.Height);
} else {
Point imageLocation = GetPackageImageLocation (image.Size, cellArea);
ctx.DrawImage (
image,
cellArea.Left + packageImagePadding.Left + checkBoxAreaWidth + imageLocation.X,
- cellArea.Top + packageImagePadding.Top + imageLocation.Y,
- imageAlpha);
- }
- }
-
- double GetImageAlphaForDefaultPackageImage ()
- {
- if (Selected) {
- return 0.5;
+ Math.Round (cellArea.Top + packageImagePadding.Top + imageLocation.Y));
}
- return 0.2;
}
bool PackageImageNeedsResizing (Image image)
@@ -328,7 +317,8 @@ namespace MonoDevelop.PackageManagement
Image checkedCheckBoxWithBackgroundColorImage;
Image uncheckedCheckBoxWithBackgroundColorImage;
- static readonly Image defaultPackageImage = Image.FromResource (typeof(PackageCellView), "packageicon.png");
+ static readonly Image defaultPackageImageLight = Image.FromResource (typeof(PackageCellView), "reference-light-48.png");
+ static readonly Image defaultPackageImageDark = Image.FromResource (typeof(PackageCellView), "reference-dark-48.png");
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageSourceCellRenderer.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageSourceCellRenderer.cs
index 8ffabd41ca..5e788c8ea7 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageSourceCellRenderer.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageSourceCellRenderer.cs
@@ -40,6 +40,8 @@ namespace MonoDevelop.PackageManagement
static Xwt.Drawing.Image warningImage = ImageService.GetIcon (MonoDevelop.Ide.Gui.Stock.Warning, Gtk.IconSize.Menu);
const int imageSpacing = 5;
+ const int textSpacing = 7;
+ const int textTopSpacing = 3;
protected override void Render (Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
{
@@ -56,16 +58,16 @@ namespace MonoDevelop.PackageManagement
layout.SetMarkup (GetPackageSourceDescriptionMarkup ());
- window.DrawLayout (widget.Style.TextGC (state), cell_area.X, cell_area.Y, layout);
+ window.DrawLayout (widget.Style.TextGC (state), cell_area.X + textSpacing, cell_area.Y + textTopSpacing, layout);
if (!PackageSourceViewModel.IsValid) {
using (var ctx = Gdk.CairoHelper.Create (window)) {
- ctx.DrawImage (widget, warningImage, cell_area.X + packageSourceNameWidth + imageSpacing, cell_area.Y);
+ ctx.DrawImage (widget, warningImage, cell_area.X + textSpacing + packageSourceNameWidth + imageSpacing, cell_area.Y + textTopSpacing);
}
layout.SetMarkup (GetPackageSourceErrorMarkup ());
- int packageSourceErrorTextX = cell_area.X + packageSourceNameWidth + (int)warningImage.Width + (2 * imageSpacing);
- window.DrawLayout (widget.Style.TextGC (state), packageSourceErrorTextX, cell_area.Y, layout);
+ int packageSourceErrorTextX = cell_area.X + textSpacing + packageSourceNameWidth + (int)warningImage.Width + (2 * imageSpacing);
+ window.DrawLayout (widget.Style.TextGC (state), packageSourceErrorTextX, cell_area.Y + textTopSpacing, layout);
}
}
}
@@ -123,7 +125,7 @@ namespace MonoDevelop.PackageManagement
using (var layout = new Pango.Layout (widget.PangoContext)) {
layout.SetMarkup (GetPackageSourceDescriptionMarkup ());
- height = GetLayoutSize (layout).Height + 10;
+ height = GetLayoutSize (layout).Height + 8 + textTopSpacing;
}
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageSourcesOptionsPanel.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageSourcesOptionsPanel.cs
index d287836d5f..d89d2bc405 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageSourcesOptionsPanel.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageSourcesOptionsPanel.cs
@@ -27,7 +27,12 @@
//
using System;
+using System.Linq;
+using System.IO;
+using System.Security.Cryptography;
using ICSharpCode.PackageManagement;
+using MonoDevelop.Core;
+using MonoDevelop.Ide;
using MonoDevelop.Ide.Gui.Dialogs;
namespace MonoDevelop.PackageManagement.Gui
@@ -45,17 +50,111 @@ namespace MonoDevelop.PackageManagement.Gui
packageSourcesWidget = new PackageSourcesWidget (viewModels.RegisteredPackageSourcesViewModel);
return packageSourcesWidget;
}
-
+
+ /// <summary>
+ /// Check that mono can encrypt package source passwords. This can fail if the
+ /// "~/.config/.mono/keypairs" directory has incorrect permissions.
+ ///
+ /// The keypairs directory will be created by the HttpWebRequest when a
+ /// request is made to url using https. The keypairs directory created has the
+ /// wrong permissions so NuGet will fail to encrypt any passwords.
+ ///
+ /// Use the following to fix the permissions:
+ ///
+ /// chmod u=rwx,go= keypairs
+ ///
+ /// This check is done here instead of in ApplyChanges so the user is presented
+ /// with a slightly better error message and the user can try to fix the problem
+ /// without losing their changes.
+ /// </summary>
+ public override bool ValidateChanges ()
+ {
+ if (Platform.IsWindows) {
+ return true;
+ }
+
+ try {
+ if (AnyPasswordsToBeEncrypted ()) {
+ CheckPasswordEncryptionIsWorking ();
+ }
+ } catch (CryptographicException ex) {
+ LoggingService.LogError ("Unable to encrypt NuGet Package Source passwords.", ex);
+
+ MessageService.ShowMessage (
+ GettextCatalog.GetString ("Unable to encrypt Package Source passwords."),
+ GetEncryptionFailureMessage (ex));
+
+ return false;
+ }
+ return true;
+ }
+
+ bool AnyPasswordsToBeEncrypted ()
+ {
+ return viewModels
+ .RegisteredPackageSourcesViewModel
+ .PackageSourceViewModels
+ .Any (packageSource => packageSource.HasPassword ());
+ }
+
+ /// <summary>
+ /// Try encrypting some data the same way NuGet does when it
+ /// encrypts passwords in the NuGet.config file.
+ ///
+ /// If the ~/.config/.mono/keypairs directory
+ /// has incorrect permissions or has a corrupt key value pair then
+ /// ProtectedData.Protect (...) will throw an exception.
+ /// </summary>
+ void CheckPasswordEncryptionIsWorking ()
+ {
+ var userData = new byte [] { 0xFF };
+ ProtectedData.Protect (userData, null, DataProtectionScope.CurrentUser);
+ }
+
+ string GetEncryptionFailureMessage (Exception ex)
+ {
+ if (ex.InnerException != null) {
+ return ex.InnerException.Message;
+ }
+
+ return ex.Message;
+ }
+
public override void ApplyChanges()
{
- if (packageSourcesWidget.HasPackageSourcesOrderChanged) {
- viewModels.RegisteredPackageSourcesViewModel.Save (
- packageSourcesWidget.GetOrderedPackageSources ());
- } else {
- viewModels.RegisteredPackageSourcesViewModel.Save ();
+ try {
+ if (packageSourcesWidget.HasPackageSourcesOrderChanged) {
+ viewModels.RegisteredPackageSourcesViewModel.Save (
+ packageSourcesWidget.GetOrderedPackageSources ());
+ } else {
+ viewModels.RegisteredPackageSourcesViewModel.Save ();
+ }
+ } catch (Exception ex) {
+ LoggingService.LogError ("Unable to save NuGet.config changes", ex);
+ MessageService.ShowError (
+ GettextCatalog.GetString ("Unable to save package source changes.{0}{0}{1}",
+ Environment.NewLine,
+ GetSaveNuGetConfigFileErrorMessage ()));
}
}
+ /// <summary>
+ /// Returns a non-Windows specific error message instead of the one NuGet returns.
+ ///
+ /// NuGet returns a Windows specific error:
+ ///
+ /// "DeleteSection" cannot be called on a NullSettings. This may be caused on account of
+ /// insufficient permissions to read or write to "%AppData%\NuGet\NuGet.config".
+ /// </summary>
+ string GetSaveNuGetConfigFileErrorMessage ()
+ {
+ string path = Path.Combine (
+ Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData),
+ "NuGet",
+ "NuGet.config");
+ return GettextCatalog.GetString ("Unable to read or write to \"{0}\".", path);
+ }
+
public override void Dispose ()
{
if (packageSourcesWidget != null) {
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageSourcesWidget.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageSourcesWidget.cs
index 07dc2ef5cb..2cc0dbf0b4 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageSourcesWidget.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/PackageSourcesWidget.cs
@@ -17,9 +17,9 @@ namespace MonoDevelop.PackageManagement
{
RegisteredPackageSourcesViewModel viewModel;
ListStore packageSourcesStore;
- const int IsEnabledCheckBoxColumn = 0;
- const int PackageSourceIconColumn = 1;
- const int PackageSourceViewModelColumn = 2;
+ const int IsEnabledCheckBoxColumn = 1;
+ const int PackageSourceIconColumn = 2;
+ const int PackageSourceViewModelColumn = 3;
public PackageSourcesWidget (RegisteredPackageSourcesViewModel viewModel)
{
@@ -50,7 +50,7 @@ namespace MonoDevelop.PackageManagement
void InitializeTreeView ()
{
- packageSourcesStore = new ListStore (typeof (bool), typeof (IconId), typeof (PackageSourceViewModel));
+ packageSourcesStore = new ListStore (typeof (object), typeof (bool), typeof (IconId), typeof (PackageSourceViewModel));
packageSourcesTreeView.Model = packageSourcesStore;
packageSourcesTreeView.AppendColumn (CreateTreeViewColumn ());
packageSourcesTreeView.Selection.Changed += PackageSourcesTreeViewSelectionChanged;
@@ -62,15 +62,26 @@ namespace MonoDevelop.PackageManagement
TreeViewColumn CreateTreeViewColumn ()
{
var column = new TreeViewColumn ();
- column.Spacing = 5;
-
+ column.Spacing = 0;
+
+ var dummyRenderer = new CellRendererImage ();
+ dummyRenderer.Width = 1;
+ dummyRenderer.Xpad = 0;
+ column.PackStart (dummyRenderer, false);
+
var checkBoxRenderer = new CellRendererToggle ();
checkBoxRenderer.Toggled += PackageSourceCheckBoxToggled;
+ checkBoxRenderer.Xpad = 7;
+ checkBoxRenderer.Ypad = 12;
+ checkBoxRenderer.Xalign = 0;
+ checkBoxRenderer.Yalign = 0;
column.PackStart (checkBoxRenderer, false);
column.AddAttribute (checkBoxRenderer, "active", IsEnabledCheckBoxColumn);
var iconRenderer = new CellRendererImage ();
- iconRenderer.StockSize = IconSize.LargeToolbar;
+ iconRenderer.StockSize = IconSize.Dnd;
+ iconRenderer.Xalign = 0;
+ iconRenderer.Xpad = 0;
column.PackStart (iconRenderer, false);
column.AddAttribute (iconRenderer, "icon-id", PackageSourceIconColumn);
@@ -97,6 +108,7 @@ namespace MonoDevelop.PackageManagement
void AddPackageSourceToTreeView (PackageSourceViewModel packageSourceViewModel)
{
packageSourcesStore.AppendValues (
+ null,
packageSourceViewModel.IsEnabled,
new IconId ("md-nuget-package-source"),
packageSourceViewModel);
@@ -212,11 +224,23 @@ namespace MonoDevelop.PackageManagement
{
viewModel.IsEditingSelectedPackageSource = false;
using (var dialog = new AddPackageSourceDialog (viewModel)) {
- dialog.ShowWithParent ();
+ if (dialog.ShowWithParent () == Xwt.Command.Ok) {
+ UpdateSelectedPackageSource ();
+ }
UpdateEnabledButtons ();
}
}
+ void UpdateSelectedPackageSource ()
+ {
+ TreeIter iter = GetTreeIter (viewModel.SelectedPackageSourceViewModel);
+ if (iter.Equals (TreeIter.Zero)) {
+ packageSourcesTreeView.Selection.UnselectAll ();
+ } else {
+ packageSourcesTreeView.Selection.SelectIter (iter);
+ }
+ }
+
void PackageSourcesTreeViewRowActivated (object o, RowActivatedArgs args)
{
viewModel.IsEditingSelectedPackageSource = true;
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/PackageReferenceNode.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/PackageReferenceNode.cs
index bdad656724..f7a5f5d17d 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/PackageReferenceNode.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/PackageReferenceNode.cs
@@ -34,14 +34,16 @@ namespace MonoDevelop.PackageManagement.NodeBuilders
{
public class PackageReferenceNode
{
- public PackageReferenceNode (PackageReference packageReference, bool installed)
+ public PackageReferenceNode (PackageReference packageReference, bool installed, bool pending = false)
{
PackageReference = packageReference;
Installed = installed;
+ IsInstallPending = pending;
}
public PackageReference PackageReference { get; private set; }
public bool Installed { get; private set; }
+ public bool IsInstallPending { get; private set; }
public string Name {
get { return PackageReference.Id; }
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/PackageReferenceNodeBuilder.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/PackageReferenceNodeBuilder.cs
index c38b58c2af..5132382986 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/PackageReferenceNodeBuilder.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/PackageReferenceNodeBuilder.cs
@@ -57,10 +57,13 @@ namespace MonoDevelop.PackageManagement.NodeBuilders
{
var packageReferenceNode = (PackageReferenceNode)dataObject;
nodeInfo.Label = packageReferenceNode.Name;
- nodeInfo.Icon = Context.GetIcon (Stock.Package);
+ nodeInfo.Icon = Context.GetIcon (Stock.Reference);
if (!packageReferenceNode.Installed) {
- nodeInfo.Label = "<span color='red'>" + packageReferenceNode.Name + "</span>";
+ nodeInfo.Label = "<span color='#c99c00'>" + packageReferenceNode.Name + "</span>";
+ if (!packageReferenceNode.IsInstallPending) {
+ nodeInfo.Icon = Context.GetIcon (Stock.ReferenceWarning);
+ }
}
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/ProjectPackagesFolderNode.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/ProjectPackagesFolderNode.cs
index d9b77fab63..bae5a81192 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/ProjectPackagesFolderNode.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/ProjectPackagesFolderNode.cs
@@ -42,6 +42,10 @@ namespace MonoDevelop.PackageManagement.NodeBuilders
this.project = project;
}
+ public DotNetProject Project {
+ get { return project; }
+ }
+
IEnumerable<PackageReference> GetPackageReferences ()
{
if (project.HasPackages ()) {
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/ProjectPackagesFolderNodeBuilder.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/ProjectPackagesFolderNodeBuilder.cs
index c7a3e3aa76..026a96120f 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/ProjectPackagesFolderNodeBuilder.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/ProjectPackagesFolderNodeBuilder.cs
@@ -28,6 +28,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Gdk;
+using ICSharpCode.PackageManagement;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Ide.Gui.Components;
@@ -75,7 +76,31 @@ namespace MonoDevelop.PackageManagement.NodeBuilders
IEnumerable<PackageReferenceNode> GetPackageReferencesNodes (object dataObject)
{
var projectPackagesNode = (ProjectPackagesFolderNode)dataObject;
- return projectPackagesNode.GetPackageReferencesNodes ();
+
+ List<PackageReferenceNode> nodes = projectPackagesNode.GetPackageReferencesNodes ().ToList ();
+
+ foreach (InstallPackageAction installAction in GetPendingInstallActions (projectPackagesNode.Project)) {
+ if (!nodes.Any (node => node.Id == installAction.Package.Id)) {
+ nodes.Add (CreatePackageReferenceNode (installAction));
+ }
+ }
+
+ foreach (PackageReferenceNode node in nodes) {
+ yield return node;
+ }
+ }
+
+ IEnumerable<InstallPackageAction> GetPendingInstallActions (DotNetProject project)
+ {
+ return PackageManagementServices.BackgroundPackageActionRunner.PendingInstallActionsForProject (project);
+ }
+
+ PackageReferenceNode CreatePackageReferenceNode (InstallPackageAction installAction)
+ {
+ return new PackageReferenceNode (
+ new PackageReference (installAction.Package.Id, installAction.Package.Version, null, null, false),
+ false,
+ true);
}
public override void BuildChildNodes (ITreeBuilder treeBuilder, object dataObject)
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/ProjectPackagesProjectNodeBuilderExtension.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/ProjectPackagesProjectNodeBuilderExtension.cs
index 4256416e61..a5bf79ac55 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/ProjectPackagesProjectNodeBuilderExtension.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.NodeBuilders/ProjectPackagesProjectNodeBuilderExtension.cs
@@ -25,10 +25,13 @@
// THE SOFTWARE.
using System;
-using MonoDevelop.Ide.Gui.Components;
-using MonoDevelop.Projects;
+using System.Linq;
using ICSharpCode.PackageManagement;
+using MonoDevelop.Core;
using MonoDevelop.Ide;
+using MonoDevelop.Ide.Gui.Components;
+using MonoDevelop.Projects;
+using NuGet;
namespace MonoDevelop.PackageManagement.NodeBuilders
{
@@ -40,22 +43,24 @@ namespace MonoDevelop.PackageManagement.NodeBuilders
{
packageManagementEvents = PackageManagementServices.PackageManagementEvents;
- packageManagementEvents.ParentPackageInstalled += ParentPackageInstalled;
- packageManagementEvents.ParentPackageUninstalled += ParentPackageUninstalled;
packageManagementEvents.PackagesRestored += PackagesRestored;
+ packageManagementEvents.PackageOperationsStarting += PackageOperationsStarting;
+ packageManagementEvents.PackageOperationError += PackageOperationError;
+
+ FileService.FileChanged += FileChanged;
}
- void ParentPackageInstalled (object sender, ParentPackageOperationEventArgs e)
+ void PackagesRestored (object sender, EventArgs e)
{
- RefreshChildNodes (e.Project);
+ RefreshAllChildNodes ();
}
- void ParentPackageUninstalled (object sender, ParentPackageOperationEventArgs e)
+ void PackageOperationsStarting (object sender, EventArgs e)
{
- RefreshChildNodes (e.Project);
+ RefreshAllChildNodes ();
}
- void PackagesRestored (object sender, EventArgs e)
+ void PackageOperationError (object sender, EventArgs e)
{
RefreshAllChildNodes ();
}
@@ -63,8 +68,8 @@ namespace MonoDevelop.PackageManagement.NodeBuilders
void RefreshAllChildNodes ()
{
DispatchService.GuiDispatch (() => {
- foreach (DotNetProject project in PackageManagementServices.Solution.GetDotNetProjects ()) {
- RefreshChildNodes (project);
+ foreach (IDotNetProject project in PackageManagementServices.Solution.GetDotNetProjects ()) {
+ RefreshChildNodes (project.DotNetProject);
}
});
}
@@ -84,9 +89,11 @@ namespace MonoDevelop.PackageManagement.NodeBuilders
public override void Dispose ()
{
- packageManagementEvents.ParentPackageInstalled -= ParentPackageInstalled;
- packageManagementEvents.ParentPackageUninstalled -= ParentPackageUninstalled;
+ FileService.FileChanged -= FileChanged;
+
packageManagementEvents.PackagesRestored -= PackagesRestored;
+ packageManagementEvents.PackageOperationsStarting -= PackageOperationsStarting;
+ packageManagementEvents.PackageOperationError -= PackageOperationError;
}
public override bool CanBuildNode (Type dataType)
@@ -102,7 +109,15 @@ namespace MonoDevelop.PackageManagement.NodeBuilders
bool ProjectHasPackages (object dataObject)
{
var project = (DotNetProject) dataObject;
- return project.HasPackages ();
+ return project.HasPackages () || ProjectHasPendingPackages (project);
+ }
+
+ bool ProjectHasPendingPackages (DotNetProject project)
+ {
+ return PackageManagementServices
+ .BackgroundPackageActionRunner
+ .PendingInstallActionsForProject (project)
+ .Any ();
}
public override void BuildChildNodes (ITreeBuilder treeBuilder, object dataObject)
@@ -112,6 +127,27 @@ namespace MonoDevelop.PackageManagement.NodeBuilders
treeBuilder.AddChild (new ProjectPackagesFolderNode (project));
}
}
+
+ void FileChanged (object sender, FileEventArgs e)
+ {
+ if (IsPackagesConfigFileChanged (e)) {
+ RefreshAllChildNodes ();
+ }
+ }
+
+ bool IsPackagesConfigFileChanged (FileEventArgs fileEventArgs)
+ {
+ return fileEventArgs.Any (file => IsPackagesConfigFileName (file.FileName));
+ }
+
+ bool IsPackagesConfigFileName (FilePath filePath)
+ {
+ if (filePath == null) {
+ return false;
+ }
+
+ return Constants.PackageReferenceFile.Equals (filePath.FileName, StringComparison.OrdinalIgnoreCase);
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MdbStackFrameTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/CollectionAssert.cs
index 2a1686a9e9..dde5cd9163 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MdbStackFrameTests.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/CollectionAssert.cs
@@ -1,41 +1,41 @@
-//
-// MdbStackFrameTests.cs
-//
-// Author:
-// Lluis Sanchez Gual <lluis@novell.com>
-//
-// Copyright (c) 2010 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using NUnit.Framework;
-
-namespace MonoDevelop.Debugger.Tests.Mdb
-{
-// [TestFixture()]
-// [Ignore ("Mdb is unmaintained and currently all tests fail")]
-// public class MdbStackFrameTests: StackFrameTests
-// {
-// public MdbStackFrameTests (): base ("Mono.Debugger.Mdb")
-// {
-// }
-// }
-}
-
+//
+// CollectionAssert.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public static class CollectionAssert
+ {
+ public static void AreEqual (IEnumerable expected, IEnumerable actual)
+ {
+ Assert.That (actual, Is.EqualTo (expected));
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/ExceptionThrowingProcessPackageAction.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/ExceptionThrowingProcessPackageAction.cs
new file mode 100644
index 0000000000..c224dfaabf
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/ExceptionThrowingProcessPackageAction.cs
@@ -0,0 +1,42 @@
+//
+// ExceptionThrowingProcessPackageAction.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class ExceptionThrowingProcessPackageAction : TestableProcessPackageAction
+ {
+ public Exception ExceptionToThrowInExecuteCore =
+ new Exception ("Error");
+
+ protected override void ExecuteCore ()
+ {
+ throw ExceptionToThrowInExecuteCore;
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/ExceptionThrowingRegisteredPackageRepositories.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/ExceptionThrowingRegisteredPackageRepositories.cs
new file mode 100644
index 0000000000..19bd75e12a
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/ExceptionThrowingRegisteredPackageRepositories.cs
@@ -0,0 +1,46 @@
+//
+// ExceptionThrowingRegisteredPackageRepositories.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class ExceptionThrowingRegisteredPackageRepositories : FakeRegisteredPackageRepositories
+ {
+ public Exception ExceptionToThrowWhenActiveRepositoryAccessed { get; set; }
+
+ public override IPackageRepository ActiveRepository {
+ get {
+ if (ExceptionToThrowWhenActiveRepositoryAccessed != null) {
+ throw ExceptionToThrowWhenActiveRepositoryAccessed;
+ }
+ return base.ActiveRepository;
+ }
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeDotNetProject.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeDotNetProject.cs
new file mode 100644
index 0000000000..ac02a9832b
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeDotNetProject.cs
@@ -0,0 +1,117 @@
+//
+// FakeDotNetProject.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using MonoDevelop.Core;
+using MonoDevelop.Core.Assemblies;
+using MonoDevelop.Projects;
+using System.Linq;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeDotNetProject : FakeProject, IDotNetProject
+ {
+ public FakeDotNetProject ()
+ {
+ References = new ProjectReferenceCollection ();
+ Files = new ProjectFileCollection ();
+ TargetFrameworkMoniker = new TargetFrameworkMoniker ("v4.5");
+ }
+
+ public FakeDotNetProject (string fileName)
+ : base (fileName)
+ {
+ References = new ProjectReferenceCollection ();
+ Files = new ProjectFileCollection ();
+ }
+
+ public DotNetProject DotNetProject { get; set; }
+ public TargetFrameworkMoniker TargetFrameworkMoniker { get; set; }
+ public string DefaultNamespace { get; set; }
+ public ProjectReferenceCollection References { get; set; }
+ public ProjectFileCollection Files { get; set; }
+
+ public List<ProjectFile> FilesAdded = new List<ProjectFile> ();
+
+ public void AddFile (ProjectFile projectFile)
+ {
+ FilesAdded.Add (projectFile);
+ Files.Add (projectFile);
+ }
+
+ public bool IsFileInProject (string fileName)
+ {
+ return Files.Any (file => file.FilePath == new FilePath (fileName));
+ }
+
+ public void AddProjectType (Guid guid)
+ {
+ ExtendedProperties.Add ("ProjectTypeGuids", guid.ToString ());
+ }
+
+ public int ReferencesWhenSavedCount;
+ public int FilesAddedWhenSavedCount;
+ public int FilesInProjectWhenSavedCount { get; set; }
+
+ public override void Save ()
+ {
+ base.Save ();
+ ReferencesWhenSavedCount = References.Count;
+ FilesAddedWhenSavedCount = FilesAdded.Count;
+ FilesInProjectWhenSavedCount = Files.Count;
+ }
+
+ public void AddDefaultBuildAction (string buildAction, string fileName)
+ {
+ DefaultBuildActions.Add (fileName.ToNativePath (), buildAction);
+ }
+
+ public Dictionary<string, string> DefaultBuildActions = new Dictionary<string, string> ();
+
+ public string GetDefaultBuildAction (string fileName)
+ {
+ string buildAction = null;
+ DefaultBuildActions.TryGetValue (fileName, out buildAction);
+ return buildAction;
+ }
+
+ public List<ImportAndCondition> ImportsAdded = new List<ImportAndCondition> ();
+
+ public void AddImportIfMissing (string name, string condition)
+ {
+ ImportsAdded.Add (new ImportAndCondition (name, condition));
+ }
+
+ public List<string> ImportsRemoved = new List <string> ();
+
+ public void RemoveImport (string name)
+ {
+ ImportsRemoved.Add (name);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeFileService.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeFileService.cs
new file mode 100644
index 0000000000..cc98f10229
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeFileService.cs
@@ -0,0 +1,63 @@
+//
+// FakeFileService.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using ICSharpCode.PackageManagement;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeFileService : IPackageManagementFileService
+ {
+ public string PathPassedToRemoveFile;
+ public string PathPassedToRemoveDirectory;
+
+ IDotNetProject project;
+
+ public FakeFileService (IDotNetProject project)
+ {
+ this.project = project;
+ }
+
+ public void RemoveFile (string path)
+ {
+ PathPassedToRemoveFile = path;
+ }
+
+ public void RemoveDirectory (string path)
+ {
+ PathPassedToRemoveDirectory = path;
+ project.Files.Clear ();
+ }
+
+ public void OnFileChanged (string path)
+ {
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeFileSystem.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeFileSystem.cs
new file mode 100644
index 0000000000..6dbb22784d
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeFileSystem.cs
@@ -0,0 +1,150 @@
+//
+// FakeFileSystem.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.IO;
+using System.Text;
+using NuGet;
+using System.Collections.Generic;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeFileSystem : IFileSystem
+ {
+ public bool FileExistsReturnValue;
+ public string PathPassedToFileExists;
+ public string FileToReturnFromOpenFile;
+ public string PathToReturnFromGetFullPath;
+ public bool DirectoryExistsReturnValue;
+ public string PathPassedToDirectoryExists;
+
+ public ILogger Logger { get; set; }
+
+ public string Root { get; set; }
+
+ public void DeleteDirectory (string path, bool recursive)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IEnumerable<string> GetFiles (string path)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IEnumerable<string> GetFiles (string path, string filter)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IEnumerable<string> GetDirectories (string path)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string GetFullPath (string path)
+ {
+ return PathToReturnFromGetFullPath;
+ }
+
+ public void DeleteFile (string path)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public bool FileExists (string path)
+ {
+ PathPassedToFileExists = path;
+ return FileExistsReturnValue;
+ }
+
+ public bool DirectoryExists (string path)
+ {
+ PathPassedToDirectoryExists = path;
+ return DirectoryExistsReturnValue;
+ }
+
+ public void AddFile (string path, Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Stream OpenFile (string path)
+ {
+ byte[] bytes = UTF8Encoding.UTF8.GetBytes (FileToReturnFromOpenFile);
+ return new MemoryStream (bytes);
+ }
+
+ public DateTimeOffset GetLastModified (string path)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public DateTimeOffset GetCreated (string path)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IEnumerable<string> GetFiles (string path, string filter, bool recursive)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public DateTimeOffset GetLastAccessed (string path)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void AddFile (string path, Action<Stream> writeToStream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void MakeFileWritable (string path)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Stream CreateFile (string path)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void DeleteFiles (IEnumerable<IPackageFile> files, string rootDir)
+ {
+ }
+
+ public void AddFiles (IEnumerable<IPackageFile> files, string rootDir)
+ {
+ }
+
+ public void MoveFile (string source, string destination)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeInstallPackageAction.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeInstallPackageAction.cs
new file mode 100644
index 0000000000..44dd254760
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeInstallPackageAction.cs
@@ -0,0 +1,64 @@
+//
+// FakeInstallPackageAction.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeInstallPackageAction : InstallPackageAction
+ {
+ public FakeInstallPackageAction ()
+ : this (null)
+ {
+ }
+
+ public FakeInstallPackageAction (IPackageManagementProject project)
+ : base (project, null)
+ {
+ }
+
+ public FakeInstallPackageAction (IPackageManagementProject project, IPackageManagementEvents packageManagementEvents)
+ : base (project, packageManagementEvents)
+ {
+ }
+
+ public bool IsExecuteCalled;
+
+ protected override void ExecuteCore ()
+ {
+ IsExecuteCalled = true;
+ ExecuteAction ();
+ }
+
+ protected override void BeforeExecute ()
+ {
+ }
+
+ public Action ExecuteAction = () => { };
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeLogger.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeLogger.cs
new file mode 100644
index 0000000000..39697146e9
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeLogger.cs
@@ -0,0 +1,77 @@
+//
+// FakeLogger.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeLogger : ILogger
+ {
+ public List<string> FormattedMessagesLogged = new List<string> ();
+
+ public string FirstFormattedMessageLogged {
+ get { return FormattedMessagesLogged [0]; }
+ }
+
+ public string LastFormattedMessageLogged {
+ get {
+ int index = FormattedMessagesLogged.Count - 1;
+ return FormattedMessagesLogged [index];
+ }
+ }
+
+ public string NextToLastFormattedMessageLogged {
+ get {
+ int index = FormattedMessagesLogged.Count - 2;
+ return FormattedMessagesLogged [index];
+ }
+ }
+
+ public string SecondFormattedMessageLogged {
+ get { return FormattedMessagesLogged [1]; }
+ }
+
+ public void Log (MessageLevel level, string message, params object[] args)
+ {
+ string formattedMessage = String.Format (message, args);
+ FormattedMessagesLogged.Add (formattedMessage);
+ }
+
+ public bool FormattedMessagesLoggedContainsText (string text)
+ {
+ return FormattedMessagesLogged.Any (message => message.Contains (text));
+ }
+
+ public FileConflictResolution ResolveFileConflict (string message)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeMachineCache.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeMachineCache.cs
new file mode 100644
index 0000000000..04a52331d6
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeMachineCache.cs
@@ -0,0 +1,54 @@
+//
+// FakeMachineCache.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using ICSharpCode.PackageManagement;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeMachinePackageCache : IMachinePackageCache
+ {
+ public List<FakePackage> FakePackages = new List<FakePackage> ();
+
+ public IQueryable<IPackage> GetPackages ()
+ {
+ return FakePackages.AsQueryable ();
+ }
+
+ public bool IsClearCalled;
+
+ public void Clear ()
+ {
+ IsClearCalled = true;
+ }
+
+ public string Source { get; set; }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeOperationAwareRepository.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeOperationAwareRepository.cs
new file mode 100644
index 0000000000..7bbdce5119
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeOperationAwareRepository.cs
@@ -0,0 +1,66 @@
+//
+// FakeOperationAwareRepository.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeOperationAwarePackageRepository : FakePackageRepository, IOperationAwareRepository, IDisposable
+ {
+ public string OperationStarted;
+ public string MainPackageIdForOperationStarted;
+
+ public IDisposable StartOperation (string operationName, string mainPackageId, string mainPackageVersion)
+ {
+ OperationStarted = operationName;
+ MainPackageIdForOperationStarted = mainPackageId;
+ return this;
+ }
+
+ public void AssertOperationWasStartedAndDisposed (string expectedOperationName, string expectedMainPackageId)
+ {
+ Assert.AreEqual (expectedOperationName, OperationStarted);
+ Assert.AreEqual (expectedMainPackageId, MainPackageIdForOperationStarted);
+ AssertOperationIsDisposed ();
+ }
+
+ void AssertOperationIsDisposed ()
+ {
+ Assert.IsTrue (IsDisposed);
+ }
+
+ public bool IsDisposed;
+
+ public void Dispose ()
+ {
+ IsDisposed = true;
+ }
+ }
+}
+
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackage.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackage.cs
new file mode 100644
index 0000000000..4601469c9b
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackage.cs
@@ -0,0 +1,233 @@
+//
+// FakePackage.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Runtime.Versioning;
+using ICSharpCode.PackageManagement;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakePackage : IPackageFromRepository
+ {
+ public Stream Stream = null;
+ public List<string> AuthorsList = new List<string> ();
+ public List<string> OwnersList = new List<string> ();
+ public List<IPackageFile> FilesList = new List<IPackageFile> ();
+
+ public List<PackageDependency> DependenciesList =
+ new List<PackageDependency> ();
+
+ public List<IPackageAssemblyReference> AssemblyReferenceList =
+ new List<IPackageAssemblyReference> ();
+
+ public FakePackage ()
+ : this (String.Empty)
+ {
+ }
+
+ public FakePackage (string id)
+ : this (id, "1.0.0.0")
+ {
+ }
+
+ public FakePackage (string id, string version)
+ {
+ this.Id = id;
+ this.Description = String.Empty;
+ this.Version = new SemanticVersion (version);
+ this.Listed = true;
+ this.IsLatestVersion = true;
+ }
+
+ public static FakePackage CreatePackageWithVersion (string version)
+ {
+ return CreatePackageWithVersion ("Test", version);
+ }
+
+ public static FakePackage CreatePackageWithVersion (string id, string version)
+ {
+ return new FakePackage (id, version);
+ }
+
+ public string Id { get; set; }
+ public SemanticVersion Version { get; set; }
+ public string Title { get; set; }
+ public Uri IconUrl { get; set; }
+ public Uri LicenseUrl { get; set; }
+ public Uri ProjectUrl { get; set; }
+ public bool RequireLicenseAcceptance { get; set; }
+ public string Description { get; set; }
+ public string Summary { get; set; }
+ public string Language { get; set; }
+ public string Tags { get; set; }
+ public Uri ReportAbuseUrl { get; set; }
+ public int DownloadCount { get; set; }
+ public int RatingsCount { get; set; }
+ public double Rating { get; set; }
+
+ public IEnumerable<IPackageAssemblyReference> AssemblyReferences {
+ get { return AssemblyReferenceList; }
+ }
+
+ public IEnumerable<string> Authors {
+ get { return AuthorsList; }
+ }
+
+ public IEnumerable<string> Owners {
+ get { return OwnersList; }
+ }
+
+ public IEnumerable<IPackageFile> GetFiles ()
+ {
+ return FilesList;
+ }
+
+ public Stream GetStream ()
+ {
+ return Stream;
+ }
+
+ public override string ToString ()
+ {
+ return String.Format ("{0} {1}", Id, Version);
+ }
+
+ public override bool Equals (object obj)
+ {
+ IPackage rhs = obj as IPackage;
+ if (rhs != null) {
+ return (Id == rhs.Id) && (Version == rhs.Version);
+ }
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ public void AddAuthor (string author)
+ {
+ AuthorsList.Add (author);
+ }
+
+ public void AddDependency (string id, SemanticVersion minVersion, SemanticVersion maxVersion)
+ {
+ var versionSpec = new VersionSpec ();
+ versionSpec.MinVersion = minVersion;
+ versionSpec.MaxVersion = maxVersion;
+ var dependency = new PackageDependency (id, versionSpec);
+ DependenciesList.Add (dependency);
+ }
+
+ public void AddDependency (string id)
+ {
+ DependenciesList.Add (new PackageDependency (id));
+ }
+
+ public List<FrameworkAssemblyReference> FrameworkAssembliesList =
+ new List<FrameworkAssemblyReference> ();
+
+ public IEnumerable<FrameworkAssemblyReference> FrameworkAssemblies {
+ get { return FrameworkAssembliesList; }
+ }
+
+ public FakePackageRepository FakePackageRepository = new FakePackageRepository ();
+
+ public IPackageRepository Repository {
+ get { return FakePackageRepository; }
+ }
+
+ public bool HasDependencies { get; set; }
+
+ public void AddFile (string fileName)
+ {
+ var file = new PhysicalPackageFile ();
+ file.TargetPath = fileName.ToNativePath ();
+ FilesList.Add (file);
+ }
+
+ public DateTime? LastUpdated { get; set; }
+
+ public bool IsLatestVersion { get; set; }
+
+ public Nullable<DateTimeOffset> Published { get; set; }
+
+ public string ReleaseNotes { get; set; }
+
+ public string Copyright { get; set; }
+
+ public bool IsAbsoluteLatestVersion { get; set; }
+
+ public bool Listed { get; set; }
+
+ public IEnumerable<PackageDependencySet> DependencySets {
+ get {
+ return new PackageDependencySet[] {
+ new PackageDependencySet (null, DependenciesList)
+ };
+ }
+ }
+
+ public List<FrameworkName> SupportedFrameworks = new List<FrameworkName> ();
+
+ public FrameworkName AddSupportedFramework (string identifier)
+ {
+ var framework = new FrameworkName (identifier);
+ SupportedFrameworks.Add (framework);
+ return framework;
+ }
+
+ public IEnumerable<FrameworkName> GetSupportedFrameworks ()
+ {
+ return SupportedFrameworks;
+ }
+
+ List<PackageReferenceSet> FakePackageAssemblyReferences =
+ new List<PackageReferenceSet> ();
+
+ public ICollection<PackageReferenceSet> PackageAssemblyReferences {
+ get { return FakePackageAssemblyReferences; }
+ }
+
+ public void AddPackageReferences (params string[] names)
+ {
+ var frameworkName = new FrameworkName (".NET Framework, Version=4.0");
+ var packageReferenceSet = new PackageReferenceSet (frameworkName, names);
+ FakePackageAssemblyReferences.Add (packageReferenceSet);
+ }
+
+ public Version MinClientVersion { get; set; }
+
+ public Uri GalleryUrl { get; set; }
+
+ public bool DevelopmentDependency { get; set; }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageAssemblyReference.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageAssemblyReference.cs
new file mode 100644
index 0000000000..403e352c3f
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageAssemblyReference.cs
@@ -0,0 +1,69 @@
+//
+// FakePackageAssemblyReference.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Runtime.Versioning;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakePackageAssemblyReference : IPackageAssemblyReference
+ {
+ public FrameworkName TargetFramework {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public string Name { get; set; }
+
+ public string Path {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public Stream GetStream ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IEnumerable<FrameworkName> SupportedFrameworks {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public string EffectivePath {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManagementProject.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManagementProject.cs
new file mode 100644
index 0000000000..e801d9413c
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManagementProject.cs
@@ -0,0 +1,295 @@
+//
+// FakePackageManagementProject.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Versioning;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.Projects;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakePackageManagementProject : IPackageManagementProject
+ {
+ public FakePackageManagementProject ()
+ : this ("Test")
+ {
+ }
+
+ public FakePackageManagementProject (string name)
+ {
+ FakeUninstallPackageAction = new FakeUninstallPackageAction (this);
+
+ this.Name = name;
+ }
+
+ public FakeUninstallPackageAction FakeUninstallPackageAction;
+
+ public FakeUpdatePackageAction FirstFakeUpdatePackageActionCreated {
+ get { return FakeUpdatePackageActionsCreated [0]; }
+ }
+
+ public FakeUpdatePackageAction SecondFakeUpdatePackageActionCreated {
+ get { return FakeUpdatePackageActionsCreated [1]; }
+ }
+
+ public List<FakeUpdatePackageAction> FakeUpdatePackageActionsCreated =
+ new List<FakeUpdatePackageAction> ();
+
+ public string Name { get; set; }
+
+ public bool IsPackageInstalled (string packageId)
+ {
+ return FakePackages.Any (p => p.Id == packageId);
+ }
+
+ public bool IsPackageInstalled (IPackage package)
+ {
+ return FakePackages.Contains (package);
+ }
+
+ public List<FakePackage> FakePackages = new List<FakePackage> ();
+
+ public IQueryable<IPackage> GetPackages ()
+ {
+ return FakePackages.AsQueryable ();
+ }
+
+ public List<FakePackageOperation> FakeInstallOperations = new List<FakePackageOperation> ();
+ public IPackage PackagePassedToGetInstallPackageOperations;
+ public bool IgnoreDependenciesPassedToGetInstallPackageOperations;
+ public bool AllowPrereleaseVersionsPassedToGetInstallPackageOperations;
+
+ public virtual IEnumerable<PackageOperation> GetInstallPackageOperations (IPackage package, InstallPackageAction installAction)
+ {
+ PackagePassedToGetInstallPackageOperations = package;
+ IgnoreDependenciesPassedToGetInstallPackageOperations = installAction.IgnoreDependencies;
+ AllowPrereleaseVersionsPassedToGetInstallPackageOperations = installAction.AllowPrereleaseVersions;
+
+ return FakeInstallOperations;
+ }
+
+ public ILogger Logger { get; set; }
+
+ public IPackage PackagePassedToInstallPackage;
+ public IEnumerable<PackageOperation> PackageOperationsPassedToInstallPackage;
+ public bool IgnoreDependenciesPassedToInstallPackage;
+ public bool AllowPrereleaseVersionsPassedToInstallPackage;
+
+ public void InstallPackage (IPackage package, InstallPackageAction installAction)
+ {
+ PackagePassedToInstallPackage = package;
+ PackageOperationsPassedToInstallPackage = installAction.Operations;
+ IgnoreDependenciesPassedToInstallPackage = installAction.IgnoreDependencies;
+ AllowPrereleaseVersionsPassedToInstallPackage = installAction.AllowPrereleaseVersions;
+ }
+
+ public FakePackageOperation AddFakeInstallOperation ()
+ {
+ var package = new FakePackage ("MyPackage");
+ var operation = new FakePackageOperation (package, PackageAction.Install);
+ FakeInstallOperations.Add (operation);
+ return operation;
+ }
+
+ public FakePackageOperation AddFakeUninstallOperation ()
+ {
+ var package = new FakePackage ("MyPackage");
+ var operation = new FakePackageOperation (package, PackageAction.Uninstall);
+ FakeInstallOperations.Add (operation);
+ return operation;
+ }
+
+ public FakePackageRepository FakeSourceRepository = new FakePackageRepository ();
+
+ public IPackageRepository SourceRepository {
+ get { return FakeSourceRepository; }
+ }
+
+ public IPackage PackagePassedToUninstallPackage;
+ public bool ForceRemovePassedToUninstallPackage;
+ public bool RemoveDependenciesPassedToUninstallPackage;
+
+ public void UninstallPackage (IPackage package, UninstallPackageAction uninstallAction)
+ {
+ PackagePassedToUninstallPackage = package;
+ ForceRemovePassedToUninstallPackage = uninstallAction.ForceRemove;
+ RemoveDependenciesPassedToUninstallPackage = uninstallAction.RemoveDependencies;
+ }
+
+ public IPackage PackagePassedToUpdatePackage;
+ public IEnumerable<PackageOperation> PackageOperationsPassedToUpdatePackage;
+ public bool UpdateDependenciesPassedToUpdatePackage;
+ public bool AllowPrereleaseVersionsPassedToUpdatePackage;
+ public bool IsUpdatePackageCalled;
+
+ public void UpdatePackage (IPackage package, UpdatePackageAction updateAction)
+ {
+ PackagePassedToUpdatePackage = package;
+ PackageOperationsPassedToUpdatePackage = updateAction.Operations;
+ UpdateDependenciesPassedToUpdatePackage = updateAction.UpdateDependencies;
+ AllowPrereleaseVersionsPassedToUpdatePackage = updateAction.AllowPrereleaseVersions;
+ IsUpdatePackageCalled = true;
+ }
+
+ public FakeInstallPackageAction LastInstallPackageCreated;
+
+ public virtual InstallPackageAction CreateInstallPackageAction ()
+ {
+ LastInstallPackageCreated = new FakeInstallPackageAction (this);
+ return LastInstallPackageCreated;
+ }
+
+ public virtual UninstallPackageAction CreateUninstallPackageAction ()
+ {
+ return FakeUninstallPackageAction;
+ }
+
+ public UpdatePackageAction CreateUpdatePackageAction ()
+ {
+ var action = new FakeUpdatePackageAction (this);
+ FakeUpdatePackageActionsCreated.Add (action);
+ return action;
+ }
+
+ public event EventHandler<PackageOperationEventArgs> PackageInstalled;
+
+ public void FirePackageInstalledEvent (PackageOperationEventArgs e)
+ {
+ if (PackageInstalled != null) {
+ PackageInstalled (this, e);
+ }
+ }
+
+ public event EventHandler<PackageOperationEventArgs> PackageUninstalled;
+
+ public void FirePackageUninstalledEvent (PackageOperationEventArgs e)
+ {
+ if (PackageUninstalled != null) {
+ PackageUninstalled (this, e);
+ }
+ }
+
+ public event EventHandler<PackageOperationEventArgs> PackageReferenceAdded;
+
+ public void FirePackageReferenceAddedEvent (PackageOperationEventArgs e)
+ {
+ if (PackageReferenceAdded != null) {
+ PackageReferenceAdded (this, e);
+ }
+ }
+
+ public event EventHandler<PackageOperationEventArgs> PackageReferenceRemoving;
+
+ public void FirePackageReferenceRemovingEvent (PackageOperationEventArgs e)
+ {
+ if (PackageReferenceRemoving != null) {
+ PackageReferenceRemoving (this, e);
+ }
+ }
+
+ public List<FakePackage> FakePackagesInReverseDependencyOrder =
+ new List<FakePackage> ();
+
+ public IEnumerable<IPackage> GetPackagesInReverseDependencyOrder ()
+ {
+ return FakePackagesInReverseDependencyOrder;
+ }
+
+ public void AddFakePackage (string id)
+ {
+ FakePackages.Add (new FakePackage (id));
+ }
+
+ public void AddFakePackageToSourceRepository (string packageId)
+ {
+ FakeSourceRepository.AddFakePackage (packageId);
+ }
+
+ public void UpdatePackages (UpdatePackagesAction action)
+ {
+ }
+
+ public List<UpdatePackagesAction> UpdatePackagesActionsCreated =
+ new List<UpdatePackagesAction> ();
+
+ public UpdatePackagesAction CreateUpdatePackagesAction ()
+ {
+ var action = new UpdatePackagesAction (this, null);
+ UpdatePackagesActionsCreated.Add (action);
+ return action;
+ }
+
+ public UpdatePackagesAction UpdatePackagesActionPassedToGetUpdatePackagesOperations;
+ public IUpdatePackageSettings SettingsPassedToGetUpdatePackagesOperations;
+ public List<IPackage> PackagesOnUpdatePackagesActionPassedToGetUpdatePackagesOperations;
+ public List<PackageOperation> PackageOperationsToReturnFromGetUpdatePackagesOperations =
+ new List<PackageOperation> ();
+
+ public IEnumerable<PackageOperation> GetUpdatePackagesOperations (
+ IEnumerable<IPackage> packages,
+ IUpdatePackageSettings settings)
+ {
+ SettingsPassedToGetUpdatePackagesOperations = settings;
+ PackagesOnUpdatePackagesActionPassedToGetUpdatePackagesOperations = packages.ToList ();
+ return PackageOperationsToReturnFromGetUpdatePackagesOperations;
+ }
+
+ public void RunPackageOperations (IEnumerable<PackageOperation> expectedOperations)
+ {
+ }
+
+ public bool HasOlderPackageInstalled (IPackage package)
+ {
+ return false;
+ }
+
+ public void UpdatePackageReference (IPackage package, IUpdatePackageSettings settings)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #pragma warning disable 0067
+ public event EventHandler<PackageOperationEventArgs> PackageReferenceRemoved;
+ #pragma warning restore 0067
+
+ public IPackage FindPackage (string packageId)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public FrameworkName TargetFramework { get; set; }
+
+ public DotNetProject DotNetProject {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManagementProjectFactory.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManagementProjectFactory.cs
new file mode 100644
index 0000000000..95d3e04eb0
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManagementProjectFactory.cs
@@ -0,0 +1,81 @@
+//
+// FakePackageManagementProjectFactory.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.PackageManagement;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakePackageManagementProjectFactory : IPackageManagementProjectFactory
+ {
+ public FakePackageManagementProjectFactory ()
+ {
+ CreatePackageManagementProject = (sourceRepository, project) => {
+ RepositoriesPassedToCreateProject.Add (sourceRepository);
+ ProjectsPassedToCreateProject.Add (project);
+
+ var fakeProject = new FakePackageManagementProject ();
+ FakeProjectsCreated.Add (fakeProject);
+ return fakeProject;
+ };
+ }
+
+ public List<FakePackageManagementProject> FakeProjectsCreated =
+ new List<FakePackageManagementProject> ();
+
+ public FakePackageManagementProject FirstFakeProjectCreated {
+ get { return FakeProjectsCreated [0]; }
+ }
+
+ public IPackageRepository FirstRepositoryPassedToCreateProject {
+ get { return RepositoriesPassedToCreateProject [0]; }
+ }
+
+ public List<IPackageRepository> RepositoriesPassedToCreateProject =
+ new List<IPackageRepository> ();
+
+ public IDotNetProject FirstProjectPassedToCreateProject {
+ get { return ProjectsPassedToCreateProject [0]; }
+ }
+
+ public Func<IPackageRepository, IDotNetProject, FakePackageManagementProject>
+ CreatePackageManagementProject = (sourceRepository, project) => {
+ return null;
+ };
+
+ public List<IDotNetProject> ProjectsPassedToCreateProject =
+ new List<IDotNetProject> ();
+
+ public IPackageManagementProject CreateProject (IPackageRepository sourceRepository, IDotNetProject project)
+ {
+ return CreatePackageManagementProject (sourceRepository, project);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManagementProjectService.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManagementProjectService.cs
new file mode 100644
index 0000000000..c428fdf10d
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManagementProjectService.cs
@@ -0,0 +1,92 @@
+//
+// FakePackageManagementProjectService.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.Projects;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakePackageManagementProjectService : IPackageManagementProjectService
+ {
+ public IProject CurrentProject { get; set; }
+ public ISolution OpenSolution { get; set; }
+
+ public ISolution SavedSolution;
+
+ public void Save (ISolution solution)
+ {
+ SavedSolution = solution;
+ }
+
+ public List<IDotNetProject> OpenProjects = new List<IDotNetProject> ();
+
+ public IEnumerable<IDotNetProject> GetOpenProjects ()
+ {
+ return OpenProjects;
+ }
+
+ public IProjectBrowserUpdater CreateProjectBrowserUpdater ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ Dictionary<string, string> defaultCustomTools = new Dictionary<string, string> ();
+
+ public void AddDefaultCustomToolForFileName (string fileName, string customTool)
+ {
+ defaultCustomTools.Add (fileName, customTool);
+ }
+
+ public string GetDefaultCustomToolForFileName (ProjectFile projectItem)
+ {
+ if (defaultCustomTools.ContainsKey (projectItem.FilePath.ToString ())) {
+ return defaultCustomTools [projectItem.FilePath.ToString ()];
+ }
+ return String.Empty;
+ }
+
+ public event EventHandler SolutionLoaded;
+ public event EventHandler SolutionUnloaded;
+
+ public void RaiseSolutionLoadedEvent ()
+ {
+ if (SolutionLoaded != null) {
+ SolutionLoaded (this, new EventArgs ());
+ }
+ }
+
+ public void RaiseSolutionUnloadedEvent ()
+ {
+ if (SolutionUnloaded != null) {
+ SolutionUnloaded (this, new EventArgs ());
+ }
+ }
+ }
+}
+
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManagementSolution.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManagementSolution.cs
new file mode 100644
index 0000000000..7185d1c5d4
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManagementSolution.cs
@@ -0,0 +1,203 @@
+//
+// FakePackageManagementSolution.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using ICSharpCode.PackageManagement;
+using NuGet;
+using MonoDevelop.Projects;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakePackageManagementSolution : IPackageManagementSolution
+ {
+ public void AddPackageToActiveProjectLocalRepository (FakePackage package)
+ {
+ FakeActiveProject.FakePackages.Add (package);
+ }
+
+ public FakePackage AddPackageToActiveProjectLocalRepository (string packageId)
+ {
+ var package = new FakePackage (packageId);
+ AddPackageToActiveProjectLocalRepository (package);
+ return package;
+ }
+
+ public int GetActiveProjectCallCount;
+ public FakePackageManagementProject FakeActiveProject = new FakePackageManagementProject ();
+ public bool IsGetActiveProjectWithNoParametersCalled;
+
+ public virtual IPackageManagementProject GetActiveProject ()
+ {
+ GetActiveProjectCallCount++;
+ IsGetActiveProjectWithNoParametersCalled = true;
+
+ return FakeActiveProject;
+ }
+
+ public IPackageRepository RepositoryPassedToGetActiveProject;
+
+ public virtual IPackageManagementProject GetActiveProject (IPackageRepository sourceRepository)
+ {
+ RepositoryPassedToGetActiveProject = sourceRepository;
+ return FakeActiveProject;
+ }
+
+ public FakePackageManagementProject FakeProjectToReturnFromGetProject =
+ new FakePackageManagementProject ();
+
+ public PackageSource PackageSourcePassedToGetProject;
+ public string ProjectNamePassedToGetProject;
+
+ public IPackageManagementProject GetProject (PackageSource source, string projectName)
+ {
+ PackageSourcePassedToGetProject = source;
+ ProjectNamePassedToGetProject = projectName;
+ return FakeProjectToReturnFromGetProject;
+ }
+
+ public IPackageRepository RepositoryPassedToGetProject;
+
+ public IPackageManagementProject GetProject (IPackageRepository sourceRepository, string projectName)
+ {
+ RepositoryPassedToGetProject = sourceRepository;
+ ProjectNamePassedToGetProject = projectName;
+ return FakeProjectToReturnFromGetProject;
+ }
+
+ public IDotNetProject ProjectPassedToGetProject;
+ public List<IDotNetProject> ProjectsPassedToGetProject = new List<IDotNetProject> ();
+ public Dictionary<string, FakePackageManagementProject> FakeProjectsToReturnFromGetProject
+ = new Dictionary<string, FakePackageManagementProject> ();
+
+ public virtual IPackageManagementProject GetProject (IPackageRepository sourceRepository, IDotNetProject project)
+ {
+ RepositoryPassedToGetProject = sourceRepository;
+ ProjectPassedToGetProject = project;
+ ProjectsPassedToGetProject.Add (project);
+ FakePackageManagementProject fakeProject = null;
+ if (FakeProjectsToReturnFromGetProject.TryGetValue (project.Name, out fakeProject)) {
+ return fakeProject;
+ }
+ return FakeProjectToReturnFromGetProject;
+ }
+
+ public FakeDotNetProject FakeActiveDotNetProject;
+
+ public IDotNetProject GetActiveDotNetProject ()
+ {
+ return FakeActiveDotNetProject;
+ }
+
+ public List<FakeDotNetProject> FakeDotNetProjects = new List<FakeDotNetProject> ();
+
+ public IEnumerable<IDotNetProject> GetDotNetProjects ()
+ {
+ return FakeDotNetProjects;
+ }
+
+ public bool IsOpen { get; set; }
+
+ public bool HasMultipleProjects ()
+ {
+ return FakeDotNetProjects.Count > 1;
+ }
+
+ public string FileName { get; set; }
+
+ public List<FakePackage> FakeInstalledPackages = new List<FakePackage> ();
+
+ public bool IsPackageInstalled (IPackage package)
+ {
+ return FakeInstalledPackages.Contains (package);
+ }
+
+ public IQueryable<IPackage> GetPackages ()
+ {
+ return FakeInstalledPackages.AsQueryable ();
+ }
+
+ public void NoProjectsSelected ()
+ {
+ FakeActiveProject = null;
+ FakeActiveDotNetProject = null;
+ }
+
+ public FakePackageManagementProject AddFakeProjectToReturnFromGetProject (string name)
+ {
+ var project = new FakePackageManagementProject (name);
+ FakeProjectsToReturnFromGetProject.Add (name, project);
+ return project;
+ }
+
+ public List<FakePackage> FakePackagesInReverseDependencyOrder =
+ new List<FakePackage> ();
+
+ public IEnumerable<IPackage> GetPackagesInReverseDependencyOrder ()
+ {
+ return FakePackagesInReverseDependencyOrder;
+ }
+
+ public List<FakePackageManagementProject> FakeProjects =
+ new List<FakePackageManagementProject> ();
+
+ public IPackageRepository SourceRepositoryPassedToGetProjects;
+
+ public IEnumerable<IPackageManagementProject> GetProjects (IPackageRepository sourceRepository)
+ {
+ SourceRepositoryPassedToGetProjects = sourceRepository;
+ return FakeProjects;
+ }
+
+ public FakePackageManagementProject AddFakeProject (string projectName)
+ {
+ var project = new FakePackageManagementProject (projectName);
+ FakeProjects.Add (project);
+ return project;
+ }
+
+ public FakePackage AddPackageToSharedLocalRepository (string packageId, string version)
+ {
+ var package = new FakePackage (packageId, version);
+ FakeInstalledPackages.Add (package);
+ return package;
+ }
+
+ public FakePackage AddPackageToSharedLocalRepository (string packageId)
+ {
+ var package = new FakePackage (packageId);
+ FakeInstalledPackages.Add (package);
+ return package;
+ }
+
+ public string GetInstallPath (IPackage package)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManager.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManager.cs
new file mode 100644
index 0000000000..9a46479d10
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManager.cs
@@ -0,0 +1,240 @@
+//
+// FakePackageManager.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using ICSharpCode.PackageManagement;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakePackageManager : ISharpDevelopPackageManager
+ {
+ public FakeProjectManager FakeProjectManager = new FakeProjectManager ();
+ public FakePackageManagementProjectService FakeProjectService = new FakePackageManagementProjectService ();
+
+ public IPackage PackagePassedToInstallPackage;
+ public bool IgnoreDependenciesPassedToInstallPackage;
+ public bool AllowPrereleaseVersionsPassedToInstallPackage;
+
+ public IPackage PackagePassedToUninstallPackage;
+
+ public UpdatePackagesAction UpdatePackagesActionsPassedToUpdatePackages;
+
+ #pragma warning disable 67
+ public event EventHandler<PackageOperationEventArgs> PackageInstalled;
+ public event EventHandler<PackageOperationEventArgs> PackageInstalling;
+ public event EventHandler<PackageOperationEventArgs> PackageUninstalled;
+ public event EventHandler<PackageOperationEventArgs> PackageUninstalling;
+ #pragma warning restore 67
+
+ public IFileSystem FileSystem {
+ get { return FakeFileSystem; }
+ set { FakeFileSystem = value as FakeFileSystem; }
+ }
+
+ public FakeFileSystem FakeFileSystem = new FakeFileSystem ();
+
+ public IPackageRepository LocalRepository { get; set; }
+
+ public ILogger Logger { get; set; }
+
+ public IPackageRepository SourceRepository { get; set; }
+
+ public ISharpDevelopProjectManager ProjectManager { get; set; }
+
+ public FakePackageRepository FakeSourceRepository = new FakePackageRepository ();
+
+ public FakePackageManager ()
+ {
+ ProjectManager = FakeProjectManager;
+ SourceRepository = FakeSourceRepository;
+ }
+
+ public bool ForceRemovePassedToUninstallPackage;
+ public bool RemoveDependenciesPassedToUninstallPackage;
+
+ public void UninstallPackage (IPackage package, UninstallPackageAction uninstallAction)
+ {
+ PackagePassedToUninstallPackage = package;
+ ForceRemovePassedToUninstallPackage = uninstallAction.ForceRemove;
+ RemoveDependenciesPassedToUninstallPackage = uninstallAction.RemoveDependencies;
+ }
+
+ public void UninstallPackage (IPackage package, bool forceRemove, bool removeDependencies)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IEnumerable<PackageOperation> PackageOperationsPassedToInstallPackage;
+
+ public void InstallPackage (IPackage package, InstallPackageAction installAction)
+ {
+ PackagePassedToInstallPackage = package;
+
+ IgnoreDependenciesPassedToInstallPackage = installAction.IgnoreDependencies;
+ PackageOperationsPassedToInstallPackage = installAction.Operations;
+ AllowPrereleaseVersionsPassedToInstallPackage = installAction.AllowPrereleaseVersions;
+ }
+
+ public List<PackageOperation> PackageOperationsToReturnFromGetInstallPackageOperations = new List<PackageOperation> ();
+ public IPackage PackagePassedToGetInstallPackageOperations;
+ public bool IgnoreDependenciesPassedToGetInstallPackageOperations;
+ public bool AllowPrereleaseVersionsPassedToGetInstallPackageOperations;
+
+ public IEnumerable<PackageOperation> GetInstallPackageOperations (IPackage package, InstallPackageAction installAction)
+ {
+ PackagePassedToGetInstallPackageOperations = package;
+ IgnoreDependenciesPassedToGetInstallPackageOperations = installAction.IgnoreDependencies;
+ AllowPrereleaseVersionsPassedToGetInstallPackageOperations = installAction.AllowPrereleaseVersions;
+ return PackageOperationsToReturnFromGetInstallPackageOperations;
+ }
+
+ public IPackage PackagePassedToUpdatePackage;
+ public IEnumerable<PackageOperation> PackageOperationsPassedToUpdatePackage;
+ public bool UpdateDependenciesPassedToUpdatePackage;
+
+ public void UpdatePackage (IPackage package, UpdatePackageAction updateAction)
+ {
+ PackagePassedToUpdatePackage = package;
+ PackageOperationsPassedToUpdatePackage = updateAction.Operations;
+ UpdateDependenciesPassedToUpdatePackage = updateAction.UpdateDependencies;
+ AllowPrereleaseVersionsPassedToInstallPackage = updateAction.AllowPrereleaseVersions;
+ }
+
+ public void FirePackageInstalled (PackageOperationEventArgs e)
+ {
+ PackageInstalled (this, e);
+ }
+
+ public void FirePackageUninstalled (PackageOperationEventArgs e)
+ {
+ PackageUninstalled (this, e);
+ }
+
+ public IPackagePathResolver PathResolver {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public void UpdatePackage (IPackage newPackage, bool updateDependencies)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void UpdatePackage (string packageId, IVersionSpec versionSpec, bool updateDependencies)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void InstallPackage (IPackage package, bool ignoreDependencies, bool allowPrereleaseVersions)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void InstallPackage (string packageId, SemanticVersion version, bool ignoreDependencies, bool allowPrereleaseVersions)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void UpdatePackage (IPackage newPackage, bool updateDependencies, bool allowPrereleaseVersions)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void UpdatePackage (string packageId, SemanticVersion version, bool updateDependencies, bool allowPrereleaseVersions)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void UpdatePackage (string packageId, IVersionSpec versionSpec, bool updateDependencies, bool allowPrereleaseVersions)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void UninstallPackage (string packageId, SemanticVersion version, bool forceRemove, bool removeDependencies)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void UpdatePackages (UpdatePackagesAction updateAction)
+ {
+ UpdatePackagesActionsPassedToUpdatePackages = updateAction;
+ }
+
+ public List<PackageOperation> PackageOperationsToReturnFromGetUpdatePackageOperations = new List<PackageOperation> ();
+ public IUpdatePackageSettings SettingsPassedToGetUpdatePackageOperations;
+ public IEnumerable<IPackage> PackagesPassedToGetUpdatePackageOperations;
+
+ public IEnumerable<PackageOperation> GetUpdatePackageOperations (IEnumerable<IPackage> packages, IUpdatePackageSettings settings)
+ {
+ SettingsPassedToGetUpdatePackageOperations = settings;
+ PackagesPassedToGetUpdatePackageOperations = packages;
+ return PackageOperationsToReturnFromGetUpdatePackageOperations;
+ }
+
+ public List<PackageOperation> PackageOperationsPassedToRunPackageOperations;
+
+ public void RunPackageOperations (IEnumerable<PackageOperation> operations)
+ {
+ PackageOperationsPassedToRunPackageOperations = operations.ToList ();
+ }
+
+ public IPackage PackagePassedToUpdatePackageReference;
+ public IUpdatePackageSettings SettingsPassedToUpdatePackageReference;
+
+ public void UpdatePackageReference (IPackage package, IUpdatePackageSettings settings)
+ {
+ PackagePassedToUpdatePackageReference = package;
+ SettingsPassedToUpdatePackageReference = settings;
+ }
+
+ public void InstallPackage (IPackage package, bool ignoreDependencies, bool allowPrereleaseVersions, bool ignoreWalkInfo)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public DependencyVersion DependencyVersion {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public bool WhatIf {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManagerFactory.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManagerFactory.cs
new file mode 100644
index 0000000000..bb98bc2097
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageManagerFactory.cs
@@ -0,0 +1,49 @@
+//
+// FakePackageManagerFactory.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakePackageManagerFactory : IPackageManagerFactory
+ {
+ public FakePackageManager FakePackageManager = new FakePackageManager ();
+ public IPackageRepository PackageRepositoryPassedToCreatePackageManager;
+ public IDotNetProject ProjectPassedToCreateRepository;
+
+ public ISharpDevelopPackageManager CreatePackageManager (IPackageRepository sourceRepository, IDotNetProject project)
+ {
+ PackageRepositoryPassedToCreatePackageManager = sourceRepository;
+ ProjectPassedToCreateRepository = project;
+ return FakePackageManager;
+ }
+ }
+}
+
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageOperation.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageOperation.cs
new file mode 100644
index 0000000000..3d1a6d65af
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageOperation.cs
@@ -0,0 +1,48 @@
+//
+// FakePackageOperation.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakePackageOperation : PackageOperation
+ {
+ public FakePackageOperation ()
+ : this (new FakePackage ("MyPackage"), PackageAction.Install)
+ {
+ }
+
+ public FakePackageOperation (FakePackage package, PackageAction action)
+ : base (package, action)
+ {
+ this.FakePackage = package;
+ }
+
+ public FakePackage FakePackage { get; set; }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageOperationResolver.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageOperationResolver.cs
new file mode 100644
index 0000000000..d9e8eeca15
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageOperationResolver.cs
@@ -0,0 +1,52 @@
+//
+// FakePackageOperationResolver.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakePackageOperationResolver : IPackageOperationResolver
+ {
+ Dictionary <IPackage, PackageOperation []> packageOperations =
+ new Dictionary<IPackage, PackageOperation[]> ();
+
+ public IPackage PackagePassedToResolveOperations;
+
+ public IEnumerable<PackageOperation> ResolveOperations (IPackage package)
+ {
+ PackagePassedToResolveOperations = package;
+ return packageOperations [package];
+ }
+
+ public void AddOperations (IPackage package, PackageOperation[] operations)
+ {
+ packageOperations.Add (package, operations);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageOperationResolverFactory.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageOperationResolverFactory.cs
new file mode 100644
index 0000000000..5c66ad1845
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageOperationResolverFactory.cs
@@ -0,0 +1,78 @@
+//
+// FakePackageOperationResolverFactory.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakePackageOperationResolverFactory : IPackageOperationResolverFactory
+ {
+ public FakePackageOperationResolver FakeInstallPackageOperationResolver = new FakePackageOperationResolver ();
+ public IPackageRepository LocalRepositoryPassedToCreateInstallPackageOperationsResolver;
+ public IPackageRepository SourceRepositoryPassedToCreateInstallPackageOperationsResolver;
+ public ILogger LoggerPassedToCreateInstallPackageOperationResolver;
+ public bool IgnoreDependenciesPassedToCreateInstallPackageOperationResolver;
+ public bool AllowPrereleaseVersionsPassedToCreateInstallPackageOperationResolver;
+
+ public IPackageOperationResolver CreateInstallPackageOperationResolver (
+ IPackageRepository localRepository,
+ IPackageRepository sourceRepository,
+ ILogger logger,
+ InstallPackageAction installAction)
+ {
+ LocalRepositoryPassedToCreateInstallPackageOperationsResolver = localRepository;
+ SourceRepositoryPassedToCreateInstallPackageOperationsResolver = sourceRepository;
+ LoggerPassedToCreateInstallPackageOperationResolver = logger;
+ IgnoreDependenciesPassedToCreateInstallPackageOperationResolver = installAction.IgnoreDependencies;
+ AllowPrereleaseVersionsPassedToCreateInstallPackageOperationResolver = installAction.AllowPrereleaseVersions;
+
+ return FakeInstallPackageOperationResolver;
+ }
+
+ public IPackageRepository LocalRepositoryPassedToCreateUpdatePackageOperationsResolver;
+ public IPackageRepository SourceRepositoryPassedToCreateUpdatePackageOperationsResolver;
+ public IPackageOperationResolver UpdatePackageOperationsResolver = new FakePackageOperationResolver ();
+ public ILogger LoggerPassedToCreateUpdatePackageOperationResolver;
+ public IUpdatePackageSettings SettingsPassedToCreatePackageOperationResolver;
+
+ public IPackageOperationResolver CreateUpdatePackageOperationResolver (
+ IPackageRepository localRepository,
+ IPackageRepository sourceRepository,
+ ILogger logger,
+ IUpdatePackageSettings settings)
+ {
+ LocalRepositoryPassedToCreateUpdatePackageOperationsResolver = localRepository;
+ SourceRepositoryPassedToCreateUpdatePackageOperationsResolver = sourceRepository;
+ LoggerPassedToCreateUpdatePackageOperationResolver = logger;
+ SettingsPassedToCreatePackageOperationResolver = settings;
+
+ return UpdatePackageOperationsResolver;
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackagePathResolver.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackagePathResolver.cs
new file mode 100644
index 0000000000..daaae9cc6e
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackagePathResolver.cs
@@ -0,0 +1,60 @@
+//
+// FakePackagePathResolver.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakePackagePathResolver : IPackagePathResolver
+ {
+ public string GetInstallPath (IPackage package)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string GetPackageDirectory (IPackage package)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string GetPackageDirectory (string packageId, SemanticVersion version)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string GetPackageFileName (IPackage package)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string GetPackageFileName (string packageId, SemanticVersion version)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageRepository.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageRepository.cs
new file mode 100644
index 0000000000..2e7bffe160
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageRepository.cs
@@ -0,0 +1,96 @@
+//
+// FakePackageRepository.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using ICSharpCode.PackageManagement;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakePackageRepository : IRecentPackageRepository, IProgressProvider
+ {
+ public List<FakePackage> FakePackages = new List<FakePackage> ();
+ public bool IsRemovePackageCalled;
+ public List<IPackage> PackagesAdded = new List<IPackage> ();
+
+ public IPackage FirstPackageAdded {
+ get { return PackagesAdded [0]; }
+ }
+
+ public IQueryable<IPackage> GetPackages ()
+ {
+ return FakePackages.AsQueryable ();
+ }
+
+ public void AddPackage (IPackage package)
+ {
+ PackagesAdded.Add (package);
+ }
+
+ public void RemovePackage (IPackage package)
+ {
+ IsRemovePackageCalled = true;
+ FakePackages.Remove (package as FakePackage);
+ }
+
+ public string Source { get; set; }
+
+ public FakePackage AddFakePackage (string packageId)
+ {
+ var package = new FakePackage (packageId);
+ FakePackages.Add (package);
+ return package;
+ }
+
+ public FakePackage AddFakePackageWithVersion (string packageId, string version)
+ {
+ var package = FakePackage.CreatePackageWithVersion (packageId, version);
+ package.IsLatestVersion = package.IsReleaseVersion ();
+ FakePackages.Add (package);
+ return package;
+ }
+
+ public void Clear ()
+ {
+ }
+
+ public bool HasRecentPackages { get; set; }
+ public bool SupportsPrereleasePackages { get; set; }
+ public PackageSaveModes PackageSaveMode { get; set; }
+
+ public event EventHandler<ProgressEventArgs> ProgressAvailable;
+
+ public void RaiseProgressAvailableEvent (ProgressEventArgs e)
+ {
+ if (ProgressAvailable != null) {
+ ProgressAvailable (this, e);
+ }
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageRepositoryFactory.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageRepositoryFactory.cs
new file mode 100644
index 0000000000..c55a3679a4
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageRepositoryFactory.cs
@@ -0,0 +1,122 @@
+//
+// FakePackageRepositoryFactory.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakePackageRepositoryFactory : IPackageRepositoryCache
+ {
+ public List<string> PackageSourcesPassedToCreateRepository
+ = new List<string> ();
+
+ public string FirstPackageSourcePassedToCreateRepository {
+ get { return PackageSourcesPassedToCreateRepository [0]; }
+ }
+
+ public FakePackageRepository FakePackageRepository = new FakePackageRepository ();
+
+ public Dictionary<string, FakePackageRepository> FakePackageRepositories =
+ new Dictionary<string, FakePackageRepository> ();
+
+ public FakePackageRepositoryFactory ()
+ {
+ CreateAggregrateRepositoryAction = (repositories) => {
+ return FakeAggregateRepository;
+ };
+ }
+
+ public IPackageRepository CreateRepository (string packageSource)
+ {
+ PackageSourcesPassedToCreateRepository.Add (packageSource);
+
+ FakePackageRepository repository = null;
+ if (FakePackageRepositories.TryGetValue (packageSource, out repository)) {
+ return repository;
+ }
+
+ return FakePackageRepository;
+ }
+
+ public IPackagePathResolver PathResolverPassedToCreateSharedRepository;
+ public IFileSystem FileSystemPassedToCreateSharedRepository;
+ public IFileSystem ConfigSettingsFileSystemPassedToCreateSharedRepository;
+ public FakeSharedPackageRepository FakeSharedRepository = new FakeSharedPackageRepository ();
+
+ public ISharedPackageRepository CreateSharedRepository (IPackagePathResolver pathResolver, IFileSystem fileSystem, IFileSystem configSettingsFileSystem)
+ {
+ PathResolverPassedToCreateSharedRepository = pathResolver;
+ FileSystemPassedToCreateSharedRepository = fileSystem;
+ ConfigSettingsFileSystemPassedToCreateSharedRepository = configSettingsFileSystem;
+ return FakeSharedRepository;
+ }
+
+ public FakePackageRepository FakeAggregateRepository = new FakePackageRepository ();
+
+ public IPackageRepository CreateAggregateRepository ()
+ {
+ return FakeAggregateRepository;
+ }
+
+ public FakeRecentPackageRepository FakeRecentPackageRepository = new FakeRecentPackageRepository ();
+ public IList<RecentPackageInfo> RecentPackagesPassedToCreateRecentPackageRepository;
+ public IPackageRepository AggregateRepositoryPassedToCreateRecentPackageRepository;
+
+ public IRecentPackageRepository CreateRecentPackageRepository (
+ IList<RecentPackageInfo> recentPackages,
+ IPackageRepository aggregateRepository)
+ {
+ RecentPackagesPassedToCreateRecentPackageRepository = recentPackages;
+ AggregateRepositoryPassedToCreateRecentPackageRepository = aggregateRepository;
+ return FakeRecentPackageRepository;
+ }
+
+ public IEnumerable<IPackageRepository> RepositoriesPassedToCreateAggregateRepository;
+ public Func<IEnumerable<IPackageRepository>, IPackageRepository> CreateAggregrateRepositoryAction;
+
+ public IPackageRepository CreateAggregateRepository (IEnumerable<IPackageRepository> repositories)
+ {
+ RepositoriesPassedToCreateAggregateRepository = repositories;
+ return CreateAggregrateRepositoryAction (repositories);
+ }
+
+ public FakePackageRepository AddFakePackageRepositoryForPackageSource (string source)
+ {
+ var repository = new FakePackageRepository ();
+ FakePackageRepositories.Add (source, repository);
+ return repository;
+ }
+
+ public IRecentPackageRepository RecentPackageRepository {
+ get { return FakeRecentPackageRepository; }
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageRepositoryFactoryEvents.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageRepositoryFactoryEvents.cs
new file mode 100644
index 0000000000..867e7c83de
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageRepositoryFactoryEvents.cs
@@ -0,0 +1,44 @@
+//
+// FakePackageRepositoryFactoryEvents.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ public class FakePackageRepositoryFactoryEvents : IPackageRepositoryFactoryEvents
+ {
+ public event EventHandler<PackageRepositoryFactoryEventArgs> RepositoryCreated;
+
+ public void RaiseRepositoryCreatedEvent (PackageRepositoryFactoryEventArgs e)
+ {
+ if (RepositoryCreated != null) {
+ RepositoryCreated (this, e);
+ }
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageRepositoryWithHttpClientEvents.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageRepositoryWithHttpClientEvents.cs
new file mode 100644
index 0000000000..52b998248d
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageRepositoryWithHttpClientEvents.cs
@@ -0,0 +1,44 @@
+//
+// FakePackageRepositoryWithHttpClientEvents.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakePackageRepositoryWithHttpClientEvents : FakePackageRepository, IHttpClientEvents
+ {
+ public event EventHandler<WebRequestEventArgs> SendingRequest;
+
+ public void RaiseSendingRequestEvent (WebRequestEventArgs e)
+ {
+ if (SendingRequest != null) {
+ SendingRequest (this, e);
+ }
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageViewModelFactory.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageViewModelFactory.cs
new file mode 100644
index 0000000000..52b88e9c19
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackageViewModelFactory.cs
@@ -0,0 +1,72 @@
+//
+// FakePackageViewModelFactory.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakePackageViewModelFactory : IPackageViewModelFactory
+ {
+ public FakePackageManagementSolution FakeSolution = new FakePackageManagementSolution ();
+ PackageManagementEvents packageManagementEvents = new PackageManagementEvents ();
+ public FakeLogger FakeLogger = new FakeLogger ();
+
+ public PackageViewModel CreatePackageViewModel (IPackageViewModelParent parent, IPackageFromRepository package)
+ {
+ SelectedProjects = new PackageManagementSelectedProjects (FakeSolution);
+ return new PackageViewModel (
+ parent,
+ package,
+ SelectedProjects,
+ PackageManagementEvents,
+ null,
+ FakeLogger);
+ }
+
+ public IPackageManagementSolution Solution {
+ get { return FakeSolution; }
+ }
+
+ public PackageManagementSelectedProjects SelectedProjects { get; set; }
+
+ public ILogger Logger {
+ get { return FakeLogger; }
+ }
+
+ public IPackageManagementEvents PackageManagementEvents {
+ get { return packageManagementEvents; }
+ }
+
+ public IPackageActionRunner PackageActionRunner {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProcess.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProcess.cs
new file mode 100644
index 0000000000..376be932ab
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProcess.cs
@@ -0,0 +1,42 @@
+//
+// FakeProcess.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeProcess : IProcess
+ {
+ public string FileNamePassedToStart;
+
+ public void Start (string fileName)
+ {
+ FileNamePassedToStart = fileName;
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProgressMonitor.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProgressMonitor.cs
new file mode 100644
index 0000000000..a06a2dc3df
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProgressMonitor.cs
@@ -0,0 +1,126 @@
+//
+// FakeProgressMonitor.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.IO;
+using System.Text;
+using MonoDevelop.Core;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeProgressMonitor : IProgressMonitor
+ {
+ public event MonitorHandler CancelRequested;
+
+ protected virtual void OnCancelRequested (IProgressMonitor monitor)
+ {
+ var handler = CancelRequested;
+ if (handler != null)
+ handler (monitor);
+ }
+
+ public FakeProgressMonitor ()
+ {
+ Log = new StringWriter (LoggedMessages);
+ }
+
+ public void BeginTask (string name, int totalWork)
+ {
+ BeginTaskTotalWork = totalWork;
+ }
+
+ public int BeginTaskTotalWork;
+
+ public void BeginStepTask (string name, int totalWork, int stepSize)
+ {
+ }
+
+ public void EndTask ()
+ {
+ IsTaskEnded = true;
+ }
+
+ public bool IsTaskEnded;
+
+ public void Step (int work)
+ {
+ StepCalledCount++;
+ TotalStepWork += work;
+ }
+
+ public int StepCalledCount;
+ public int TotalStepWork;
+
+ public void ReportWarning (string message)
+ {
+ ReportedWarningMessage = message;
+ }
+
+ public string ReportedWarningMessage;
+
+ public void ReportSuccess (string message)
+ {
+ ReportedSuccessMessage = message;
+ }
+
+ public string ReportedSuccessMessage;
+
+ public void ReportError (string message, Exception exception)
+ {
+ ReportedErrorMessage = message;
+ }
+
+ public string ReportedErrorMessage;
+
+ public StringBuilder LoggedMessages = new StringBuilder ();
+
+ public void AssertMessageIsLogged (string message)
+ {
+ string log = LoggedMessages.ToString ();
+ Assert.IsTrue (log.Contains (message), log);
+ }
+
+ public void AssertMessageIsNotLogged (string message)
+ {
+ string log = LoggedMessages.ToString ();
+ Assert.IsFalse (log.Contains (message), log);
+ }
+
+ public TextWriter Log { get; set; }
+ public bool IsCancelRequested { get; set; }
+ public IAsyncOperation AsyncOperation { get; set; }
+ public object SyncRoot { get; set; }
+
+ public void Dispose ()
+ {
+ IsDisposed = true;
+ }
+
+ public bool IsDisposed;
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProgressMonitorFactory.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProgressMonitorFactory.cs
new file mode 100644
index 0000000000..90e62b3268
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProgressMonitorFactory.cs
@@ -0,0 +1,44 @@
+//
+// FakeProgressMonitorFactory.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using MonoDevelop.Core;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeProgressMonitorFactory : IPackageManagementProgressMonitorFactory
+ {
+ public FakeProgressMonitor ProgressMonitor = new FakeProgressMonitor ();
+ public string StatusText;
+
+ public IProgressMonitor CreateProgressMonitor (string statusText)
+ {
+ StatusText = statusText;
+ return ProgressMonitor;
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProject.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProject.cs
new file mode 100644
index 0000000000..8d71ae6e85
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProject.cs
@@ -0,0 +1,61 @@
+//
+// FakeProject.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections;
+using MonoDevelop.Core;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeProject : IProject
+ {
+ public string Name { get; set; }
+ public FilePath FileName { get; set; }
+ public FilePath BaseDirectory { get; set; }
+ public ISolution ParentSolution { get; set; }
+ public IDictionary ExtendedProperties { get; set; }
+
+ public FakeProject ()
+ {
+ ExtendedProperties = new Hashtable ();
+ }
+
+ public FakeProject (string fileName)
+ : this ()
+ {
+ FileName = new FilePath (fileName.ToNativePath ());
+ BaseDirectory = FileName.ParentDirectory;
+ }
+
+ public bool IsSaved;
+
+ public virtual void Save ()
+ {
+ IsSaved = true;
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProjectManager.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProjectManager.cs
new file mode 100644
index 0000000000..b3d90c6e6f
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProjectManager.cs
@@ -0,0 +1,209 @@
+//
+// FakeProjectManager.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+using NuGet;
+using System.Collections.Generic;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeProjectManager : ISharpDevelopProjectManager
+ {
+ public FakePackageRepository FakeLocalRepository {
+ get { return LocalRepository as FakePackageRepository; }
+ set { LocalRepository = value; }
+ }
+
+ public FakePackageRepository FakeSourceRepository {
+ get { return SourceRepository as FakePackageRepository; }
+ set { SourceRepository = value; }
+ }
+
+ public bool IsInstalledReturnValue;
+
+ public FakeProjectManager ()
+ {
+ LocalRepository = new FakePackageRepository ();
+ SourceRepository = new FakePackageRepository ();
+ }
+
+ public event EventHandler<PackageOperationEventArgs> PackageReferenceAdded;
+
+ protected virtual void OnPackageReferenceAdded (IPackage package)
+ {
+ if (PackageReferenceAdded != null) {
+ PackageReferenceAdded (this, new PackageOperationEventArgs (package, null, String.Empty));
+ }
+ }
+
+ public event EventHandler<PackageOperationEventArgs> PackageReferenceRemoved;
+
+ protected virtual void OnPackageReferenceRemoved (PackageOperationEventArgs eventArgs)
+ {
+ if (PackageReferenceRemoved != null) {
+ PackageReferenceRemoved (this, eventArgs);
+ }
+ }
+
+ #pragma warning disable 67
+ public event EventHandler<PackageOperationEventArgs> PackageReferenceAdding;
+ public event EventHandler<PackageOperationEventArgs> PackageReferenceRemoving;
+ #pragma warning restore 67
+
+ public IPackageRepository LocalRepository { get; set; }
+
+ public ILogger Logger { get; set; }
+
+ public IPackageRepository SourceRepository { get; set; }
+
+ public IPackagePathResolver PathResolver { get; set; }
+
+ public IProjectSystem Project {
+ get { return FakeProjectSystem; }
+ set { FakeProjectSystem = value as FakeProjectSystem; }
+ }
+
+ public FakeProjectSystem FakeProjectSystem = new FakeProjectSystem ();
+
+ public void RemovePackageReference (string packageId, bool forceRemove, bool removeDependencies)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IPackage PackagePassedToIsInstalled;
+
+ public bool IsInstalled (IPackage package)
+ {
+ PackagePassedToIsInstalled = package;
+ return IsInstalledReturnValue;
+ }
+
+ public string PackageIdPassedToIsInstalled;
+
+ public bool IsInstalled (string packageId)
+ {
+ PackageIdPassedToIsInstalled = packageId;
+ return IsInstalledReturnValue;
+ }
+
+ public void FirePackageReferenceAdded (IPackage package)
+ {
+ OnPackageReferenceAdded (package);
+ }
+
+ public void FirePackageReferenceRemoved (IPackage package)
+ {
+ FirePackageReferenceRemoved (new PackageOperationEventArgs (package, null, String.Empty));
+ }
+
+ public void FirePackageReferenceRemoved (PackageOperationEventArgs eventArgs)
+ {
+ OnPackageReferenceRemoved (eventArgs);
+ }
+
+ public void AddPackageReference (IPackage package, bool ignoreDependencies, bool allowPrereleaseVersions)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void RemovePackageReference (IPackage package, bool forceRemove, bool removeDependencies)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void AddPackageReference (string packageId, SemanticVersion version, bool ignoreDependencies, bool allowPrereleaseVersions)
+ {
+ string key = packageId + version.ToString ();
+ if (addPackageReferenceCallbacks.ContainsKey (key)) {
+ Action callback = addPackageReferenceCallbacks [key];
+ callback ();
+ }
+ }
+
+ Dictionary<string, Action> addPackageReferenceCallbacks = new Dictionary<string, Action> ();
+
+ public void WhenAddPackageReferenceCalled (string id, SemanticVersion version, Action callback)
+ {
+ string key = id + version.ToString ();
+ addPackageReferenceCallbacks.Add (key, callback);
+ }
+
+ public void UpdatePackageReference (string packageId, SemanticVersion version, bool updateDependencies, bool allowPrereleaseVersions)
+ {
+ string key = packageId + version.ToString ();
+ if (updatePackageReferenceCallbacks.ContainsKey (key)) {
+ Action callback = updatePackageReferenceCallbacks [key];
+ callback ();
+ }
+ }
+
+ Dictionary<string, Action> updatePackageReferenceCallbacks = new Dictionary<string, Action> ();
+
+ public void WhenUpdatePackageReferenceCalled (string id, SemanticVersion version, Action callback)
+ {
+ string key = id + version.ToString ();
+ updatePackageReferenceCallbacks.Add (key, callback);
+ }
+
+ public void UpdatePackageReference (string packageId, IVersionSpec versionSpec, bool updateDependencies, bool allowPrereleaseVersions)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IPackage PackagePassedToHasOlderPackageInstalled;
+ public bool HasOlderPackageInstalledReturnValue;
+
+ public bool HasOlderPackageInstalled (IPackage package)
+ {
+ PackagePassedToHasOlderPackageInstalled = package;
+ return HasOlderPackageInstalledReturnValue;
+ }
+
+ public DependencyVersion DependencyVersion {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public bool WhatIf {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public void UpdatePackageReference (IPackage remotePackage, bool updateDependencies, bool allowPrereleaseVersions)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProjectSystem.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProjectSystem.cs
new file mode 100644
index 0000000000..0b898101fa
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProjectSystem.cs
@@ -0,0 +1,99 @@
+//
+// FakeProjectSystem.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Runtime.Versioning;
+
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeProjectSystem : FakeFileSystem, IProjectSystem
+ {
+ public FrameworkName TargetFramework {
+ get { return new FrameworkName(".NETFramework, Version=v4.0"); }
+ }
+
+ public string ProjectName {
+ get { return String.Empty; }
+ }
+
+ public dynamic GetPropertyValue(string propertyName)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void AddReference(string referencePath, Stream stream)
+ {
+ throw new NotImplementedException();
+ }
+
+ public bool ReferenceExists(string name)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void RemoveReference(string name)
+ {
+ throw new NotImplementedException();
+ }
+
+ public bool IsSupportedFile(string path)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void AddFrameworkReference(string name)
+ {
+ throw new NotImplementedException();
+ }
+
+ public string ResolvePath(string path)
+ {
+ throw new NotImplementedException();
+ }
+
+ public bool IsBindingRedirectSupported { get; set; }
+
+ public void AddImport(string targetPath, ProjectImportLocation location)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void RemoveImport(string targetPath)
+ {
+ throw new NotImplementedException();
+ }
+
+ public bool FileExistsInProject(string path)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProjectSystemFactory.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProjectSystemFactory.cs
new file mode 100644
index 0000000000..fc88fcd103
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeProjectSystemFactory.cs
@@ -0,0 +1,45 @@
+//
+// FakeProjectSystemFactory.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.Projects;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeProjectSystemFactory : ISharpDevelopProjectSystemFactory
+ {
+ public FakeProjectSystem FakeProjectSystem = new FakeProjectSystem ();
+
+ public IProjectSystem CreateProjectSystem (DotNetProject project)
+ {
+ return FakeProjectSystem;
+ }
+ }
+}
+
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeRecentPackageRepository.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeRecentPackageRepository.cs
new file mode 100644
index 0000000000..b9ba5142c3
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeRecentPackageRepository.cs
@@ -0,0 +1,69 @@
+//
+// FakeRecentPackageRepository.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using ICSharpCode.PackageManagement;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeRecentPackageRepository : IRecentPackageRepository
+ {
+ public string Source { get; set; }
+
+ public List<FakePackage> FakePackages = new List<FakePackage> ();
+
+ public IQueryable<IPackage> GetPackages ()
+ {
+ return FakePackages.AsQueryable ();
+ }
+
+ public void AddPackage (IPackage package)
+ {
+ FakePackages.Add (package as FakePackage);
+ }
+
+ public void RemovePackage (IPackage package)
+ {
+ }
+
+ public bool IsClearCalled;
+
+ public void Clear ()
+ {
+ IsClearCalled = true;
+ }
+
+ public bool HasRecentPackages { get; set; }
+
+ public bool SupportsPrereleasePackages { get; set; }
+
+ public PackageSaveModes PackageSaveMode { get; set; }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeRegisteredPackageRepositories.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeRegisteredPackageRepositories.cs
new file mode 100644
index 0000000000..a0c313e0e2
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeRegisteredPackageRepositories.cs
@@ -0,0 +1,122 @@
+//
+// FakeRegisteredPackageRepositories.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeRegisteredPackageRepositories : IRegisteredPackageRepositories
+ {
+ public FakeRegisteredPackageRepositories ()
+ {
+ PackageSources = new RegisteredPackageSources (new PackageSource[0]);
+ }
+
+ public FakePackageRepository FakeActiveRepository = new FakePackageRepository ();
+
+ public virtual IPackageRepository ActiveRepository {
+ get { return FakeActiveRepository; }
+ }
+
+ public FakePackageRepository FakeRecentPackageRepository = new FakePackageRepository ();
+
+ public IRecentPackageRepository RecentPackageRepository {
+ get { return FakeRecentPackageRepository; }
+ }
+
+ public bool HasMultiplePackageSources { get; set; }
+
+ public PackageSource ActivePackageSource { get; set; }
+
+ public RegisteredPackageSources PackageSources { get; set; }
+
+ public FakePackageRepository FakePackageRepository = new FakePackageRepository ();
+ public PackageSource PackageSourcePassedToCreateRepository;
+
+ public IPackageRepository CreateRepository (PackageSource source)
+ {
+ PackageSourcePassedToCreateRepository = source;
+ return FakePackageRepository;
+ }
+
+ public FakePackageRepository FakeAggregateRepository = new FakePackageRepository ();
+
+ public IPackageRepository CreateAggregateRepository ()
+ {
+ return FakeAggregateRepository;
+ }
+
+ public void ClearPackageSources ()
+ {
+ PackageSources.Clear ();
+ }
+
+ public PackageSource AddOnePackageSource ()
+ {
+ return AddOnePackageSource ("Test");
+ }
+
+ public PackageSource AddOnePackageSource (string name)
+ {
+ var source = new PackageSource ("http://sharpdevelop.codeplex.com", name);
+ PackageSources.Add (source);
+ return source;
+ }
+
+ public void AddPackageSources (IEnumerable<PackageSource> sources)
+ {
+ PackageSources.AddRange (sources);
+ }
+
+ public FakePackage AddFakePackageWithVersionToActiveRepository (string version)
+ {
+ return AddFakePackageWithVersionToActiveRepository ("Test", version);
+ }
+
+ public FakePackage AddFakePackageWithVersionToActiveRepository (string id, string version)
+ {
+ var package = FakePackage.CreatePackageWithVersion (id, version);
+ FakeActiveRepository.FakePackages.Add (package);
+ return package;
+ }
+
+ public FakePackage AddFakePackageWithVersionToAggregrateRepository (string id, string version)
+ {
+ var package = FakePackage.CreatePackageWithVersion (id, version);
+ FakeAggregateRepository.FakePackages.Add (package);
+ return package;
+ }
+
+ public void UpdatePackageSources (IEnumerable<PackageSource> updatedPackageSources)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeServiceBasedRepository.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeServiceBasedRepository.cs
new file mode 100644
index 0000000000..7fdd0270b9
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeServiceBasedRepository.cs
@@ -0,0 +1,65 @@
+//
+// FakeServiceBasedRepository.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Versioning;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeServiceBasedRepository : FakePackageRepository, IServiceBasedRepository
+ {
+ Dictionary<string, List<IPackage>> repositoryPackages = new Dictionary<string, List<IPackage>> ();
+
+ public IQueryable<IPackage> Search (string searchTerm, IEnumerable<string> targetFrameworks, bool allowPrereleaseVersions)
+ {
+ string key = GetKey (searchTerm, allowPrereleaseVersions);
+ if (repositoryPackages.ContainsKey (key)) {
+ return repositoryPackages [key].AsQueryable ();
+ }
+ return new List<IPackage> ().AsQueryable ();
+ }
+
+ string GetKey (string searchTerm, bool allowPrereleaseVersions)
+ {
+ return searchTerm + allowPrereleaseVersions.ToString ();
+ }
+
+ public void PackagesToReturnForSearch (string search, bool allowPrereleaseVersions, IEnumerable<IPackage> packages)
+ {
+ string key = GetKey (search, allowPrereleaseVersions);
+ repositoryPackages.Add (key, packages.ToList ());
+ }
+
+ public IEnumerable<IPackage> GetUpdates (IEnumerable<IPackageName> packages, bool includePrerelease, bool includeAllVersions, IEnumerable<FrameworkName> targetFrameworks, IEnumerable<IVersionSpec> versionConstraints)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSettings.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSettings.cs
new file mode 100644
index 0000000000..a96cc48c92
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSettings.cs
@@ -0,0 +1,238 @@
+//
+// FakeSettings.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using NuGet;
+using System.Linq;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ /// <summary>
+ /// TODO: Remove this class. Replace it with the actual NuGet.Settings class but
+ /// use a fake IFileSystem instead. There is too much implementation in this test
+ /// helper class and it makes the tests brittle now that we are using the
+ /// NuGet.PackageSourceProvider instead of directly accessing the ISettings.
+ /// </summary>
+ public class FakeSettings : ISettings
+ {
+ public List<KeyValuePair<string, string>> PackageSources
+ = new List<KeyValuePair<string, string>> ();
+
+ public List<KeyValuePair<string, string>> DisabledPackageSources
+ = new List<KeyValuePair<string, string>> ();
+
+ public List<KeyValuePair<string, string>> ActivePackageSourceSettings =
+ new List<KeyValuePair<string, string>> ();
+
+ public Dictionary<string, IList<KeyValuePair<string, string>>> Sections
+ = new Dictionary<string, IList<KeyValuePair<string, string>>> ();
+
+ public const string PackageSourcesSectionName = "packageSources";
+ public const string DisabledPackageSourcesSectionName = "disabledPackageSources";
+
+ public FakeSettings ()
+ {
+ Sections.Add (PackageSourcesSectionName, PackageSources);
+ Sections.Add (RegisteredPackageSourceSettings.ActivePackageSourceSectionName, ActivePackageSourceSettings);
+ Sections.Add (DisabledPackageSourcesSectionName, DisabledPackageSources);
+ }
+
+ public string GetValue (string section, string key)
+ {
+ if (!Sections.ContainsKey (section))
+ return null;
+
+ IList<KeyValuePair<string, string>> values = Sections [section];
+ foreach (KeyValuePair<string, string> keyPair in values) {
+ if (keyPair.Key == key) {
+ return keyPair.Value;
+ }
+ }
+ return null;
+ }
+
+ public IList<KeyValuePair<string, string>> GetValues (string section)
+ {
+ return Sections [section];
+ }
+
+ public void AddFakePackageSource (PackageSource packageSource)
+ {
+ var valuePair = new KeyValuePair<string, string> (packageSource.Name, packageSource.Source);
+ PackageSources.Add (valuePair);
+ }
+
+ public Dictionary<string, KeyValuePair<string, string>> SavedSectionValues =
+ new Dictionary<string, KeyValuePair<string, string>> ();
+
+ public void SetValue (string section, string key, string value)
+ {
+ SavedSectionValues.Remove (section);
+ SavedSectionValues.Add (section, new KeyValuePair<string, string> (key, value));
+ }
+
+ public KeyValuePair<string, string> GetValuePassedToSetValueForActivePackageSourceSection ()
+ {
+ return SavedSectionValues [RegisteredPackageSourceSettings.ActivePackageSourceSectionName];
+ }
+
+ public void SetValues (string section, IList<KeyValuePair<string, string>> values)
+ {
+ SavedSectionValueLists.Remove (section);
+ SavedSectionValueLists.Add (section, values);
+ }
+
+ public Dictionary<string, IList<KeyValuePair<string, string>>> SavedSectionValueLists
+ = new Dictionary<string, IList<KeyValuePair<string, string>>> ();
+
+ public IList<KeyValuePair<string, string>> GetValuesPassedToSetValuesForPackageSourcesSection ()
+ {
+ return SavedSectionValueLists [PackageSourcesSectionName];
+ }
+
+ public bool DeleteValue (string section, string key)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public List<string> SectionsDeleted = new List<string> ();
+
+ public bool DeleteSection (string section)
+ {
+ SectionsDeleted.Add (section);
+ return true;
+ }
+
+ public bool IsPackageSourcesSectionDeleted {
+ get {
+ return SectionsDeleted.Contains (PackageSourcesSectionName);
+ }
+ }
+
+ public bool IsDisabledPackageSourcesSectionDeleted {
+ get {
+ return SectionsDeleted.Contains (DisabledPackageSourcesSectionName);
+ }
+ }
+
+ public bool IsActivePackageSourceSectionDeleted {
+ get {
+ return SectionsDeleted.Contains (RegisteredPackageSourceSettings.ActivePackageSourceSectionName);
+ }
+ }
+
+ public void SetFakeActivePackageSource (PackageSource packageSource)
+ {
+ ActivePackageSourceSettings.Clear ();
+ var valuePair = new KeyValuePair<string, string> (packageSource.Name, packageSource.Source);
+ ActivePackageSourceSettings.Add (valuePair);
+ }
+
+ public void MakeActivePackageSourceSectionNull ()
+ {
+ Sections.Remove (RegisteredPackageSourceSettings.ActivePackageSourceSectionName);
+ Sections.Add (RegisteredPackageSourceSettings.ActivePackageSourceSectionName, null);
+ }
+
+ public void MakePackageSourceSectionsNull ()
+ {
+ Sections.Remove (PackageSourcesSectionName);
+ Sections.Add (PackageSourcesSectionName, null);
+ }
+
+ public void AddFakePackageSources (IEnumerable<PackageSource> packageSources)
+ {
+ foreach (PackageSource packageSource in packageSources) {
+ AddFakePackageSource (packageSource);
+ }
+ }
+
+ public IList<KeyValuePair<string, string>> GetNestedValues (string section, string key)
+ {
+ return new List<KeyValuePair<string, string>> ();
+ }
+
+ public void SetNestedValues (string section, string key, IList<KeyValuePair<string, string>> values)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void AddDisabledPackageSource (PackageSource packageSource)
+ {
+ var valuePair = new KeyValuePair<string, string> (packageSource.Name, packageSource.Source);
+ DisabledPackageSources.Add (valuePair);
+ }
+
+ public IList<KeyValuePair<string, string>> GetValuesPassedToSetValuesForDisabledPackageSourcesSection ()
+ {
+ return SavedSectionValueLists [DisabledPackageSourcesSectionName];
+ }
+
+ public bool AnyValuesPassedToSetValuesForDisabledPackageSourcesSection {
+ get {
+ return SavedSectionValueLists.ContainsKey (DisabledPackageSourcesSectionName);
+ }
+ }
+
+ public void SetPackageRestoreSetting (bool enabled)
+ {
+ var items = new List<KeyValuePair<string, string>> ();
+ items.Add (new KeyValuePair<string, string> ("enabled", enabled.ToString ()));
+ Sections.Add ("packageRestore", items);
+ }
+
+ public KeyValuePair<string, string> GetValuePassedToSetValueForPackageRestoreSection ()
+ {
+ return SavedSectionValues ["packageRestore"];
+ }
+
+ public bool IsPackageRestoreSectionDeleted {
+ get {
+ return SectionsDeleted.Contains ("packageRestore");
+ }
+ }
+
+ public string GetValue (string section, string key, bool isPath)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IList<KeyValuePair<string, string>> GetValues (string section, bool isPath)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IList<SettingValue> GetSettingValues (string section, bool isPath)
+ {
+ return Sections [section]
+ .Select (item => new SettingValue (item.Key, item.Value, false))
+ .ToList ();
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSharedPackageRepository.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSharedPackageRepository.cs
new file mode 100644
index 0000000000..f4ecfeec9b
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSharedPackageRepository.cs
@@ -0,0 +1,70 @@
+//
+// FakeSharedPackageRepository.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeSharedPackageRepository : FakePackageRepository, ISharedPackageRepository
+ {
+ public string PathPassedToRegisterRepository;
+
+ public List<string> PackageIdsReferences = new List<string> ();
+ public string PackageIdPassedToIsReferenced;
+ public SemanticVersion VersionPassedToIsReferenced;
+
+ public bool IsReferenced (string packageId, SemanticVersion version)
+ {
+ PackageIdPassedToIsReferenced = packageId;
+ VersionPassedToIsReferenced = version;
+ return PackageIdsReferences.Contains (packageId);
+ }
+
+ public void RegisterRepository (string path)
+ {
+ PathPassedToRegisterRepository = path;
+ }
+
+ public void UnregisterRepository (string path)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void AddPackageReferenceEntry (string packageId, SemanticVersion version)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public bool IsSolutionReferenced (string packageId, SemanticVersion version)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSolution.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSolution.cs
new file mode 100644
index 0000000000..6eaa5f6096
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSolution.cs
@@ -0,0 +1,48 @@
+//
+// FakeSolution.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using MonoDevelop.Core;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeSolution : ISolution
+ {
+ public FilePath BaseDirectory { get; set; }
+ public FilePath FileName { get; set; }
+
+ public FakeSolution ()
+ {
+ }
+
+ public FakeSolution (string fileName)
+ {
+ FileName = new FilePath (fileName.ToNativePath ());
+ BaseDirectory = FileName.ParentDirectory;
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSolutionPackageRepository.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSolutionPackageRepository.cs
new file mode 100644
index 0000000000..26be2ad35d
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSolutionPackageRepository.cs
@@ -0,0 +1,86 @@
+//
+// FakeSolutionPackageRepository.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using ICSharpCode.PackageManagement;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeSolutionPackageRepository : ISolutionPackageRepository
+ {
+ public FakeSharedPackageRepository FakeSharedRepository = new FakeSharedPackageRepository ();
+
+ public List<FakePackage> FakePackages;
+
+ public FakeSolutionPackageRepository ()
+ {
+ FakePackages = FakeSharedRepository.FakePackages;
+ }
+
+ public string InstallPathToReturn;
+ public IPackage PackagePassedToGetInstallPath;
+
+ public string GetInstallPath (IPackage package)
+ {
+ PackagePassedToGetInstallPath = package;
+ return InstallPathToReturn;
+ }
+
+ public IEnumerable<IPackage> GetPackagesByDependencyOrder ()
+ {
+ return FakePackages;
+ }
+
+ public List<FakePackage> FakePackagesByReverseDependencyOrder = new List<FakePackage> ();
+
+ public IEnumerable<IPackage> GetPackagesByReverseDependencyOrder ()
+ {
+ return FakePackagesByReverseDependencyOrder;
+ }
+
+ public bool IsInstalled (IPackage package)
+ {
+ return FakeSharedRepository.FakePackages.Exists (p => p == package);
+ }
+
+ public IQueryable<IPackage> GetPackages ()
+ {
+ return FakeSharedRepository.FakePackages.AsQueryable ();
+ }
+
+ public ISharedPackageRepository Repository {
+ get { return FakeSharedRepository; }
+ }
+
+ public IFileSystem FileSystem { get; set; }
+
+ public IPackagePathResolver PackagePathResolver { get; set; }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSolutionPackageRepositoryFactory.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSolutionPackageRepositoryFactory.cs
new file mode 100644
index 0000000000..4cc0386417
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSolutionPackageRepositoryFactory.cs
@@ -0,0 +1,45 @@
+//
+// FakeSolutionPackageRepositoryFactory.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeSolutionPackageRepositoryFactory : ISolutionPackageRepositoryFactory
+ {
+ public FakeSolutionPackageRepository FakeSolutionPackageRepository = new FakeSolutionPackageRepository ();
+ public ISolution SolutionPassedToCreateSolutionPackageRepository;
+
+ public ISolutionPackageRepository CreateSolutionPackageRepository (ISolution solution)
+ {
+ SolutionPassedToCreateSolutionPackageRepository = solution;
+ return FakeSolutionPackageRepository;
+ }
+ }
+}
+
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeTask.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeTask.cs
new file mode 100644
index 0000000000..0743a8ba33
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeTask.cs
@@ -0,0 +1,89 @@
+//
+// FakeTask.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeTask<TResult> : ITask<TResult>
+ {
+ public bool IsStartCalled;
+ public bool IsCancelCalled;
+
+ public bool RunTaskSynchronously;
+
+ Func<TResult> function;
+ Action<ITask<TResult>> continueWith;
+
+ public FakeTask (Func<TResult> function, Action<ITask<TResult>> continueWith, bool runTaskSynchronously)
+ {
+ this.function = function;
+ this.continueWith = continueWith;
+ RunTaskSynchronously = runTaskSynchronously;
+ Exception = new AggregateException (new Exception ("FakeTaskAggregateInnerException"));
+ }
+
+ public void Start ()
+ {
+ IsStartCalled = true;
+ if (RunTaskSynchronously) {
+ ExecuteTaskCompletely ();
+ }
+ }
+
+ public TResult Result { get; set; }
+
+ public void ExecuteTaskCompletely ()
+ {
+ ExecuteTaskButNotContinueWith ();
+ ExecuteContinueWith ();
+ }
+
+ public TResult ExecuteTaskButNotContinueWith ()
+ {
+ Result = function ();
+ return Result;
+ }
+
+ public void ExecuteContinueWith ()
+ {
+ continueWith (this);
+ }
+
+ public void Cancel ()
+ {
+ IsCancelCalled = true;
+ }
+
+ public bool IsCancelled { get; set; }
+
+ public bool IsFaulted { get; set; }
+
+ public AggregateException Exception { get; set; }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeTaskFactory.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeTaskFactory.cs
new file mode 100644
index 0000000000..86acede7b5
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeTaskFactory.cs
@@ -0,0 +1,67 @@
+//
+// FakeTaskFactory.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeTaskFactory : ITaskFactory
+ {
+ public bool IsCreateTaskCalled;
+ public bool RunTasksSynchronously;
+
+ public FakeTask<PackagesForSelectedPageResult> FirstFakeTaskCreated {
+ get { return FakeTasksCreated [0] as FakeTask<PackagesForSelectedPageResult>; }
+ }
+
+ public List<object> FakeTasksCreated = new List<object> ();
+
+ public ITask<TResult> CreateTask<TResult> (
+ Func<TResult> function,
+ Action<ITask<TResult>> continueWith)
+ {
+ IsCreateTaskCalled = true;
+ var task = new FakeTask<TResult> (function, continueWith, RunTasksSynchronously);
+ FakeTasksCreated.Add (task);
+ return task;
+ }
+
+ public void ExecuteAllFakeTasks ()
+ {
+ foreach (FakeTask<PackagesForSelectedPageResult> task in FakeTasksCreated) {
+ task.ExecuteTaskCompletely ();
+ }
+ }
+
+ public void ClearAllFakeTasks ()
+ {
+ FakeTasksCreated.Clear ();
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeUninstallPackageAction.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeUninstallPackageAction.cs
new file mode 100644
index 0000000000..16f7ce1c82
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeUninstallPackageAction.cs
@@ -0,0 +1,51 @@
+//
+// FakeUninstallPackageAction.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeUninstallPackageAction : UninstallPackageAction
+ {
+ public bool IsExecuted;
+
+ public FakeUninstallPackageAction (IPackageManagementProject project)
+ : base (project, null)
+ {
+ }
+
+ protected override void ExecuteCore ()
+ {
+ IsExecuted = true;
+ }
+
+ protected override void BeforeExecute ()
+ {
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeUpdatePackageAction.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeUpdatePackageAction.cs
new file mode 100644
index 0000000000..069cc62210
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeUpdatePackageAction.cs
@@ -0,0 +1,59 @@
+//
+// FakeUpdatePackageAction.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FakeUpdatePackageAction : UpdatePackageAction
+ {
+ public bool IsExecuted;
+
+ public FakePackageManagementProject FakeProject;
+
+ public FakeUpdatePackageAction ()
+ : this (new FakePackageManagementProject ())
+ {
+ }
+
+ public FakeUpdatePackageAction (IPackageManagementProject project)
+ : base (project, null)
+ {
+ FakeProject = project as FakePackageManagementProject;
+ }
+
+ protected override void ExecuteCore ()
+ {
+ IsExecuted = true;
+ }
+
+ protected override void BeforeExecute ()
+ {
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeWebRequest.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeWebRequest.cs
new file mode 100644
index 0000000000..f071e47439
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeWebRequest.cs
@@ -0,0 +1,42 @@
+//
+// FakeWebRequest.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Net;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ public class FakeWebRequest : WebRequest
+ {
+ public FakeWebRequest ()
+ {
+ Headers = new WebHeaderCollection ();
+ }
+
+ public override WebHeaderCollection Headers { get; set; }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FileNameAndDirectory.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FileNameAndDirectory.cs
new file mode 100644
index 0000000000..c15389b660
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FileNameAndDirectory.cs
@@ -0,0 +1,67 @@
+//
+// FileNameAndDirectory.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FileNameAndDirectory
+ {
+ public FileNameAndDirectory ()
+ {
+ }
+
+ public FileNameAndDirectory (string fileName, string folder)
+ {
+ this.FileName = fileName;
+ this.Folder = folder;
+ }
+
+ public string FileName;
+ public string Folder;
+
+ public override bool Equals (object obj)
+ {
+ var rhs = obj as FileNameAndDirectory;
+ if (rhs != null) {
+ return (FileName == rhs.FileName) &&
+ (Folder == rhs.Folder);
+ }
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ public override string ToString ()
+ {
+ return String.Format ("[FileNameAndDirectory FileName={0}, Folder={1}]", FileName, Folder);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FileNameAndProjectName.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FileNameAndProjectName.cs
new file mode 100644
index 0000000000..1cb23d7eb3
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FileNameAndProjectName.cs
@@ -0,0 +1,66 @@
+//
+// FileNameAndProjectName.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class FileNameAndProjectName
+ {
+ public FileNameAndProjectName ()
+ {
+ }
+
+ public FileNameAndProjectName (string fileName, string projectName)
+ {
+ this.FileName = fileName;
+ this.ProjectName = projectName;
+ }
+
+ public string FileName;
+ public string ProjectName;
+
+ public override bool Equals (object obj)
+ {
+ FileNameAndProjectName rhs = obj as FileNameAndProjectName;
+ if (rhs != null) {
+ return (rhs.FileName == FileName) &&
+ (rhs.ProjectName == ProjectName);
+ }
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ public override string ToString ()
+ {
+ return String.Format ("[FileNameAndProjectName FileName={0}, ProjectName={1}]", FileName, ProjectName);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/ImportAndCondition.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/ImportAndCondition.cs
new file mode 100644
index 0000000000..33b99da2fb
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/ImportAndCondition.cs
@@ -0,0 +1,43 @@
+//
+// ImportAndCondition.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class ImportAndCondition
+ {
+ public ImportAndCondition (string name, string condition)
+ {
+ Name = name;
+ Condition = condition;
+ }
+
+ public string Name { get; set; }
+ public string Condition { get; set; }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/InstallPackageHelper.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/InstallPackageHelper.cs
new file mode 100644
index 0000000000..303cc48702
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/InstallPackageHelper.cs
@@ -0,0 +1,83 @@
+//
+// InstallPackageHelper.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class InstallPackageHelper
+ {
+ InstallPackageAction action;
+
+ public FakePackage TestPackage = new FakePackage () {
+ Id = "Test"
+ };
+
+ public FakePackageRepository PackageRepository = new FakePackageRepository ();
+ public List<PackageOperation> PackageOperations = new List<PackageOperation> ();
+
+ public InstallPackageHelper (InstallPackageAction action)
+ {
+ this.action = action;
+ }
+
+ public void InstallTestPackage ()
+ {
+ action.Package = TestPackage;
+ action.Operations = PackageOperations;
+ action.IgnoreDependencies = IgnoreDependencies;
+ action.AllowPrereleaseVersions = AllowPrereleaseVersions;
+ action.Execute ();
+ }
+
+ public FakePackage AddPackageInstallOperation ()
+ {
+ var package = new FakePackage ("Package to install");
+ var operation = new PackageOperation (package, PackageAction.Install);
+ PackageOperations.Add (operation);
+ return package;
+ }
+
+ public PackageSource PackageSource = new PackageSource ("http://sharpdevelop/packages");
+ public bool IgnoreDependencies;
+ public bool AllowPrereleaseVersions;
+ public SemanticVersion Version;
+
+ public void InstallPackageById (string packageId)
+ {
+ action.PackageId = packageId;
+ action.PackageVersion = Version;
+ action.IgnoreDependencies = IgnoreDependencies;
+ action.AllowPrereleaseVersions = AllowPrereleaseVersions;
+
+ action.Execute ();
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/OneRegisteredPackageSourceHelper.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/OneRegisteredPackageSourceHelper.cs
new file mode 100644
index 0000000000..1f48502c50
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/OneRegisteredPackageSourceHelper.cs
@@ -0,0 +1,88 @@
+//
+// OneRegisteredPackageSourceHelper.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class OneRegisteredPackageSourceHelper
+ {
+ public TestablePackageManagementOptions Options;
+ public FakeSettings FakeSettings;
+ public PackageSource PackageSource = new PackageSource ("http://sharpdevelop.com", "Test Package Source");
+
+ public RegisteredPackageSources RegisteredPackageSources {
+ get { return Options.PackageSources; }
+ }
+
+ public OneRegisteredPackageSourceHelper ()
+ {
+ CreateOneRegisteredPackageSource ();
+ }
+
+ void CreateOneRegisteredPackageSource ()
+ {
+ Options = new TestablePackageManagementOptions ();
+ FakeSettings = Options.FakeSettings;
+ AddOnePackageSource ();
+ }
+
+ public void AddOnePackageSource ()
+ {
+ RegisteredPackageSources.Clear ();
+ RegisteredPackageSources.Add (PackageSource);
+ }
+
+ public void AddOnePackageSource (string source)
+ {
+ RegisteredPackageSources.Clear ();
+ AddPackageSource (source);
+ }
+
+ public void AddTwoPackageSources ()
+ {
+ AddOnePackageSource ();
+ var packageSource = new PackageSource ("http://second.codeplex.com", "second");
+ RegisteredPackageSources.Add (packageSource);
+ }
+
+ public void AddTwoPackageSources (string source1, string source2)
+ {
+ RegisteredPackageSources.Clear ();
+ AddPackageSource (source1);
+ AddPackageSource (source2);
+ }
+
+ void AddPackageSource (string source)
+ {
+ var packageSource = new PackageSource (source);
+ RegisteredPackageSources.Add (packageSource);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/PackageCollectionAssert.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/PackageCollectionAssert.cs
new file mode 100644
index 0000000000..7b2e29d67c
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/PackageCollectionAssert.cs
@@ -0,0 +1,62 @@
+//
+// PackageCollectionAssert.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public static class PackageCollectionAssert
+ {
+ public static void AreEqual (IEnumerable<IPackage> expectedPackages, IEnumerable<PackageViewModel> actualViewModels)
+ {
+ var expectedPackagesAsList = new List<IPackage> (expectedPackages);
+ List<IPackage> actualPackages = ConvertToPackageList (actualViewModels);
+
+ CollectionAssert.AreEqual (expectedPackagesAsList, actualPackages);
+ }
+
+ static List<IPackage> ConvertToPackageList (IEnumerable<PackageViewModel> viewModels)
+ {
+ var packages = new List<IPackage> ();
+ foreach (PackageViewModel viewModel in viewModels) {
+ packages.Add (viewModel.GetPackage ());
+ }
+ return packages;
+ }
+
+ public static void AreEqual (IEnumerable<IPackage> expectedPackages, IEnumerable<IPackage> actualPackages)
+ {
+ var expectedPackagesAsList = new List<IPackage> (expectedPackages);
+ var actualPackagesAsList = new List<IPackage> (actualPackages);
+
+ CollectionAssert.AreEqual (expectedPackagesAsList, actualPackagesAsList);
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/PackageOperationHelper.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/PackageOperationHelper.cs
new file mode 100644
index 0000000000..b1f329d802
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/PackageOperationHelper.cs
@@ -0,0 +1,52 @@
+//
+// PackageOperationHelper.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public static class PackageOperationHelper
+ {
+ public static PackageOperation CreateInstallOperationWithFile (string fileName)
+ {
+ var package = new FakePackage ();
+ package.AddFile (fileName);
+
+ return new PackageOperation (package, PackageAction.Install);
+ }
+
+ public static List<PackageOperation> CreateListWithOneInstallOperationWithFile (string fileName)
+ {
+ PackageOperation operation = CreateInstallOperationWithFile (fileName);
+ var operations = new List<PackageOperation> ();
+ operations.Add (operation);
+ return operations;
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/PackageReferenceRepositoryHelper.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/PackageReferenceRepositoryHelper.cs
new file mode 100644
index 0000000000..7eed2a283c
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/PackageReferenceRepositoryHelper.cs
@@ -0,0 +1,57 @@
+//
+// PackageReferenceRepositoryHelper.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class PackageReferenceRepositoryHelper
+ {
+ public FakeSharedPackageRepository FakeSharedSourceRepository = new FakeSharedPackageRepository ();
+ public FakeProjectSystem FakeProjectSystem = new FakeProjectSystem ();
+
+ public PackageReferenceRepositoryHelper ()
+ {
+ Init ();
+ }
+
+ void Init ()
+ {
+ string config =
+ "<root>\r\n" +
+ " <package id='Test' version='1.0.0.0'/>\r\n" +
+ "</root>";
+
+ FakeProjectSystem.FileExistsReturnValue = true;
+ FakeProjectSystem.FileToReturnFromOpenFile = config;
+
+ FakePackage package = new FakePackage ("Test", "1.0.0.0");
+
+ FakeSharedSourceRepository.FakePackages.Add (package);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/PackageSourceCollectionAssert.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/PackageSourceCollectionAssert.cs
new file mode 100644
index 0000000000..8d4d19074b
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/PackageSourceCollectionAssert.cs
@@ -0,0 +1,82 @@
+//
+// PackageSourceCollectionAssert.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class PackageSourceCollectionAssert
+ {
+ public static void AreEqual (IEnumerable<PackageSource> expectedSources, IEnumerable<PackageSourceViewModel> actualViewModels)
+ {
+ List<string> expectedSourcesAsList = ConvertToStrings (expectedSources);
+ List<string> actualSources = ConvertToStrings (actualViewModels);
+
+ CollectionAssert.AreEqual (expectedSourcesAsList, actualSources);
+ }
+
+ public static void AreEqual (IEnumerable<PackageSource> expectedSources, IEnumerable<PackageSource> actualSources)
+ {
+ List<string> expectedSourcesAsList = ConvertToStrings (expectedSources);
+ List<string> actualSourcesAsList = ConvertToStrings (actualSources);
+
+ CollectionAssert.AreEqual (expectedSourcesAsList, actualSourcesAsList);
+ }
+
+ static List<string> ConvertToStrings (IEnumerable<PackageSource> sources)
+ {
+ List<string> convertedSources = new List<string> ();
+ foreach (PackageSource source in sources) {
+ convertedSources.Add (ConvertToString (source));
+ }
+ return convertedSources;
+ }
+
+ static string ConvertToString (PackageSource source)
+ {
+ if (source != null) {
+ return String.Format ("[PackageSource] Name='{0}', Source='{1}'",
+ source.Name,
+ source.Source);
+ }
+ return "[PackageSource] == Null";
+ }
+
+ static List<string> ConvertToStrings (IEnumerable<PackageSourceViewModel> viewModels)
+ {
+ List<string> convertedSources = new List<string> ();
+ foreach (PackageSourceViewModel viewModel in viewModels) {
+ PackageSource source = viewModel.GetPackageSource ();
+ convertedSources.Add (ConvertToString (source));
+ }
+ return convertedSources;
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/RecentPackageInfoCollectionAssert.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/RecentPackageInfoCollectionAssert.cs
new file mode 100644
index 0000000000..970b49e684
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/RecentPackageInfoCollectionAssert.cs
@@ -0,0 +1,53 @@
+//
+// RecentPackageInfoCollectionAssert.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public static class RecentPackageInfoCollectionAssert
+ {
+ public static void AreEqual (IEnumerable<RecentPackageInfo> expectedPackages, IEnumerable<RecentPackageInfo> actualPackages)
+ {
+ var expectedPackagesAsList = ConvertToStringList (expectedPackages);
+ var actualPackagesAsList = ConvertToStringList (actualPackages);
+
+ CollectionAssert.AreEqual (expectedPackagesAsList, actualPackagesAsList);
+ }
+
+ static List<string> ConvertToStringList (IEnumerable<RecentPackageInfo> expectedPackages)
+ {
+ var items = new List<string> ();
+ foreach (RecentPackageInfo recentPackage in expectedPackages) {
+ items.Add (recentPackage.ToString ());
+ }
+ return items;
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/ReferenceAndProjectName.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/ReferenceAndProjectName.cs
new file mode 100644
index 0000000000..c70e0545f3
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/ReferenceAndProjectName.cs
@@ -0,0 +1,67 @@
+//
+// ReferenceAndProjectName.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class ReferenceAndProjectName
+ {
+ public ReferenceAndProjectName ()
+ {
+ }
+
+ public ReferenceAndProjectName (string reference, string project)
+ {
+ this.Reference = reference;
+ this.Project = project;
+ }
+
+ public string Reference;
+ public string Project;
+
+ public override bool Equals (object obj)
+ {
+ ReferenceAndProjectName rhs = obj as ReferenceAndProjectName;
+ if (rhs != null) {
+ return (rhs.Project == Project) &&
+ (rhs.Reference == Reference);
+ }
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ public override string ToString ()
+ {
+ return String.Format ("[ReferenceAndProjectName Reference={0}, Project={1}]", Reference, Project);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/SelectedProjectCollectionAssert.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/SelectedProjectCollectionAssert.cs
new file mode 100644
index 0000000000..aa8cb49aac
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/SelectedProjectCollectionAssert.cs
@@ -0,0 +1,61 @@
+//
+// SelectedProjectCollectionAssert.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public static class SelectedProjectCollectionAssert
+ {
+ public static void AreEqual (
+ IEnumerable<IPackageManagementSelectedProject> expected,
+ IEnumerable<IPackageManagementSelectedProject> actual)
+ {
+ List<string> expectedAsStrings = ConvertToStrings (expected);
+ List<string> actualAsStrings = ConvertToStrings (actual);
+ CollectionAssert.AreEqual (expectedAsStrings, actualAsStrings);
+ }
+
+ static List<string> ConvertToStrings (IEnumerable<IPackageManagementSelectedProject> projects)
+ {
+ var projectsAsString = new List<string> ();
+ foreach (IPackageManagementSelectedProject project in projects) {
+ string text = String.Format (
+ "Name: {0}, IsSelected: {1}, IsEnabled: {2}",
+ project.Name,
+ project.IsSelected,
+ project.IsEnabled);
+ projectsAsString.Add (text);
+ }
+ return projectsAsString;
+ }
+ }
+}
+
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestPackageHelper.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestPackageHelper.cs
new file mode 100644
index 0000000000..2ad33ebfd1
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestPackageHelper.cs
@@ -0,0 +1,66 @@
+//
+// TestPackageHelper.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class TestPackageHelper
+ {
+ public FakePackage Package;
+
+ public TestPackageHelper ()
+ : this ("Test", "1.0.0.0")
+ {
+ }
+
+ public TestPackageHelper (string id, string version)
+ {
+ Package = new FakePackage (id, version);
+ }
+
+ public void SetId (string id)
+ {
+ Package.Id = id;
+ }
+
+ public void SetVersion (string version)
+ {
+ Package.Version = new SemanticVersion (version);
+ }
+
+ public void IsLatestVersion ()
+ {
+ Package.IsLatestVersion = true;
+ }
+
+ public void Listed ()
+ {
+ Package.Listed = true;
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableBackgroundPackageActionRunner.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableBackgroundPackageActionRunner.cs
new file mode 100644
index 0000000000..66439b08e1
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableBackgroundPackageActionRunner.cs
@@ -0,0 +1,74 @@
+//
+// TestableBackgroundPackageActionRunner.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.Core;
+using MonoDevelop.Ide;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class TestableBackgroundPackageActionRunner : BackgroundPackageActionRunner
+ {
+ MessageHandler backgroundDispatcher;
+
+ public TestableBackgroundPackageActionRunner (
+ IPackageManagementProgressMonitorFactory progressMonitorFactory,
+ IPackageManagementEvents packageManagementEvents,
+ IProgressProvider progressProvider)
+ : base (progressMonitorFactory, packageManagementEvents, progressProvider)
+ {
+ }
+
+ public void ExecuteBackgroundDispatch ()
+ {
+ backgroundDispatcher.Invoke ();
+ }
+
+ protected override void BackgroundDispatch (MessageHandler handler)
+ {
+ backgroundDispatcher = handler;
+ }
+
+ protected override void GuiDispatch (MessageHandler handler)
+ {
+ handler.Invoke ();
+ }
+
+ protected override PackageManagementEventsMonitor CreateEventMonitor (
+ IProgressMonitor monitor,
+ IPackageManagementEvents packageManagementEvents,
+ IProgressProvider progressProvider)
+ {
+ EventsMonitor = new TestablePackageManagementEventsMonitor (monitor, packageManagementEvents, progressProvider);
+ return EventsMonitor;
+ }
+
+ public TestablePackageManagementEventsMonitor EventsMonitor;
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableMonoDevelopProjectSystem.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableMonoDevelopProjectSystem.cs
new file mode 100644
index 0000000000..e115f3a57a
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableMonoDevelopProjectSystem.cs
@@ -0,0 +1,119 @@
+//
+// TestableMonoDevelopProjectSystem.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.IO;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.Ide;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class TestableMonoDevelopProjectSystem : SharpDevelopProjectSystem
+ {
+ public string PathPassedToPhysicalFileSystemAddFile;
+ public Stream StreamPassedToPhysicalFileSystemAddFile;
+ public Action<Stream> ActionPassedToPhysicalFileSystemAddFile;
+ public FakeFileService FakeFileService;
+ public FakePackageManagementProjectService FakeProjectService;
+ public FakeLogger FakeLogger;
+ public string FileNamePassedToLogDeletedFile;
+ public FileNameAndDirectory FileNameAndDirectoryPassedToLogDeletedFileFromDirectory;
+ public string DirectoryPassedToLogDeletedDirectory;
+ public ReferenceAndProjectName ReferenceAndProjectNamePassedToLogAddedReferenceToProject;
+ public ReferenceAndProjectName ReferenceAndProjectNamePassedToLogRemovedReferenceFromProject;
+ public FileNameAndProjectName FileNameAndProjectNamePassedToLogAddedFileToProject;
+
+ public static Action<MessageHandler> GuiSyncDispatcher = handler => handler.Invoke ();
+
+ public TestableMonoDevelopProjectSystem (IDotNetProject project)
+ : this (
+ project,
+ new FakeFileService (project),
+ new FakePackageManagementProjectService (),
+ new FakeLogger ())
+ {
+ }
+
+ TestableMonoDevelopProjectSystem (
+ IDotNetProject project,
+ IPackageManagementFileService fileService,
+ IPackageManagementProjectService projectService,
+ FakeLogger logger)
+ : base (project, fileService, projectService, GuiSyncDispatcher)
+ {
+ FakeFileService = (FakeFileService)fileService;
+ FakeProjectService = (FakePackageManagementProjectService)projectService;
+ Logger = logger;
+ }
+
+ protected override void PhysicalFileSystemAddFile (string path, Stream stream)
+ {
+ PathPassedToPhysicalFileSystemAddFile = path;
+ StreamPassedToPhysicalFileSystemAddFile = stream;
+ }
+
+ protected override void PhysicalFileSystemAddFile (string path, Action<Stream> writeToStream)
+ {
+ PathPassedToPhysicalFileSystemAddFile = path;
+ ActionPassedToPhysicalFileSystemAddFile = writeToStream;
+ }
+
+ protected override void LogDeletedFile (string fileName)
+ {
+ FileNamePassedToLogDeletedFile = fileName;
+ }
+
+ protected override void LogDeletedFileFromDirectory (string fileName, string directory)
+ {
+ FileNameAndDirectoryPassedToLogDeletedFileFromDirectory = new FileNameAndDirectory (fileName, directory);
+ }
+
+ protected override void LogDeletedDirectory (string directory)
+ {
+ DirectoryPassedToLogDeletedDirectory = directory;
+ }
+
+ protected override void LogAddedReferenceToProject (string referenceName, string projectName)
+ {
+ ReferenceAndProjectNamePassedToLogAddedReferenceToProject =
+ new ReferenceAndProjectName (referenceName, projectName);
+ }
+
+ protected override void LogRemovedReferenceFromProject (string referenceName, string projectName)
+ {
+ ReferenceAndProjectNamePassedToLogRemovedReferenceFromProject =
+ new ReferenceAndProjectName (referenceName, projectName);
+ }
+
+ protected override void LogAddedFileToProject (string fileName, string projectName)
+ {
+ FileNameAndProjectNamePassedToLogAddedFileToProject =
+ new FileNameAndProjectName (fileName, projectName);
+ }
+ }
+}
+
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestablePackageFromRepository.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestablePackageFromRepository.cs
new file mode 100644
index 0000000000..ec2d653666
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestablePackageFromRepository.cs
@@ -0,0 +1,57 @@
+//
+// TestablePackageFromRepository.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class TestablePackageFromRepository : PackageFromRepository
+ {
+ public FakePackage FakePackagePassedToConstructor;
+ public FakePackageRepository FakePackageRepositoryPassedToConstructor;
+
+ public TestablePackageFromRepository ()
+ : this (new FakePackage ("Test"), new FakePackageRepository ())
+ {
+ }
+
+ public TestablePackageFromRepository (FakePackage package, FakePackageRepository repository)
+ : base (package, repository)
+ {
+ this.FakePackagePassedToConstructor = package;
+ this.FakePackageRepositoryPassedToConstructor = repository;
+ }
+
+ public DateTimeOffset? DateTimeOffsetToReturnFromGetDataServicePackageLastUpdated;
+
+ protected override DateTimeOffset? GetDataServicePackageLastUpdated ()
+ {
+ return DateTimeOffsetToReturnFromGetDataServicePackageLastUpdated;
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestablePackageManagementEventsMonitor.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestablePackageManagementEventsMonitor.cs
new file mode 100644
index 0000000000..451310dd19
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestablePackageManagementEventsMonitor.cs
@@ -0,0 +1,68 @@
+//
+// TestablePackageManagementEventsMonitor.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.Ide;
+using MonoDevelop.Core;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class TestablePackageManagementEventsMonitor : PackageManagementEventsMonitor
+ {
+ public TestablePackageManagementEventsMonitor (
+ IProgressMonitor progressMonitor,
+ IPackageManagementEvents packageManagementEvents,
+ IProgressProvider progressProvider)
+ : base (progressMonitor, packageManagementEvents, progressProvider)
+ {
+ }
+
+ public List<FilePath> FilesChanged = new List<FilePath> ();
+
+ protected override void NotifyFilesChanged (FilePath[] files)
+ {
+ FilesChanged.AddRange (files);
+ }
+
+ protected override void GuiSyncDispatch (MessageHandler handler)
+ {
+ handler.Invoke ();
+ }
+
+ protected override void ShowPackageConsole (IProgressMonitor progressMonitor)
+ {
+ IsPackageConsoleShown = true;
+ ProgressMonitorPassedToShowPackageConsole = progressMonitor;
+ }
+
+ public bool IsPackageConsoleShown;
+ public IProgressMonitor ProgressMonitorPassedToShowPackageConsole;
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestablePackageManagementOptions.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestablePackageManagementOptions.cs
new file mode 100644
index 0000000000..365d634fc9
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestablePackageManagementOptions.cs
@@ -0,0 +1,69 @@
+//
+// TestablePackageManagementOptions.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.Core;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class TestablePackageManagementOptions : PackageManagementOptions
+ {
+ public Properties Properties;
+ public FakeSettings FakeSettings;
+ public FakePackageManagementProjectService ProjectService;
+
+ public TestablePackageManagementOptions ()
+ : this (new Properties (), new FakeSettings (), new FakePackageManagementProjectService ())
+ {
+ }
+
+ public TestablePackageManagementOptions (
+ Properties properties,
+ FakeSettings fakeSettings,
+ FakePackageManagementProjectService projectService)
+ : base (properties, CreateSettingsProvider (fakeSettings, projectService))
+ {
+ this.Properties = properties;
+ this.FakeSettings = fakeSettings;
+ this.ProjectService = projectService;
+ }
+
+ public static void ChangeSettingsReturnedBySettingsProvider (FakeSettings settings)
+ {
+ SettingsProvider.LoadDefaultSettings = (fileSystem, configFile, machineSettings) => {
+ return settings;
+ };
+ }
+
+ public static SettingsProvider CreateSettingsProvider (FakeSettings fakeSettings, FakePackageManagementProjectService projectService)
+ {
+ ChangeSettingsReturnedBySettingsProvider (fakeSettings);
+ return new SettingsProvider (projectService);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestablePackageViewModel.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestablePackageViewModel.cs
new file mode 100644
index 0000000000..94d0a57325
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestablePackageViewModel.cs
@@ -0,0 +1,79 @@
+using System;
+using ICSharpCode.PackageManagement;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class TestablePackageViewModel : PackageViewModel
+ {
+ public FakePackageManagementSolution FakeSolution;
+ public PackageManagementEvents PackageManagementEvents;
+ public FakePackage FakePackage;
+ public FakeLogger FakeLogger;
+
+ public TestablePackageViewModel (
+ IPackageViewModelParent parent,
+ FakePackageManagementSolution solution)
+ : this (
+ parent,
+ new FakePackage ("Test"),
+ new PackageManagementSelectedProjects (solution),
+ new PackageManagementEvents (),
+ new FakeLogger ())
+ {
+ this.FakeSolution = solution;
+ }
+
+ public TestablePackageViewModel (
+ IPackageViewModelParent parent,
+ FakePackage package,
+ PackageManagementSelectedProjects selectedProjects,
+ PackageManagementEvents packageManagementEvents,
+ FakeLogger logger)
+ : base (
+ parent,
+ package,
+ selectedProjects,
+ packageManagementEvents,
+ null,
+ logger)
+ {
+ this.FakePackage = package;
+ this.PackageManagementEvents = packageManagementEvents;
+ this.FakeLogger = logger;
+ }
+
+ protected override PackageViewModelOperationLogger CreateLogger (ILogger logger)
+ {
+ PackageViewModelOperationLogger operationLogger = base.CreateLogger (logger);
+ operationLogger.AddingPackageMessageFormat = "Installing...{0}";
+ operationLogger.RemovingPackageMessageFormat = "Uninstalling...{0}";
+ operationLogger.ManagingPackageMessageFormat = "Managing...{0}";
+ OperationLoggerCreated = operationLogger;
+ return operationLogger;
+ }
+
+ public PackageViewModelOperationLogger OperationLoggerCreated;
+
+ public PackageOperation AddOneFakeInstallPackageOperationForViewModelPackage ()
+ {
+ var operation = new FakePackageOperation (FakePackage, PackageAction.Install);
+
+ FakeSolution
+ .FakeProjectToReturnFromGetProject
+ .FakeInstallOperations
+ .Add (operation);
+
+ return operation;
+ }
+
+ public PackageOperation AddOneFakeUninstallPackageOperation ()
+ {
+ var package = new FakePackage ("PackageToUninstall");
+ var operation = new FakePackageOperation (package, PackageAction.Uninstall);
+ FakeSolution.FakeProjectToReturnFromGetProject.FakeInstallOperations.Add (operation);
+ return operation;
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableProcessPackageAction.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableProcessPackageAction.cs
new file mode 100644
index 0000000000..b85eb37b2d
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableProcessPackageAction.cs
@@ -0,0 +1,70 @@
+//
+// TestableProcessPackageAction.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using ICSharpCode.PackageManagement;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class TestableProcessPackageAction : ProcessPackageAction
+ {
+ public FakePackageManagementProject FakeProject;
+ public PackageManagementEvents PackageManagementEvents;
+ public FakePackage FakePackage = new FakePackage ("Test");
+
+ public TestableProcessPackageAction ()
+ : this (new FakePackageManagementProject (), new PackageManagementEvents ())
+ {
+ }
+
+ public TestableProcessPackageAction (
+ FakePackageManagementProject project,
+ PackageManagementEvents packageManagementEvents)
+ : base (project, packageManagementEvents)
+ {
+ FakeProject = project;
+ PackageManagementEvents = packageManagementEvents;
+ this.Package = FakePackage;
+ }
+
+ public void CallBeforeExecute ()
+ {
+ base.BeforeExecute ();
+ }
+
+ public bool IsRunPackageScriptsActionCreated;
+ public bool IsExecuteCoreCalled;
+
+ protected override void ExecuteCore ()
+ {
+ IsExecuteCoreCalled = true;
+ }
+
+ protected override string StartingMessageFormat {
+ get { return String.Empty; }
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableProjectManager.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableProjectManager.cs
new file mode 100644
index 0000000000..61522f49ee
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableProjectManager.cs
@@ -0,0 +1,105 @@
+//
+// TestableProjectManager.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class TestableProjectManager : SharpDevelopProjectManager
+ {
+ public IPackage PackagePassedToAddPackageReference;
+ public bool IgnoreDependenciesPassedToAddPackageReference;
+ public bool AllowPrereleaseVersionsPassedToAddPackageReference;
+
+ public IPackage PackagePassedToRemovePackageReference;
+ public bool ForcePassedToRemovePackageReference;
+ public bool RemoveDependenciesPassedToRemovePackageReference;
+
+ public IPackage PackagePassedToUpdatePackageReference;
+ public bool UpdateDependenciesPassedToUpdatePackageReference;
+ public bool AllowPrereleaseVersionsPassedToUpdatePackageReference;
+ public List<IPackage> PackagesPassedToUpdatePackageReference = new List<IPackage> ();
+
+ public FakePackageRepository FakeLocalRepository {
+ get { return LocalRepository as FakePackageRepository; }
+ }
+
+ public TestableProjectManager ()
+ : base (
+ new FakePackageRepository (),
+ new FakePackagePathResolver (),
+ new FakeProjectSystem (),
+ new FakePackageRepository ())
+ {
+ }
+
+ public override void AddPackageReference (string packageId, SemanticVersion version, bool ignoreDependencies, bool allowPrereleaseVersions)
+ {
+ var package = new FakePackage ();
+ package.Id = packageId;
+ package.Version = version;
+ PackagePassedToAddPackageReference = package;
+ IgnoreDependenciesPassedToAddPackageReference = ignoreDependencies;
+ AllowPrereleaseVersionsPassedToAddPackageReference = allowPrereleaseVersions;
+ }
+
+ public override void AddPackageReference (IPackage package, bool ignoreDependencies, bool allowPrereleaseVersions)
+ {
+ PackagePassedToAddPackageReference = package;
+ IgnoreDependenciesPassedToAddPackageReference = ignoreDependencies;
+ AllowPrereleaseVersionsPassedToAddPackageReference = allowPrereleaseVersions;
+ }
+
+ public override void RemovePackageReference (IPackage package, bool force, bool removeDependencies)
+ {
+ PackagePassedToRemovePackageReference = package;
+ ForcePassedToRemovePackageReference = force;
+ RemoveDependenciesPassedToRemovePackageReference = removeDependencies;
+ }
+
+ public override void UpdatePackageReference (string packageId, SemanticVersion version, bool updateDependencies, bool allowPrereleaseVersions)
+ {
+ var package = new FakePackage ();
+ package.Id = packageId;
+ package.Version = version;
+
+ PackagePassedToUpdatePackageReference = package;
+ UpdateDependenciesPassedToUpdatePackageReference = updateDependencies;
+ AllowPrereleaseVersionsPassedToUpdatePackageReference = allowPrereleaseVersions;
+
+ PackagesPassedToUpdatePackageReference.Add (package);
+ }
+
+ public FakePackage AddFakePackageToProjectLocalRepository (string packageId, string version)
+ {
+ return FakeLocalRepository.AddFakePackageWithVersion (packageId, version);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableViewModelBase.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableViewModelBase.cs
new file mode 100644
index 0000000000..37656ef548
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableViewModelBase.cs
@@ -0,0 +1,37 @@
+//
+// TestableViewModelBase.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class TestableViewModelBase : ViewModelBase<TestableViewModelBase>
+ {
+ public string MyProperty { get; set; }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/UninstallPackageHelper.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/UninstallPackageHelper.cs
new file mode 100644
index 0000000000..3139f5a247
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/UninstallPackageHelper.cs
@@ -0,0 +1,68 @@
+//
+// UninstallPackageHelper.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class UninstallPackageHelper
+ {
+ UninstallPackageAction action;
+
+ public UninstallPackageHelper (UninstallPackageAction action)
+ {
+ this.action = action;
+ }
+
+ public FakePackage TestPackage = new FakePackage () {
+ Id = "Test"
+ };
+
+ public void UninstallTestPackage ()
+ {
+ action.Package = TestPackage;
+ action.Execute ();
+ }
+
+ public SemanticVersion Version;
+ public PackageSource PackageSource = new PackageSource ("http://sharpdevelop.net");
+ public bool ForceRemove;
+ public bool RemoveDependencies;
+
+ public void UninstallPackageById (string packageId)
+ {
+ action.PackageId = packageId;
+ action.PackageVersion = Version;
+ action.ForceRemove = ForceRemove;
+ action.RemoveDependencies = RemoveDependencies;
+ action.Execute ();
+ }
+ }
+}
+
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/UpdatePackageHelper.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/UpdatePackageHelper.cs
new file mode 100644
index 0000000000..1a61cddd71
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/UpdatePackageHelper.cs
@@ -0,0 +1,82 @@
+//
+// UpdatePackageHelper.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public class UpdatePackageHelper
+ {
+ UpdatePackageAction action;
+
+ public FakePackage TestPackage = new FakePackage () {
+ Id = "Test"
+ };
+
+ public List<PackageOperation> PackageOperations = new List<PackageOperation> ();
+
+ public UpdatePackageHelper (UpdatePackageAction action)
+ {
+ this.action = action;
+ }
+
+ public void UpdateTestPackage ()
+ {
+ action.UpdateDependencies = UpdateDependencies;
+ action.AllowPrereleaseVersions = AllowPrereleaseVersions;
+ action.Package = TestPackage;
+ action.Operations = PackageOperations;
+ action.Execute ();
+ }
+
+ public FakePackage AddPackageInstallOperation ()
+ {
+ var package = new FakePackage ("Package to install");
+ var operation = new PackageOperation (package, PackageAction.Install);
+ PackageOperations.Add (operation);
+ return package;
+ }
+
+ public PackageSource PackageSource = new PackageSource ("http://sharpdevelop/packages");
+ public bool UpdateDependencies;
+ public bool AllowPrereleaseVersions;
+ public SemanticVersion Version;
+
+ public void UpdatePackageById (string packageId)
+ {
+ action.PackageId = packageId;
+ action.PackageVersion = Version;
+ action.UpdateDependencies = UpdateDependencies;
+ action.AllowPrereleaseVersions = AllowPrereleaseVersions;
+ action.Execute ();
+ }
+ }
+}
+
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/WindowsPath.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/WindowsPath.cs
new file mode 100644
index 0000000000..6072cc410d
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/WindowsPath.cs
@@ -0,0 +1,52 @@
+//
+// NativePath.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.IO;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public static class WindowsPath
+ {
+ /// <summary>
+ /// Converts a Windows path to a native path by converting any
+ /// directory separators.
+ /// </summary>
+ public static string ToNativePath (this string filePath)
+ {
+ if (Path.DirectorySeparatorChar == '\\')
+ return filePath;
+
+ if (filePath.Contains (":")) {
+ filePath = filePath.Replace (":", "_drive");
+ filePath = "/" + filePath;
+ }
+
+ return filePath.Replace ('\\', Path.DirectorySeparatorChar);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.csproj b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.csproj
index 4624fb2317..2da741aa9c 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.csproj
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.csproj
@@ -49,10 +49,131 @@
<HintPath>..\..\..\..\external\nuget-binary\NuGet.Core.dll</HintPath>
<Private>False</Private>
</Reference>
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="Microsoft.Web.XmlTransform">
+ <HintPath>..\..\..\..\external\nuget-binary\Microsoft.Web.XmlTransform.dll</HintPath>
+ </Reference>
</ItemGroup>
<ItemGroup>
- <Compile Include="MSBuildProjectExtensionsTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\MSBuildProjectExtensionsTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\DelegateCommandTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\ViewModelBaseTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\TestableViewModelBase.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\PackageFromRepositoryTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakePackage.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\TestablePackageFromRepository.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakePackageRepository.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakePackageAssemblyReference.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\CollectionAssert.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\PackageOperationMessageTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\PackageFilesTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\IPackageExtensionsTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\RecentPackageInfoTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\PackageRepositoryCacheTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakePackageRepositoryFactory.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeSharedPackageRepository.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\OneRegisteredPackageSourceHelper.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeSettings.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\TestablePackageManagementOptions.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeRecentPackageRepository.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakePackagePathResolver.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeFileSystem.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\PackageManagementLoggerTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\PackageManagementEventsTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakePackageManagementSolution.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakePackageManagementProject.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeInstallPackageAction.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeUpdatePackageAction.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeUninstallPackageAction.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakePackageOperation.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\PackageManagementOptionsTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\RecentPackageInfoCollectionAssert.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\RegisteredPackageRepositoriesTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\PackageManagementOptionsViewModelTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeMachineCache.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeProcess.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\ThreadSafePackageManagementEventsTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\PackageSourceViewModelTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\RegisteredPackageSourcesViewModelTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\PackageSourceCollectionAssert.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\ProcessPackageActionTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\TestableProcessPackageAction.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\ExceptionThrowingProcessPackageAction.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\InstallPackageActionTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\InstallPackageHelper.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\PackageOperationHelper.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\RecentPackageRepositoryTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\PackageCollectionAssert.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\AvailablePackagesViewModelTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeRegisteredPackageRepositories.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeTaskFactory.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeTask.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\ExceptionThrowingRegisteredPackageRepositories.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakePackageViewModelFactory.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeLogger.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeServiceBasedRepository.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\PackageManagementSelectedProjectTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\UninstallPackageActionTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\UninstallPackageHelper.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\UpdatePackageActionTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\UpdatePackageHelper.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\UpdateAllPackagesInProjectTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\UpdateAllPackagesInSolutionTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\UserAgentGeneratorForRepositoryRequestsTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakePackageRepositoryWithHttpClientEvents.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\NuGetPackageRestoreCommandLineTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\ReducedPackageOperationsTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\TestPackageHelper.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakePackageOperationResolver.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\SolutionPackageRepositoryPathTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeSolution.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeProject.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\SolutionPackageRepositoryTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\PackageManagementProjectTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakePackageManagerFactory.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakePackageManager.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakePackageManagementProjectService.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeProjectManager.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeProjectSystem.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeDotNetProject.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\PackageReferenceRepositoryHelper.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\TestableProjectManager.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakePackageOperationResolverFactory.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\MonoDevelopPackageManagerTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeSolutionPackageRepository.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeWebRequest.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakePackageRepositoryFactoryEvents.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\MonoDevelopProjectSystemTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\TestableMonoDevelopProjectSystem.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeFileService.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FileNameAndDirectory.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FileNameAndProjectName.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\ReferenceAndProjectName.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\ProjectHelper.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\OpenDotNetProjectTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeProjectSystemFactory.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\MonoDevelopPackageManagerFactoryTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\MonoDevelopProjectManagerTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\PackageManagementSelectedProjectsTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\SelectedProjectCollectionAssert.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\PackageViewModelTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\TestablePackageViewModel.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeOperationAwareRepository.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\PackageManagementSolutionTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeSolutionPackageRepositoryFactory.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakePackageManagementProjectFactory.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\WindowsPath.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\XmlDocumentTransformTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\BackgroundPackageActionRunnerTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeProgressMonitorFactory.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\FakeProgressMonitor.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\TestableBackgroundPackageActionRunner.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\TestablePackageManagementEventsMonitor.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\SettingProviderTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\PackageSearchCriteriaTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests\WildcardVersionSpecTests.cs" />
+ <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\ImportAndCondition.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
@@ -69,6 +190,14 @@
<Project>{E13A0A7B-4DE6-43ED-A139-41052D065A9B}</Project>
<Name>GuiUnit_NET_4_0</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\..\core\MonoDevelop.Ide\MonoDevelop.Ide.csproj">
+ <Project>{27096E7F-C91C-4AC6-B289-6897A701DF21}</Project>
+ <Name>MonoDevelop.Ide</Name>
+ </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <ItemGroup>
+ <Folder Include="MonoDevelop.PackageManagement.Tests\" />
+ <Folder Include="MonoDevelop.PackageManagement.Tests.Helpers\" />
+ </ItemGroup>
</Project>
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/AvailablePackagesViewModelTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/AvailablePackagesViewModelTests.cs
new file mode 100644
index 0000000000..664e6fa424
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/AvailablePackagesViewModelTests.cs
@@ -0,0 +1,915 @@
+//
+// AvailablePackagesViewModelTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
+// software and associated documentation files (the "Software"), to deal in the Software
+// without restriction, including without limitation the rights to use, copy, modify, merge,
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+// to whom the Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or
+// substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class AvailablePackagesViewModelTests
+ {
+ AvailablePackagesViewModel viewModel;
+ FakeRegisteredPackageRepositories registeredPackageRepositories;
+ ExceptionThrowingRegisteredPackageRepositories exceptionThrowingRegisteredPackageRepositories;
+ FakeTaskFactory taskFactory;
+ FakeRecentPackageRepository recentPackageRepository;
+
+ void CreateViewModel ()
+ {
+ CreateRegisteredPackageRepositories ();
+ CreateViewModel (registeredPackageRepositories);
+ }
+
+ void CreateRegisteredPackageRepositories ()
+ {
+ registeredPackageRepositories = new FakeRegisteredPackageRepositories ();
+ }
+
+ void CreateViewModel (FakeRegisteredPackageRepositories registeredPackageRepositories)
+ {
+ taskFactory = new FakeTaskFactory ();
+ var packageViewModelFactory = new FakePackageViewModelFactory ();
+ recentPackageRepository = new FakeRecentPackageRepository ();
+
+ viewModel = new AvailablePackagesViewModel (
+ registeredPackageRepositories,
+ recentPackageRepository,
+ packageViewModelFactory,
+ taskFactory);
+ }
+
+ void CreateExceptionThrowingRegisteredPackageRepositories ()
+ {
+ exceptionThrowingRegisteredPackageRepositories = new ExceptionThrowingRegisteredPackageRepositories ();
+ }
+
+ void CompleteReadPackagesTask ()
+ {
+ taskFactory.ExecuteAllFakeTasks ();
+ }
+
+ void ClearReadPackagesTasks ()
+ {
+ taskFactory.ClearAllFakeTasks ();
+ }
+
+ void AddOnePackageSourceToRegisteredSources ()
+ {
+ registeredPackageRepositories.ClearPackageSources ();
+ registeredPackageRepositories.AddOnePackageSource ();
+ registeredPackageRepositories.HasMultiplePackageSources = false;
+ registeredPackageRepositories.ActivePackageSource = registeredPackageRepositories.PackageSources [0];
+ }
+
+ void AddTwoPackageSourcesToRegisteredSources ()
+ {
+ var expectedPackageSources = new PackageSource[] {
+ new PackageSource ("http://first.com", "First"),
+ new PackageSource ("http://second.com", "Second")
+ };
+ AddPackageSourcesToRegisteredSources (expectedPackageSources);
+ registeredPackageRepositories.HasMultiplePackageSources = true;
+ registeredPackageRepositories.ActivePackageSource = expectedPackageSources [0];
+ }
+
+ void AddPackageSourcesToRegisteredSources (PackageSource[] sources)
+ {
+ registeredPackageRepositories.ClearPackageSources ();
+ registeredPackageRepositories.AddPackageSources (sources);
+ }
+
+ PackageSource AddTwoPackageSourcesToRegisteredSourcesWithFirstOneDisabled ()
+ {
+ var expectedPackageSources = new PackageSource[] {
+ new PackageSource ("http://first.com", "First") { IsEnabled = false },
+ new PackageSource ("http://second.com", "Second") { IsEnabled = true }
+ };
+ AddPackageSourcesToRegisteredSources (expectedPackageSources);
+ registeredPackageRepositories.HasMultiplePackageSources = true;
+ return expectedPackageSources [0];
+ }
+
+ void CreateNewActiveRepositoryWithDifferentPackages ()
+ {
+ var package = new FakePackage ("NewRepositoryPackageId");
+ var newRepository = new FakePackageRepository ();
+ newRepository.FakePackages.Add (package);
+ registeredPackageRepositories.FakeActiveRepository = newRepository;
+ }
+
+ void SetUpTwoPackageSourcesAndViewModelHasReadPackages ()
+ {
+ CreateRegisteredPackageRepositories ();
+ AddTwoPackageSourcesToRegisteredSources ();
+ CreateViewModel (registeredPackageRepositories);
+ registeredPackageRepositories.ActivePackageSource = registeredPackageRepositories.PackageSources [0];
+ viewModel.ReadPackages ();
+ CompleteReadPackagesTask ();
+ CreateNewActiveRepositoryWithDifferentPackages ();
+ }
+
+ void ChangeSelectedPackageSourceToSecondSource ()
+ {
+ var secondPackageSource = registeredPackageRepositories.PackageSources [1];
+ viewModel.SelectedPackageSource = secondPackageSource;
+ }
+
+ void ChangeSelectedPackageSourceToFirstSource ()
+ {
+ var firstPackageSource = registeredPackageRepositories.PackageSources [0];
+ viewModel.SelectedPackageSource = firstPackageSource;
+ }
+
+ void SearchForAllPackageVersions (string packageId, string versions = "")
+ {
+ viewModel.SearchTerms = string.Format ("{0} version:{1}", packageId, versions).TrimEnd ();
+ }
+
+ [Test]
+ public void ReadPackages_RepositoryHasThreePackagesWithSameIdButDifferentVersions_HasLatestPackageVersionOnly ()
+ {
+ CreateViewModel ();
+ AddOnePackageSourceToRegisteredSources ();
+
+ var package1 = new FakePackage ("Test", "0.1.0.0");
+ var package2 = new FakePackage ("Test", "0.2.0.0");
+ var package3 = new FakePackage ("Test", "0.3.0.0");
+
+ var packages = new FakePackage[] {
+ package1, package2, package3
+ };
+
+ registeredPackageRepositories.FakeActiveRepository.FakePackages.AddRange (packages);
+
+ viewModel.ReadPackages ();
+ CompleteReadPackagesTask ();
+
+ var expectedPackages = new FakePackage[] {
+ package3
+ };
+
+ PackageCollectionAssert.AreEqual (expectedPackages, viewModel.PackageViewModels);
+ }
+
+ [Test]
+ public void IsSearchable_ByDefault_ReturnsTrue ()
+ {
+ CreateViewModel ();
+ Assert.IsTrue (viewModel.IsSearchable);
+ }
+
+ [Test]
+ public void Search_RepositoryHasThreePackagesWithSameIdButSearchTermsMatchNoPackageIds_ReturnsNoPackages ()
+ {
+ CreateViewModel ();
+
+ var package1 = new FakePackage ("Test", "0.1.0.0");
+ var package2 = new FakePackage ("Test", "0.2.0.0");
+ var package3 = new FakePackage ("Test", "0.3.0.0");
+
+ var packages = new FakePackage[] {
+ package1, package2, package3
+ };
+
+ registeredPackageRepositories.FakeActiveRepository.FakePackages.AddRange (packages);
+
+ viewModel.ReadPackages ();
+ CompleteReadPackagesTask ();
+
+ ClearReadPackagesTasks ();
+ viewModel.SearchTerms = "NotAMatch";
+ viewModel.Search ();
+ CompleteReadPackagesTask ();
+
+ Assert.AreEqual (0, viewModel.PackageViewModels.Count);
+ }
+
+ [Test]
+ public void ShowNextPage_TwoObjectsWatchingForPagesCollectionChangedEventAndUserMovesToPageTwoAndFilteredPackagesReturnsLessThanExpectedPackagesDueToMatchingVersions_InvalidOperationExceptionNotThrownWhen ()
+ {
+ CreateViewModel ();
+ AddOnePackageSourceToRegisteredSources ();
+ viewModel.PageSize = 2;
+
+ var package1 = new FakePackage ("First", "0.1.0.0");
+ var package2 = new FakePackage ("Second", "0.2.0.0");
+ var package3 = new FakePackage ("Test", "0.3.0.0");
+ var package4 = new FakePackage ("Test", "0.4.0.0");
+
+ var packages = new FakePackage[] {
+ package1, package2, package3, package4
+ };
+
+ registeredPackageRepositories.FakeActiveRepository.FakePackages.AddRange (packages);
+
+ viewModel.ReadPackages ();
+ CompleteReadPackagesTask ();
+
+ ClearReadPackagesTasks ();
+ bool collectionChangedEventFired = false;
+ viewModel.Pages.CollectionChanged += (sender, e) => collectionChangedEventFired = true;
+ viewModel.ShowNextPage ();
+ CompleteReadPackagesTask ();
+
+ var expectedPackages = new FakePackage[] {
+ package4
+ };
+
+ PackageCollectionAssert.AreEqual (expectedPackages, viewModel.PackageViewModels);
+ Assert.IsTrue (collectionChangedEventFired);
+ }
+
+ [Test]
+ public void ShowSources_TwoPackageSources_ReturnsTrue ()
+ {
+ CreateRegisteredPackageRepositories ();
+ AddTwoPackageSourcesToRegisteredSources ();
+ CreateViewModel (registeredPackageRepositories);
+
+ Assert.IsTrue (viewModel.ShowPackageSources);
+ }
+
+ [Test]
+ public void ShowPackageSources_OnePackageSources_ReturnsTrue ()
+ {
+ CreateRegisteredPackageRepositories ();
+ AddOnePackageSourceToRegisteredSources ();
+ CreateViewModel (registeredPackageRepositories);
+
+ Assert.IsTrue (viewModel.ShowPackageSources);
+ }
+
+ [Test]
+ public void PackageSources_TwoPackageSourcesInOptions_ReturnsTwoPackageSourcesPlusAggregatePackageSource ()
+ {
+ CreateRegisteredPackageRepositories ();
+ AddTwoPackageSourcesToRegisteredSources ();
+ CreateViewModel (registeredPackageRepositories);
+
+ var expectedPackageSources = new List<PackageSource> (registeredPackageRepositories.PackageSources);
+ expectedPackageSources.Insert (0, RegisteredPackageSourceSettings.AggregatePackageSource);
+
+ PackageSourceCollectionAssert.AreEqual (expectedPackageSources, viewModel.PackageSources);
+ }
+
+ [Test]
+ public void PackageSources_OnePackageSourceInOptions_ReturnsOnePackageSource ()
+ {
+ CreateRegisteredPackageRepositories ();
+ AddOnePackageSourceToRegisteredSources ();
+ CreateViewModel (registeredPackageRepositories);
+
+ var expectedPackageSources = new List<PackageSource> (registeredPackageRepositories.PackageSources);
+
+ PackageSourceCollectionAssert.AreEqual (expectedPackageSources, viewModel.PackageSources);
+ }
+
+ [Test]
+ public void SelectedPackageSource_TwoPackageSourcesInOptionsAndActivePackageSourceIsFirstSource_IsFirstPackageSource ()
+ {
+ CreateRegisteredPackageRepositories ();
+ AddTwoPackageSourcesToRegisteredSources ();
+ CreateViewModel (registeredPackageRepositories);
+
+ var expectedPackageSource = registeredPackageRepositories.PackageSources [0];
+ registeredPackageRepositories.ActivePackageSource = expectedPackageSource;
+
+ Assert.AreEqual (expectedPackageSource, viewModel.SelectedPackageSource);
+ }
+
+ [Test]
+ public void SelectedPackageSource_TwoPackageSourcesInOptionsAndActivePackageSourceIsSecondSource_IsSecondPackageSource ()
+ {
+ CreateRegisteredPackageRepositories ();
+ AddTwoPackageSourcesToRegisteredSources ();
+ CreateViewModel (registeredPackageRepositories);
+
+ var expectedPackageSource = registeredPackageRepositories.PackageSources [1];
+ registeredPackageRepositories.ActivePackageSource = expectedPackageSource;
+
+ Assert.AreEqual (expectedPackageSource, viewModel.SelectedPackageSource);
+ }
+
+ [Test]
+ public void SelectedPackageSource_Changed_ActivePackageSourceChanged ()
+ {
+ CreateRegisteredPackageRepositories ();
+ AddTwoPackageSourcesToRegisteredSources ();
+ CreateViewModel (registeredPackageRepositories);
+
+ registeredPackageRepositories.ActivePackageSource = registeredPackageRepositories.PackageSources [0];
+ var expectedPackageSource = registeredPackageRepositories.PackageSources [1];
+ viewModel.SelectedPackageSource = expectedPackageSource;
+
+ Assert.AreEqual (expectedPackageSource, registeredPackageRepositories.ActivePackageSource);
+ }
+
+ [Test]
+ public void SelectedPackageSource_PackageSourceChangedAfterReadingPackages_PackagesReadFromNewPackageSourceAndDisplayed ()
+ {
+ SetUpTwoPackageSourcesAndViewModelHasReadPackages ();
+ ClearReadPackagesTasks ();
+ ChangeSelectedPackageSourceToSecondSource ();
+ CompleteReadPackagesTask ();
+
+ var expectedPackages = registeredPackageRepositories.FakeActiveRepository.FakePackages;
+
+ PackageCollectionAssert.AreEqual (expectedPackages, viewModel.PackageViewModels);
+ }
+
+ [Test]
+ public void SelectedPackageSource_PackageSourceChangedAfterReadingPackages_PropertyChangedEventFiredAfterPackagesAreRead ()
+ {
+ SetUpTwoPackageSourcesAndViewModelHasReadPackages ();
+
+ int packageCountWhenPropertyChangedEventFired = -1;
+ viewModel.PropertyChanged += (sender, e) => packageCountWhenPropertyChangedEventFired = viewModel.PackageViewModels.Count;
+ ClearReadPackagesTasks ();
+ ChangeSelectedPackageSourceToSecondSource ();
+ CompleteReadPackagesTask ();
+
+ Assert.AreEqual (1, packageCountWhenPropertyChangedEventFired);
+ }
+
+ [Test]
+ public void SelectedPackageSource_PackageSourceChangedButToSameSelectedPackageSource_PackagesAreNotRead ()
+ {
+ SetUpTwoPackageSourcesAndViewModelHasReadPackages ();
+ ChangeSelectedPackageSourceToFirstSource ();
+
+ Assert.AreEqual (0, viewModel.PackageViewModels.Count);
+ }
+
+ [Test]
+ public void SelectedPackageSource_PackageSourceChangedButToSameSelectedPackageSource_PropertyChangedEventNotFired ()
+ {
+ SetUpTwoPackageSourcesAndViewModelHasReadPackages ();
+
+ bool fired = false;
+ viewModel.PropertyChanged += (sender, e) => fired = true;
+ ChangeSelectedPackageSourceToFirstSource ();
+
+ Assert.IsFalse (fired);
+ }
+
+ [Test]
+ public void GetAllPackages_OnePackageInRepository_RepositoryNotCreatedByBackgroundThread ()
+ {
+ CreateRegisteredPackageRepositories ();
+ AddOnePackageSourceToRegisteredSources ();
+ registeredPackageRepositories.FakeActiveRepository.FakePackages.Add (new FakePackage ());
+ CreateViewModel (registeredPackageRepositories);
+ viewModel.ReadPackages ();
+
+ registeredPackageRepositories.FakeActiveRepository = null;
+ CompleteReadPackagesTask ();
+
+ Assert.AreEqual (1, viewModel.PackageViewModels.Count);
+ }
+
+ [Test]
+ public void ReadPackages_ExceptionThrownWhenAccessingActiveRepository_ErrorMessageFromExceptionNotOverriddenByReadPackagesCall ()
+ {
+ CreateExceptionThrowingRegisteredPackageRepositories ();
+ exceptionThrowingRegisteredPackageRepositories.ExceptionToThrowWhenActiveRepositoryAccessed =
+ new Exception ("Test");
+ CreateViewModel (exceptionThrowingRegisteredPackageRepositories);
+ exceptionThrowingRegisteredPackageRepositories.ActivePackageSource = new PackageSource ("Test");
+ viewModel.ReadPackages ();
+
+ ApplicationException ex = Assert.Throws<ApplicationException> (CompleteReadPackagesTask);
+ Assert.AreEqual ("Test", ex.Message);
+ }
+
+ [Test]
+ public void ReadPackages_RepositoryHasPrereleaseAndReleasePackage_HasReleasePackageOnly ()
+ {
+ CreateViewModel ();
+ AddOnePackageSourceToRegisteredSources ();
+ var releasePackage = new FakePackage ("Test", "1.1.0.0");
+ var prereleasePackage = new FakePackage ("Test", "1.1.0-alpha");
+
+ var packages = new FakePackage[] {
+ releasePackage, prereleasePackage
+ };
+
+ registeredPackageRepositories.FakeActiveRepository.FakePackages.AddRange (packages);
+
+ viewModel.ReadPackages ();
+ CompleteReadPackagesTask ();
+
+ var expectedPackages = new FakePackage[] {
+ releasePackage
+ };
+
+ PackageCollectionAssert.AreEqual (expectedPackages, viewModel.PackageViewModels);
+ }
+
+ [Test]
+ public void ReadPackages_TwoPackagesWithDifferentDownloadCounts_HighestDownloadCountShownFirst ()
+ {
+ CreateViewModel ();
+ AddOnePackageSourceToRegisteredSources ();
+
+ var package1 = new FakePackage ("A", "0.1.0.0") { DownloadCount = 1 };
+ var package2 = new FakePackage ("Z", "0.1.0.0") { DownloadCount = 1000 };
+
+ var packages = new FakePackage[] {
+ package1, package2
+ };
+
+ registeredPackageRepositories.FakeActiveRepository.FakePackages.AddRange (packages);
+
+ viewModel.ReadPackages ();
+ CompleteReadPackagesTask ();
+
+ var expectedPackages = new FakePackage[] {
+ package2, package1
+ };
+
+ PackageCollectionAssert.AreEqual (expectedPackages, viewModel.PackageViewModels);
+ }
+
+ [Test]
+ public void GetPackagesFromPackageSource_RepositoryHasThreePackagesWithSameIdButDifferentVersions_LatestPackageVersionOnlyRequestedFromPackageSource ()
+ {
+ CreateViewModel ();
+ AddOnePackageSourceToRegisteredSources ();
+ var package1 = new FakePackage ("Test", "0.1.0.0") { IsLatestVersion = false };
+ var package2 = new FakePackage ("Test", "0.2.0.0") { IsLatestVersion = false };
+ var package3 = new FakePackage ("Test", "0.3.0.0") { IsLatestVersion = true };
+ var packages = new FakePackage[] {
+ package1, package2, package3
+ };
+ registeredPackageRepositories.FakeActiveRepository.FakePackages.AddRange (packages);
+ viewModel.ReadPackages ();
+
+ IList<IPackage> allPackages = viewModel.GetPackagesFromPackageSource ().ToList ();
+
+ var expectedPackages = new FakePackage[] {
+ package3
+ };
+ PackageCollectionAssert.AreEqual (expectedPackages, allPackages);
+ }
+
+ [Test]
+ public void PackageSources_TwoPackageSourcesButFirstIsDisabled_DoesNotReturnDisabledPackageSource ()
+ {
+ CreateRegisteredPackageRepositories ();
+ AddTwoPackageSourcesToRegisteredSourcesWithFirstOneDisabled ();
+ CreateViewModel (registeredPackageRepositories);
+
+ IEnumerable<PackageSource> packageSources = viewModel.PackageSources;
+
+ bool containsDisabledPackageSource = packageSources.Contains (registeredPackageRepositories.PackageSources [0]);
+ bool containsEnabledPackageSource = packageSources.Contains (registeredPackageRepositories.PackageSources [1]);
+ Assert.IsFalse (containsDisabledPackageSource);
+ Assert.IsTrue (containsEnabledPackageSource);
+ }
+
+ [Test]
+ public void IsInstallAllPackagesEnabled_RepositoryHasTwoPackages_ReturnsFalse ()
+ {
+ CreateViewModel ();
+ var package1 = new FakePackage ("Test", "0.1.0.0");
+ var package2 = new FakePackage ("Test", "0.2.0.0");
+ var packages = new FakePackage[] {
+ package1, package2
+ };
+ registeredPackageRepositories.FakeActiveRepository.FakePackages.AddRange (packages);
+ viewModel.ReadPackages ();
+ CompleteReadPackagesTask ();
+
+ bool enabled = viewModel.IsUpdateAllPackagesEnabled;
+
+ Assert.IsFalse (enabled);
+ }
+
+ [Test]
+ public void ShowPrerelease_ByDefault_ReturnsTrue ()
+ {
+ CreateViewModel ();
+
+ bool show = viewModel.ShowPrerelease;
+
+ Assert.IsTrue (show);
+ }
+
+ [Test]
+ public void ReadPackages_RepositoryHasPrereleasePackageAndIncludePrereleaseIsTrue_HasPrereleasePackageInList ()
+ {
+ CreateViewModel ();
+ AddOnePackageSourceToRegisteredSources ();
+ viewModel.IncludePrerelease = true;
+ var prereleasePackage = new FakePackage ("Test", "1.1.0-alpha") {
+ IsLatestVersion = false,
+ IsAbsoluteLatestVersion = true
+ };
+ var expectedPackages = new FakePackage[] { prereleasePackage };
+ registeredPackageRepositories.FakeActiveRepository.FakePackages.AddRange (expectedPackages);
+
+ viewModel.ReadPackages ();
+ CompleteReadPackagesTask ();
+
+ PackageCollectionAssert.AreEqual (expectedPackages, viewModel.PackageViewModels);
+ }
+
+ [Test]
+ public void ReadPackages_RepositoryHasThreePrereleasePackagesWithSameIdButDifferentVersionsAndIncludePrereleaseIsTrue_HasLatestPreleasePackageVersionOnly ()
+ {
+ CreateViewModel ();
+ AddOnePackageSourceToRegisteredSources ();
+ viewModel.IncludePrerelease = true;
+ var package1 = new FakePackage ("Test", "0.1.0.0-alpha") { IsLatestVersion = false };
+ var package2 = new FakePackage ("Test", "0.2.0.0-alpha") { IsLatestVersion = false };
+ var package3 = new FakePackage ("Test", "0.3.0.0-alpha") { IsLatestVersion = false, IsAbsoluteLatestVersion = true };
+ var packages = new FakePackage[] {
+ package1, package2, package3
+ };
+ registeredPackageRepositories.FakeActiveRepository.FakePackages.AddRange (packages);
+
+ viewModel.ReadPackages ();
+ CompleteReadPackagesTask ();
+
+ var expectedPackages = new FakePackage[] {
+ package3
+ };
+ PackageCollectionAssert.AreEqual (expectedPackages, viewModel.PackageViewModels);
+ }
+
+ [Test]
+ public void PackageViewModels_GetParentOfPackageViewModel_ReturnsAvailablePackagesViewModel ()
+ {
+ CreateViewModel ();
+ AddOnePackageSourceToRegisteredSources ();
+ var package1 = new FakePackage ("Test", "0.1.0.0");
+ var package2 = new FakePackage ("Test", "0.2.0.0");
+ var packages = new FakePackage[] {
+ package1, package2
+ };
+ registeredPackageRepositories.FakeActiveRepository.FakePackages.AddRange (packages);
+ viewModel.ReadPackages ();
+ CompleteReadPackagesTask ();
+ PackageViewModel childViewModel = viewModel.PackageViewModels.First ();
+
+ IPackageViewModelParent parent = childViewModel.GetParent ();
+
+ Assert.AreEqual (viewModel, parent);
+ }
+
+ [Test]
+ public void GetPackagesFromPackageSource_RepositoryIsServiceBasedRepository_ServiceBasedRepositorySearchUsed ()
+ {
+ CreateViewModel ();
+ AddOnePackageSourceToRegisteredSources ();
+ var package = FakePackage.CreatePackageWithVersion ("Test", "0.1.0.0");
+ var packages = new FakePackage[] { package };
+ var repository = new FakeServiceBasedRepository ();
+ repository.PackagesToReturnForSearch ("id:test", false, packages);
+ registeredPackageRepositories.FakeActiveRepository = repository;
+ viewModel.SearchTerms = "id:test";
+ viewModel.IncludePrerelease = false;
+ viewModel.ReadPackages ();
+
+ IList<IPackage> allPackages = viewModel.GetPackagesFromPackageSource ().ToList ();
+
+ var expectedPackages = new FakePackage[] { package };
+ PackageCollectionAssert.AreEqual (expectedPackages, allPackages);
+ }
+
+ [Test]
+ public void GetPackagesFromPackageSource_RepositoryIsServiceBasedRepositoryAndPrereleaseIncluded_ServiceBasedRepositorySearchUsed ()
+ {
+ CreateViewModel ();
+ AddOnePackageSourceToRegisteredSources ();
+ var package = FakePackage.CreatePackageWithVersion ("Test", "0.1.0.0");
+ package.IsAbsoluteLatestVersion = true;
+ var packages = new FakePackage[] { package };
+ var repository = new FakeServiceBasedRepository ();
+ repository.PackagesToReturnForSearch ("id:test", true, packages);
+ registeredPackageRepositories.FakeActiveRepository = repository;
+ viewModel.SearchTerms = "id:test";
+ viewModel.IncludePrerelease = true;
+ viewModel.ReadPackages ();
+
+ IList<IPackage> allPackages = viewModel.GetPackagesFromPackageSource ().ToList ();
+
+ var expectedPackages = new FakePackage[] { package };
+ PackageCollectionAssert.AreEqual (expectedPackages, allPackages);
+ }
+
+ [Test]
+ public void GetPackagesFromPackageSource_RepositoryHasThreePackagesWithSameIdButDifferentVersionsAndSearchIncludesPrerelease_AbsoluteLatestPackageVersionOnlyRequestedFromPackageSource ()
+ {
+ CreateViewModel ();
+ AddOnePackageSourceToRegisteredSources ();
+ var package1 = new FakePackage ("Test", "0.1.0.0") { IsAbsoluteLatestVersion = false };
+ var package2 = new FakePackage ("Test", "0.2.0.0") { IsAbsoluteLatestVersion = false };
+ var package3 = new FakePackage ("Test", "0.3.0.0") { IsAbsoluteLatestVersion = true };
+ var packages = new FakePackage[] {
+ package1, package2, package3
+ };
+ registeredPackageRepositories.FakeActiveRepository.FakePackages.AddRange (packages);
+ viewModel.IncludePrerelease = true;
+ viewModel.ReadPackages ();
+
+ IList<IPackage> allPackages = viewModel.GetPackagesFromPackageSource ().ToList ();
+
+ var expectedPackages = new FakePackage[] {
+ package3
+ };
+ PackageCollectionAssert.AreEqual (expectedPackages, allPackages);
+ }
+
+ [Test]
+ public void ReadPackages_ActiveRepositoryChangedWhichUsesInvalidUrl_InvalidUrlExceptionIsShownAsErrorMessage ()
+ {
+ CreateExceptionThrowingRegisteredPackageRepositories ();
+ CreateViewModel (exceptionThrowingRegisteredPackageRepositories);
+ exceptionThrowingRegisteredPackageRepositories.ActivePackageSource = new PackageSource ("test");
+ var package = new FakePackage ("Test", "0.1.0.0");
+ exceptionThrowingRegisteredPackageRepositories
+ .FakeActiveRepository
+ .FakePackages
+ .Add (package);
+ viewModel.ReadPackages ();
+ CompleteReadPackagesTask ();
+ taskFactory.ClearAllFakeTasks ();
+ exceptionThrowingRegisteredPackageRepositories.ExceptionToThrowWhenActiveRepositoryAccessed =
+ new Exception ("Invalid url");
+
+ viewModel.ReadPackages ();
+ FakeTask<PackagesForSelectedPageResult> task = taskFactory.FirstFakeTaskCreated;
+ ApplicationException ex = Assert.Throws<ApplicationException> (() => task.ExecuteTaskButNotContinueWith ());
+ task.Exception = new AggregateException (ex);
+ task.IsFaulted = true;
+ task.ExecuteContinueWith ();
+
+ Assert.AreEqual ("Invalid url", ex.Message);
+ Assert.IsTrue (viewModel.HasError);
+ Assert.AreEqual ("Invalid url", viewModel.ErrorMessage);
+ }
+
+ [Test]
+ public void ReadPackages_SearchForAllPackageVersionsWhenThreePackageVersionsAvailable_ShowsOnlyPackagesWithSameIdAndAllVersionsWithHighestVersionFirst ()
+ {
+ CreateViewModel ();
+ AddOnePackageSourceToRegisteredSources ();
+ var package1 = new FakePackage ("A", "0.1.0.0") { IsLatestVersion = false };
+ var package2 = new FakePackage ("A", "0.3.0.0");
+ var package3 = new FakePackage ("A", "0.2.0.0") { IsLatestVersion = false };
+ var package4 = new FakePackage ("AA", "0.1.0.0");
+ var packages = new FakePackage[] {
+ package1, package2, package3, package4
+ };
+ registeredPackageRepositories.FakeActiveRepository.FakePackages.AddRange (packages);
+ SearchForAllPackageVersions ("a");
+
+ viewModel.ReadPackages ();
+ CompleteReadPackagesTask ();
+
+ var expectedPackages = new FakePackage[] {
+ package2, package3, package1
+ };
+ PackageCollectionAssert.AreEqual (expectedPackages, viewModel.PackageViewModels);
+ }
+
+ [Test]
+ public void ReadPackages_SearchForAllPackageVersionsWhenThreePackageVersionsAvailableButOneIsPrerelease_ShowsOnlyNonPrereleasePackages ()
+ {
+ CreateViewModel ();
+ AddOnePackageSourceToRegisteredSources ();
+ var package1 = new FakePackage ("A", "0.1.0.0") { IsLatestVersion = false };
+ var package2 = new FakePackage ("A", "0.2.0.0");
+ var package3 = new FakePackage ("A", "0.2.0-alpha") { IsLatestVersion = false };
+ var packages = new FakePackage[] {
+ package1, package2, package3
+ };
+ registeredPackageRepositories.FakeActiveRepository.FakePackages.AddRange (packages);
+ SearchForAllPackageVersions ("a");
+
+ viewModel.ReadPackages ();
+ CompleteReadPackagesTask ();
+
+ var expectedPackages = new FakePackage[] {
+ package2, package1
+ };
+ PackageCollectionAssert.AreEqual (expectedPackages, viewModel.PackageViewModels);
+ }
+
+ [Test]
+ public void ReadPackages_SearchForAllPackageVersionsIncludePrereleaseWhenOneIsPrereleaseAndOneIsRelease_ShowsAllPackages ()
+ {
+ CreateViewModel ();
+ AddOnePackageSourceToRegisteredSources ();
+ var package1 = new FakePackage ("A", "0.2.0.0");
+ var package2 = new FakePackage ("A", "0.2.0-alpha") { IsLatestVersion = false };
+ var packages = new FakePackage[] {
+ package1, package2
+ };
+ registeredPackageRepositories.FakeActiveRepository.FakePackages.AddRange (packages);
+ SearchForAllPackageVersions ("a");
+ viewModel.IncludePrerelease = true;
+
+ viewModel.ReadPackages ();
+ CompleteReadPackagesTask ();
+
+ var expectedPackages = new FakePackage[] {
+ package1, package2
+ };
+ PackageCollectionAssert.AreEqual (expectedPackages, viewModel.PackageViewModels);
+ }
+
+ [Test]
+ public void ReadPackages_SearchForAllPackageVersionsWhenOneRecentPackageIsAvailable_RecentPackagesNotDisplayed ()
+ {
+ CreateViewModel ();
+ AddOnePackageSourceToRegisteredSources ();
+ var package1 = new FakePackage ("A", "0.1.0.0") { IsLatestVersion = false };
+ var package2 = new FakePackage ("A", "0.2.0.0");
+ var packages = new FakePackage[] {
+ package1, package2
+ };
+ registeredPackageRepositories.FakeActiveRepository.FakePackages.AddRange (packages);
+ var recentPackage = new FakePackage ("A", "0.2.0.0") {
+ Description = "A -version"
+ };
+ recentPackageRepository.AddPackage (recentPackage);
+ SearchForAllPackageVersions ("a");
+
+ viewModel.ReadPackages ();
+ CompleteReadPackagesTask ();
+
+ var expectedPackages = new FakePackage[] {
+ package2, package1
+ };
+ PackageCollectionAssert.AreEqual (expectedPackages, viewModel.PackageViewModels);
+ }
+
+ [Test]
+ public void ReadPackages_SearchForAllPackageVersions_ShowVersionInsteadOfDownloadCountIsTrueForEachPackageViewModel ()
+ {
+ CreateViewModel ();
+ AddOnePackageSourceToRegisteredSources ();
+ var package1 = new FakePackage ("A", "0.1.0.0") { IsLatestVersion = false };
+ var package2 = new FakePackage ("A", "0.2.0.0");
+ var packages = new FakePackage[] {
+ package1, package2
+ };
+ registeredPackageRepositories.FakeActiveRepository.FakePackages.AddRange (packages);
+ SearchForAllPackageVersions ("a");
+
+ viewModel.ReadPackages ();
+ CompleteReadPackagesTask ();
+
+ var expectedPackages = new FakePackage[] {
+ package2, package1
+ };
+ Assert.IsTrue (viewModel.PackageViewModels [0].ShowVersionInsteadOfDownloadCount);
+ Assert.IsTrue (viewModel.PackageViewModels [1].ShowVersionInsteadOfDownloadCount);
+ }
+
+ [Test]
+ public void ReadPackages_SearchForPackage_ShowVersionInsteadOfDownloadCountIsFalseForEachPackageViewModel ()
+ {
+ CreateViewModel ();
+ AddOnePackageSourceToRegisteredSources ();
+ var package1 = new FakePackage ("A", "0.1.0.0");
+ var package2 = new FakePackage ("B", "0.2.0.0");
+ var packages = new FakePackage[] {
+ package1, package2
+ };
+ registeredPackageRepositories.FakeActiveRepository.FakePackages.AddRange (packages);
+
+ viewModel.ReadPackages ();
+ CompleteReadPackagesTask ();
+
+ var expectedPackages = new FakePackage[] {
+ package2, package1
+ };
+ Assert.IsFalse (viewModel.PackageViewModels [0].ShowVersionInsteadOfDownloadCount);
+ Assert.IsFalse (viewModel.PackageViewModels [1].ShowVersionInsteadOfDownloadCount);
+ }
+
+ [Test]
+ public void ReadPackages_SearchForSinglePackageVersionWhenThreePackageVersionsAvailable_ShowsSinglePackagesWithSameIdAndSameVersion ()
+ {
+ CreateViewModel ();
+ AddOnePackageSourceToRegisteredSources ();
+ var package1 = new FakePackage ("A", "0.1.0.0") { IsLatestVersion = false };
+ var package2 = new FakePackage ("A", "0.3.0.0");
+ var package3 = new FakePackage ("A", "0.2.0.0") { IsLatestVersion = false };
+ var packages = new FakePackage[] {
+ package1, package2, package3
+ };
+ registeredPackageRepositories.FakeActiveRepository.FakePackages.AddRange (packages);
+ SearchForAllPackageVersions ("a", "0.2");
+
+ viewModel.ReadPackages ();
+ CompleteReadPackagesTask ();
+
+ var expectedPackages = new FakePackage[] {
+ package3
+ };
+ PackageCollectionAssert.AreEqual (expectedPackages, viewModel.PackageViewModels);
+ }
+
+ [Test]
+ public void ReadPackages_SearchForAllPackageVersionsUsingAsteriskWhenThreePackageVersionsAvailable_HasAllPackageVersions ()
+ {
+ CreateViewModel ();
+ AddOnePackageSourceToRegisteredSources ();
+ var package1 = new FakePackage ("A", "0.1.0.0") { IsLatestVersion = false };
+ var package2 = new FakePackage ("A", "0.3.0.0");
+ var package3 = new FakePackage ("A", "0.2.0.0") { IsLatestVersion = false };
+ var packages = new FakePackage[] {
+ package1, package2, package3
+ };
+ registeredPackageRepositories.FakeActiveRepository.FakePackages.AddRange (packages);
+ SearchForAllPackageVersions ("a", "*");
+
+ viewModel.ReadPackages ();
+ CompleteReadPackagesTask ();
+
+ var expectedPackages = new FakePackage[] {
+ package2, package3, package1
+ };
+ PackageCollectionAssert.AreEqual (expectedPackages, viewModel.PackageViewModels);
+ }
+
+ [Test]
+ public void ReadPackages_SearchForAllOnePointZeroPackageVersionsUsingVersionOne_ReturnsAllOnePointZeroVersions ()
+ {
+ CreateViewModel ();
+ AddOnePackageSourceToRegisteredSources ();
+ var package1 = new FakePackage ("A", "1.0.0.0") { IsLatestVersion = false };
+ var package2 = new FakePackage ("A", "2.1.0.0");
+ var package3 = new FakePackage ("A", "2.0.0.0") { IsLatestVersion = false };
+ var package4 = new FakePackage ("A", "1.1.0.0") { IsLatestVersion = false };
+ var package5 = new FakePackage ("A", "1.9.0.0") { IsLatestVersion = false };
+ var package6 = new FakePackage ("A", "1.2.0.0") { IsLatestVersion = false };
+ var package7 = new FakePackage ("A", "1.3.0.0") { IsLatestVersion = false };
+ var package8 = new FakePackage ("A", "0.1.0.0") { IsLatestVersion = false };
+ var packages = new FakePackage[] {
+ package1, package2, package3, package4, package5, package6, package7, package8
+ };
+ registeredPackageRepositories.FakeActiveRepository.FakePackages.AddRange (packages);
+ SearchForAllPackageVersions ("a", "1");
+
+ viewModel.ReadPackages ();
+ CompleteReadPackagesTask ();
+
+ var expectedPackages = new FakePackage[] {
+ package5, package7, package6, package4, package1
+ };
+ PackageCollectionAssert.AreEqual (expectedPackages, viewModel.PackageViewModels);
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/BackgroundPackageActionRunnerTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/BackgroundPackageActionRunnerTests.cs
new file mode 100644
index 0000000000..b4e42e263d
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/BackgroundPackageActionRunnerTests.cs
@@ -0,0 +1,438 @@
+//
+// BackgroundPackageActionRunnerTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using NUnit.Framework;
+using NuGet;
+using MonoDevelop.Core;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class BackgroundPackageActionRunnerTests
+ {
+ TestableBackgroundPackageActionRunner runner;
+ FakeProgressMonitorFactory progressMonitorFactory;
+ PackageManagementEvents packageManagementEvents;
+ PackageManagementProgressProvider progressProvider;
+ List<IPackageAction> actions;
+ ProgressMonitorStatusMessage progressMessage;
+ FakeProgressMonitor progressMonitor;
+ FakePackageRepositoryFactoryEvents repositoryFactoryEvents;
+
+ void CreateRunner ()
+ {
+ actions = new List<IPackageAction> ();
+ progressMessage = new ProgressMonitorStatusMessage ("Status", "Success", "Error", "Warning");
+ packageManagementEvents = new PackageManagementEvents ();
+ progressMonitorFactory = new FakeProgressMonitorFactory ();
+ progressMonitor = progressMonitorFactory.ProgressMonitor;
+ repositoryFactoryEvents = new FakePackageRepositoryFactoryEvents ();
+ progressProvider = new PackageManagementProgressProvider (repositoryFactoryEvents, handler => {
+ handler.Invoke ();
+ });
+
+ runner = new TestableBackgroundPackageActionRunner (
+ progressMonitorFactory,
+ packageManagementEvents,
+ progressProvider);
+ }
+
+ void Run ()
+ {
+ RunWithoutBackgroundDispatch ();
+ runner.ExecuteBackgroundDispatch ();
+ }
+
+ void RunWithoutBackgroundDispatch ()
+ {
+ runner.Run (progressMessage, actions);
+ }
+
+ FakeInstallPackageAction AddInstallAction ()
+ {
+ var action = new FakeInstallPackageAction (new FakePackageManagementProject (), packageManagementEvents);
+ action.Operations = new List <PackageOperation> ();
+ action.Logger = new FakeLogger ();
+ actions.Add (action);
+ return action;
+ }
+
+ void AddInstallActionWithPowerShellScript (string packageId = "Test")
+ {
+ FakeInstallPackageAction action = AddInstallAction ();
+ var package = new FakePackage (packageId);
+ package.AddFile (@"tools\install.ps1");
+ var operations = new List<PackageOperation> ();
+ operations.Add (new PackageOperation (package, PackageAction.Install));
+ action.Operations = operations;
+ action.Package = package;
+ }
+
+ void AddInstallActionWithLicenseToAccept (string packageId = "Test")
+ {
+ FakeInstallPackageAction action = AddInstallAction ();
+ var package = new FakePackage (packageId) {
+ RequireLicenseAcceptance = true
+ };
+ var operations = new List<PackageOperation> ();
+ operations.Add (new PackageOperation (package, PackageAction.Install));
+ action.Operations = operations;
+ action.Package = package;
+ }
+
+ void AddInstallActionWithMissingPackageId (string packageId = "Unknown")
+ {
+ var action = new InstallPackageAction (new FakePackageManagementProject (), packageManagementEvents);
+ action.PackageId = packageId;
+ actions.Add (action);
+ }
+
+ void AddInstallActionWithCustomExecuteAction (Action executeAction)
+ {
+ FakeInstallPackageAction action = AddInstallAction ();
+ action.ExecuteAction = executeAction;
+ }
+
+ FakeUninstallPackageAction AddUninstallAction ()
+ {
+ var action = new FakeUninstallPackageAction (new FakePackageManagementProject ());
+ action.Package = new FakePackage ();
+ action.Logger = new FakeLogger ();
+ actions.Add (action);
+ return action;
+ }
+
+ [Test]
+ public void Run_OneInstallActionAndOneUninstallActionAndRunNotCompleted_InstallActionMarkedAsPending ()
+ {
+ CreateRunner ();
+ InstallPackageAction expectedAction = AddInstallAction ();
+ AddUninstallAction ();
+
+ RunWithoutBackgroundDispatch ();
+
+ Assert.AreEqual (expectedAction, runner.PendingInstallActions.Single ());
+ }
+
+ [Test]
+ public void Run_OneInstallActionAndRunNotCompleted_PackageOperationsStartedEventRaisedAfterInstallActionMarkedAsPending ()
+ {
+ CreateRunner ();
+ InstallPackageAction expectedAction = AddInstallAction ();
+ List<InstallPackageAction> actions = null;
+ packageManagementEvents.PackageOperationsStarting += (sender, e) => {
+ actions = runner.PendingInstallActions.ToList ();
+ };
+
+ RunWithoutBackgroundDispatch ();
+
+ Assert.AreEqual (expectedAction, actions.Single ());
+ }
+
+ [Test]
+ public void Run_OneInstallAction_ProgressMonitorCreatedWithInitialProgressStatus ()
+ {
+ CreateRunner ();
+ AddInstallAction ();
+
+ Run ();
+
+ Assert.AreEqual ("Status", progressMonitorFactory.StatusText);
+ }
+
+ [Test]
+ public void Run_OneInstallAction_PackageOperationsFinishedEventRaisedAfterPendingInstallActionsRemoved ()
+ {
+ CreateRunner ();
+ AddInstallAction ();
+ List<InstallPackageAction> actions = null;
+ packageManagementEvents.PackageOperationsFinished += (sender, e) => {
+ actions = runner.PendingInstallActions.ToList ();
+ };
+
+ Run ();
+
+ Assert.AreEqual (0, actions.Count);
+ }
+
+ [Test]
+ public void Run_OneInstallAction_ProgressMonitorDisposed ()
+ {
+ CreateRunner ();
+ AddInstallAction ();
+
+ Run ();
+
+ Assert.IsTrue (progressMonitor.IsDisposed);
+ }
+
+ [Test]
+ public void Run_TwoActions_BeginsProgressMonitorTaskWithTwoItems ()
+ {
+ CreateRunner ();
+ AddInstallAction ();
+ AddUninstallAction ();
+
+ Run ();
+
+ Assert.AreEqual (2, progressMonitor.BeginTaskTotalWork);
+ }
+
+ [Test]
+ public void Run_OneAction_ProgressMonitorEndTaskCalled ()
+ {
+ CreateRunner ();
+ AddInstallAction ();
+
+ Run ();
+
+ Assert.IsTrue (progressMonitor.IsTaskEnded);
+ }
+
+ [Test]
+ public void Run_TwoActions_BothActionsExecuted ()
+ {
+ CreateRunner ();
+ FakeInstallPackageAction action1 = AddInstallAction ();
+ FakeUninstallPackageAction action2 = AddUninstallAction ();
+
+ Run ();
+
+ Assert.IsTrue (action1.IsExecuteCalled);
+ Assert.IsTrue (action2.IsExecuted);
+ }
+
+ [Test]
+ public void Run_TwoActions_ProgressStepCalledTwice ()
+ {
+ CreateRunner ();
+ AddInstallAction ();
+ AddUninstallAction ();
+
+ Run ();
+
+ Assert.AreEqual (2, progressMonitor.StepCalledCount);
+ Assert.AreEqual (2, progressMonitor.TotalStepWork);
+ }
+
+ [Test]
+ public void Run_OneActionSuccessfully_SuccessReportedToProgressMonitor ()
+ {
+ CreateRunner ();
+ AddInstallAction ();
+
+ Run ();
+
+ Assert.AreEqual ("Success", progressMonitor.ReportedSuccessMessage);
+ }
+
+ [Test]
+ public void Run_OneInstallActionWithPowerShellScripts_WarningReportedToProgressMonitor ()
+ {
+ CreateRunner ();
+ AddInstallActionWithPowerShellScript ();
+
+ Run ();
+
+ Assert.AreEqual ("Warning", progressMonitor.ReportedWarningMessage);
+ }
+
+ [Test]
+ public void Run_OneInstallActionWithPowerShellScripts_WarningMessageLoggedInPackageConsole ()
+ {
+ CreateRunner ();
+ AddInstallActionWithPowerShellScript ("Test");
+
+ Run ();
+
+ progressMonitor.AssertMessageIsLogged ("Test Package contains PowerShell scripts which will not be run.");
+ }
+
+ [Test]
+ public void Run_OneInstallActionWithLicenseToAccept_WarningReportedToProgressMonitor ()
+ {
+ CreateRunner ();
+ AddInstallActionWithLicenseToAccept ();
+
+ Run ();
+
+ Assert.AreEqual ("Warning", progressMonitor.ReportedWarningMessage);
+ }
+
+ [Test]
+ public void Run_OneInstallActionWithLicenseToAccept_WarningMessageLoggedInPackageConsole ()
+ {
+ CreateRunner ();
+ AddInstallActionWithLicenseToAccept ("Test");
+
+ Run ();
+
+ progressMonitor.AssertMessageIsLogged ("The Test package has a license agreement");
+ }
+
+ [Test]
+ public void Run_OneInstallActionWithMissingPackageId_ErrorReportedToProgressMonitor ()
+ {
+ CreateRunner ();
+ AddInstallActionWithMissingPackageId ("Unknown");
+
+ Run ();
+
+ Assert.AreEqual ("Error", progressMonitor.ReportedErrorMessage);
+ }
+
+ [Test]
+ public void Run_OneInstallActionWithMissingPackageId_ErrorLoggedInPackageConsole ()
+ {
+ CreateRunner ();
+ AddInstallActionWithMissingPackageId ("Unknown");
+
+ Run ();
+
+ progressMonitor.AssertMessageIsLogged ("Unable to find package 'Unknown'.");
+ }
+
+ [Test]
+ public void Run_OneInstallActionWithMissingPackageId_PackageOperationsFinishedEventFired ()
+ {
+ CreateRunner ();
+ AddInstallActionWithMissingPackageId ("Unknown");
+ bool eventFired = false;
+ packageManagementEvents.PackageOperationsFinished += (sender, e) => {
+ eventFired = true;
+ };
+
+ Run ();
+
+ Assert.IsTrue (eventFired);
+ }
+
+ [Test]
+ public void Run_OneInstallActionWithMissingPackageId_PackageOperationErrorEventFired ()
+ {
+ CreateRunner ();
+ AddInstallActionWithMissingPackageId ("Unknown");
+ string exceptionMessage = null;
+ packageManagementEvents.PackageOperationError += (sender, e) => {
+ exceptionMessage = e.Exception.Message;
+ };
+
+ Run ();
+
+ Assert.AreEqual ("Unable to find package 'Unknown'.", exceptionMessage);
+ }
+
+ [Test]
+ public void Run_OneInstallActionWithMissingPackageId_PackageConsoleDisplayedDueToError ()
+ {
+ CreateRunner ();
+ AddInstallActionWithMissingPackageId ("Unknown");
+
+ Run ();
+
+ Assert.IsTrue (runner.EventsMonitor.IsPackageConsoleShown);
+ Assert.AreEqual (progressMonitor, runner.EventsMonitor.ProgressMonitorPassedToShowPackageConsole);
+ }
+
+ [Test]
+ public void Run_OneInstallActionWithMissingPackageId_InstallPackageOperationsRemovedFromPendingListWhenPackageOperationErrorEventFired ()
+ {
+ CreateRunner ();
+ AddInstallActionWithMissingPackageId ("Unknown");
+ int pendingInstallActionsCount = -1;
+ packageManagementEvents.PackageOperationError += (sender, e) => {
+ pendingInstallActionsCount = runner.PendingInstallActions.Count ();
+ };
+
+ Run ();
+
+ Assert.AreEqual (0, pendingInstallActionsCount);
+ }
+
+ [Test]
+ public void Run_ActionLogsPackageOperationMessage_ProgressMonitorLogsMessage ()
+ {
+ CreateRunner ();
+ AddInstallActionWithCustomExecuteAction (() => {
+ packageManagementEvents.OnPackageOperationMessageLogged (MessageLevel.Info, "Message");
+ });
+
+ Run ();
+
+ progressMonitor.AssertMessageIsLogged ("Message");
+ }
+
+ [Test]
+ public void Run_ActionChangesTwoFiles_FileServiceNotifiedOfFileChanges ()
+ {
+ CreateRunner ();
+ string file1 = @"d:\projects\MyProject\packages.config".ToNativePath ();
+ string file2 = @"d:\projects\MyProject\Scripts\jquery.js".ToNativePath ();
+ AddInstallActionWithCustomExecuteAction (() => {
+ packageManagementEvents.OnFileChanged (file1);
+ packageManagementEvents.OnFileChanged (file2);
+ });
+
+ Run ();
+
+ List<FilePath> filesChanged = runner.EventsMonitor.FilesChanged;
+ Assert.AreEqual (2, filesChanged.Count);
+ Assert.That (filesChanged, Contains.Item (new FilePath (file1)));
+ Assert.That (filesChanged, Contains.Item (new FilePath (file2)));
+ }
+
+ [Test]
+ public void Run_ActionDownloadsTwoPackages_DownloadingMessageLoggedOnceForEachDownloadOperationByProgressMonitor ()
+ {
+ CreateRunner ();
+ AddInstallActionWithCustomExecuteAction (() => {
+ var repository = new FakePackageRepository ();
+ repositoryFactoryEvents.RaiseRepositoryCreatedEvent (new PackageRepositoryFactoryEventArgs (repository));
+
+ var progress = new ProgressEventArgs ("Download1", 100);
+ repository.RaiseProgressAvailableEvent (progress);
+
+ progress = new ProgressEventArgs ("Download2", 50);
+ repository.RaiseProgressAvailableEvent (progress);
+
+ progress = new ProgressEventArgs ("Download2", 100);
+ repository.RaiseProgressAvailableEvent (progress);
+ });
+
+ Run ();
+
+ progressMonitor.AssertMessageIsLogged ("Download1");
+ progressMonitor.AssertMessageIsLogged ("Download2");
+ progressMonitor.AssertMessageIsNotLogged ("Download2" + Environment.NewLine + "Download2");
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/DelegateCommandTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/DelegateCommandTests.cs
new file mode 100644
index 0000000000..eee4b6f1da
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/DelegateCommandTests.cs
@@ -0,0 +1,94 @@
+//
+// DelegateCommandTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class DelegateCommandTests
+ {
+ [Test]
+ public void CanExecute_NoCanExecuteDelegateDefined_ReturnsTrue ()
+ {
+ Action<object> execute = delegate { };
+ var command = new DelegateCommand (execute);
+
+ bool result = command.CanExecute (null);
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void CanExecute_CanExecuteDelegateDefinedToReturnFalse_ReturnsFalse ()
+ {
+ Action<object> execute = delegate { };
+ Predicate<object> canExecute = delegate {
+ return false;
+ };
+ var command = new DelegateCommand (execute, canExecute);
+
+ bool result = command.CanExecute (null);
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void CanExecute_CanExecuteDelegateDefined_ParameterPassedToCanExecuteDelegate ()
+ {
+ Action<object> execute = delegate { };
+
+ object parameterPassed = null;
+ Predicate<object> canExecute = param => {
+ parameterPassed = param;
+ return true;
+ };
+ var command = new DelegateCommand (execute, canExecute);
+
+ object expectedParameter = new object ();
+ bool result = command.CanExecute (expectedParameter);
+
+ Assert.AreEqual (expectedParameter, parameterPassed);
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void Execute_ObjectPassedAsParameter_ParameterPassedToExecuteDelegate ()
+ {
+ object parameterPassed = null;
+ Action<object> execute = param => parameterPassed = param;
+ var command = new DelegateCommand (execute);
+
+ object expectedParameter = new object ();
+ command.Execute (expectedParameter);
+
+ Assert.AreEqual (expectedParameter, parameterPassed);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/IPackageExtensionsTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/IPackageExtensionsTests.cs
new file mode 100644
index 0000000000..5113b3f35d
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/IPackageExtensionsTests.cs
@@ -0,0 +1,114 @@
+//
+// IPackageExtensionsTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class IPackageExtensionsTests
+ {
+ FakePackage package;
+
+ void CreatePackageWithSummary (string summary)
+ {
+ package = new FakePackage { Summary = summary };
+ }
+
+ void CreatePackageWithTitle (string title)
+ {
+ package = new FakePackage { Title = title };
+ }
+
+ [Test]
+ public void SummaryOrDescription_PackageHasSummary_ReturnsSummary ()
+ {
+ CreatePackageWithSummary ("summary");
+
+ string result = package.SummaryOrDescription ();
+
+ Assert.AreEqual ("summary", result);
+ }
+
+ [Test]
+ public void SummaryOrDescription_PackageHasDescriptionButNullSummary_ReturnsDescription ()
+ {
+ CreatePackageWithSummary (null);
+ package.Description = "description";
+
+ string result = package.SummaryOrDescription ();
+
+ Assert.AreEqual ("description", result);
+ }
+
+ [Test]
+ public void SummaryOrDescription_PackageHasDescriptionButEmptySummary_ReturnsDescription ()
+ {
+ CreatePackageWithSummary (String.Empty);
+ package.Description = "description";
+
+ string result = package.SummaryOrDescription ();
+
+ Assert.AreEqual ("description", result);
+ }
+
+ [Test]
+ public void GetName_PackageHasTitle_ReturnsTitle ()
+ {
+ CreatePackageWithTitle ("title");
+
+ string result = package.GetName ();
+
+ Assert.AreEqual ("title", result);
+ }
+
+ [Test]
+ public void GetName_PackageHasNullTitle_ReturnsPackageId ()
+ {
+ CreatePackageWithTitle (null);
+ package.Id = "Id";
+
+ string result = package.GetName ();
+
+ Assert.AreEqual ("Id", result);
+ }
+
+ [Test]
+ public void GetName_PackageHasEmptyStringTitle_ReturnsPackageId ()
+ {
+ CreatePackageWithTitle (String.Empty);
+ package.Id = "Id";
+
+ string result = package.GetName ();
+
+ Assert.AreEqual ("Id", result);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/InstallPackageActionTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/InstallPackageActionTests.cs
new file mode 100644
index 0000000000..da59bdb7c8
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/InstallPackageActionTests.cs
@@ -0,0 +1,499 @@
+//
+// InstallPackageActionTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using ICSharpCode.PackageManagement;
+using NuGet;
+using NUnit.Framework;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class InstallPackageActionTests
+ {
+ PackageManagementEvents packageManagementEvents;
+ FakePackageManagementProject fakeProject;
+ InstallPackageAction action;
+ InstallPackageHelper installPackageHelper;
+
+ void CreateAction ()
+ {
+ packageManagementEvents = new PackageManagementEvents ();
+ fakeProject = new FakePackageManagementProject ();
+ action = new InstallPackageAction (fakeProject, packageManagementEvents);
+ installPackageHelper = new InstallPackageHelper (action);
+ }
+
+ FakePackage AddOnePackageToProjectSourceRepository (string packageId)
+ {
+ return fakeProject.FakeSourceRepository.AddFakePackage (packageId);
+ }
+
+ void AddInstallOperationWithFile (string fileName)
+ {
+ action.Operations =
+ PackageOperationHelper.CreateListWithOneInstallOperationWithFile (fileName);
+ }
+
+ [Test]
+ public void Execute_PackageIsSet_InstallsPackageIntoProject ()
+ {
+ CreateAction ();
+ installPackageHelper.InstallTestPackage ();
+
+ var actualPackage = fakeProject.PackagePassedToInstallPackage;
+ var expectedPackage = installPackageHelper.TestPackage;
+
+ Assert.AreEqual (expectedPackage, actualPackage);
+ }
+
+ [Test]
+ public void Execute_PackageIsSet_InstallsPackageUsingPackageOperations ()
+ {
+ CreateAction ();
+ var expectedOperations = new List<PackageOperation> ();
+ installPackageHelper.PackageOperations = expectedOperations;
+ installPackageHelper.InstallTestPackage ();
+
+ var actualOperations = fakeProject.PackageOperationsPassedToInstallPackage;
+
+ Assert.AreEqual (expectedOperations, actualOperations);
+ }
+
+ [Test]
+ public void Execute_PackageIsSet_InstallsPackageNotIgnoringDependencies ()
+ {
+ CreateAction ();
+ installPackageHelper.IgnoreDependencies = false;
+ installPackageHelper.InstallTestPackage ();
+
+ bool ignored = fakeProject.IgnoreDependenciesPassedToInstallPackage;
+
+ Assert.IsFalse (ignored);
+ }
+
+ [Test]
+ public void Execute_PackageIsSetAndIgnoreDependenciesIsTrue_InstallsPackageIgnoringDependencies ()
+ {
+ CreateAction ();
+ installPackageHelper.IgnoreDependencies = true;
+ installPackageHelper.InstallTestPackage ();
+
+ bool ignored = fakeProject.IgnoreDependenciesPassedToInstallPackage;
+
+ Assert.IsTrue (ignored);
+ }
+
+ [Test]
+ public void Execute_PackageIsSetAndAllowPrereleaseVersionsIsTrue_InstallsPackageAllowingPrereleaseVersions ()
+ {
+ CreateAction ();
+ installPackageHelper.AllowPrereleaseVersions = true;
+ installPackageHelper.InstallTestPackage ();
+
+ bool allowed = fakeProject.AllowPrereleaseVersionsPassedToInstallPackage;
+
+ Assert.IsTrue (allowed);
+ }
+
+ [Test]
+ public void Execute_PackageIsSetAndAllowPrereleaseVersionsIsFalse_InstallsPackageWithoutAllowingPrereleaseVersions ()
+ {
+ CreateAction ();
+ installPackageHelper.AllowPrereleaseVersions = false;
+ installPackageHelper.InstallTestPackage ();
+
+ bool allowed = fakeProject.AllowPrereleaseVersionsPassedToInstallPackage;
+
+ Assert.IsFalse (allowed);
+ }
+
+ [Test]
+ public void IgnoreDependencies_DefaultValue_IsFalse ()
+ {
+ CreateAction ();
+ Assert.IsFalse (action.IgnoreDependencies);
+ }
+
+ [Test]
+ public void AllowPrereleaseVersion_DefaultValue_IsFalse ()
+ {
+ CreateAction ();
+ Assert.IsFalse (action.AllowPrereleaseVersions);
+ }
+
+ [Test]
+ public void Execute_PackageAndPackageRepositoryPassed_PackageInstallNotificationRaisedWithInstalledPackage ()
+ {
+ CreateAction ();
+ IPackage actualPackage = null;
+ packageManagementEvents.ParentPackageInstalled += (sender, e) => actualPackage = e.Package;
+ installPackageHelper.InstallTestPackage ();
+
+ IPackage expectedPackage = installPackageHelper.TestPackage;
+
+ Assert.AreEqual (expectedPackage, actualPackage);
+ }
+
+ [Test]
+ public void Execute_PackageIdAndSourceAndProjectPassed_PackageOperationsRetrievedFromProject ()
+ {
+ CreateAction ();
+ fakeProject.AddFakeInstallOperation ();
+ fakeProject.AddFakePackageToSourceRepository ("PackageId");
+ installPackageHelper.InstallPackageById ("PackageId");
+
+ var actualOperations = action.Operations;
+ var expectedOperations = fakeProject.FakeInstallOperations;
+
+ Assert.AreEqual (expectedOperations, actualOperations);
+ }
+
+ [Test]
+ public void Execute_PackageSpecifiedButNoPackageOperations_PackageUsedWhenPackageOperationsRetrievedForProject ()
+ {
+ CreateAction ();
+ installPackageHelper.PackageOperations = null;
+ installPackageHelper.InstallTestPackage ();
+
+ var expectedPackage = installPackageHelper.TestPackage;
+
+ var actualPackage = fakeProject.PackagePassedToGetInstallPackageOperations;
+
+ Assert.AreEqual (expectedPackage, actualPackage);
+ }
+
+ [Test]
+ public void Execute_PackageIdAndSourceAndProjectPassedAndIgnoreDependenciesIsTrue_DependenciesIgnoredWhenGettingPackageOperations ()
+ {
+ CreateAction ();
+ fakeProject.AddFakePackageToSourceRepository ("PackageId");
+ installPackageHelper.IgnoreDependencies = true;
+ installPackageHelper.InstallPackageById ("PackageId");
+
+ bool result = fakeProject.IgnoreDependenciesPassedToGetInstallPackageOperations;
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void Execute_PackageIdAndSourceAndProjectPassedAndAllowPrereleaseVersionsIsTrue_PrereleaseVersionsAllowedWhenGettingPackageOperations ()
+ {
+ CreateAction ();
+ fakeProject.AddFakePackageToSourceRepository ("PackageId");
+ installPackageHelper.AllowPrereleaseVersions = true;
+ installPackageHelper.InstallPackageById ("PackageId");
+
+ bool result = fakeProject.AllowPrereleaseVersionsPassedToGetInstallPackageOperations;
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void InstallPackage_PackageIdAndSourceAndProjectPassedAndIgnoreDependenciesIsFalse_DependenciesNotIgnoredWhenGettingPackageOperations ()
+ {
+ CreateAction ();
+ fakeProject.AddFakePackageToSourceRepository ("PackageId");
+ installPackageHelper.IgnoreDependencies = false;
+ installPackageHelper.InstallPackageById ("PackageId");
+
+ bool result = fakeProject.IgnoreDependenciesPassedToGetInstallPackageOperations;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void Execute_PackageIdAndSourceAndProjectPassedAndAllowPrereleaseVersionsIsFalse_PrereleaseVersionsNotAllowedWhenGettingPackageOperations ()
+ {
+ CreateAction ();
+ fakeProject.AddFakePackageToSourceRepository ("PackageId");
+ installPackageHelper.AllowPrereleaseVersions = false;
+ installPackageHelper.InstallPackageById ("PackageId");
+
+ bool result = fakeProject.AllowPrereleaseVersionsPassedToGetInstallPackageOperations;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void Execute_VersionSpecified_VersionUsedWhenSearchingForPackage ()
+ {
+ CreateAction ();
+
+ var recentPackage = AddOnePackageToProjectSourceRepository ("PackageId");
+ recentPackage.Version = new SemanticVersion ("1.2.0");
+
+ var oldPackage = AddOnePackageToProjectSourceRepository ("PackageId");
+ oldPackage.Version = new SemanticVersion ("1.0.0");
+
+ var package = AddOnePackageToProjectSourceRepository ("PackageId");
+ var version = new SemanticVersion ("1.1.0");
+ package.Version = version;
+
+ installPackageHelper.Version = version;
+ installPackageHelper.InstallPackageById ("PackageId");
+
+ var actualPackage = fakeProject.PackagePassedToInstallPackage;
+
+ Assert.AreEqual (package, actualPackage);
+ }
+
+ [Test]
+ public void HasPackageScriptsToRun_OnePackageInOperationsHasInitPowerShellScript_ReturnsTrue ()
+ {
+ CreateAction ();
+ fakeProject.AddFakePackageToSourceRepository ("Test");
+ action.PackageId = "Test";
+ AddInstallOperationWithFile (@"tools\init.ps1".ToNativePath ());
+
+ bool hasPackageScripts = action.HasPackageScriptsToRun ();
+
+ Assert.IsTrue (hasPackageScripts);
+ }
+
+ [Test]
+ public void HasPackageScriptsToRun_OnePackageInOperationsHasNoFiles_ReturnsFalse ()
+ {
+ CreateAction ();
+ fakeProject.AddFakePackageToSourceRepository ("Test");
+ action.PackageId = "Test";
+ action.Operations = new List<PackageOperation> ();
+
+ bool hasPackageScripts = action.HasPackageScriptsToRun ();
+
+ Assert.IsFalse (hasPackageScripts);
+ }
+
+ [Test]
+ public void HasPackageScriptsToRun_OnePackageInOperationsHasInitPowerShellScriptInUpperCase_ReturnsTrue ()
+ {
+ CreateAction ();
+ fakeProject.AddFakePackageToSourceRepository ("Test");
+ action.PackageId = "Test";
+ AddInstallOperationWithFile (@"tools\INIT.PS1".ToNativePath ());
+
+ bool hasPackageScripts = action.HasPackageScriptsToRun ();
+
+ Assert.IsTrue (hasPackageScripts);
+ }
+
+ [Test]
+ public void HasPackageScriptsToRun_OnePackageInOperationsHasInstallPowerShellScriptInUpperCase_ReturnsTrue ()
+ {
+ CreateAction ();
+ fakeProject.AddFakePackageToSourceRepository ("Test");
+ action.PackageId = "Test";
+ AddInstallOperationWithFile (@"tools\INSTALL.PS1".ToNativePath ());
+
+ bool hasPackageScripts = action.HasPackageScriptsToRun ();
+
+ Assert.IsTrue (hasPackageScripts);
+ }
+
+ [Test]
+ public void HasPackageScriptsToRun_OnePackageInOperationsHasUninstallPowerShellScriptInUpperCase_ReturnsTrue ()
+ {
+ CreateAction ();
+ fakeProject.AddFakePackageToSourceRepository ("Test");
+ action.PackageId = "Test";
+ AddInstallOperationWithFile (@"tools\UNINSTALL.PS1".ToNativePath ());
+
+ bool hasPackageScripts = action.HasPackageScriptsToRun ();
+
+ Assert.IsTrue (hasPackageScripts);
+ }
+
+ [Test]
+ public void HasPackageScriptsToRun_ProjectHasOnePackageOperation_DoesNotThrowNullReferenceException ()
+ {
+ CreateAction ();
+ FakePackage package = fakeProject.FakeSourceRepository.AddFakePackageWithVersion ("Test", "1.0");
+ var operation = new FakePackageOperation (package, PackageAction.Install);
+ action.PackageId = package.Id;
+ action.PackageVersion = package.Version;
+ fakeProject.FakeInstallOperations.Add (operation);
+
+ Assert.DoesNotThrow (() => action.HasPackageScriptsToRun ());
+ }
+
+ [Test]
+ public void HasPackageScriptsToRun_ProjectHasOnePackageOperation_PackageLocated ()
+ {
+ CreateAction ();
+ FakePackage expectedPackage = fakeProject.FakeSourceRepository.AddFakePackageWithVersion ("Test", "1.0");
+ var operation = new FakePackageOperation (expectedPackage, PackageAction.Install);
+ action.PackageId = expectedPackage.Id;
+ action.PackageVersion = expectedPackage.Version;
+ fakeProject.FakeInstallOperations.Add (operation);
+
+ action.HasPackageScriptsToRun ();
+
+ IPackage actualPackage = action.Package;
+
+ Assert.AreEqual (expectedPackage, actualPackage);
+ }
+
+ [Test]
+ public void Execute_InstallPrereleasePackageAndAllowPreleasePackagesIsFalse_DoesNotFindPreleasePackage ()
+ {
+ CreateAction ();
+ fakeProject.FakeSourceRepository.AddFakePackageWithVersion ("Prerelease", "1.0-beta");
+ action.PackageId = "Prerelease";
+ action.AllowPrereleaseVersions = false;
+
+ Exception ex = Assert.Throws (typeof(ApplicationException), () => action.Execute ());
+
+ Assert.AreEqual ("Unable to find package 'Prerelease'.", ex.Message);
+ }
+
+ [Test]
+ public void Execute_InstallPrereleasePackageAndAllowPreleasePackagesIsTrue_InstallsPackageIntoProject ()
+ {
+ CreateAction ();
+ FakePackage expectedPackage = fakeProject.FakeSourceRepository.AddFakePackageWithVersion ("Prerelease", "1.0-beta");
+ action.PackageId = "Prerelease";
+ action.AllowPrereleaseVersions = true;
+
+ action.Execute ();
+
+ IPackage actualPackage = fakeProject.PackagePassedToInstallPackage;
+ Assert.AreEqual (expectedPackage, actualPackage);
+ }
+
+ [Test]
+ public void Execute_InstallUnlistedPackageWithoutVersion_DoesNotInstallPackageIntoProject ()
+ {
+ CreateAction ();
+ FakePackage expectedPackage = fakeProject.FakeSourceRepository.AddFakePackageWithVersion ("test", "1.0");
+ expectedPackage.Listed = false;
+ action.PackageId = "test";
+
+ Exception ex = Assert.Throws (typeof(ApplicationException), () => action.Execute ());
+
+ Assert.AreEqual ("Unable to find package 'test'.", ex.Message);
+ }
+
+ [Test]
+ public void Execute_PackageIdSpecifiedButDoesNotExistInRepository_ExceptionThrown ()
+ {
+ CreateAction ();
+ action.PackageId = "UnknownId";
+
+ Exception ex = Assert.Throws (typeof(ApplicationException), () => action.Execute ());
+
+ Assert.AreEqual ("Unable to find package 'UnknownId'.", ex.Message);
+ }
+
+ [Test]
+ public void Execute_ProjectHasOnePackageInstallOperationThatHasALicenseToBeAccepted_AcceptLicensesEventRaised ()
+ {
+ CreateAction ();
+ FakePackage expectedPackage = fakeProject.FakeSourceRepository.AddFakePackageWithVersion ("Test", "1.0");
+ expectedPackage.RequireLicenseAcceptance = true;
+ var expectedPackages = new IPackage [] { expectedPackage };
+ var operation = new FakePackageOperation (expectedPackage, PackageAction.Install);
+ action.PackageId = expectedPackage.Id;
+ action.PackageVersion = expectedPackage.Version;
+ fakeProject.FakeInstallOperations.Add (operation);
+ List<IPackage> actualPackages = null;
+ packageManagementEvents.AcceptLicenses += (sender, e) => {
+ e.IsAccepted = true;
+ actualPackages = e.Packages.ToList ();
+ };
+
+ action.Execute ();
+
+ PackageCollectionAssert.AreEqual (expectedPackages, actualPackages);
+ }
+
+ [Test]
+ public void Execute_ProjectHasOnePackageInstallOperationThatHasALicenseToBeAcceptedButPackageInstalledAlready_NoAcceptLicensesEventIsRaised ()
+ {
+ CreateAction ();
+ FakePackage expectedPackage = fakeProject.FakeSourceRepository.AddFakePackageWithVersion ("Test", "1.0");
+ expectedPackage.RequireLicenseAcceptance = true;
+ var expectedPackages = new IPackage [] { expectedPackage };
+ var operation = new FakePackageOperation (expectedPackage, PackageAction.Install);
+ action.PackageId = expectedPackage.Id;
+ action.PackageVersion = expectedPackage.Version;
+ fakeProject.FakeInstallOperations.Add (operation);
+ fakeProject.FakePackages.Add (expectedPackage);
+ bool acceptLicensesEventRaised = false;
+ packageManagementEvents.AcceptLicenses += (sender, e) => {
+ acceptLicensesEventRaised = true;
+ };
+
+ action.Execute ();
+
+ Assert.IsFalse (acceptLicensesEventRaised);
+ }
+
+ [Test]
+ public void Execute_ProjectHasOnePackageInstallOperationThatHasALicenseToBeAcceptedAndLicensesNotAccepted_ExceptionThrown ()
+ {
+ CreateAction ();
+ FakePackage expectedPackage = fakeProject.FakeSourceRepository.AddFakePackageWithVersion ("Test", "1.0");
+ expectedPackage.RequireLicenseAcceptance = true;
+ var expectedPackages = new IPackage [] { expectedPackage };
+ var operation = new FakePackageOperation (expectedPackage, PackageAction.Install);
+ action.PackageId = expectedPackage.Id;
+ action.PackageVersion = expectedPackage.Version;
+ fakeProject.FakeInstallOperations.Add (operation);
+ packageManagementEvents.AcceptLicenses += (sender, e) => {
+ e.IsAccepted = false;
+ };
+
+ Exception ex = Assert.Throws (typeof(ApplicationException), () => action.Execute ());
+
+ Assert.AreEqual ("Licenses not accepted.", ex.Message);
+ }
+
+ [Test]
+ public void Execute_PackageBeingInstalledHasPowerShellScripts_WarningAboutPowerShellScriptsIsLogged ()
+ {
+ CreateAction ();
+ FakePackage expectedPackage = fakeProject.FakeSourceRepository.AddFakePackageWithVersion ("Test", "1.0");
+ expectedPackage.AddFile (@"tools\init.ps1");
+ var operation = new FakePackageOperation (expectedPackage, PackageAction.Install);
+ action.PackageId = expectedPackage.Id;
+ action.PackageVersion = expectedPackage.Version;
+ fakeProject.FakeInstallOperations.Add (operation);
+ string messageLogged = null;
+ packageManagementEvents.PackageOperationMessageLogged += (sender, e) => {
+ if (e.Message.Level == MessageLevel.Warning) {
+ messageLogged = e.Message.ToString ();
+ }
+ };
+
+ action.Execute ();
+
+ Assert.AreEqual ("Test Package contains PowerShell scripts which will not be run.", messageLogged);
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MSBuildProjectExtensionsTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MSBuildProjectExtensionsTests.cs
index 1251ff766a..78593251e5 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MSBuildProjectExtensionsTests.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MSBuildProjectExtensionsTests.cs
@@ -12,64 +12,64 @@ namespace MonoDevelop.PackageManagement.Tests
public class MSBuildProjectExtensionsTests
{
MSBuildProject project;
-
+
void CreateProject ()
{
project = new MSBuildProject ();
}
-
+
void AddImportIfMissingAtBottom (string importFile, string condition = "")
{
project.AddImportIfMissing (importFile, ProjectImportLocation.Bottom, condition);
}
-
+
void AddImportIfMissingAtTop (string importFile, string condition = "")
{
project.AddImportIfMissing (importFile, ProjectImportLocation.Top, condition);
}
-
+
void AssertLastMSBuildImportElementHasProjectAttributeValue (string expectedAttributeValue)
{
XmlElement import = GetLastMSBuildImportElement ();
string actualAttributeValue = import.GetAttribute ("Project");
Assert.AreEqual (expectedAttributeValue, actualAttributeValue);
}
-
+
void AssertLastMSBuildImportElementHasCondition (string expectedCondition)
{
XmlElement import = GetLastMSBuildImportElement ();
string actualCondition = import.GetAttribute ("Condition");
Assert.AreEqual (expectedCondition, actualCondition);
}
-
- XmlElement GetLastMSBuildImportElement()
+
+ XmlElement GetLastMSBuildImportElement ()
{
- var import = project.doc.DocumentElement.LastChild as XmlElement;
+ var import = project.Document.DocumentElement.LastChild as XmlElement;
Assert.AreEqual (import.LocalName, "Import");
return import;
}
-
+
void AssertFirstMSBuildImportElementHasProjectAttributeValue (string expectedAttributeValue)
{
XmlElement import = GetFirstMSBuildImportElement ();
string actualAttributeValue = import.GetAttribute ("Project");
Assert.AreEqual (expectedAttributeValue, actualAttributeValue);
}
-
- XmlElement GetFirstMSBuildImportElement()
+
+ XmlElement GetFirstMSBuildImportElement ()
{
- var import = project.doc.DocumentElement.FirstChild as XmlElement;
+ var import = project.Document.DocumentElement.FirstChild as XmlElement;
Assert.AreEqual (import.LocalName, "Import");
return import;
}
-
+
void AssertFirstMSBuildImportElementHasCondition (string expectedCondition)
{
XmlElement import = GetFirstMSBuildImportElement ();
string actualCondition = import.GetAttribute ("Condition");
Assert.AreEqual (expectedCondition, actualCondition);
}
-
+
[Test]
public void AddImportIfMissing_RelativeImportFilePathAndBottomOfProject_ImportAddedAsLastImportInProject ()
{
@@ -80,7 +80,7 @@ namespace MonoDevelop.PackageManagement.Tests
AssertLastMSBuildImportElementHasProjectAttributeValue (@"..\packages\Foo.0.1\build\Foo.targets");
}
-
+
[Test]
public void AddImportIfMissing_AddImportToBottomOfProjectWithCondition_ImportAddedWithCondition ()
{
@@ -92,7 +92,7 @@ namespace MonoDevelop.PackageManagement.Tests
AssertLastMSBuildImportElementHasCondition (condition);
}
-
+
[Test]
public void ImportExists_ImportAlreadyExists_ReturnsTrue ()
{
@@ -103,7 +103,7 @@ namespace MonoDevelop.PackageManagement.Tests
Assert.IsTrue (exists);
}
-
+
[Test]
public void ImportExists_ImportDoesNotExist_ReturnsFalse ()
{
@@ -114,7 +114,7 @@ namespace MonoDevelop.PackageManagement.Tests
Assert.IsFalse (exists);
}
-
+
[Test]
public void ImportExists_DifferentImportExists_ReturnsFalse ()
{
@@ -125,9 +125,9 @@ namespace MonoDevelop.PackageManagement.Tests
Assert.IsFalse (exists);
}
-
+
[Test]
- public void AddImportIfMissing_AddSameImportTwice_ImportOnlyAddedOnceToProject()
+ public void AddImportIfMissing_AddSameImportTwice_ImportOnlyAddedOnceToProject ()
{
CreateProject ();
string import = @"packages\Foo.0.1\build\Foo.targets";
@@ -135,9 +135,9 @@ namespace MonoDevelop.PackageManagement.Tests
AddImportIfMissingAtBottom (import);
- Assert.AreEqual (1, project.doc.DocumentElement.ChildNodes.Count);
+ Assert.AreEqual (1, project.Document.DocumentElement.ChildNodes.Count);
}
-
+
[Test]
public void ImportExists_ImportExistsButtWithDifferentCase_ReturnsTrue ()
{
@@ -150,7 +150,7 @@ namespace MonoDevelop.PackageManagement.Tests
Assert.IsTrue (exists);
}
-
+
[Test]
public void RemoveImportIfExists_ImportAlreadyAddedToBottomOfProject_ImportRemoved ()
{
@@ -160,9 +160,9 @@ namespace MonoDevelop.PackageManagement.Tests
project.RemoveImportIfExists (import);
- Assert.AreEqual (0, project.doc.DocumentElement.ChildNodes.Count);
+ Assert.AreEqual (0, project.Document.DocumentElement.ChildNodes.Count);
}
-
+
[Test]
public void RemoveImportIfExists_ImportAlreadyWithDifferentCaseAddedToBottomOfProject_ImportRemoved ()
{
@@ -173,9 +173,9 @@ namespace MonoDevelop.PackageManagement.Tests
project.RemoveImportIfExists (import2);
- Assert.AreEqual (0, project.doc.DocumentElement.ChildNodes.Count);
+ Assert.AreEqual (0, project.Document.DocumentElement.ChildNodes.Count);
}
-
+
[Test]
public void AddImportIfMissing_AddToTopOfProject_ImportAddedAsFirstChildElement ()
{
@@ -187,7 +187,7 @@ namespace MonoDevelop.PackageManagement.Tests
AssertFirstMSBuildImportElementHasProjectAttributeValue (@"..\packages\Foo.0.1\build\Foo.targets");
}
-
+
[Test]
public void AddImportIfMissing_AddImportToTopOfProject_ImportAddedWithConditionThatChecksForExistenceOfTargetsFile ()
{
@@ -200,7 +200,7 @@ namespace MonoDevelop.PackageManagement.Tests
AssertFirstMSBuildImportElementHasCondition (condition);
}
-
+
[Test]
public void AddImportIfMissing_AddToTopOfProjectTwice_ImportAddedOnlyOnce ()
{
@@ -210,7 +210,7 @@ namespace MonoDevelop.PackageManagement.Tests
AddImportIfMissingAtTop (import);
- Assert.AreEqual (1, project.doc.DocumentElement.ChildNodes.Count);
+ Assert.AreEqual (1, project.Document.DocumentElement.ChildNodes.Count);
}
}
} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MonoDevelopPackageManagerFactoryTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MonoDevelopPackageManagerFactoryTests.cs
new file mode 100644
index 0000000000..921e216264
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MonoDevelopPackageManagerFactoryTests.cs
@@ -0,0 +1,141 @@
+//
+// SharpDevelopPackageManagerFactoryTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+using NuGet;
+using NUnit.Framework;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class MonoDevelopPackageManagerFactoryTests
+ {
+ SharpDevelopPackageManagerFactory factory;
+ IPackageManager packageManager;
+ FakePackageRepository fakePackageRepository;
+ FakeDotNetProject testProject;
+ PackageManagementOptions options;
+ FakePackageRepositoryFactory fakePackageRepositoryFactory;
+ FakeProjectSystemFactory fakeProjectSystemFactory;
+
+ void CreateFactory ()
+ {
+ options = new TestablePackageManagementOptions ();
+ fakePackageRepositoryFactory = new FakePackageRepositoryFactory ();
+ fakeProjectSystemFactory = new FakeProjectSystemFactory ();
+ factory = new SharpDevelopPackageManagerFactory (fakePackageRepositoryFactory, fakeProjectSystemFactory, options);
+ }
+
+ void CreateTestProject ()
+ {
+ testProject = ProjectHelper.CreateTestProject ();
+ var solution = new FakeSolution {
+ BaseDirectory = @"c:\projects\MyProject\".ToNativePath ()
+ };
+ testProject.ParentSolution = solution;
+ }
+
+ void CreatePackageManager ()
+ {
+ fakePackageRepository = new FakePackageRepository ();
+ packageManager = factory.CreatePackageManager (fakePackageRepository, testProject);
+ }
+
+ [Test]
+ public void CreatePackageManager_ProjectAndSolutionHaveDifferentFolders_PackageManagerLocalRepositoryIsSharedRepository ()
+ {
+ CreateFactory ();
+ CreateTestProject ();
+ CreatePackageManager ();
+ ISharedPackageRepository sharedRepository = packageManager.LocalRepository as ISharedPackageRepository;
+
+ Assert.IsNotNull (sharedRepository);
+ }
+
+ [Test]
+ public void CreatePackageManager_PackagesSolutionFolderDefinedInOptions_SharedLocalRepositoryFileSystemRootIsSolutionFolder ()
+ {
+ CreateFactory ();
+ CreateTestProject ();
+ options.PackagesDirectory = "MyPackages";
+ CreatePackageManager ();
+
+ string expectedRoot = @"c:\projects\MyProject\MyPackages".ToNativePath ();
+ string actualRoot = fakePackageRepositoryFactory.FileSystemPassedToCreateSharedRepository.Root;
+ Assert.AreEqual (expectedRoot, actualRoot);
+ }
+
+ [Test]
+ public void CreatePackageManager_PackagesSolutionFolderDefinedInOptions_SharedLocalRepositoryPackagePathResolverCreatedWithPackagesFolderInsideSolutionFolder ()
+ {
+ CreateFactory ();
+ CreateTestProject ();
+ options.PackagesDirectory = "MyPackages";
+ CreatePackageManager ();
+
+ FakePackage package = new FakePackage ("Test.Package");
+ package.Version = new SemanticVersion (1, 0, 0, 0);
+ string expectedDirectory = @"c:\projects\MyProject\MyPackages\Test.Package.1.0.0.0".ToNativePath ();
+ string actualDirectory =
+ fakePackageRepositoryFactory
+ .PathResolverPassedToCreateSharedRepository
+ .GetInstallPath (package);
+
+ Assert.AreEqual (expectedDirectory, actualDirectory);
+ }
+
+ [Test]
+ public void CreatePackageManager_PackagesSolutionFolderDefinedInOptions_LocalRepositoryFileSystemIsPackageManagerFileSystem ()
+ {
+ CreateFactory ();
+ CreateTestProject ();
+ CreatePackageManager ();
+
+ Assert.AreEqual (packageManager.FileSystem, fakePackageRepositoryFactory.FileSystemPassedToCreateSharedRepository);
+ }
+
+ [Test]
+ public void CreatePackageManager_PackagesSolutionFolderDefinedInOptions_PackageManagerPathResolverUsesPackagesFolderInsideSolutionFolder ()
+ {
+ CreateFactory ();
+ CreateTestProject ();
+ options.PackagesDirectory = "packages";
+ CreatePackageManager ();
+
+ var package = new FakePackage ("TestPackage", "1.0.0.0");
+
+ string expectedDirectory = @"c:\projects\MyProject\packages\TestPackage.1.0.0.0".ToNativePath ();
+
+ SharpDevelopPackageManager sharpDevelopPackageManager = packageManager as SharpDevelopPackageManager;
+ string actualDirectory = sharpDevelopPackageManager.PathResolver.GetInstallPath (package);
+
+ Assert.AreEqual (expectedDirectory, actualDirectory);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MonoDevelopPackageManagerTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MonoDevelopPackageManagerTests.cs
new file mode 100644
index 0000000000..beb98f08ff
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MonoDevelopPackageManagerTests.cs
@@ -0,0 +1,1139 @@
+//
+// SharpDevelopPackageManagerTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using NuGet;
+using NUnit.Framework;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class MonoDevelopPackageManagerTests
+ {
+ SharpDevelopPackageManager packageManager;
+ FakePackageRepository fakeFeedSourceRepository;
+ FakeSharedPackageRepository fakeSolutionSharedRepository;
+ FakeProject project;
+ PackageManagementOptions options;
+ SolutionPackageRepositoryPath repositoryPaths;
+ PackageReferenceRepositoryHelper packageRefRepositoryHelper;
+ TestableProjectManager testableProjectManager;
+ FakeFileSystem fakeFileSystem;
+ FakePackageOperationResolverFactory fakePackageOperationResolverFactory;
+ FakePackageOperationResolver fakePackageOperationResolver;
+
+ void CreatePackageManager (IProject project, PackageReferenceRepositoryHelper packageRefRepositoryHelper)
+ {
+ options = new TestablePackageManagementOptions ();
+ options.PackagesDirectory = "packages";
+
+ repositoryPaths = new SolutionPackageRepositoryPath (project, options);
+ var pathResolver = new DefaultPackagePathResolver (repositoryPaths.PackageRepositoryPath);
+
+ fakeFileSystem = new FakeFileSystem ();
+
+ fakeFeedSourceRepository = new FakePackageRepository ();
+ fakeSolutionSharedRepository = packageRefRepositoryHelper.FakeSharedSourceRepository;
+
+ fakePackageOperationResolverFactory = new FakePackageOperationResolverFactory ();
+ fakePackageOperationResolver = fakePackageOperationResolverFactory.FakeInstallPackageOperationResolver;
+
+ var fakeSolutionPackageRepository = new FakeSolutionPackageRepository ();
+ fakeSolutionPackageRepository.FileSystem = fakeFileSystem;
+ fakeSolutionPackageRepository.PackagePathResolver = pathResolver;
+ fakeSolutionPackageRepository.FakeSharedRepository = fakeSolutionSharedRepository;
+
+ packageManager = new SharpDevelopPackageManager (fakeFeedSourceRepository,
+ packageRefRepositoryHelper.FakeProjectSystem,
+ fakeSolutionPackageRepository,
+ fakePackageOperationResolverFactory);
+ }
+
+ void CreatePackageManager ()
+ {
+ CreateTestProject ();
+ CreatePackageReferenceRepositoryHelper ();
+ CreatePackageManager (project, packageRefRepositoryHelper);
+ }
+
+ void CreatePackageReferenceRepositoryHelper ()
+ {
+ packageRefRepositoryHelper = new PackageReferenceRepositoryHelper ();
+ }
+
+ void CreateTestProject ()
+ {
+ var solution = new FakeSolution (@"c:\projects\Test\MyProject\MySolution.sln");
+ solution.BaseDirectory = @"c:\projects\Test\MyProject";
+ project = new FakeProject ();
+ project.ParentSolution = solution;
+ }
+
+ void CreateTestableProjectManager ()
+ {
+ testableProjectManager = new TestableProjectManager ();
+ packageManager.ProjectManager = testableProjectManager;
+ }
+
+ FakePackage CreateFakePackage (string id = "Test", string version = "1.0.0.0")
+ {
+ return new FakePackage (id, version);
+ }
+
+ FakePackage InstallPackage ()
+ {
+ FakePackage package = CreateFakePackage ();
+ packageManager.InstallPackage (package);
+ return package;
+ }
+
+ FakePackage InstallPackageWithNoPackageOperations ()
+ {
+ return InstallPackageWithNoPackageOperations (ignoreDependencies: false);
+ }
+
+ FakePackage InstallPackageWithNoPackageOperationsAndIgnoreDependencies ()
+ {
+ return InstallPackageWithNoPackageOperations (ignoreDependencies: true);
+ }
+
+ FakePackage InstallPackageWithNoPackageOperationsAndAllowPrereleaseVersions ()
+ {
+ return InstallPackageWithNoPackageOperations (ignoreDependencies: false, allowPrereleaseVersions: true);
+ }
+
+ FakePackage InstallPackageWithNoPackageOperations (bool ignoreDependencies)
+ {
+ return InstallPackageWithNoPackageOperations (ignoreDependencies, allowPrereleaseVersions: false);
+ }
+
+ FakePackage InstallPackageWithNoPackageOperations (bool ignoreDependencies, bool allowPrereleaseVersions)
+ {
+ FakePackage package = CreateFakePackage ();
+ var operations = new List<PackageOperation> ();
+ var installAction = new FakeInstallPackageAction ();
+ installAction.IgnoreDependencies = ignoreDependencies;
+ installAction.AllowPrereleaseVersions = allowPrereleaseVersions;
+ installAction.Operations = operations;
+ packageManager.InstallPackage (package, installAction);
+ return package;
+ }
+
+ FakePackage InstallPackageWithPackageOperations (PackageOperation operation)
+ {
+ var operations = new PackageOperation[] {
+ operation
+ };
+ FakePackage package = CreateFakePackage ();
+ var installAction = new FakeInstallPackageAction ();
+ installAction.Operations = operations;
+ packageManager.InstallPackage (package, installAction);
+ return package;
+ }
+
+ FakePackage InstallPackageAndIgnoreDependencies ()
+ {
+ return InstallPackageWithParameters (true, false);
+ }
+
+ FakePackage InstallPackageWithParameters (bool ignoreDependencies, bool allowPrereleaseVersions)
+ {
+ FakePackage package = CreateFakePackage ();
+ packageManager.InstallPackage (package, ignoreDependencies, allowPrereleaseVersions);
+ return package;
+ }
+
+ FakePackage InstallPackageAndAllowPrereleaseVersions ()
+ {
+ return InstallPackageWithParameters (false, true);
+ }
+
+ FakePackage InstallPackageAndDoNotAllowPrereleaseVersions ()
+ {
+ return InstallPackageWithParameters (false, false);
+ }
+
+ FakePackage InstallPackageAndDoNotIgnoreDependencies ()
+ {
+ return InstallPackageWithParameters (false, false);
+ }
+
+ FakePackage UninstallPackage ()
+ {
+ FakePackage package = CreateFakePackage ();
+ testableProjectManager.FakeLocalRepository.FakePackages.Add (package);
+
+ packageManager.UninstallPackage (package);
+ return package;
+ }
+
+ FakePackage UninstallPackageAndForceRemove ()
+ {
+ FakePackage package = CreateFakePackage ();
+ testableProjectManager.FakeLocalRepository.FakePackages.Add (package);
+
+ bool removeDependencies = false;
+ bool forceRemove = true;
+ packageManager.UninstallPackage (package, forceRemove, removeDependencies);
+
+ return package;
+ }
+
+ FakePackage UninstallPackageAndRemoveDependencies ()
+ {
+ FakePackage package = CreateFakePackage ();
+ testableProjectManager.FakeLocalRepository.FakePackages.Add (package);
+
+ bool removeDependencies = true;
+ bool forceRemove = false;
+ packageManager.UninstallPackage (package, forceRemove, removeDependencies);
+
+ return package;
+ }
+
+ PackageOperation CreateOneInstallPackageOperation (string id = "PackageToInstall", string version = "1.0")
+ {
+ FakePackage package = CreateFakePackage (id, version);
+ return new PackageOperation (package, PackageAction.Install);
+ }
+
+ IEnumerable<PackageOperation> GetInstallPackageOperations (FakePackage package)
+ {
+ return GetInstallPackageOperations (package, false, false);
+ }
+
+ IEnumerable<PackageOperation> GetInstallPackageOperationsAndIgnoreDependencies (FakePackage package)
+ {
+ return GetInstallPackageOperations (package, true, false);
+ }
+
+ IEnumerable<PackageOperation> GetInstallPackageOperationsAndAllowPrereleaseVersions (FakePackage package)
+ {
+ return GetInstallPackageOperations (package, false, true);
+ }
+
+ IEnumerable<PackageOperation> GetInstallPackageOperations (
+ FakePackage package,
+ bool ignoreDependencies,
+ bool allowPrereleaseVersions)
+ {
+ var fakeInstallAction = new FakeInstallPackageAction ();
+ fakeInstallAction.IgnoreDependencies = ignoreDependencies;
+ fakeInstallAction.AllowPrereleaseVersions = allowPrereleaseVersions;
+ return packageManager.GetInstallPackageOperations (package, fakeInstallAction);
+ }
+
+ FakePackage UpdatePackageWithNoPackageOperations ()
+ {
+ FakePackage package = CreateFakePackage ();
+ var updateAction = new FakeUpdatePackageAction ();
+ updateAction.Operations = new List<PackageOperation> ();
+ updateAction.UpdateDependencies = true;
+ packageManager.UpdatePackage (package, updateAction);
+ return package;
+ }
+
+ FakePackage UpdatePackageWithPackageOperations (PackageOperation operation)
+ {
+ var operations = new PackageOperation[] {
+ operation
+ };
+ FakePackage package = CreateFakePackage ();
+ var updateAction = new FakeUpdatePackageAction ();
+ updateAction.Operations = operations;
+ updateAction.UpdateDependencies = true;
+ packageManager.UpdatePackage (package, updateAction);
+ return package;
+ }
+
+ FakePackage UpdatePackageWithNoPackageOperationsAndDoNotUpdateDependencies ()
+ {
+ return UpdatePackageWithNoPackageOperations (false, false);
+ }
+
+ FakePackage UpdatePackageWithNoPackageOperationsAndAllowPrereleaseVersions ()
+ {
+ return UpdatePackageWithNoPackageOperations (false, true);
+ }
+
+ FakePackage UpdatePackageWithNoPackageOperations (bool updateDependencies, bool allowPrereleaseVersions)
+ {
+ FakePackage package = CreateFakePackage ();
+ var updateAction = new FakeUpdatePackageAction ();
+ updateAction.Operations = new List<PackageOperation> ();
+ updateAction.UpdateDependencies = updateDependencies;
+ updateAction.AllowPrereleaseVersions = allowPrereleaseVersions;
+ packageManager.UpdatePackage (package, updateAction);
+ return package;
+ }
+
+ UpdatePackagesAction CreateUpdatePackagesAction ()
+ {
+ return new UpdatePackagesAction (new FakePackageManagementProject (), null);
+ }
+
+ UpdatePackagesAction CreateUpdatePackagesActionWithPackages (params IPackageFromRepository[] packages)
+ {
+ UpdatePackagesAction action = CreateUpdatePackagesAction ();
+ action.AddPackages (packages);
+ return action;
+ }
+
+ UpdatePackagesAction CreateUpdatePackagesActionWithOperations (params PackageOperation[] operations)
+ {
+ UpdatePackagesAction action = CreateUpdatePackagesAction ();
+ action.AddOperations (operations);
+ return action;
+ }
+
+ PackageOperation AddInstallOperationForPackage (IPackage package)
+ {
+ var operation = new PackageOperation (package, PackageAction.Install);
+ AddInstallOperationsForPackage (package, operation);
+ return operation;
+ }
+
+ void AddInstallOperationsForPackage (IPackage package, params PackageOperation[] operations)
+ {
+ fakePackageOperationResolver.AddOperations (package, operations);
+ }
+
+ void CreateFakePackageResolverForUpdatePackageOperations ()
+ {
+ fakePackageOperationResolver = new FakePackageOperationResolver ();
+ fakePackageOperationResolverFactory.UpdatePackageOperationsResolver = fakePackageOperationResolver;
+ }
+
+ void RaisePackageRemovedEventWhenPackageReferenceUpdated (
+ FakeProjectManager projectManager,
+ FakePackage updatedPackage,
+ params PackageOperationEventArgs[] eventArgs)
+ {
+ projectManager.WhenUpdatePackageReferenceCalled (
+ updatedPackage.Id,
+ updatedPackage.Version,
+ () => eventArgs.ToList ().ForEach (eventArg => projectManager.FirePackageReferenceRemoved (eventArg)));
+ }
+
+ void RaisePackageRemovedEventWhenPackageReferenceAdded (
+ FakeProjectManager projectManager,
+ FakePackage newPackage,
+ params PackageOperationEventArgs[] eventArgs)
+ {
+ projectManager.WhenAddPackageReferenceCalled (
+ newPackage.Id,
+ newPackage.Version,
+ () => eventArgs.ToList ().ForEach (eventArg => projectManager.FirePackageReferenceRemoved (eventArg)));
+ }
+
+ [Test]
+ public void ProjectManager_InstanceCreated_SourceRepositoryIsSharedRepositoryPassedToPackageManager ()
+ {
+ CreatePackageManager ();
+ Assert.AreEqual (fakeSolutionSharedRepository, packageManager.ProjectManager.SourceRepository);
+ }
+
+ [Test]
+ public void ProjectManager_InstanceCreated_LocalRepositoryIsPackageReferenceRepository ()
+ {
+ CreatePackageManager ();
+ PackageReferenceRepository packageRefRepository = packageManager.ProjectManager.LocalRepository as PackageReferenceRepository;
+ Assert.IsNotNull (packageRefRepository);
+ }
+
+ [Test]
+ public void ProjectManager_InstanceCreated_LocalRepositoryIsRegisteredWithSharedRepository ()
+ {
+ CreateTestProject ();
+ CreatePackageReferenceRepositoryHelper ();
+
+ string expectedPath = @"c:\projects\Test\MyProject";
+ packageRefRepositoryHelper.FakeProjectSystem.PathToReturnFromGetFullPath = expectedPath;
+
+ CreatePackageManager (project, packageRefRepositoryHelper);
+
+ string actualPath = fakeSolutionSharedRepository.PathPassedToRegisterRepository;
+
+ Assert.AreEqual (expectedPath, actualPath);
+ }
+
+ [Test]
+ public void ProjectManager_InstanceCreated_PathResolverIsPackageManagerPathResolver ()
+ {
+ CreatePackageManager ();
+
+ Assert.AreEqual (packageManager.PathResolver, packageManager.ProjectManager.PathResolver);
+ }
+
+ [Test]
+ public void InstallPackage_PackageInstancePassed_AddsReferenceToProject ()
+ {
+ CreatePackageManager ();
+ FakePackage package = InstallPackage ();
+
+ Assert.AreEqual (package, testableProjectManager.PackagePassedToAddPackageReference);
+ }
+
+ [Test]
+ public void InstallPackage_PackageInstancePassed_DependenciesNotIgnoredWhenAddingReferenceToProject ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ InstallPackage ();
+
+ Assert.IsFalse (testableProjectManager.IgnoreDependenciesPassedToAddPackageReference);
+ }
+
+ [Test]
+ public void InstallPackage_PackageInstancePassed_PrereleaseVersionsNotAllowedWhenAddingReferenceToProject ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ InstallPackage ();
+
+ Assert.IsFalse (testableProjectManager.AllowPrereleaseVersionsPassedToAddPackageReference);
+ }
+
+ [Test]
+ public void InstallPackage_PackageInstanceAndPackageOperationsPassed_AddsReferenceToProject ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ FakePackage package = InstallPackageWithNoPackageOperations ();
+
+ Assert.AreEqual (package, testableProjectManager.PackagePassedToAddPackageReference);
+ }
+
+ [Test]
+ public void InstallPackage_PackageInstanceAndPackageOperationsPassed_DoNotIgnoreDependenciesWhenAddingReferenceToProject ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ InstallPackageWithNoPackageOperations ();
+
+ Assert.IsFalse (testableProjectManager.IgnoreDependenciesPassedToAddPackageReference);
+ }
+
+ [Test]
+ public void InstallPackage_PackageInstanceAndPackageOperationsPassed_DoNotAllowPrereleaseVersionsWhenAddingReferenceToProject ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ InstallPackageWithNoPackageOperations ();
+
+ Assert.IsFalse (testableProjectManager.AllowPrereleaseVersionsPassedToAddPackageReference);
+ }
+
+ [Test]
+ public void InstallPackage_PackageInstanceAndPackageOperationsPassedAndIgnoreDependenciesIsTrue_IgnoreDependenciesWhenAddingReferenceToProject ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ InstallPackageWithNoPackageOperationsAndIgnoreDependencies ();
+
+ Assert.IsTrue (testableProjectManager.IgnoreDependenciesPassedToAddPackageReference);
+ }
+
+ [Test]
+ public void InstallPackage_PackageInstanceAndPackageOperationsPassedAndAllowPrereleaseVersionsIsTrue_PrereleaseVersionsallowedWhenAddingReferenceToProject ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ InstallPackageWithNoPackageOperationsAndAllowPrereleaseVersions ();
+
+ Assert.IsTrue (testableProjectManager.AllowPrereleaseVersionsPassedToAddPackageReference);
+ }
+
+ [Test]
+ public void InstallPackage_PackageInstanceAndOneInstallPackageOperationPassed_PackageDefinedInOperationIsInstalledInLocalRepository ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+
+ PackageOperation operation = CreateOneInstallPackageOperation ();
+ InstallPackageWithPackageOperations (operation);
+
+ Assert.AreEqual (operation.Package, fakeSolutionSharedRepository.FirstPackageAdded);
+ }
+
+ [Test]
+ public void InstallPackage_PackageDependenciesIgnored_IgnoreDependenciesPassedToProjectManager ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ InstallPackageAndIgnoreDependencies ();
+
+ Assert.IsTrue (testableProjectManager.IgnoreDependenciesPassedToAddPackageReference);
+ }
+
+ [Test]
+ public void InstallPackage_AllowPrereleaseVersions_AllowPrereleaseVersionsPassedToProjectManager ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ InstallPackageAndAllowPrereleaseVersions ();
+
+ Assert.IsTrue (testableProjectManager.AllowPrereleaseVersionsPassedToAddPackageReference);
+ }
+
+ [Test]
+ public void InstallPackage_PackageDependenciesIgnored_AddsReferenceToPackage ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ FakePackage package = InstallPackageAndIgnoreDependencies ();
+
+ Assert.AreEqual (package, testableProjectManager.PackagePassedToAddPackageReference);
+ }
+
+ [Test]
+ public void InstallPackage_PackageDependenciesNotIgnored_IgnoreDependenciesPassedToProjectManager ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ InstallPackageAndDoNotIgnoreDependencies ();
+
+ Assert.IsFalse (testableProjectManager.IgnoreDependenciesPassedToAddPackageReference);
+ }
+
+ [Test]
+ public void InstallPackage_PackageDependenciesNotIgnored_AddsReferenceToPackage ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ FakePackage package = InstallPackageAndDoNotIgnoreDependencies ();
+
+ Assert.AreEqual (package, testableProjectManager.PackagePassedToAddPackageReference);
+ }
+
+ [Test]
+ public void UninstallPackage_PackageInProjectLocalRepository_RemovesReferenceFromProject ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ FakePackage package = UninstallPackage ();
+
+ Assert.AreEqual (package.Id, testableProjectManager.PackagePassedToRemovePackageReference.Id);
+ }
+
+ [Test]
+ public void UninstallPackage_PackageInProjectLocalRepository_DoesNotRemoveReferenceForcefullyFromProject ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ UninstallPackage ();
+
+ Assert.IsFalse (testableProjectManager.ForcePassedToRemovePackageReference);
+ }
+
+ [Test]
+ public void UninstallPackage_PackageInProjectLocalRepository_DependenciesNotRemovedWhenPackageReferenceRemovedFromProject ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ UninstallPackage ();
+
+ Assert.IsFalse (testableProjectManager.RemoveDependenciesPassedToRemovePackageReference);
+ }
+
+ [Test]
+ public void UninstallPackage_PassingForceRemove_ReferenceForcefullyRemovedFromProject ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+
+ UninstallPackageAndForceRemove ();
+
+ Assert.IsTrue (testableProjectManager.ForcePassedToRemovePackageReference);
+ }
+
+ [Test]
+ public void UninstallPackage_PassingRemoveDependencies_DependenciesRemovedWhenPackageReferenceRemovedFromProject ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+
+ UninstallPackageAndRemoveDependencies ();
+
+ Assert.IsTrue (testableProjectManager.RemoveDependenciesPassedToRemovePackageReference);
+ }
+
+ [Test]
+ public void UninstallPackage_ProjectLocalRepositoryHasPackage_PackageRemovedFromProjectRepositoryBeforeSolutionRepository ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+
+ FakePackage package = CreateFakePackage ();
+ package.Id = "Test";
+
+ testableProjectManager.FakeLocalRepository.FakePackages.Add (package);
+
+ IPackage packageRemovedFromProject = null;
+ packageManager.PackageUninstalled += (sender, e) => {
+ packageRemovedFromProject = testableProjectManager.PackagePassedToRemovePackageReference;
+ };
+ packageManager.UninstallPackage (package);
+
+ Assert.AreEqual ("Test", packageRemovedFromProject.Id);
+ }
+
+ [Test]
+ public void UninstallPackage_PackageReferencedByNoProjects_PackageIsRemovedFromSharedSolutionRepository ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+
+ FakePackage package = CreateFakePackage ();
+ package.Id = "MyPackageId";
+
+ testableProjectManager.FakeLocalRepository.FakePackages.Add (package);
+ fakeSolutionSharedRepository.FakePackages.Add (package);
+
+ packageManager.UninstallPackage (package);
+
+ bool containsPackage = fakeSolutionSharedRepository.FakePackages.Contains (package);
+
+ Assert.IsFalse (containsPackage);
+ }
+
+ [Test]
+ public void UninstallPackage_PackageReferencedByTwoProjects_PackageIsNotRemovedFromSharedSolutionRepository ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+
+ var package = new FakePackage ("MyPackageId", "1.4.5.2");
+
+ testableProjectManager.FakeLocalRepository.FakePackages.Add (package);
+ fakeSolutionSharedRepository.FakePackages.Add (package);
+ fakeSolutionSharedRepository.PackageIdsReferences.Add ("MyPackageId");
+
+ packageManager.UninstallPackage (package);
+
+ bool containsPackage = fakeSolutionSharedRepository.FakePackages.Contains (package);
+
+ Assert.IsTrue (containsPackage);
+ Assert.AreEqual ("MyPackageId", fakeSolutionSharedRepository.PackageIdPassedToIsReferenced);
+ Assert.AreEqual (package.Version, fakeSolutionSharedRepository.VersionPassedToIsReferenced);
+ }
+
+ [Test]
+ public void GetInstallPackageOperations_PackageOperationResolverFactoryUsed_PackageOperationsReturnedFromPackageOperationsResolverCreated ()
+ {
+ CreatePackageManager ();
+ var package = new FakePackage ();
+ var expectedOperations = new PackageOperation [] {
+ new PackageOperation (package, PackageAction.Install)
+ };
+ fakePackageOperationResolver.AddOperations (package, expectedOperations);
+
+ IEnumerable<PackageOperation> operations = GetInstallPackageOperations (package);
+
+ Assert.AreEqual (expectedOperations, operations);
+ }
+
+ [Test]
+ public void GetInstallPackageOperations_PackageOperationResolverFactoryUsed_PackageManagerUsesLocalRepositoryWhenGettingPackageOperations ()
+ {
+ CreatePackageManager ();
+ var package = new FakePackage ();
+ AddInstallOperationForPackage (package);
+ GetInstallPackageOperations (package);
+
+ IPackageRepository expectedRepository = packageManager.LocalRepository;
+ IPackageRepository actualRepository = fakePackageOperationResolverFactory.LocalRepositoryPassedToCreateInstallPackageOperationsResolver;
+
+ Assert.AreEqual (expectedRepository, actualRepository);
+ }
+
+ [Test]
+ public void GetInstallPackageOperations_PackageOperationResolverFactoryUsed_PackageManagerUsesSourceRepositoryWhenGettingPackageOperations ()
+ {
+ CreatePackageManager ();
+ var package = new FakePackage ();
+ AddInstallOperationForPackage (package);
+ GetInstallPackageOperations (package);
+
+ IPackageRepository expectedRepository = packageManager.SourceRepository;
+ IPackageRepository actualRepository = fakePackageOperationResolverFactory.SourceRepositoryPassedToCreateInstallPackageOperationsResolver;
+
+ Assert.AreEqual (expectedRepository, actualRepository);
+ }
+
+ [Test]
+ public void GetInstallPackageOperations_PackageOperationResolverFactoryUsed_DependenciesNotIgnored ()
+ {
+ CreatePackageManager ();
+ var package = new FakePackage ();
+ AddInstallOperationForPackage (package);
+ GetInstallPackageOperations (package);
+
+ bool result = fakePackageOperationResolverFactory.IgnoreDependenciesPassedToCreateInstallPackageOperationResolver;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void GetInstallPackageOperations_PackageOperationResolverFactoryUsed_PackageManagerUsesLoggerWhenGettingPackageOperations ()
+ {
+ CreatePackageManager ();
+ var package = new FakePackage ();
+ AddInstallOperationForPackage (package);
+ GetInstallPackageOperations (package);
+
+ ILogger expectedLogger = packageManager.Logger;
+ ILogger actualLogger = fakePackageOperationResolverFactory.LoggerPassedToCreateInstallPackageOperationResolver;
+
+ Assert.AreEqual (expectedLogger, actualLogger);
+ }
+
+ [Test]
+ public void GetInstallPackageOperations_PackageOperationResolverFactoryUsed_PackageUsedWhenGettingPackageOperations ()
+ {
+ CreatePackageManager ();
+ var package = new FakePackage ();
+ AddInstallOperationForPackage (package);
+ GetInstallPackageOperations (package);
+
+ IPackage actualPackage = fakePackageOperationResolverFactory
+ .FakeInstallPackageOperationResolver
+ .PackagePassedToResolveOperations;
+
+ Assert.AreEqual (package, actualPackage);
+ }
+
+ [Test]
+ public void GetInstallPackageOperations_IgnoreDependenciesIsTrue_PackageOperationResolverIgnoresDependencies ()
+ {
+ CreatePackageManager ();
+ var package = new FakePackage ();
+ AddInstallOperationForPackage (package);
+ GetInstallPackageOperationsAndIgnoreDependencies (package);
+
+ bool result = fakePackageOperationResolverFactory.IgnoreDependenciesPassedToCreateInstallPackageOperationResolver;
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void GetInstallPackageOperations_AllowPrereleaseVersionsIsTrue_PackageOperationResolverAllowsPrereleaseVersions ()
+ {
+ CreatePackageManager ();
+ var package = new FakePackage ();
+ AddInstallOperationForPackage (package);
+ GetInstallPackageOperationsAndAllowPrereleaseVersions (package);
+
+ bool result = fakePackageOperationResolverFactory.AllowPrereleaseVersionsPassedToCreateInstallPackageOperationResolver;
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void GetInstallPackageOperations_AllowPrereleaseVersionsIsFalse_PackageOperationResolverDoesNotAllowPrereleaseVersions ()
+ {
+ CreatePackageManager ();
+ var package = new FakePackage ("Test", "1.0");
+ AddInstallOperationForPackage (package);
+ GetInstallPackageOperations (package);
+
+ bool result = fakePackageOperationResolverFactory.AllowPrereleaseVersionsPassedToCreateInstallPackageOperationResolver;
+
+ Assert.IsFalse (result);
+ }
+
+ public void UpdatePackage_PackageInstanceAndNoPackageOperationsPassed_UpdatesReferenceInProject ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ FakePackage package = UpdatePackageWithNoPackageOperations ();
+
+ Assert.AreEqual (package, testableProjectManager.PackagePassedToUpdatePackageReference);
+ }
+
+ [Test]
+ public void UpdatePackage_PackageInstanceAndNoPackageOperationsPassed_UpdatesDependenciesInProject ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ UpdatePackageWithNoPackageOperations ();
+
+ Assert.IsTrue (testableProjectManager.UpdateDependenciesPassedToUpdatePackageReference);
+ }
+
+ [Test]
+ public void UpdatePackage_PackageInstanceAndAllowPrereleaseVersionsIsTrue_PrereleaseVersionsAllowedToUpdateProject ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ UpdatePackageWithNoPackageOperationsAndAllowPrereleaseVersions ();
+
+ Assert.IsTrue (testableProjectManager.AllowPrereleaseVersionsPassedToUpdatePackageReference);
+ }
+
+ [Test]
+ public void UpdatePackage_PackageInstanceAndAllowPrereleaseVersionsIsFalse_PrereleaseVersionsNotAllowedToUpdateProject ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ UpdatePackageWithNoPackageOperations ();
+
+ Assert.IsFalse (testableProjectManager.AllowPrereleaseVersionsPassedToUpdatePackageReference);
+ }
+
+ [Test]
+ public void UpdatePackage_PackageInstanceAndOneInstallPackageOperationPassed_PackageDefinedInOperationIsInstalledInLocalRepository ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+
+ PackageOperation operation = CreateOneInstallPackageOperation ();
+ UpdatePackageWithPackageOperations (operation);
+
+ Assert.AreEqual (operation.Package, fakeSolutionSharedRepository.FirstPackageAdded);
+ }
+
+ [Test]
+ public void UpdatePackage_UpdateDependenciesSetToFalse_DependenciesInProjectNotUpdated ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ UpdatePackageWithNoPackageOperationsAndDoNotUpdateDependencies ();
+
+ Assert.IsFalse (testableProjectManager.UpdateDependenciesPassedToUpdatePackageReference);
+ }
+
+ [Test]
+ public void UpdatePackages_OnePackage_PackageReferencedIsAddedToProject ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ FakePackage package = CreateFakePackage ("Test", "1.1");
+ UpdatePackagesAction action = CreateUpdatePackagesActionWithPackages (package);
+
+ packageManager.UpdatePackages (action);
+
+ Assert.AreEqual (package, testableProjectManager.PackagePassedToUpdatePackageReference);
+ }
+
+ [Test]
+ public void UpdatePackages_TwoPackages_PackageReferencedIsAddedToProjectForBothPackages ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ FakePackage package1 = CreateFakePackage ("First", "1.1");
+ FakePackage package2 = CreateFakePackage ("Second", "2.0");
+ var expectedPackages = new FakePackage[] { package1, package2 };
+ UpdatePackagesAction action = CreateUpdatePackagesActionWithPackages (expectedPackages);
+
+ packageManager.UpdatePackages (action);
+
+ PackageCollectionAssert.AreEqual (expectedPackages, testableProjectManager.PackagesPassedToUpdatePackageReference);
+ }
+
+ [Test]
+ public void UpdatePackages_UpdateDependenciesIsTrue_UpdateDependenciesPassedToProjectManager ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ FakePackage package = CreateFakePackage ("Test", "1.1");
+ UpdatePackagesAction action = CreateUpdatePackagesActionWithPackages (package);
+ action.UpdateDependencies = true;
+
+ packageManager.UpdatePackages (action);
+
+ Assert.IsTrue (testableProjectManager.UpdateDependenciesPassedToUpdatePackageReference);
+ }
+
+ [Test]
+ public void UpdatePackages_UpdateDependenciesIsFalse_UpdateDependenciesPassedToProjectManager ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ FakePackage package = CreateFakePackage ("Test", "1.1");
+ UpdatePackagesAction action = CreateUpdatePackagesActionWithPackages (package);
+ action.UpdateDependencies = false;
+
+ packageManager.UpdatePackages (action);
+
+ Assert.IsFalse (testableProjectManager.UpdateDependenciesPassedToUpdatePackageReference);
+ }
+
+ [Test]
+ public void UpdatePackages_AllowPrereleaseVersionsIsTrue_AllowPrereleaseVersionsPassedToProjectManager ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ FakePackage package = CreateFakePackage ("Test", "1.1");
+ UpdatePackagesAction action = CreateUpdatePackagesActionWithPackages (package);
+ action.AllowPrereleaseVersions = true;
+
+ packageManager.UpdatePackages (action);
+
+ Assert.IsTrue (testableProjectManager.AllowPrereleaseVersionsPassedToUpdatePackageReference);
+ }
+
+ [Test]
+ public void UpdatePackages_AllowPrereleaseVersionsIsFalse_AllowPrereleaseVersionsPassedToProjectManager ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ FakePackage package = CreateFakePackage ("Test", "1.1");
+ UpdatePackagesAction action = CreateUpdatePackagesActionWithPackages (package);
+ action.AllowPrereleaseVersions = false;
+
+ packageManager.UpdatePackages (action);
+
+ Assert.IsFalse (testableProjectManager.AllowPrereleaseVersionsPassedToUpdatePackageReference);
+ }
+
+ [Test]
+ public void UpdatePackages_TwoPackageOperations_BothPackagesInOperationsAddedToSharedRepository ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ PackageOperation operation1 = CreateOneInstallPackageOperation ("First", "1.0");
+ PackageOperation operation2 = CreateOneInstallPackageOperation ("Second", "1.0");
+ UpdatePackagesAction action = CreateUpdatePackagesActionWithOperations (operation1, operation2);
+ var expectedPackages = new FakePackage[] {
+ operation1.Package as FakePackage,
+ operation2.Package as FakePackage
+ };
+
+ packageManager.UpdatePackages (action);
+
+ PackageCollectionAssert.AreEqual (expectedPackages, fakeSolutionSharedRepository.PackagesAdded);
+ }
+
+ [Test]
+ public void GetUpdatePackageOperations_PackageOperationResolverFactoryUsed_PackageManagerUsesLoggerWhenGettingPackageOperations ()
+ {
+ CreatePackageManager ();
+ FakePackage package = CreateFakePackage ("Test", "1.1");
+ UpdatePackagesAction updateAction = CreateUpdatePackagesActionWithPackages (package);
+ CreateFakePackageResolverForUpdatePackageOperations ();
+ AddInstallOperationForPackage (package);
+
+ packageManager.GetUpdatePackageOperations (updateAction.Packages, updateAction);
+
+ ILogger expectedLogger = packageManager.Logger;
+ ILogger actualLogger = fakePackageOperationResolverFactory.LoggerPassedToCreateUpdatePackageOperationResolver;
+ Assert.AreEqual (expectedLogger, actualLogger);
+ }
+
+ [Test]
+ public void GetUpdatePackageOperations_PackageOperationResolverFactoryUsed_PackageManagerUsesLocalRepositoryWhenGettingPackageOperations ()
+ {
+ CreatePackageManager ();
+ FakePackage package = CreateFakePackage ("Test", "1.1");
+ UpdatePackagesAction updateAction = CreateUpdatePackagesActionWithPackages (package);
+ CreateFakePackageResolverForUpdatePackageOperations ();
+ AddInstallOperationForPackage (package);
+
+ packageManager.GetUpdatePackageOperations (updateAction.Packages, updateAction);
+
+ IPackageRepository expectedRepository = packageManager.LocalRepository;
+ IPackageRepository actualRepository = fakePackageOperationResolverFactory.LocalRepositoryPassedToCreateUpdatePackageOperationsResolver;
+ Assert.AreEqual (expectedRepository, actualRepository);
+ }
+
+ [Test]
+ public void GetUpdatePackageOperations_PackageOperationResolverFactoryUsed_PackageManagerUsesSourceRepositoryWhenGettingPackageOperations ()
+ {
+ CreatePackageManager ();
+ FakePackage package = CreateFakePackage ("Test", "1.1");
+ UpdatePackagesAction updateAction = CreateUpdatePackagesActionWithPackages (package);
+ CreateFakePackageResolverForUpdatePackageOperations ();
+ AddInstallOperationForPackage (package);
+
+ packageManager.GetUpdatePackageOperations (updateAction.Packages, updateAction);
+
+ IPackageRepository expectedRepository = packageManager.SourceRepository;
+ IPackageRepository actualRepository = fakePackageOperationResolverFactory.SourceRepositoryPassedToCreateUpdatePackageOperationsResolver;
+ Assert.AreEqual (expectedRepository, actualRepository);
+ }
+
+ [Test]
+ public void GetUpdatePackageOperations_PackageOperationResolverFactoryUsed_PackageManagerUsesUpdatePackageSettingsWhenGettingPackageOperations ()
+ {
+ CreatePackageManager ();
+ FakePackage package = CreateFakePackage ("Test", "1.1");
+ UpdatePackagesAction updateAction = CreateUpdatePackagesActionWithPackages (package);
+ CreateFakePackageResolverForUpdatePackageOperations ();
+ AddInstallOperationForPackage (package);
+
+ packageManager.GetUpdatePackageOperations (updateAction.Packages, updateAction);
+
+ IUpdatePackageSettings settings = fakePackageOperationResolverFactory.SettingsPassedToCreatePackageOperationResolver;
+ Assert.AreEqual (updateAction, settings);
+ }
+
+ [Test]
+ public void GetUpdatePackageOperations_TwoPackages_ReturnsPackageOperationsForBothPackages ()
+ {
+ CreatePackageManager ();
+ CreateFakePackageResolverForUpdatePackageOperations ();
+ IPackageFromRepository package1 = CreateFakePackage ("Test", "1.0");
+ IPackageFromRepository package2 = CreateFakePackage ("Test2", "1.0");
+ PackageOperation operation1 = AddInstallOperationForPackage (package1);
+ PackageOperation operation2 = AddInstallOperationForPackage (package2);
+ UpdatePackagesAction updateAction = CreateUpdatePackagesActionWithPackages (package1, package2);
+
+ List<PackageOperation> operations = packageManager.GetUpdatePackageOperations (updateAction.Packages, updateAction).ToList ();
+
+ Assert.AreEqual (2, operations.Count ());
+ Assert.IsTrue (operations.Contains (operation1));
+ Assert.IsTrue (operations.Contains (operation2));
+ }
+
+ [Test]
+ public void RunPackageOperations_TwoPackageOperations_BothPackagesInOperationsAddedToSharedRepository ()
+ {
+ CreatePackageManager ();
+ CreateTestableProjectManager ();
+ PackageOperation operation1 = CreateOneInstallPackageOperation ("First", "1.0");
+ PackageOperation operation2 = CreateOneInstallPackageOperation ("Second", "1.0");
+ var operations = new PackageOperation[] { operation1, operation2 };
+ var expectedPackages = new FakePackage[] {
+ operation1.Package as FakePackage,
+ operation2.Package as FakePackage
+ };
+
+ packageManager.RunPackageOperations (operations);
+
+ PackageCollectionAssert.AreEqual (expectedPackages, fakeSolutionSharedRepository.PackagesAdded);
+ }
+
+ [Test]
+ public void UpdatePackage_OldPackageReferenceIsRemovedOnUpdating_OldPackageIsUninstalled ()
+ {
+ CreatePackageManager ();
+ var fakeProjectManager = new FakeProjectManager ();
+ packageManager.ProjectManager = fakeProjectManager;
+ FakePackage installedPackage = fakeSolutionSharedRepository.AddFakePackageWithVersion ("MyPackage", "1.0");
+ FakePackage updatedPackage = fakeFeedSourceRepository.AddFakePackageWithVersion ("MyPackage", "1.1");
+ var eventArgs = new PackageOperationEventArgs (installedPackage, null, null);
+ RaisePackageRemovedEventWhenPackageReferenceUpdated (fakeProjectManager, updatedPackage, eventArgs);
+ var updateAction = new FakeUpdatePackageAction {
+ Operations = new List<PackageOperation> (),
+ UpdateDependencies = false
+ };
+
+ packageManager.UpdatePackage (updatedPackage, updateAction);
+
+ Assert.IsFalse (fakeSolutionSharedRepository.FakePackages.Contains (installedPackage));
+ }
+
+ [Test]
+ public void UpdatePackage_TwoOldPackageReferencesAreRemovedOnUpdating_BothOldPackagesAreUninstalled ()
+ {
+ CreatePackageManager ();
+ var fakeProjectManager = new FakeProjectManager ();
+ packageManager.ProjectManager = fakeProjectManager;
+ FakePackage installedPackage1 = fakeSolutionSharedRepository.AddFakePackageWithVersion ("MyPackage-Core", "1.0");
+ FakePackage installedPackage2 = fakeSolutionSharedRepository.AddFakePackageWithVersion ("MyPackage", "1.0");
+ FakePackage updatedPackage = fakeFeedSourceRepository.AddFakePackageWithVersion ("MyPackage", "1.1");
+ var eventArgs1 = new PackageOperationEventArgs (installedPackage1, null, null);
+ var eventArgs2 = new PackageOperationEventArgs (installedPackage2, null, null);
+ RaisePackageRemovedEventWhenPackageReferenceUpdated (fakeProjectManager, updatedPackage, eventArgs1, eventArgs2);
+ var updateAction = new FakeUpdatePackageAction {
+ Operations = new List<PackageOperation> (),
+ UpdateDependencies = false
+ };
+
+ packageManager.UpdatePackage (updatedPackage, updateAction);
+
+ Assert.IsFalse (fakeSolutionSharedRepository.FakePackages.Contains (installedPackage2));
+ Assert.IsFalse (fakeSolutionSharedRepository.FakePackages.Contains (installedPackage1));
+ }
+
+ [Test]
+ public void UpdatePackage_OldPackageReferenceIsRemovedOnUpdatingButAnotherProjectStillReferencesThePackage_OldPackageIsNotUninstalled ()
+ {
+ CreatePackageManager ();
+ var fakeProjectManager = new FakeProjectManager ();
+ packageManager.ProjectManager = fakeProjectManager;
+ FakePackage installedPackage = fakeSolutionSharedRepository.AddFakePackageWithVersion ("MyPackage-Core", "1.0");
+ FakePackage updatedPackage = fakeFeedSourceRepository.AddFakePackageWithVersion ("MyPackage", "1.1");
+ var eventArgs = new PackageOperationEventArgs (installedPackage, null, null);
+ RaisePackageRemovedEventWhenPackageReferenceUpdated (fakeProjectManager, updatedPackage, eventArgs);
+ var updateAction = new FakeUpdatePackageAction {
+ Operations = new List<PackageOperation> (),
+ UpdateDependencies = false
+ };
+ fakeSolutionSharedRepository.PackageIdsReferences.Add ("MyPackage-Core");
+
+ packageManager.UpdatePackage (updatedPackage, updateAction);
+
+ Assert.IsTrue (fakeSolutionSharedRepository.FakePackages.Contains (installedPackage));
+ }
+
+ [Test]
+ public void InstallPackage_OldPackageReferenceIsRemovedOnInstalling_OldPackageIsUninstalled ()
+ {
+ CreatePackageManager ();
+ var fakeProjectManager = new FakeProjectManager ();
+ packageManager.ProjectManager = fakeProjectManager;
+ FakePackage installedPackage = fakeSolutionSharedRepository.AddFakePackageWithVersion ("MyPackage", "1.0");
+ FakePackage newPackage = fakeFeedSourceRepository.AddFakePackageWithVersion ("MyPackage", "1.1");
+ var eventArgs = new PackageOperationEventArgs (installedPackage, null, null);
+ RaisePackageRemovedEventWhenPackageReferenceAdded (fakeProjectManager, newPackage, eventArgs);
+ var installAction = new FakeInstallPackageAction {
+ Operations = new List<PackageOperation> ()
+ };
+
+ packageManager.InstallPackage (newPackage, installAction);
+
+ Assert.IsFalse (fakeSolutionSharedRepository.FakePackages.Contains (installedPackage));
+ }
+
+ [Test]
+ public void InstallPackage_OldPackageReferenceIsRemovedOnInstallingButOtherProjectsReferencesOldPackage_OldPackageIsNotUninstalled ()
+ {
+ CreatePackageManager ();
+ var fakeProjectManager = new FakeProjectManager ();
+ packageManager.ProjectManager = fakeProjectManager;
+ FakePackage installedPackage = fakeSolutionSharedRepository.AddFakePackageWithVersion ("MyPackage.Core", "1.0");
+ FakePackage newPackage = fakeFeedSourceRepository.AddFakePackageWithVersion ("MyPackage", "1.1");
+ fakeSolutionSharedRepository.PackageIdsReferences.Add ("MyPackage.Core");
+ var eventArgs = new PackageOperationEventArgs (installedPackage, null, null);
+ RaisePackageRemovedEventWhenPackageReferenceAdded (fakeProjectManager, newPackage, eventArgs);
+ var installAction = new FakeInstallPackageAction {
+ Operations = new List<PackageOperation> ()
+ };
+
+ packageManager.InstallPackage (newPackage, installAction);
+
+ Assert.IsTrue (fakeSolutionSharedRepository.FakePackages.Contains (installedPackage));
+ }
+ }
+}
+
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MonoDevelopProjectManagerTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MonoDevelopProjectManagerTests.cs
new file mode 100644
index 0000000000..88d01e1555
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MonoDevelopProjectManagerTests.cs
@@ -0,0 +1,110 @@
+//
+// MonoDevelopProjectManagerTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class MonoDevelopProjectManagerTests
+ {
+ TestableProjectManager projectManager;
+
+ void CreateProjectManager ()
+ {
+ projectManager = new TestableProjectManager ();
+ }
+
+ void AddFakePackageToProjectLocalRepository (string packageId, string version)
+ {
+ projectManager.AddFakePackageToProjectLocalRepository (packageId, version);
+ }
+
+ FakePackage CreatePackage (string packageId, string version)
+ {
+ return FakePackage.CreatePackageWithVersion (packageId, version);
+ }
+
+ [Test]
+ public void IsInstalled_PackageIdPassedThatDoesNotExistInProjectLocalRepository_ReturnsFalse ()
+ {
+ CreateProjectManager ();
+
+ bool installed = projectManager.IsInstalled ("Test");
+
+ Assert.IsFalse (installed);
+ }
+
+ [Test]
+ public void IsInstalled_PackageIdPassedExistsInProjectLocalRepository_ReturnsTrue ()
+ {
+ CreateProjectManager ();
+ projectManager.AddFakePackageToProjectLocalRepository ("Test", "1.0.2");
+
+ bool installed = projectManager.IsInstalled ("Test");
+
+ Assert.IsTrue (installed);
+ }
+
+ [Test]
+ public void HasOlderPackageInstalled_ProjectLocalRepositoryDoesNotHavePackage_ReturnsFalse ()
+ {
+ CreateProjectManager ();
+ FakePackage package = CreatePackage ("Test", "1.0");
+
+ bool installed = projectManager.HasOlderPackageInstalled (package);
+
+ Assert.IsFalse (installed);
+ }
+
+ [Test]
+ public void HasOlderPackageInstalled_ProjectLocalRepositoryHasOlderPackage_ReturnsTrue ()
+ {
+ CreateProjectManager ();
+ projectManager.AddFakePackageToProjectLocalRepository ("Test", "1.0");
+ FakePackage package = CreatePackage ("Test", "1.1");
+
+ bool installed = projectManager.HasOlderPackageInstalled (package);
+
+ Assert.IsTrue (installed);
+ }
+
+ [Test]
+ public void HasOlderPackageInstalled_ProjectLocalRepositoryHasSamePackageVersion_ReturnsFalse ()
+ {
+ CreateProjectManager ();
+ projectManager.AddFakePackageToProjectLocalRepository ("Test", "1.1");
+ FakePackage package = CreatePackage ("Test", "1.1");
+
+ bool installed = projectManager.HasOlderPackageInstalled (package);
+
+ Assert.IsFalse (installed);
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MonoDevelopProjectSystemTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MonoDevelopProjectSystemTests.cs
new file mode 100644
index 0000000000..ef11874465
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MonoDevelopProjectSystemTests.cs
@@ -0,0 +1,1129 @@
+//
+// SharpDevelopProjectSystemTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.IO;
+using System.Linq;
+using System.Runtime.Versioning;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.Core;
+using MonoDevelop.Core.Assemblies;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using MonoDevelop.Projects;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class MonoDevelopProjectSystemTests
+ {
+ TestableMonoDevelopProjectSystem projectSystem;
+ FakeDotNetProject project;
+
+ void CreateProjectSystem (IDotNetProject project)
+ {
+ projectSystem = new TestableMonoDevelopProjectSystem (project);
+ }
+
+ void CreateTestProject ()
+ {
+ project = new FakeDotNetProject ();
+ }
+
+ void CreateTestWebApplicationProject ()
+ {
+ project = ProjectHelper.CreateTestWebApplicationProject ();
+ }
+
+ void CreateTestWebSiteProject ()
+ {
+ project = ProjectHelper.CreateTestWebSiteProject ();
+ }
+
+ void CreateTestProject (string fileName)
+ {
+ project = new FakeDotNetProject (fileName);
+ }
+
+ void AddFileToProject (string fileName)
+ {
+ ProjectHelper.AddFile (project, fileName);
+ }
+
+ void AddDefaultCustomToolForFileName (string fileName, string customTool)
+ {
+ projectSystem.FakeProjectService.AddDefaultCustomToolForFileName (fileName, customTool);
+ }
+
+ void AddFile (string fileName)
+ {
+ projectSystem.AddFile (fileName.ToNativePath (), (Stream)null);
+ }
+
+ void AssertLastMSBuildChildElementHasProjectAttributeValue (string expectedImport)
+ {
+ ImportAndCondition import = project.ImportsAdded.Last ();
+ Assert.AreEqual (expectedImport, import.Name);
+ }
+
+ void AssertLastImportHasCondition (string expectedCondition)
+ {
+ ImportAndCondition import = project.ImportsAdded.Last ();
+ Assert.AreEqual (expectedCondition, import.Condition);
+ }
+
+ void AssertFirstMSBuildChildElementHasProjectAttributeValue (string expectedImport)
+ {
+ ImportAndCondition import = project.ImportsAdded.First ();
+ Assert.AreEqual (expectedImport, import.Name);
+ }
+
+ void AssertFirstImportHasCondition (string expectedCondition)
+ {
+ ImportAndCondition import = project.ImportsAdded.First ();
+ Assert.AreEqual (expectedCondition, import.Condition);
+ }
+
+ void AssertImportRemoved (string expectedImportRemoved)
+ {
+ Assert.That (project.ImportsRemoved, Contains.Item (expectedImportRemoved));
+ }
+
+ [Test]
+ public void Root_NewInstanceCreated_ReturnsProjectDirectory ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject.csproj");
+ CreateProjectSystem (project);
+
+ string expectedRoot = @"d:\projects\MyProject\".ToNativePath ();
+ Assert.AreEqual (expectedRoot, projectSystem.Root);
+ }
+
+ [Test]
+ public void ProjectName_NewInstanceCreated_ReturnsProjectName ()
+ {
+ CreateTestProject ();
+ project.Name = "MyProjectName";
+ CreateProjectSystem (project);
+
+ Assert.AreEqual ("MyProjectName", projectSystem.ProjectName);
+ }
+
+ [Test]
+ [Ignore ("Arbitrary properties are not implemented")]
+ public void GetPropertyValue_PassedDefinedPropertyName_ReturnsExpectedPropertyValue ()
+ {
+ CreateTestProject ();
+ string expectedPropertyValue = "Test";
+ string propertyName = "TestProperty";
+ //project.SetEvaluatedProperty (propertyName, expectedPropertyValue);
+ CreateProjectSystem (project);
+
+ string propertyValue = projectSystem.GetPropertyValue (propertyName);
+
+ Assert.AreEqual (expectedPropertyValue, propertyValue);
+ }
+
+ [Test]
+ public void GetPropertyValue_PassedRootNamespacePropertyName_ReturnsRootNamespace ()
+ {
+ CreateTestProject ();
+ project.DefaultNamespace = "Test";
+ CreateProjectSystem (project);
+
+ string propertyValue = projectSystem.GetPropertyValue ("RootNamespace");
+
+ Assert.AreEqual ("Test", propertyValue);
+ }
+
+ [Test]
+ public void TargetFramework_TargetFrameworkVersion40DefinedInProject_ReturnsFullDotNetFramework40 ()
+ {
+ CreateTestProject ();
+ project.TargetFrameworkMoniker = new TargetFrameworkMoniker ("v4.0");
+ CreateProjectSystem (project);
+
+ FrameworkName expectedName = new FrameworkName (".NETFramework, Version=v4.0");
+
+ Assert.AreEqual (expectedName, projectSystem.TargetFramework);
+ }
+
+ [Test]
+ public void TargetFramework_TargetFrameworkVersion35ClientProfileDefinedInProject_ReturnsClientProfileDotNetFramework35 ()
+ {
+ CreateTestProject ();
+ project.TargetFrameworkMoniker = new TargetFrameworkMoniker (".NETFramework", "v3.5", "Client");
+ CreateProjectSystem (project);
+
+ FrameworkName expectedName = new FrameworkName (".NETFramework, Profile=Client, Version=v3.5");
+
+ Assert.AreEqual (expectedName, projectSystem.TargetFramework);
+ }
+
+ [Test]
+ public void TargetFramework_TargetFrameworkVersionIsSilverlight20DefinedInProject_ReturnsSilverlight ()
+ {
+ CreateTestProject ();
+ project.TargetFrameworkMoniker = new TargetFrameworkMoniker ("Silverlight", "v2.0");
+ CreateProjectSystem (project);
+
+ FrameworkName expectedName = new FrameworkName ("Silverlight, Version=v2.0");
+
+ Assert.AreEqual (expectedName, projectSystem.TargetFramework);
+ }
+
+ [Test]
+ public void IsSupportedFile_PassedCSharpFileName_ReturnsTrue ()
+ {
+ CreateTestProject ();
+ CreateProjectSystem (project);
+
+ string fileName = @"d:\temp\abc.cs".ToNativePath ();
+ bool result = projectSystem.IsSupportedFile (fileName);
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void IsSupportedFile_ProjectIsWebProjectAndPassedAppConfigFileName_ReturnsFalse ()
+ {
+ CreateTestWebApplicationProject ();
+ CreateProjectSystem (project);
+
+ string fileName = @"d:\temp\app.config".ToNativePath ();
+ bool result = projectSystem.IsSupportedFile (fileName);
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void IsSupportedFile_ProjectIsWebProjectAndPassedAppConfigFileNameInUpperCase_ReturnsFalse ()
+ {
+ CreateTestWebApplicationProject ();
+ CreateProjectSystem (project);
+
+ string fileName = @"c:\projects\APP.CONFIG".ToNativePath ();
+ bool result = projectSystem.IsSupportedFile (fileName);
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void IsSupportedFile_ProjectIsWebApplicationProjectAndPassedWebConfigFileName_ReturnsTrue ()
+ {
+ CreateTestWebApplicationProject ();
+ CreateProjectSystem (project);
+
+ string fileName = @"d:\temp\web.config".ToNativePath ();
+ bool result = projectSystem.IsSupportedFile (fileName);
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void IsSupportedFile_ProjectIsWebSiteProjectAndPassedWebConfigFileName_ReturnsTrue ()
+ {
+ CreateTestWebSiteProject ();
+ CreateProjectSystem (project);
+
+ string fileName = @"d:\temp\web.config".ToNativePath ();
+ bool result = projectSystem.IsSupportedFile (fileName);
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void IsSupportedFile_ProjectIsCSharpProjectAndPassedWebConfigFileName_ReturnsFalse ()
+ {
+ CreateTestProject ();
+ CreateProjectSystem (project);
+
+ string fileName = @"d:\temp\web.config".ToNativePath ();
+ bool result = projectSystem.IsSupportedFile (fileName);
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void IsSupportedFile_ProjectIsCSharpProjectAndPassedWebConfigFileNameInUpperCase_ReturnsFalse ()
+ {
+ CreateTestProject ();
+ CreateProjectSystem (project);
+
+ string fileName = @"d:\temp\WEB.CONFIG".ToNativePath ();
+ bool result = projectSystem.IsSupportedFile (fileName);
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void IsSupportedFile_ProjectIsCSharpProjectAndPassedAppConfigFileName_ReturnsTrue ()
+ {
+ CreateTestProject ();
+ CreateProjectSystem (project);
+
+ string fileName = @"d:\temp\app.config".ToNativePath ();
+ bool result = projectSystem.IsSupportedFile (fileName);
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void ReferenceExists_ProjectHasReferenceAndFullPathToAssemblyPassedToMethod_ReturnsTrue ()
+ {
+ CreateTestProject (@"D:\Projects\Test\MyProject.csproj");
+ ProjectHelper.AddReference (project, "MyAssembly", @"d:\Projects\Test\MyAssembly.dll".ToNativePath ());
+ CreateProjectSystem (project);
+ string fileName = @"D:\Projects\Test\MyAssembly.dll".ToNativePath ();
+
+ bool result = projectSystem.ReferenceExists (fileName);
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void ReferenceExists_ProjectHasNoReferences_ReturnsFalse ()
+ {
+ CreateTestProject ();
+ CreateProjectSystem (project);
+ string fileName = @"D:\Projects\Test\MyAssembly.dll".ToNativePath ();
+
+ bool result = projectSystem.ReferenceExists (fileName);
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void ReferenceExists_ProjectReferenceNameHasDifferentCase_ReturnsTrue ()
+ {
+ CreateTestProject (@"D:\Projects\Test\MyProject.csproj");
+ ProjectHelper.AddReference (project, "myassembly", @"d:\Projects\Test\myassembly.dll".ToNativePath ());
+ CreateProjectSystem (project);
+ string fileName = @"D:\Projects\Test\MYASSEMBLY.dll".ToNativePath ();
+
+ bool result = projectSystem.ReferenceExists (fileName);
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void ReferenceExists_ReferenceNamePassedIsInProjectAndIsReferenceNameWithNoFileExtension_ReturnsTrue ()
+ {
+ CreateTestProject ();
+ ProjectHelper.AddGacReference (project, "System.ComponentModel.Composition");
+ CreateProjectSystem (project);
+ string referenceName = "System.ComponentModel.Composition";
+
+ bool result = projectSystem.ReferenceExists (referenceName);
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void ReferenceExists_ReferenceIsInProjectAndProjectReferenceSearchedForHasExeFileExtension_ReturnsTrue ()
+ {
+ CreateTestProject (@"D:\Projects\Test\MyProject.csproj");
+ ProjectHelper.AddReference (project, "myassembly", @"d:\Projects\Test\myassembly.exe".ToNativePath ());
+ CreateProjectSystem (project);
+ string fileName = @"D:\Projects\Test\myassembly.exe".ToNativePath ();
+
+ bool result = projectSystem.ReferenceExists (fileName);
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void ReferenceExists_ReferenceIsInProjectAndProjectReferenceSearchedForHasExeFileExtensionInUpperCase_ReturnsTrue ()
+ {
+ CreateTestProject (@"D:\Projects\Test\MyProject.csproj");
+ ProjectHelper.AddReference (project, "myassembly", @"d:\Projects\Test\myassembly.exe".ToNativePath ());
+ CreateProjectSystem (project);
+ string fileName = @"D:\Projects\Test\MYASSEMBLY.EXE".ToNativePath ();
+
+ bool result = projectSystem.ReferenceExists (fileName);
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void AddReference_AddReferenceToNUnitFramework_ProjectIsSavedAfterAddingReference ()
+ {
+ CreateTestProject ();
+ CreateProjectSystem (project);
+ project.IsSaved = false;
+
+ string fileName = @"d:\projects\packages\nunit\nunit.framework.dll".ToNativePath ();
+ projectSystem.AddReference (fileName, null);
+
+ Assert.AreEqual (1, project.ReferencesWhenSavedCount);
+ }
+
+ [Test]
+ public void AddReference_AddReferenceToNUnitFramework_ReferenceAddedToProject ()
+ {
+ CreateTestProject ();
+ CreateProjectSystem (project);
+ project.IsSaved = false;
+
+ string fileName = @"d:\projects\packages\nunit\nunit.framework.dll".ToNativePath ();
+ projectSystem.AddReference (fileName, null);
+
+ ProjectReference actualReference = project.References [0];
+ Assert.AreEqual ("nunit.framework", actualReference.Reference);
+ Assert.AreEqual (fileName, actualReference.HintPath);
+ }
+
+ [Test]
+ public void AddReference_ReferenceFileNameIsRelativePath_ReferenceAddedToProject ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject.csproj");
+ CreateProjectSystem (project);
+ project.IsSaved = false;
+ string relativeFileName = @"packages\nunit\nunit.framework.dll".ToNativePath ();
+ string fullFileName = @"d:\projects\MyProject\packages\nunit\nunit.framework.dll".ToNativePath ();
+ projectSystem.AddReference (relativeFileName, null);
+
+ ProjectReference actualReference = project.References [0];
+ Assert.AreEqual ("nunit.framework", actualReference.Reference);
+ Assert.AreEqual (fullFileName, actualReference.HintPath);
+ }
+
+ [Test]
+ public void AddReference_AddReferenceToNUnitFramework_AddingReferenceIsLogged ()
+ {
+ CreateTestProject ();
+ CreateProjectSystem (project);
+ project.Name = "MyTestProject";
+
+ string fileName = @"d:\projects\packages\nunit\nunit.framework.dll".ToNativePath ();
+ projectSystem.AddReference (fileName, null);
+
+ var expectedReferenceAndProjectName = new ReferenceAndProjectName () {
+ Reference = "nunit.framework",
+ Project = "MyTestProject"
+ };
+
+ Assert.AreEqual (expectedReferenceAndProjectName, projectSystem.ReferenceAndProjectNamePassedToLogAddedReferenceToProject);
+ }
+
+ [Test]
+ public void RemoveReference_ReferenceBeingRemovedHasFileExtension_ReferenceRemovedFromProject ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject.csproj");
+ string fileName = @"d:\projects\MyProject\packages\nunit\nunit.framework.dll".ToNativePath ();
+ ProjectHelper.AddReference (project, fileName);
+ CreateProjectSystem (project);
+
+ projectSystem.RemoveReference (fileName);
+
+ ProjectReference referenceItem = ProjectHelper.GetReference (project, "nunit.framework");
+
+ Assert.IsNull (referenceItem);
+ }
+
+ [Test]
+ public void RemoveReference_ReferenceCaseAddedToProjectDifferentToReferenceNameBeingRemoved_ReferenceRemovedFromProject ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject.csproj");
+ ProjectHelper.AddReference (project, @"d:\projects\MyProject\packages\nunit\nunit.framework.dll".ToNativePath ());
+ CreateProjectSystem (project);
+
+ string fileName = @"NUNIT.FRAMEWORK.DLL";
+ projectSystem.RemoveReference (fileName);
+
+ ProjectReference referenceItem = ProjectHelper.GetReference (project, "nunit.framework");
+
+ Assert.IsNull (referenceItem);
+ }
+
+ [Test]
+ public void RemoveReference_ProjectHasNoReference_ArgumentNullExceptionNotThrown ()
+ {
+ CreateTestProject ();
+ CreateProjectSystem (project);
+
+ string fileName = @"NUNIT.FRAMEWORK.DLL";
+ Assert.DoesNotThrow (() => projectSystem.RemoveReference (fileName));
+ }
+
+ [Test]
+ public void RemoveReference_ReferenceExistsInProject_ProjectIsSavedAfterReferenceRemoved ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject.csproj");
+ string fileName = @"d:\projects\packages\nunit\nunit.framework.dll".ToNativePath ();
+ ProjectHelper.AddReference (project, fileName);
+ CreateProjectSystem (project);
+
+ projectSystem.RemoveReference (fileName);
+
+ Assert.AreEqual (0, project.ReferencesWhenSavedCount);
+ }
+
+ [Test]
+ public void RemoveReference_ReferenceBeingRemovedHasFileExtension_ReferenceRemovalIsLogged ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject.csproj");
+ project.Name = "MyTestProject";
+ string fileName = @"d:\projects\MyProject\packages\nunit\nunit.framework.dll".ToNativePath ();
+ ProjectHelper.AddReference (project, fileName);
+ CreateProjectSystem (project);
+
+ projectSystem.RemoveReference (fileName);
+
+ var expectedReferenceAndProjectName = new ReferenceAndProjectName {
+ Reference = "nunit.framework",
+ Project = "MyTestProject"
+ };
+
+ Assert.AreEqual (expectedReferenceAndProjectName, projectSystem.ReferenceAndProjectNamePassedToLogRemovedReferenceFromProject);
+ }
+
+ [Test]
+ public void AddFile_NewFile_AddsFileToFileSystem ()
+ {
+ CreateTestProject ();
+ CreateProjectSystem (project);
+
+ string expectedPath = @"d:\temp\abc.cs".ToNativePath ();
+ Stream expectedStream = new MemoryStream ();
+ projectSystem.AddFile (expectedPath, expectedStream);
+
+ Assert.AreEqual (expectedPath, projectSystem.PathPassedToPhysicalFileSystemAddFile);
+ Assert.AreEqual (expectedStream, projectSystem.StreamPassedToPhysicalFileSystemAddFile);
+ }
+
+ [Test]
+ public void AddFile_NewFile_AddsFileToProject ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject.csproj");
+ string fileName = @"d:\projects\MyProject\src\NewFile.cs".ToNativePath ();
+ project.AddDefaultBuildAction (BuildAction.Compile, fileName);
+ CreateProjectSystem (project);
+ AddFile (fileName);
+
+ ProjectFile fileItem = ProjectHelper.GetFile (project, fileName);
+ FilePath expectedFileName = new FilePath (fileName);
+ Assert.AreEqual (expectedFileName, fileItem.FilePath);
+ Assert.AreEqual (BuildAction.Compile, fileItem.BuildAction);
+ }
+
+ [Test]
+ public void AddFile_NewResxFile_AddsFileToProjectWithCorrectItemType ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject.csproj");
+ string fileName = @"d:\projects\MyProject\src\NewFile.resx".ToNativePath ();
+ project.AddDefaultBuildAction (BuildAction.EmbeddedResource, fileName);
+ CreateProjectSystem (project);
+
+ AddFile (fileName);
+ ProjectFile fileItem = ProjectHelper.GetFile (project, fileName);
+
+ FilePath expectedFileName = new FilePath (fileName);
+
+ Assert.AreEqual (expectedFileName, fileItem.FilePath);
+ Assert.AreEqual (BuildAction.EmbeddedResource, fileItem.BuildAction);
+ }
+
+ [Test]
+ public void AddFile_RelativeFileNameUsed_AddsFileToProject ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject.csproj");
+ string fileName = @"d:\projects\MyProject\src\NewFile.cs".ToNativePath ();
+ project.AddDefaultBuildAction (BuildAction.Compile, fileName);
+ CreateProjectSystem (project);
+
+ string relativeFileName = @"src\NewFile.cs".ToNativePath ();
+ AddFile (relativeFileName);
+ ProjectFile fileItem = ProjectHelper.GetFile (project, fileName);
+
+ FilePath expectedFileName = new FilePath (fileName);
+
+ Assert.AreEqual (expectedFileName, fileItem.FilePath);
+ Assert.AreEqual (BuildAction.Compile, fileItem.BuildAction);
+ }
+
+ [Test]
+ public void AddFile_RelativeFileNameWithNoPathUsed_AddsFileToProject ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject.csproj");
+ string fileName = @"d:\projects\MyProject\NewFile.cs".ToNativePath ();
+ project.AddDefaultBuildAction (BuildAction.Compile, fileName);
+ CreateProjectSystem (project);
+
+ string relativeFileName = @"NewFile.cs";
+ AddFile (relativeFileName);
+ ProjectFile fileItem = ProjectHelper.GetFile (project, fileName);
+
+ FilePath expectedFileName = new FilePath (fileName);
+
+ Assert.AreEqual (expectedFileName, fileItem.FilePath);
+ Assert.AreEqual (BuildAction.Compile, fileItem.BuildAction);
+ }
+
+ [Test]
+ public void AddFile_NewFile_ProjectIsSavedAfterFileAddedToProject ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject.csproj");
+ project.IsSaved = false;
+ CreateProjectSystem (project);
+
+ string fileName = @"d:\projects\MyProject\src\NewFile.cs";
+ AddFile (fileName);
+
+ Assert.AreEqual (1, project.FilesAddedWhenSavedCount);
+ }
+
+ [Test]
+ public void AddFile_NewFileToBeAddedInBinFolder_FileIsNotAddedToProject ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject.csproj");
+ CreateProjectSystem (project);
+
+ string fileName = @"bin\NewFile.dll";
+ AddFile (fileName);
+
+ Assert.AreEqual (0, project.FilesAdded.Count);
+ }
+
+ [Test]
+ public void AddFile_NewFileToBeAddedInBinFolderWithBinFolderNameInUpperCase_FileIsNotAddedToProject ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject.csproj");
+ CreateProjectSystem (project);
+
+ string fileName = @"BIN\NewFile.dll";
+ AddFile (fileName);
+
+ Assert.AreEqual (0, project.FilesAdded.Count);
+ }
+
+ [Test]
+ public void AddFile_FileAlreadyExistsInProject_FileIsNotAddedToProject ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject.csproj");
+ project.AddDefaultBuildAction (BuildAction.Compile, @"d:\projects\MyProject\src\NewFile.cs");
+ CreateProjectSystem (project);
+ AddFileToProject (@"d:\projects\MyProject\src\NewFile.cs");
+
+ AddFile (@"src\NewFile.cs");
+
+ int projectItemsCount = project.FilesAdded.Count;
+ Assert.AreEqual (0, projectItemsCount);
+ }
+
+ [Test]
+ public void AddFile_NewFile_FileAddedToProjectIsLogged ()
+ {
+ CreateTestProject (@"d:\temp\MyProject.csproj");
+ project.Name = "MyTestProject";
+ CreateProjectSystem (project);
+
+ AddFile (@"src\files\abc.cs");
+
+ var expectedFileNameAndProjectName = new FileNameAndProjectName {
+ FileName = @"src\files\abc.cs".ToNativePath (),
+ ProjectName = "MyTestProject"
+ };
+
+ Assert.AreEqual (expectedFileNameAndProjectName, projectSystem.FileNameAndProjectNamePassedToLogAddedFileToProject);
+ }
+
+ [Test]
+ public void AddFile_NewFileAlreadyExistsInProject_FileIsStillLogged ()
+ {
+ CreateTestProject (@"d:\temp\MyProject.csproj");
+ project.Name = "MyTestProject";
+ AddFileToProject (@"src\files\abc.cs");
+ CreateProjectSystem (project);
+
+ AddFile (@"src\files\abc.cs");
+
+ var expectedFileNameAndProjectName = new FileNameAndProjectName {
+ FileName = @"src\files\abc.cs".ToNativePath (),
+ ProjectName = "MyTestProject"
+ };
+
+ Assert.AreEqual (expectedFileNameAndProjectName, projectSystem.FileNameAndProjectNamePassedToLogAddedFileToProject);
+ }
+
+ [Test]
+ public void DeleteFile_DeletesFileFromFileSystem_CallsFileServiceRemoveFile ()
+ {
+ CreateTestProject (@"d:\temp\MyProject.csproj");
+ AddFileToProject (@"d:\temp\test.cs");
+ CreateProjectSystem (project);
+
+ projectSystem.DeleteFile ("test.cs");
+
+ Assert.AreEqual (@"d:\temp\test.cs".ToNativePath (), projectSystem.FakeFileService.PathPassedToRemoveFile);
+ }
+
+ [Test]
+ public void DeleteFile_DeletesFileFromFileSystem_ProjectIsSavedAfterFileRemoved ()
+ {
+ CreateTestProject (@"d:\temp\MyProject.csproj");
+ project.IsSaved = false;
+ AddFileToProject (@"d:\temp\test.cs");
+ CreateProjectSystem (project);
+
+ projectSystem.DeleteFile ("test.cs");
+
+ Assert.AreEqual (0, project.FilesInProjectWhenSavedCount);
+ }
+
+ [Test]
+ public void DeleteFile_DeletesFileFromFileSystem_FileDeletionLogged ()
+ {
+ CreateTestProject (@"d:\temp\MyProject.csproj");
+ AddFileToProject (@"d:\temp\test.cs");
+ CreateProjectSystem (project);
+
+ projectSystem.DeleteFile ("test.cs");
+
+ Assert.AreEqual ("test.cs", projectSystem.FileNamePassedToLogDeletedFile);
+ }
+
+ [Test]
+ public void DeleteFile_DeletesFileFromFileSystem_FolderInformationNotLogged ()
+ {
+ CreateTestProject (@"d:\temp\MyProject.csproj");
+ AddFileToProject (@"d:\temp\test.cs");
+ CreateProjectSystem (project);
+
+ projectSystem.DeleteFile ("test.cs");
+
+ Assert.IsNull (projectSystem.FileNameAndDirectoryPassedToLogDeletedFileFromDirectory);
+ }
+
+ [Test]
+ public void DeleteFile_DeletesFileFromSubFolder_FileDeletionLogged ()
+ {
+ CreateTestProject (@"d:\temp\MyProject.csproj");
+ AddFileToProject (@"d:\temp\src\Files\test.cs");
+ CreateProjectSystem (project);
+
+ projectSystem.DeleteFile (@"src\Files\test.cs".ToNativePath ());
+
+ var expectedFileNameAndFolder = new FileNameAndDirectory () {
+ FileName = "test.cs",
+ Folder = @"src\Files".ToNativePath ()
+ };
+
+ var actualFileNameAndFolder = projectSystem.FileNameAndDirectoryPassedToLogDeletedFileFromDirectory;
+
+ Assert.AreEqual (expectedFileNameAndFolder, actualFileNameAndFolder);
+ }
+
+ [Test]
+ public void DeleteFile_DeletesFileFromSubFolder_FileDeletionWithoutFolderInformationIsNotLogged ()
+ {
+ CreateTestProject (@"d:\temp\MyProject.csproj");
+ AddFileToProject (@"d:\temp\src\Files\test.cs");
+ CreateProjectSystem (project);
+
+ projectSystem.DeleteFile (@"src\Files\test.cs".ToNativePath ());
+
+ Assert.IsNull (projectSystem.FileNamePassedToLogDeletedFile);
+ }
+
+ [Test]
+ public void DeleteDirectory_DeletesDirectoryFromFileSystem_CallsFileServiceRemoveDirectory ()
+ {
+ CreateTestProject (@"d:\temp\MyProject.csproj");
+ AddFileToProject (@"d:\temp\test\test.cs");
+ CreateProjectSystem (project);
+
+ projectSystem.DeleteDirectory ("test");
+
+ string path = @"d:\temp\test".ToNativePath ();
+ Assert.AreEqual (path, projectSystem.FakeFileService.PathPassedToRemoveDirectory);
+ }
+
+ [Test]
+ public void DeleteDirectory_DeletesDirectoryFromFileSystem_ProjectIsSavedAfterDirectoryDeleted ()
+ {
+ CreateTestProject (@"d:\temp\MyProject.csproj");
+ project.IsSaved = false;
+ AddFileToProject (@"d:\temp\test\test.cs");
+ CreateProjectSystem (project);
+
+ projectSystem.DeleteDirectory ("test");
+
+ Assert.AreEqual (0, project.FilesInProjectWhenSavedCount);
+ Assert.IsTrue (project.IsSaved);
+ }
+
+ [Test]
+ public void DeleteDirectory_DeletesDirectoryFromFileSystem_DirectoryIsLogged ()
+ {
+ CreateTestProject (@"d:\temp\MyProject.csproj");
+ project.IsSaved = false;
+ AddFileToProject (@"d:\temp\test\test.cs");
+ CreateProjectSystem (project);
+
+ projectSystem.DeleteDirectory ("test");
+
+ Assert.AreEqual ("test", projectSystem.DirectoryPassedToLogDeletedDirectory);
+ }
+
+ [Test]
+ public void AddFrameworkReference_SystemXmlToBeAdded_ReferenceAddedToProject ()
+ {
+ CreateTestProject ();
+ CreateProjectSystem (project);
+
+ projectSystem.AddFrameworkReference ("System.Xml");
+
+ ProjectReference referenceItem = ProjectHelper.GetReference (project, "System.Xml");
+
+ Assert.AreEqual ("System.Xml", referenceItem.Reference);
+ Assert.AreEqual (ReferenceType.Package, referenceItem.ReferenceType);
+ }
+
+ [Test]
+ public void AddFrameworkReference_SystemXmlToBeAdded_ProjectIsSaved ()
+ {
+ CreateTestProject ();
+ CreateProjectSystem (project);
+
+ projectSystem.AddFrameworkReference ("System.Xml");
+
+ bool saved = project.IsSaved;
+
+ Assert.IsTrue (saved);
+ }
+
+ [Test]
+ public void AddFrameworkReference_SystemXmlToBeAdded_AddedReferenceIsLogged ()
+ {
+ CreateTestProject ();
+ CreateProjectSystem (project);
+ project.Name = "MyTestProject";
+
+ projectSystem.AddFrameworkReference ("System.Xml");
+
+ var expectedReferenceAndProjectName = new ReferenceAndProjectName () {
+ Reference = "System.Xml",
+ Project = "MyTestProject"
+ };
+
+ Assert.AreEqual (expectedReferenceAndProjectName, projectSystem.ReferenceAndProjectNamePassedToLogAddedReferenceToProject);
+ }
+
+ [Test]
+ public void ResolvePath_PathPassed_ReturnsPathUnchanged ()
+ {
+ CreateTestProject ();
+ CreateProjectSystem (project);
+
+ string expectedPath = @"d:\temp".ToNativePath ();
+
+ string path = projectSystem.ResolvePath (expectedPath);
+
+ Assert.AreEqual (expectedPath, path);
+ }
+
+ [Test]
+ [Ignore ("Custom tool not implemented")]
+ public void AddFile_NewTextTemplateFileWithAssociatedDefaultCustomTool_AddsFileToProjectWithDefaultCustomTool ()
+ {
+ CreateTestProject ();
+ CreateProjectSystem (project);
+ string path = @"d:\temp\abc.tt";
+ AddDefaultCustomToolForFileName (path, "TextTemplatingFileGenerator");
+ Stream stream = new MemoryStream ();
+
+ projectSystem.AddFile (path, stream);
+
+ //ProjectFile fileItem = ProjectHelper.GetFile (project, path);
+ //string customTool = fileItem.CustomTool;
+ //Assert.AreEqual ("TextTemplatingFileGenerator", customTool);
+ }
+
+ [Test]
+ [Ignore ("Custom tool not implemented")]
+ public void AddFile_NewFileWithNoAssociatedDefaultCustomTool_AddsFileToProjectWithNoDefaultCustomTool ()
+ {
+ CreateTestProject ();
+ CreateProjectSystem (project);
+ string path = @"d:\temp\abc.tt".ToNativePath ();
+ AddDefaultCustomToolForFileName (path, null);
+ Stream stream = new MemoryStream ();
+
+ projectSystem.AddFile (path, stream);
+
+ //ProjectFile fileItem = ProjectHelper.GetFile (project, path);
+ //string customTool = fileItem.CustomTool;
+ //Assert.AreEqual (String.Empty, customTool);
+ }
+
+ [Test]
+ public void AddImport_FullImportFilePathAndBottomOfProject_PathRelativeToProjectAddedAsLastImportInProject ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject\MyProject.csproj");
+ CreateProjectSystem (project);
+ string targetPath = @"d:\projects\MyProject\packages\Foo.0.1\build\Foo.targets".ToNativePath ();
+
+ projectSystem.AddImport (targetPath, ProjectImportLocation.Bottom);
+
+ AssertLastMSBuildChildElementHasProjectAttributeValue (@"..\packages\Foo.0.1\build\Foo.targets");
+ }
+
+ [Test]
+ public void AddImport_SolutionAndProjectInSameDirectory_PathRelativeToProjectAddedAsLastImportInProject ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject.csproj");
+ CreateProjectSystem (project);
+ string targetPath = @"d:\projects\MyProject\packages\Foo.0.1\build\Foo.targets".ToNativePath ();
+
+ projectSystem.AddImport (targetPath, ProjectImportLocation.Bottom);
+
+ AssertLastMSBuildChildElementHasProjectAttributeValue (@"packages\Foo.0.1\build\Foo.targets");
+ }
+
+ [Test]
+ public void AddImport_AddImportToBottomOfProject_ImportAddedWithConditionThatChecksForExistenceOfTargetsFile ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject\MyProject.csproj");
+ CreateProjectSystem (project);
+ string targetPath = @"d:\projects\MyProject\packages\Foo.0.1\build\Foo.targets".ToNativePath ();
+
+ projectSystem.AddImport (targetPath, ProjectImportLocation.Bottom);
+
+ AssertLastImportHasCondition ("Exists('..\\packages\\Foo.0.1\\build\\Foo.targets')");
+ }
+
+ [Test]
+ public void AddImport_AddSameImportTwice_ImportOnlyAddedTwiceToProjectSinceProjectRemovesDuplicates ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject\MyProject.csproj");
+ CreateProjectSystem (project);
+ string targetPath = @"d:\projects\MyProject\packages\Foo.0.1\build\Foo.targets".ToNativePath ();
+ projectSystem.AddImport (targetPath, ProjectImportLocation.Bottom);
+
+ projectSystem.AddImport (targetPath, ProjectImportLocation.Bottom);
+
+ Assert.AreEqual (2, project.ImportsAdded.Count);
+ }
+
+ [Test]
+ public void AddImport_AddSameImportTwiceButWithDifferentCase_ImportOnlyAddedTwiceToProjectSinceProjectRemovesDuplicates ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject\MyProject.csproj");
+ CreateProjectSystem (project);
+ string targetPath1 = @"d:\projects\MyProject\packages\Foo.0.1\build\Foo.targets".ToNativePath ();
+ string targetPath2 = @"d:\projects\MyProject\packages\Foo.0.1\BUILD\FOO.TARGETS".ToNativePath ();
+ projectSystem.AddImport (targetPath1, ProjectImportLocation.Bottom);
+
+ projectSystem.AddImport (targetPath2, ProjectImportLocation.Bottom);
+
+ Assert.AreEqual (2, project.ImportsAdded.Count);
+ }
+
+ [Test]
+ public void AddImport_FullImportFilePathAndBottomOfProject_ProjectIsSaved ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject\MyProject.csproj");
+ CreateProjectSystem (project);
+ string targetPath = @"d:\projects\MyProject\packages\Foo.0.1\build\Foo.targets".ToNativePath ();
+
+ projectSystem.AddImport (targetPath, ProjectImportLocation.Bottom);
+
+ Assert.IsTrue (project.IsSaved);
+ }
+
+ [Test]
+ public void RemoveImport_ImportAlreadyAddedToBottomOfProject_ImportRemoved ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject\MyProject.csproj");
+ CreateProjectSystem (project);
+ string targetPath = @"d:\projects\MyProject\packages\Foo.0.1\build\Foo.targets".ToNativePath ();
+ projectSystem.AddImport (targetPath, ProjectImportLocation.Bottom);
+
+ projectSystem.RemoveImport (targetPath);
+
+ AssertImportRemoved (@"..\packages\Foo.0.1\build\Foo.targets");
+ }
+
+ [Test]
+ public void RemoveImport_ImportAlreadyWithDifferentCaseAddedToBottomOfProject_ImportRemoved ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject\MyProject.csproj");
+ CreateProjectSystem (project);
+ string targetPath1 = @"d:\projects\MyProject\packages\Foo.0.1\build\Foo.targets".ToNativePath ();
+ projectSystem.AddImport (targetPath1, ProjectImportLocation.Bottom);
+ string targetPath2 = @"d:\projects\MyProject\packages\Foo.0.1\BUILD\FOO.TARGETS".ToNativePath ();
+
+ projectSystem.RemoveImport (targetPath2);
+
+ Assert.AreEqual (1, project.ImportsAdded.Count);
+ Assert.AreEqual (2, project.ImportsRemoved.Count);
+ }
+
+ [Test]
+ public void RemoveImport_NoImportsAdded_ProjectIsSaved ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject\MyProject.csproj");
+ CreateProjectSystem (project);
+
+ projectSystem.RemoveImport ("Unknown.targets");
+
+ Assert.IsTrue (project.IsSaved);
+ }
+
+ [Test]
+ public void AddImport_AddToTopOfProject_ImportAddedAsFirstChildElement ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject\MyProject.csproj");
+ CreateProjectSystem (project);
+ string targetPath = @"d:\projects\MyProject\packages\Foo.0.1\build\Foo.targets".ToNativePath ();
+
+ projectSystem.AddImport (targetPath, ProjectImportLocation.Top);
+
+ AssertFirstMSBuildChildElementHasProjectAttributeValue (@"..\packages\Foo.0.1\build\Foo.targets");
+ }
+
+ [Test]
+ public void AddImport_AddImportToTopOfProject_ImportAddedWithConditionThatChecksForExistenceOfTargetsFile ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject\MyProject.csproj");
+ CreateProjectSystem (project);
+ string targetPath = @"d:\projects\MyProject\packages\Foo.0.1\build\Foo.targets".ToNativePath ();
+
+ projectSystem.AddImport (targetPath, ProjectImportLocation.Top);
+
+ AssertFirstImportHasCondition ("Exists('..\\packages\\Foo.0.1\\build\\Foo.targets')");
+ }
+
+ [Test]
+ public void AddImport_AddToTopOfProjectTwice_ImportAddedTwiceSinceProjectRemovesDuplicates ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject\MyProject.csproj");
+ CreateProjectSystem (project);
+ string targetPath = @"d:\projects\MyProject\packages\Foo.0.1\build\Foo.targets".ToNativePath ();
+ projectSystem.AddImport (targetPath, ProjectImportLocation.Top);
+
+ projectSystem.AddImport (targetPath, ProjectImportLocation.Top);
+
+ Assert.AreEqual (2, project.ImportsAdded.Count);
+ }
+
+ [Test]
+ public void AddFile_NewFileAddedWithAction_AddsFileToFileSystem ()
+ {
+ CreateTestProject ();
+ CreateProjectSystem (project);
+
+ string expectedPath = @"d:\temp\abc.cs".ToNativePath ();
+ Action<Stream> expectedAction = stream => {
+ };
+ projectSystem.AddFile (expectedPath, expectedAction);
+
+ Assert.AreEqual (expectedPath, projectSystem.PathPassedToPhysicalFileSystemAddFile);
+ Assert.AreEqual (expectedAction, projectSystem.ActionPassedToPhysicalFileSystemAddFile);
+ }
+
+ [Test]
+ public void AddFile_NewFileAddedWithAction_AddsFileToProject ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject.csproj");
+ string fileName = @"d:\projects\MyProject\src\NewFile.cs".ToNativePath ();
+ project.AddDefaultBuildAction (BuildAction.Compile, fileName);
+ CreateProjectSystem (project);
+
+ Action<Stream> action = stream => {
+ };
+ projectSystem.AddFile (fileName, action);
+
+ ProjectFile fileItem = ProjectHelper.GetFile (project, fileName);
+ var expectedFileName = new FilePath (fileName);
+
+ Assert.AreEqual (expectedFileName, fileItem.FilePath);
+ Assert.AreEqual (BuildAction.Compile, fileItem.BuildAction);
+ }
+
+ [Test]
+ public void ReferenceExists_ReferenceIsInProjectButIncludesAssemblyVersion_ReturnsTrue ()
+ {
+ CreateTestProject ();
+ string include = "MyAssembly, Version=0.1.0.0, Culture=neutral, PublicKeyToken=8cc8392e8503e009";
+ ProjectHelper.AddGacReference (project, include);
+ CreateProjectSystem (project);
+ string fileName = @"D:\Projects\Test\myassembly.dll".ToNativePath ();
+
+ bool result = projectSystem.ReferenceExists (fileName);
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void RemoveReference_ReferenceBeingRemovedHasFileExtensionAndProjectHasReferenceIncludingAssemblyVersion_ReferenceRemovedFromProject ()
+ {
+ CreateTestProject ();
+ string include = "nunit.framework, Version=2.6.2.0, Culture=neutral, PublicKeyToken=8cc8392e8503e009";
+ ProjectHelper.AddGacReference (project, include);
+ CreateProjectSystem (project);
+ string fileName = @"d:\projects\packages\nunit\nunit.framework.dll".ToNativePath ();
+
+ projectSystem.RemoveReference (fileName);
+
+ ProjectReference referenceItem = ProjectHelper.GetReference (project, "nunit.framework");
+ Assert.IsNull (referenceItem);
+ }
+
+ [Test]
+ public void RemoveImport_EnsureMacImportsWithWrongSeparatorAreRemoved_RemovesTwoImportsOneWithForwardSlashesAndOneWithBackslashesOnBothWindowsAndMac ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject\MyProject.csproj");
+ CreateProjectSystem (project);
+ string targetPath = @"d:\projects\MyProject\packages\Foo.0.1\build\Foo.targets".ToNativePath ();
+ projectSystem.AddImport (targetPath, ProjectImportLocation.Bottom);
+ string expectedImportRemoved = @"..\packages\Foo.0.1\build\Foo.targets";
+
+ projectSystem.RemoveImport (targetPath.ToNativePath ());
+
+ AssertImportRemoved (expectedImportRemoved);
+ AssertImportRemoved (expectedImportRemoved.Replace ('\\', '/'));
+ Assert.AreEqual (2, project.ImportsRemoved.Count);
+ }
+
+ [Test]
+ public void RemoveImport_ProjectAndSolutionInSameDirectory_ImportRemoved ()
+ {
+ CreateTestProject (@"d:\projects\MyProject\MyProject.csproj");
+ CreateProjectSystem (project);
+ string targetPath = @"d:\projects\MyProject\packages\Foo.0.1\build\Foo.targets".ToNativePath ();
+ projectSystem.AddImport (targetPath, ProjectImportLocation.Bottom);
+
+ projectSystem.RemoveImport (targetPath);
+
+ AssertImportRemoved (@"packages\Foo.0.1\build\Foo.targets");
+ }
+ }
+}
+
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/NuGetPackageRestoreCommandLineTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/NuGetPackageRestoreCommandLineTests.cs
new file mode 100644
index 0000000000..92dae73c23
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/NuGetPackageRestoreCommandLineTests.cs
@@ -0,0 +1,86 @@
+//
+// NuGetPackageRestoreCommandLineTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+using NUnit.Framework;
+using MonoDevelop.Core.Assemblies;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using System.IO;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class NuGetPackageRestoreCommandLineTests
+ {
+ NuGetPackageRestoreCommandLine commandLine;
+
+ void CreateCommandLineWithSolution (string fileName)
+ {
+ CreateCommandLineWithSolution (fileName, null, false);
+ }
+
+ void CreateCommandLineWithSolution (string fileName, MonoRuntimeInfo monoRuntimeInfo)
+ {
+ CreateCommandLineWithSolution (fileName, monoRuntimeInfo, true);
+ }
+
+ void CreateCommandLineWithSolution (string fileName, MonoRuntimeInfo monoRuntimeInfo, bool isMonoRuntime)
+ {
+ var solution = new FakePackageManagementSolution ();
+ solution.FileName = fileName;
+ commandLine = new NuGetPackageRestoreCommandLine (
+ solution,
+ monoRuntimeInfo,
+ isMonoRuntime);
+ }
+
+ [Test]
+ public void Arguments_RestoreSolution_SolutionFullFileNameUsed ()
+ {
+ CreateCommandLineWithSolution (@"d:\projects\MySolution\MySolution.sln");
+
+ string arguments = commandLine.Arguments;
+
+ string expectedArguments = "restore \"d:\\projects\\MySolution\\MySolution.sln\"";
+ Assert.AreEqual (expectedArguments, arguments);
+ }
+
+ [Test]
+ public void CommandLine_RestoreSolutionOnMono_MonoUsedFromCurrentPrefix ()
+ {
+ var monoRuntime = new MonoRuntimeInfo (@"c:\Users\Prefix");
+ CreateCommandLineWithSolution (@"d:\projects\MySolution\MySolution.sln", monoRuntime);
+
+ string arguments = commandLine.Arguments;
+
+ string expectedCommandLine = Path.Combine (@"c:\Users\Prefix", "bin", "mono");
+ Assert.IsTrue (arguments.StartsWith ("--runtime=v4.0 "), arguments);
+ Assert.IsTrue (arguments.EndsWith ("restore \"d:\\projects\\MySolution\\MySolution.sln\""), arguments);
+ Assert.AreEqual (expectedCommandLine, commandLine.Command);
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/OpenDotNetProjectTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/OpenDotNetProjectTests.cs
new file mode 100644
index 0000000000..84d7b1a2ae
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/OpenDotNetProjectTests.cs
@@ -0,0 +1,90 @@
+//
+// OpenDotNetProjectTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.Core;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class OpenDotNetProjectsTests
+ {
+ OpenDotNetProjects projects;
+ FakePackageManagementProjectService fakeProjectService;
+ List<IDotNetProject> openProjects;
+
+ void CreateOpenMSBuildProjects ()
+ {
+ fakeProjectService = new FakePackageManagementProjectService ();
+ openProjects = fakeProjectService.OpenProjects;
+
+ projects = new OpenDotNetProjects (fakeProjectService);
+ }
+
+ FakeDotNetProject AddProjectWithShortName (string projectName)
+ {
+ var project = ProjectHelper.CreateTestProject (projectName);
+ openProjects.Add (project);
+ return project;
+ }
+
+ FakeDotNetProject AddProjectWithFileName (string fileName)
+ {
+ FakeDotNetProject project = AddProjectWithShortName ("Test");
+ project.FileName = new FilePath (fileName);
+ return project;
+ }
+
+ [Test]
+ public void FindProject_ProjectShortNameUsedAndProjectIsOpen_ReturnsProject ()
+ {
+ CreateOpenMSBuildProjects ();
+ IDotNetProject expectedProject = AddProjectWithShortName ("MyProject");
+
+ IDotNetProject project = projects.FindProject ("MyProject");
+
+ Assert.AreEqual (expectedProject, project);
+ }
+
+ [Test]
+ public void FindProject_ProjectFileNameUsedAndProjectIsOpen_ReturnsProject ()
+ {
+ CreateOpenMSBuildProjects ();
+ string fileName = @"d:\projects\MyProject\MyProject.csproj";
+ IDotNetProject expectedProject = AddProjectWithFileName (fileName);
+
+ IDotNetProject project = projects.FindProject (fileName);
+
+ Assert.AreEqual (expectedProject, project);
+ }
+ }
+}
+
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageFilesTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageFilesTests.cs
new file mode 100644
index 0000000000..30d245fe04
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageFilesTests.cs
@@ -0,0 +1,170 @@
+//
+// PackageFilesTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using NUnit.Framework;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class PackageFilesTests
+ {
+ PackageFiles packageFiles;
+
+ void CreatePackageFiles (FakePackage package)
+ {
+ packageFiles = new PackageFiles (package);
+ }
+
+ void CreatePackageFilesWithOneFile (string fileName)
+ {
+ var package = new FakePackage ();
+ package.AddFile (fileName);
+ CreatePackageFiles (package);
+ }
+
+ void CreatePackageFilesWithTwoFiles (string fileName1, string fileName2)
+ {
+ var package = new FakePackage ();
+ package.AddFile (fileName1);
+ package.AddFile (fileName2);
+ CreatePackageFiles (package);
+ }
+
+ [Test]
+ public void HasAnyPackageScripts_HasOnePowerShellInitScript_ReturnsTrue ()
+ {
+ CreatePackageFilesWithOneFile (@"tools\init.ps1");
+
+ bool hasScripts = packageFiles.HasAnyPackageScripts ();
+
+ Assert.IsTrue (hasScripts);
+ }
+
+ [Test]
+ public void HasAnyPackageScripts_HasOneCSharpFile_ReturnsFalse ()
+ {
+ CreatePackageFilesWithOneFile (@"src\test.cs");
+
+ bool hasScripts = packageFiles.HasAnyPackageScripts ();
+
+ Assert.IsFalse (hasScripts);
+ }
+
+ [Test]
+ public void HasAnyPackageScripts_HasOnePowerShellInitScriptWithDifferentParentFolder_ReturnsTrue ()
+ {
+ CreatePackageFilesWithOneFile (@"parentfolder\init.ps1");
+
+ bool hasScripts = packageFiles.HasAnyPackageScripts ();
+
+ Assert.IsTrue (hasScripts);
+ }
+
+ [Test]
+ public void HasAnyPackageScripts_HasOnePowerShellInitScriptInUpperCase_ReturnsTrue ()
+ {
+ CreatePackageFilesWithOneFile (@"tools\INIT.PS1");
+
+ bool hasScripts = packageFiles.HasAnyPackageScripts ();
+
+ Assert.IsTrue (hasScripts);
+ }
+
+ [Test]
+ public void HasAnyPackageScripts_HasOnePowerShellInstallScript_ReturnsTrue ()
+ {
+ CreatePackageFilesWithOneFile (@"tools\install.ps1");
+
+ bool hasScripts = packageFiles.HasAnyPackageScripts ();
+
+ Assert.IsTrue (hasScripts);
+ }
+
+ [Test]
+ public void HasAnyPackageScripts_HasOnePowerShellInstallScriptInUpperCase_ReturnsTrue ()
+ {
+ CreatePackageFilesWithOneFile (@"tools\INSTALL.PS1");
+
+ bool hasScripts = packageFiles.HasAnyPackageScripts ();
+
+ Assert.IsTrue (hasScripts);
+ }
+
+ [Test]
+ public void HasAnyPackageScripts_HasOnePowerShellUninstallScript_ReturnsTrue ()
+ {
+ CreatePackageFilesWithOneFile (@"tools\uninstall.ps1");
+
+ bool hasScripts = packageFiles.HasAnyPackageScripts ();
+
+ Assert.IsTrue (hasScripts);
+ }
+
+ [Test]
+ public void HasAnyPackageScripts_HasOnePowerShellUninstallScriptInUpperCase_ReturnsTrue ()
+ {
+ CreatePackageFilesWithOneFile (@"tools\UNINSTALL.PS1");
+
+ bool hasScripts = packageFiles.HasAnyPackageScripts ();
+
+ Assert.IsTrue (hasScripts);
+ }
+
+ [Test]
+ public void HasAnyPackageScripts_SecondFileIsPowerShellInitScript_ReturnsTrue ()
+ {
+ CreatePackageFilesWithTwoFiles (@"src\test.cs", @"tools\init.ps1");
+
+ bool hasScripts = packageFiles.HasAnyPackageScripts ();
+
+ Assert.IsTrue (hasScripts);
+ }
+
+ [Test]
+ public void HasUninstallPackageScript_HasOnePowerShellUninstallScript_ReturnsTrue ()
+ {
+ CreatePackageFilesWithOneFile (@"tools\uninstall.ps1");
+
+ bool hasScript = packageFiles.HasUninstallPackageScript ();
+
+ Assert.IsTrue (hasScript);
+ }
+
+ [Test]
+ public void HasUninstallPackageScript_HasOneCSharpFile_ReturnsFalse ()
+ {
+ CreatePackageFilesWithOneFile (@"tools\test.cs");
+
+ bool hasScript = packageFiles.HasUninstallPackageScript ();
+
+ Assert.IsFalse (hasScript);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageFromRepositoryTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageFromRepositoryTests.cs
new file mode 100644
index 0000000000..b3ad384a74
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageFromRepositoryTests.cs
@@ -0,0 +1,467 @@
+//
+// PackageFromRepositoryTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.Versioning;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class PackageFromRepositoryTests
+ {
+ FakePackage fakePackage;
+ TestablePackageFromRepository package;
+ FakePackageRepository fakeRepository;
+
+ void CreatePackage ()
+ {
+ package = new TestablePackageFromRepository ();
+ fakePackage = package.FakePackagePassedToConstructor;
+ fakeRepository = package.FakePackageRepositoryPassedToConstructor;
+ }
+
+ [Test]
+ public void Repository_PackageCreatedWithSourceRepository_ReturnsSourceRepository ()
+ {
+ CreatePackage ();
+ IPackageRepository repository = package.Repository;
+
+ Assert.AreEqual (fakeRepository, repository);
+ }
+
+ [Test]
+ public void AssemblyReferences_WrappedPackageHasOneAssemblyReference_ReturnsOneAssemblyReference ()
+ {
+ CreatePackage ();
+ fakePackage.AssemblyReferenceList.Add (new FakePackageAssemblyReference ());
+
+ IEnumerable<IPackageAssemblyReference> assemblyReferences = package.AssemblyReferences;
+ List<IPackageAssemblyReference> expectedAssemblyReferences = fakePackage.AssemblyReferenceList;
+
+ CollectionAssert.AreEqual (expectedAssemblyReferences, assemblyReferences);
+ }
+
+ [Test]
+ public void Id_WrappedPackageIdIsTest_ReturnsTest ()
+ {
+ CreatePackage ();
+ fakePackage.Id = "Test";
+ string id = package.Id;
+
+ Assert.AreEqual ("Test", id);
+ }
+
+ [Test]
+ public void Version_WrappedPackageVersionIsOnePointOne_ReturnsOnePointOne ()
+ {
+ CreatePackage ();
+ var expectedVersion = new SemanticVersion ("1.1");
+ fakePackage.Version = expectedVersion;
+ SemanticVersion version = package.Version;
+
+ Assert.AreEqual (expectedVersion, version);
+ }
+
+ [Test]
+ public void Title_WrappedPackageTitleIsTest_ReturnsTest ()
+ {
+ CreatePackage ();
+ fakePackage.Title = "Test";
+ string title = package.Title;
+
+ Assert.AreEqual ("Test", title);
+ }
+
+ [Test]
+ public void Authors_WrappedPackageHasOneAuthor_ReturnsOneAuthor ()
+ {
+ CreatePackage ();
+ fakePackage.AuthorsList.Add ("Author1");
+
+ IEnumerable<string> authors = package.Authors;
+ List<string> expectedAuthors = fakePackage.AuthorsList;
+
+ CollectionAssert.AreEqual (expectedAuthors, authors);
+ }
+
+ [Test]
+ public void Owners_WrappedPackageHasOneOwner_ReturnsOneOwner ()
+ {
+ CreatePackage ();
+ fakePackage.OwnersList.Add ("Owner1");
+
+ IEnumerable<string> owners = package.Owners;
+ List<string> expectedOwners = fakePackage.OwnersList;
+
+ CollectionAssert.AreEqual (expectedOwners, owners);
+ }
+
+ [Test]
+ public void IconUrl_WrappedPackageIconUrlIsHttpSharpDevelopNet_ReturnsHttpSharpDevelopNet ()
+ {
+ CreatePackage ();
+ var expectedUrl = new Uri ("http://sharpdevelop.net");
+ fakePackage.IconUrl = expectedUrl;
+ Uri url = package.IconUrl;
+
+ Assert.AreEqual (expectedUrl, url);
+ }
+
+ [Test]
+ public void LicenseUrl_WrappedPackageLicenseUrlIsHttpSharpDevelopNet_ReturnsHttpSharpDevelopNet ()
+ {
+ CreatePackage ();
+ var expectedUrl = new Uri ("http://sharpdevelop.net");
+ fakePackage.LicenseUrl = expectedUrl;
+ Uri url = package.LicenseUrl;
+
+ Assert.AreEqual (expectedUrl, url);
+ }
+
+ [Test]
+ public void ProjectUrl_WrappedPackageProjectUrlIsHttpSharpDevelopNet_ReturnsHttpSharpDevelopNet ()
+ {
+ CreatePackage ();
+ var expectedUrl = new Uri ("http://sharpdevelop.net");
+ fakePackage.ProjectUrl = expectedUrl;
+ Uri url = package.ProjectUrl;
+
+ Assert.AreEqual (expectedUrl, url);
+ }
+
+ [Test]
+ public void ReportAbuseUrl_WrappedPackageReportAbuseUrlIsHttpSharpDevelopNet_ReturnsHttpSharpDevelopNet ()
+ {
+ CreatePackage ();
+ var expectedUrl = new Uri ("http://sharpdevelop.net");
+ fakePackage.ReportAbuseUrl = expectedUrl;
+ Uri url = package.ReportAbuseUrl;
+
+ Assert.AreEqual (expectedUrl, url);
+ }
+
+ [Test]
+ public void RequiresLicenseAcceptance_WrappedPackageRequiresLicenseAcceptanceIsTrue_ReturnsTrue ()
+ {
+ CreatePackage ();
+ fakePackage.RequireLicenseAcceptance = true;
+
+ Assert.IsTrue (package.RequireLicenseAcceptance);
+ }
+
+ [Test]
+ public void Description_WrappedPackageDescriptionIsTest_ReturnsTest ()
+ {
+ CreatePackage ();
+ fakePackage.Description = "Test";
+ string description = package.Description;
+
+ Assert.AreEqual ("Test", description);
+ }
+
+ [Test]
+ public void Summary_WrappedPackageSummaryIsTest_ReturnsTest ()
+ {
+ CreatePackage ();
+ fakePackage.Summary = "Test";
+ string summary = package.Summary;
+
+ Assert.AreEqual ("Test", summary);
+ }
+
+ [Test]
+ public void Language_WrappedPackageLanguageIsTest_ReturnsTest ()
+ {
+ CreatePackage ();
+ fakePackage.Language = "Test";
+ string language = package.Language;
+
+ Assert.AreEqual ("Test", language);
+ }
+
+ [Test]
+ public void Tags_WrappedPackageTagsIsTest_ReturnsTest ()
+ {
+ CreatePackage ();
+ fakePackage.Tags = "Test";
+ string tags = package.Tags;
+
+ Assert.AreEqual ("Test", tags);
+ }
+
+ [Test]
+ public void FrameworkAssemblies_WrappedPackageHasOneFrameworkAssembly_ReturnsOneFrameworkAssembly ()
+ {
+ CreatePackage ();
+ fakePackage.FrameworkAssembliesList.Add (new FrameworkAssemblyReference ("System.Xml"));
+
+ IEnumerable<FrameworkAssemblyReference> assemblies = package.FrameworkAssemblies;
+ IEnumerable<FrameworkAssemblyReference> expectedAssemblies = fakePackage.FrameworkAssemblies;
+
+ CollectionAssert.AreEqual (expectedAssemblies, assemblies);
+ }
+
+ [Test]
+ public void Dependencies_WrappedPackageHasOneDependency_ReturnsOneDependency ()
+ {
+ CreatePackage ();
+ fakePackage.AddDependency ("Test");
+
+ IEnumerable<PackageDependency> dependencies = package.Dependencies;
+
+ CollectionAssert.AreEqual (fakePackage.DependenciesList, dependencies);
+ }
+
+ [Test]
+ public void GetFiles_WrappedPackageHasOneFile_ReturnsOneFile ()
+ {
+ CreatePackage ();
+ fakePackage.FilesList.Add (new PhysicalPackageFile ());
+
+ IEnumerable<IPackageFile> files = package.GetFiles ();
+ IEnumerable<IPackageFile> expectedFiles = fakePackage.FilesList;
+
+ CollectionAssert.AreEqual (expectedFiles, files);
+ }
+
+ [Test]
+ public void DownloadCount_WrappedPackageDownloadCountIsTen_ReturnsTen ()
+ {
+ CreatePackage ();
+ fakePackage.DownloadCount = 10;
+ int count = package.DownloadCount;
+
+ Assert.AreEqual (10, count);
+ }
+
+ [Test]
+ public void GetStream_WrappedPackageHasStream_ReturnsWrappedPackageStream ()
+ {
+ CreatePackage ();
+ var expectedStream = new MemoryStream ();
+ fakePackage.Stream = expectedStream;
+
+ Stream stream = package.GetStream ();
+
+ Assert.AreEqual (expectedStream, stream);
+ }
+
+ [Test]
+ public void HasDependencies_WrappedPackageHasNoDependencies_ReturnsFalse ()
+ {
+ CreatePackage ();
+ fakePackage.DependenciesList.Clear ();
+ bool result = package.HasDependencies;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void HasDependencies_WrappedPackageHasOneDependency_ReturnsTrue ()
+ {
+ CreatePackage ();
+ fakePackage.AddDependency ("Test");
+ bool result = package.HasDependencies;
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void LastUpdated_PackageWrapsDataServicePackageThatHasLastUpdatedDateOffset_ReturnsDateFromDataServicePackage ()
+ {
+ CreatePackage ();
+ var expectedDateTime = new DateTime (2011, 1, 2);
+ package.DateTimeOffsetToReturnFromGetDataServicePackageLastUpdated = new DateTimeOffset (expectedDateTime);
+
+ DateTime? lastUpdated = package.LastUpdated;
+
+ Assert.AreEqual (expectedDateTime, lastUpdated.Value);
+ }
+
+ [Test]
+ public void LastUpdated_PackageWrapsPackageThatDoesNotHaveLastUpdatedDateOffset_ReturnsNullDate ()
+ {
+ CreatePackage ();
+ package.DateTimeOffsetToReturnFromGetDataServicePackageLastUpdated = null;
+
+ DateTime? lastUpdated = package.LastUpdated;
+
+ Assert.IsFalse (lastUpdated.HasValue);
+ }
+
+ [Test]
+ public void IsLatestVersion_WrappedPackageIsNotLatestVersion_ReturnsFalse ()
+ {
+ CreatePackage ();
+ fakePackage.IsLatestVersion = false;
+ bool result = package.IsLatestVersion;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void IsLatestVersion_WrappedPackageHasOneDependency_ReturnsTrue ()
+ {
+ CreatePackage ();
+ fakePackage.IsLatestVersion = true;
+ bool result = package.IsLatestVersion;
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void Published_PackageWrapsPackageThatHasPublishedDateOffset_ReturnsDateTimeOffsetFromWrappedPackage ()
+ {
+ CreatePackage ();
+ var dateTime = new DateTime (2011, 1, 2);
+ var expectedDateTimeOffset = new DateTimeOffset (dateTime);
+ fakePackage.Published = expectedDateTimeOffset;
+
+ DateTimeOffset? published = package.Published;
+
+ Assert.AreEqual (expectedDateTimeOffset, published.Value);
+ }
+
+ [Test]
+ public void Copyright_WrappedPackageCopyrightIsTest_ReturnsTest ()
+ {
+ CreatePackage ();
+ fakePackage.Copyright = "Test";
+ string copyright = package.Copyright;
+
+ Assert.AreEqual ("Test", copyright);
+ }
+
+ [Test]
+ public void ReleaseNotes_WrappedPackageReleaseNotesIsTest_ReturnsTest ()
+ {
+ CreatePackage ();
+ fakePackage.ReleaseNotes = "Test";
+ string releaseNotes = package.ReleaseNotes;
+
+ Assert.AreEqual ("Test", releaseNotes);
+ }
+
+ [Test]
+ public void IsAbsoluteLatestVersion_WrappedPackageIsAbsoluteLatestVersion_ReturnsTrue ()
+ {
+ CreatePackage ();
+ fakePackage.IsAbsoluteLatestVersion = true;
+ bool result = package.IsAbsoluteLatestVersion;
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void Listed_WrappedPackageIsListed_ReturnsTrue ()
+ {
+ CreatePackage ();
+ fakePackage.Listed = true;
+ bool result = package.Listed;
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void DependencySets_WrappedPackageIsListed_ReturnsTrue ()
+ {
+ CreatePackage ();
+ fakePackage.AddDependency ("Test");
+ List<PackageDependencySet> expectedDependencies = fakePackage.DependencySets.ToList ();
+
+ List<PackageDependencySet> dependencies = package.DependencySets.ToList ();
+
+ Assert.AreEqual (1, dependencies.Count);
+ Assert.AreEqual (expectedDependencies [0].Dependencies, dependencies [0].Dependencies);
+ }
+
+ [Test]
+ public void GetSupportedFrameworks_OneFramework_ReturnsOneFramework ()
+ {
+ CreatePackage ();
+ FrameworkName expectedFramework = fakePackage.AddSupportedFramework (".NET Framework, Version=4.0");
+
+ List<FrameworkName> supportedFrameworks = package.GetSupportedFrameworks ().ToList ();
+
+ Assert.AreEqual (1, supportedFrameworks.Count);
+ Assert.AreEqual (expectedFramework, supportedFrameworks [0]);
+ }
+
+ [Test]
+ public void ToString_PackageHasIdAndVersion_ReturnsWrappedPackageToString ()
+ {
+ CreatePackage ();
+ fakePackage.Id = "MyPackage";
+ fakePackage.Version = new SemanticVersion ("1.1");
+
+ string result = package.ToString ();
+
+ Assert.AreEqual ("MyPackage 1.1", result);
+ }
+
+ [Test]
+ public void MinClientVersion_PackageHasMinClientVersion_ReturnsWrappedPackageMinClientVersion ()
+ {
+ CreatePackage ();
+ var expectedVersion = new Version ("1.1");
+ fakePackage.MinClientVersion = expectedVersion;
+
+ Version version = package.MinClientVersion;
+
+ Assert.AreEqual (expectedVersion, version);
+ }
+
+ [Test]
+ public void PackageAssemblyReferences_PackageHasOnePackageAssemblyReference_ReturnsWrappedPackagePackageAssemblyReferences ()
+ {
+ CreatePackage ();
+ fakePackage.AddPackageReferences ("Test");
+ List<PackageReferenceSet> expectedReferences = fakePackage.PackageAssemblyReferences.ToList ();
+
+ List<PackageReferenceSet> result = package.PackageAssemblyReferences.ToList ();
+
+ Assert.AreEqual (expectedReferences, result);
+ }
+
+ [Test]
+ public void DevelopmentDependency_PackageHasDevelopmentDependencySetToTrue_ReturnsWrappedPackageDevelopmentDependency ()
+ {
+ CreatePackage ();
+ fakePackage.DevelopmentDependency = true;
+
+ bool dependency = package.DevelopmentDependency;
+
+ Assert.IsTrue (dependency);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementEventsTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementEventsTests.cs
new file mode 100644
index 0000000000..5e7f7074e9
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementEventsTests.cs
@@ -0,0 +1,463 @@
+//
+// PackageManagementEventsTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using NuGet;
+using NUnit.Framework;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class PackageManagementEventsTests
+ {
+ PackageManagementEvents events;
+ List<FakePackage> packages;
+
+ void CreateEvents ()
+ {
+ packages = new List<FakePackage> ();
+ events = new PackageManagementEvents ();
+ }
+
+ PackageManagementSelectedProjects CreateSelectedProjects ()
+ {
+ var solution = new FakePackageManagementSolution ();
+ return new PackageManagementSelectedProjects (solution);
+ }
+
+ [Test]
+ public void OnPackageOperationsStarting_OneEventSubscriber_PackageOperationsStartingFired ()
+ {
+ CreateEvents ();
+ EventArgs eventArgs = null;
+ events.PackageOperationsStarting += (sender, e) => eventArgs = e;
+ events.OnPackageOperationsStarting ();
+
+ Assert.IsNotNull (eventArgs);
+ }
+
+ [Test]
+ public void OnPackageOperationsStarting_OneEventSubscriber_SenderIsPackageManagementEvents ()
+ {
+ CreateEvents ();
+ object eventSender = null;
+ events.PackageOperationsStarting += (sender, e) => eventSender = sender;
+ events.OnPackageOperationsStarting ();
+
+ Assert.AreEqual (events, eventSender);
+ }
+
+ [Test]
+ public void OnPackageOperationsStarting_NoEventSubscribers_NullReferenceExceptionNotThrown ()
+ {
+ CreateEvents ();
+ Assert.DoesNotThrow (() => events.OnPackageOperationsStarting ());
+ }
+
+ [Test]
+ public void OnPackageOperationError_OneEventSubscriber_PackageOperationErrorEventArgsHasException ()
+ {
+ CreateEvents ();
+ Exception exception = null;
+ events.PackageOperationError += (sender, e) => exception = e.Exception;
+
+ Exception expectedException = new Exception ("Test");
+ events.OnPackageOperationError (expectedException);
+
+ Assert.AreEqual (expectedException, exception);
+ }
+
+ [Test]
+ public void OnPackageOperationError_OneEventSubscriber_SenderIsPackageManagementEvents ()
+ {
+ CreateEvents ();
+ object eventSender = null;
+ events.PackageOperationError += (sender, e) => eventSender = sender;
+
+ Exception expectedException = new Exception ("Test");
+ events.OnPackageOperationError (expectedException);
+
+ Assert.AreEqual (events, eventSender);
+ }
+
+ [Test]
+ public void OnPackageOperationError_NoEventSubscribers_NullReferenceExceptionNotThrown ()
+ {
+ CreateEvents ();
+ Exception expectedException = new Exception ("Test");
+
+ Assert.DoesNotThrow (() => events.OnPackageOperationError (expectedException));
+ }
+
+ [Test]
+ public void OnAcceptLicenses_OneEventSubscriber_EventArgsHasPackages ()
+ {
+ CreateEvents ();
+ IEnumerable<IPackage> packages = null;
+ events.AcceptLicenses += (sender, e) => packages = e.Packages;
+
+ var expectedPackages = new FakePackage[] {
+ new FakePackage ("A"),
+ new FakePackage ("B")
+ };
+ events.OnAcceptLicenses (expectedPackages);
+
+ Assert.AreEqual (expectedPackages, packages);
+ }
+
+ [Test]
+ public void OnAcceptLicenses_OneEventSubscriber_SenderIsPackageEvents ()
+ {
+ CreateEvents ();
+ object eventSender = null;
+ events.AcceptLicenses += (sender, e) => eventSender = sender;
+ events.OnAcceptLicenses (packages);
+
+ Assert.AreEqual (events, eventSender);
+ }
+
+ [Test]
+ public void OnAcceptLicenses_NoEventSubscribers_NullReferenceExceptionIsNotThrown ()
+ {
+ CreateEvents ();
+ Assert.DoesNotThrow (() => events.OnAcceptLicenses (packages));
+ }
+
+ [Test]
+ public void OnAcceptLicenses_NoEventSubscribers_ReturnsTrue ()
+ {
+ CreateEvents ();
+ bool result = events.OnAcceptLicenses (packages);
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void OnAcceptLicenses_EventArgIsAcceptedIsSetToFalse_ReturnsFalse ()
+ {
+ CreateEvents ();
+ events.AcceptLicenses += (sender, e) => e.IsAccepted = false;
+ bool result = events.OnAcceptLicenses (packages);
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void OnAcceptLicenses_EventArgIsAcceptedIsSetToTrue_ReturnsTrue ()
+ {
+ CreateEvents ();
+ events.AcceptLicenses += (sender, e) => e.IsAccepted = true;
+ bool result = events.OnAcceptLicenses (packages);
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void OnParentPackageInstalled_OneEventSubscriber_EventArgsHasPackage ()
+ {
+ CreateEvents ();
+ IPackage package = null;
+ IPackageManagementProject project = null;
+ events.ParentPackageInstalled += (sender, e) => {
+ package = e.Package;
+ project = e.Project;
+ };
+
+ var expectedPackage = new FakePackage ("Test");
+ var expectedProject = new FakePackageManagementProject ();
+ events.OnParentPackageInstalled (expectedPackage, expectedProject);
+
+ Assert.AreEqual (expectedPackage, package);
+ Assert.AreEqual (expectedProject, project);
+ }
+
+ [Test]
+ public void OnParentPackageInstalled_OneEventSubscriber_SenderIsPackageManagementEvents ()
+ {
+ CreateEvents ();
+ object eventSender = null;
+ events.ParentPackageInstalled += (sender, e) => eventSender = sender;
+
+ var package = new FakePackage ("Test");
+ events.OnParentPackageInstalled (package, null);
+
+ Assert.AreEqual (events, eventSender);
+ }
+
+ [Test]
+ public void OnParentPackageInstalled_NoEventSubscribers_NullReferenceExceptionIsNotThrown ()
+ {
+ CreateEvents ();
+ var package = new FakePackage ("Test");
+ Assert.DoesNotThrow (() => events.OnParentPackageInstalled (package, null));
+ }
+
+ [Test]
+ public void OnParentPackageUninstalled_OneEventSubscriber_EventArgsHasPackage ()
+ {
+ CreateEvents ();
+ IPackage package = null;
+ IPackageManagementProject project = null;
+ events.ParentPackageUninstalled += (sender, e) => {
+ package = e.Package;
+ project = e.Project;
+ };
+
+ var expectedPackage = new FakePackage ("Test");
+ var expectedProject = new FakePackageManagementProject ();
+ events.OnParentPackageUninstalled (expectedPackage, expectedProject);
+
+ Assert.AreEqual (expectedPackage, package);
+ Assert.AreEqual (expectedProject, project);
+ }
+
+ [Test]
+ public void OnParentPackageUninstalled_OneEventSubscriber_SenderIsPackageManagementEvents ()
+ {
+ CreateEvents ();
+ object eventSender = null;
+ events.ParentPackageUninstalled += (sender, e) => eventSender = sender;
+
+ var package = new FakePackage ("Test");
+ events.OnParentPackageUninstalled (package, null);
+
+ Assert.AreEqual (events, eventSender);
+ }
+
+ [Test]
+ public void OnParentPackageUninstalled_NoEventSubscribers_NullReferenceExceptionIsNotThrown ()
+ {
+ CreateEvents ();
+ var package = new FakePackage ("Test");
+ Assert.DoesNotThrow (() => events.OnParentPackageUninstalled (package, null));
+ }
+
+ [Test]
+ public void OnPackageOperationMessageLogged_OneEventSubscriber_SenderIsPackageManagementEvents ()
+ {
+ CreateEvents ();
+ object eventSender = null;
+ events.PackageOperationMessageLogged += (sender, e) => eventSender = sender;
+
+ events.OnPackageOperationMessageLogged (MessageLevel.Info, "Test");
+
+ Assert.AreEqual (events, eventSender);
+ }
+
+ [Test]
+ public void OnPackageOperationMessageLogged_NoEventSubscribers_NullReferenceExceptionIsNotThrown ()
+ {
+ CreateEvents ();
+ Assert.DoesNotThrow (() => events.OnPackageOperationMessageLogged (MessageLevel.Info, "Test"));
+ }
+
+ [Test]
+ public void OnPackageOperationMessageLogged_InfoMessageLoggedWithOneEventSubscriber_EventArgsHasInfoMessageLevel ()
+ {
+ CreateEvents ();
+ PackageOperationMessageLoggedEventArgs eventArgs = null;
+ events.PackageOperationMessageLogged += (sender, e) => eventArgs = e;
+
+ events.OnPackageOperationMessageLogged (MessageLevel.Info, "Test");
+
+ Assert.AreEqual (MessageLevel.Info, eventArgs.Message.Level);
+ }
+
+ [Test]
+ public void OnPackageOperationMessageLogged_FormattedInfoMessageLoggedWithOneEventSubscriber_EventArgsHasFormattedMessage ()
+ {
+ CreateEvents ();
+ PackageOperationMessageLoggedEventArgs eventArgs = null;
+ events.PackageOperationMessageLogged += (sender, e) => eventArgs = e;
+
+ string format = "Test {0}";
+ events.OnPackageOperationMessageLogged (MessageLevel.Info, format, "B");
+
+ string message = eventArgs.Message.ToString ();
+
+ string expectedMessage = "Test B";
+ Assert.AreEqual (expectedMessage, message);
+ }
+
+ [Test]
+ public void OnSelectProjects_OneEventSubscriber_EventArgsHasSelectedProjects ()
+ {
+ CreateEvents ();
+ IEnumerable<IPackageManagementSelectedProject> selectedProjects = null;
+ events.SelectProjects += (sender, e) => selectedProjects = e.SelectedProjects;
+
+ var expectedSelectedProjects = new List<IPackageManagementSelectedProject> ();
+ events.OnSelectProjects (expectedSelectedProjects);
+
+ Assert.AreEqual (expectedSelectedProjects, selectedProjects);
+ }
+
+ [Test]
+ public void OnSelectProjects_OneEventSubscriber_SenderIsPackageEvents ()
+ {
+ CreateEvents ();
+ object eventSender = null;
+ events.SelectProjects += (sender, e) => eventSender = sender;
+ var selectedProjects = new List<IPackageManagementSelectedProject> ();
+ events.OnSelectProjects (selectedProjects);
+
+ Assert.AreEqual (events, eventSender);
+ }
+
+ [Test]
+ public void OnSelectProjects_NoEventSubscribers_NullReferenceExceptionIsNotThrown ()
+ {
+ CreateEvents ();
+ var selectedProjects = new List<IPackageManagementSelectedProject> ();
+
+ Assert.DoesNotThrow (() => events.OnSelectProjects (selectedProjects));
+ }
+
+ [Test]
+ public void OnSelectProjects_NoEventSubscribers_ReturnsTrue ()
+ {
+ CreateEvents ();
+ var selectedProjects = new List<IPackageManagementSelectedProject> ();
+ bool result = events.OnSelectProjects (selectedProjects);
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void OnSelectProjects_EventArgIsAcceptedIsSetToFalse_ReturnsFalse ()
+ {
+ CreateEvents ();
+ events.SelectProjects += (sender, e) => e.IsAccepted = false;
+ var selectedProjects = new List<IPackageManagementSelectedProject> ();
+ bool result = events.OnSelectProjects (selectedProjects);
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void OnSelectProjects_EventArgIsAcceptedIsSetToTrue_ReturnsTrue ()
+ {
+ CreateEvents ();
+ events.SelectProjects += (sender, e) => e.IsAccepted = true;
+ var selectedProjects = new List<IPackageManagementSelectedProject> ();
+ bool result = events.OnSelectProjects (selectedProjects);
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void OnResolveFileConflict_OneEventSubscriber_SenderIsPackageEvents ()
+ {
+ CreateEvents ();
+ object eventSender = null;
+ events.ResolveFileConflict += (sender, e) => eventSender = sender;
+ events.OnResolveFileConflict ("message");
+
+ Assert.AreEqual (events, eventSender);
+ }
+
+ [Test]
+ public void OnResolveFileConflict_OneEventSubscriber_MessageAddedToEventArgs ()
+ {
+ CreateEvents ();
+ ResolveFileConflictEventArgs eventArgs = null;
+ events.ResolveFileConflict += (sender, e) => eventArgs = e;
+ events.OnResolveFileConflict ("message");
+
+ Assert.AreEqual ("message", eventArgs.Message);
+ }
+
+ [Test]
+ public void OnResolveFileConflict_OneEventSubscriberWhichDoesNotChangeEventArgs_EventArgsHasFileConflictResolutionOfIgnore ()
+ {
+ CreateEvents ();
+ ResolveFileConflictEventArgs eventArgs = null;
+ events.ResolveFileConflict += (sender, e) => eventArgs = e;
+ events.OnResolveFileConflict ("message");
+
+ Assert.AreEqual (FileConflictResolution.Ignore, eventArgs.Resolution);
+ }
+
+ [Test]
+ public void OnResolveFileConflict_OneEventSubscriberWhichChangesResolutionToOverwrite_ReturnsOverwrite ()
+ {
+ CreateEvents ();
+ events.ResolveFileConflict += (sender, e) => e.Resolution = FileConflictResolution.Overwrite;
+ FileConflictResolution resolution = events.OnResolveFileConflict ("message");
+
+ Assert.AreEqual (FileConflictResolution.Overwrite, resolution);
+ }
+
+ [Test]
+ public void OnResolveFileConflict_NoEventSubscribers_ReturnsIgnoreAll ()
+ {
+ CreateEvents ();
+ FileConflictResolution resolution = events.OnResolveFileConflict ("message");
+
+ Assert.AreEqual (FileConflictResolution.IgnoreAll, resolution);
+ }
+
+ [Test]
+ public void OnParentPackagesUpdated_OneEventSubscriber_PackagesUpdatedEventFired ()
+ {
+ CreateEvents ();
+ ParentPackagesOperationEventArgs eventArgs = null;
+ events.ParentPackagesUpdated += (sender, e) => eventArgs = e;
+ var packages = new FakePackage[] { new FakePackage ("Test") };
+
+ events.OnParentPackagesUpdated (packages);
+
+ Assert.AreEqual (packages, eventArgs.Packages);
+ }
+
+ [Test]
+ public void OnParentPackagesUpdated_OneEventSubscriber_SenderIsPackageManagementEvents ()
+ {
+ CreateEvents ();
+ object eventSender = null;
+ events.ParentPackagesUpdated += (sender, e) => eventSender = sender;
+ var packages = new FakePackage[] { new FakePackage ("Test") };
+
+ events.OnParentPackagesUpdated (packages);
+
+ Assert.AreEqual (events, eventSender);
+ }
+
+ [Test]
+ public void OnParentPackagesUpdated_NoEventSubscribers_NullReferenceExceptionNotThrown ()
+ {
+ CreateEvents ();
+ var packages = new FakePackage[] { new FakePackage ("Test") };
+
+ Assert.DoesNotThrow (() => events.OnParentPackagesUpdated (packages));
+ }
+ }
+}
+
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementLoggerTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementLoggerTests.cs
new file mode 100644
index 0000000000..cce2a5c9e9
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementLoggerTests.cs
@@ -0,0 +1,109 @@
+//
+// PackageManagementLoggerTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class PackageManagementLoggerTests
+ {
+ PackageManagementEvents packageManagementEvents;
+ PackageManagementLogger logger;
+ List<PackageOperationMessageLoggedEventArgs> messagesLoggedEventArgs;
+
+ void CreateLogger ()
+ {
+ messagesLoggedEventArgs = new List<PackageOperationMessageLoggedEventArgs> ();
+ packageManagementEvents = new PackageManagementEvents ();
+ packageManagementEvents.PackageOperationMessageLogged += (sender, e) => {
+ messagesLoggedEventArgs.Add (e);
+ };
+
+ logger = new PackageManagementLogger (packageManagementEvents);
+ }
+
+ void AssertOnPackageOperationMessageLoggedCalled (MessageLevel level, string message)
+ {
+ PackageOperationMessageLoggedEventArgs eventArgs = messagesLoggedEventArgs [0];
+ Assert.AreEqual (message, eventArgs.Message.ToString ());
+ Assert.AreEqual (level, eventArgs.Message.Level);
+ }
+
+ [Test]
+ public void Log_WarningMessageLogged_RaisesMessageLoggedEventWithWarningMessageLevel ()
+ {
+ CreateLogger ();
+
+ logger.Log (MessageLevel.Warning, "test");
+
+ AssertOnPackageOperationMessageLoggedCalled (MessageLevel.Warning, "test");
+ }
+
+ [Test]
+ public void Log_FormattedInfoMessageLogged_RaisesMessageLoggedEventWithFormattedMessage ()
+ {
+ CreateLogger ();
+
+ string format = "Test {0}";
+ logger.Log (MessageLevel.Info, format, "C");
+
+ AssertOnPackageOperationMessageLoggedCalled (MessageLevel.Info, "Test C");
+ }
+
+ [Test]
+ public void ResolveFileConflict_MessagePassed_RaisesOnResolveFileConflictEvent ()
+ {
+ CreateLogger ();
+ string message = null;
+ packageManagementEvents.ResolveFileConflict += (sender, e) => {
+ message = e.Message;
+ };
+
+ logger.ResolveFileConflict ("message");
+
+ Assert.AreEqual ("message", message);
+ }
+
+ [Test]
+ public void ResolveFileConflict_PackageManagementEventsResolveFileConflictReturnsIgnoreAll_ReturnsIgnoreAll ()
+ {
+ CreateLogger ();
+ packageManagementEvents.ResolveFileConflict += (sender, e) => {
+ e.Resolution = FileConflictResolution.IgnoreAll;
+ };
+
+ FileConflictResolution resolution = logger.ResolveFileConflict ("message");
+
+ Assert.AreEqual (FileConflictResolution.IgnoreAll, resolution);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementOptionsTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementOptionsTests.cs
new file mode 100644
index 0000000000..f0bf3da6ca
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementOptionsTests.cs
@@ -0,0 +1,582 @@
+//
+// PackageManagementOptionsTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Xml;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.Core;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class PackageManagementOptionsTests
+ {
+ Properties properties;
+ PackageManagementOptions options;
+ FakeSettings fakeSettings;
+ SettingsProvider settingsProvider;
+ FakePackageManagementProjectService projectService;
+
+ void CreateOptions ()
+ {
+ CreateProperties ();
+ CreateSettings ();
+ CreateOptions (properties, fakeSettings);
+ }
+
+ void CreateProperties ()
+ {
+ properties = new Properties ();
+ }
+
+ void CreateSettings ()
+ {
+ fakeSettings = new FakeSettings ();
+ }
+
+ void CreateOptions (Properties properties)
+ {
+ CreateSettings ();
+ CreateOptions (properties, fakeSettings);
+ }
+
+ void CreateOptions (FakeSettings fakeSettings)
+ {
+ CreateProperties ();
+ CreateSettingsProvider (fakeSettings);
+ options = new PackageManagementOptions (properties, settingsProvider);
+ }
+
+ void CreateSettingsProvider (FakeSettings fakeSettings)
+ {
+ projectService = new FakePackageManagementProjectService ();
+ settingsProvider = TestablePackageManagementOptions.CreateSettingsProvider (fakeSettings, projectService);
+ }
+
+ void ChangeSettingsReturnedBySettingsProvider ()
+ {
+ fakeSettings = new FakeSettings ();
+ TestablePackageManagementOptions.ChangeSettingsReturnedBySettingsProvider (fakeSettings);
+ }
+
+ void CreateOptions (Properties properties, FakeSettings fakeSettings)
+ {
+ CreateSettingsProvider (fakeSettings);
+ options = new PackageManagementOptions (properties, settingsProvider);
+ }
+
+ void SaveOptions ()
+ {
+ var builder = new StringBuilder ();
+ var writer = new XmlTextWriter (new StringWriter (builder));
+ properties.Write (writer);
+ }
+
+ RecentPackageInfo AddRecentPackageToOptions (string id, string version)
+ {
+ var recentPackage = new RecentPackageInfo (id, new SemanticVersion (version));
+ options.RecentPackages.Add (recentPackage);
+ return recentPackage;
+ }
+
+ void EnablePackageRestoreInSettings ()
+ {
+ fakeSettings.SetPackageRestoreSetting (true);
+ }
+
+ void OpenSolution ()
+ {
+ projectService.RaiseSolutionLoadedEvent ();
+ }
+
+ void CloseSolution ()
+ {
+ projectService.RaiseSolutionUnloadedEvent ();
+ }
+
+ [Test]
+ public void PackageSources_OnePackageSourceInSettings_ContainsPackageSourceFromSettingsAndDefaultNuGetOrgFeed ()
+ {
+ CreateSettings ();
+ var packageSource = new PackageSource ("http://codeplex.com", "Test");
+ fakeSettings.AddFakePackageSource (packageSource);
+ CreateOptions (fakeSettings);
+
+ RegisteredPackageSources actualSources = options.PackageSources;
+
+ List<PackageSource> expectedSources = new List<PackageSource> ();
+ expectedSources.Add (packageSource);
+ expectedSources.Add (RegisteredPackageSources.DefaultPackageSource);
+
+ Assert.AreEqual (expectedSources, actualSources);
+ }
+
+ [Test]
+ public void PackageSources_NoPackageSourceInSavedSettings_ContainsDefaultPackageSource ()
+ {
+ CreateSettings ();
+ CreateOptions (fakeSettings);
+
+ List<PackageSource> expectedSources = new List<PackageSource> ();
+ expectedSources.Add (RegisteredPackageSources.DefaultPackageSource);
+
+ RegisteredPackageSources actualPackageSources = options.PackageSources;
+
+ CollectionAssert.AreEqual (expectedSources, actualPackageSources);
+ }
+
+ [Test]
+ public void PackageSources_NoPackageSourceInSavedSettings_DefaultPackageSourceIsNotAddedToSettings ()
+ {
+ CreateSettings ();
+ CreateOptions (fakeSettings);
+ RegisteredPackageSources packageSources = options.PackageSources;
+
+ PackageSource packageSource = RegisteredPackageSources.DefaultPackageSource;
+
+ bool result = fakeSettings.SavedSectionValueLists.ContainsKey (FakeSettings.PackageSourcesSectionName);
+ Assert.IsFalse (result);
+ Assert.IsNotNull (packageSource);
+ }
+
+ [Test]
+ public void PackageSources_OnePackageSourceAdded_PackageSourceSavedInSettings ()
+ {
+ CreateSettings ();
+ CreateOptions (fakeSettings);
+ RegisteredPackageSources registeredPackageSources = options.PackageSources;
+
+ var packageSource = new PackageSource ("http://codeplex.com", "Test");
+ registeredPackageSources.Clear ();
+ registeredPackageSources.Add (packageSource);
+
+ var expectedSavedPackageSourceSettings = new List<KeyValuePair<string, string>> ();
+ expectedSavedPackageSourceSettings.Add (new KeyValuePair<string, string> ("Test", "http://codeplex.com"));
+
+ IList<KeyValuePair<string, string>> actualSavedPackageSourceSettings = fakeSettings.GetValuesPassedToSetValuesForPackageSourcesSection ();
+
+ Assert.AreEqual (expectedSavedPackageSourceSettings, actualSavedPackageSourceSettings);
+ }
+
+ [Test]
+ public void PackageSources_OnePackageSourceAdded_PackageSourcesSectionDeletedFromSettings ()
+ {
+ CreateSettings ();
+ CreateOptions (fakeSettings);
+ RegisteredPackageSources registeredPackageSources = options.PackageSources;
+
+ var packageSource = new PackageSource ("http://codeplex.com", "Test");
+ registeredPackageSources.Clear ();
+ registeredPackageSources.Add (packageSource);
+
+ bool sectionDeleted = fakeSettings.IsPackageSourcesSectionDeleted;
+
+ Assert.IsTrue (sectionDeleted);
+ }
+
+ [Test]
+ public void PackageSources_SettingsFilesDoesNotExistSoSettingsReturnsNullForPackageSourcesSection_DoesNotThrowException ()
+ {
+ CreateSettings ();
+ fakeSettings.MakePackageSourceSectionsNull ();
+ CreateOptions (fakeSettings);
+
+ RegisteredPackageSources packageSources = null;
+ Assert.DoesNotThrow (() => packageSources = options.PackageSources);
+ }
+
+ [Test]
+ public void ActivePackageSource_NoInitialPropertiesSet_ReturnsNull ()
+ {
+ CreateOptions ();
+ PackageSource actualSource = options.ActivePackageSource;
+ Assert.IsNull (options.ActivePackageSource);
+ }
+
+ [Test]
+ public void ActivePackageSource_SourceChanged_ActivePackageSourceUpdatedInSettings ()
+ {
+ CreateOptions ();
+ var packageSource = new PackageSource ("http://sharpdevelop.com", "Test");
+
+ options.ActivePackageSource = packageSource;
+
+ var expectedKeyValuePair = new KeyValuePair<string, string> ("Test", "http://sharpdevelop.com");
+ KeyValuePair<string, string> actualKeyValuePair = fakeSettings.GetValuePassedToSetValueForActivePackageSourceSection ();
+
+ Assert.AreEqual (expectedKeyValuePair, actualKeyValuePair);
+ }
+
+ [Test]
+ public void ActivePackageSource_ActivePackageSourceNonNullInSettings_ReturnsActivatePackageSourceInSavedSettings ()
+ {
+ CreateSettings ();
+ var expectedSource = new PackageSource ("http://source-url", "Test");
+ fakeSettings.SetFakeActivePackageSource (expectedSource);
+ fakeSettings.AddFakePackageSource (expectedSource);
+ CreateOptions (fakeSettings);
+
+ PackageSource actualSource = options.ActivePackageSource;
+
+ Assert.AreEqual (expectedSource, actualSource);
+ }
+
+ [Test]
+ public void ActivePackageSource_SetToNullAfterHavingNonNullValue_ReturnsNull ()
+ {
+ CreateOptions ();
+ var source = new PackageSource ("http://source-url", "Test");
+ options.ActivePackageSource = source;
+
+ options.ActivePackageSource = null;
+
+ PackageSource actualSource = options.ActivePackageSource;
+ Assert.IsNull (actualSource);
+ }
+
+ [Test]
+ public void ActivePackageSource_ActivePackageSourceRemovedFromPackageSources_ActivePackageSourceSetToNull ()
+ {
+ CreateOptions ();
+ var source = new PackageSource ("http://source-url", "Test");
+ options.PackageSources.Add (source);
+
+ var differentSource = new PackageSource ("http://different-url", "Test2");
+ options.ActivePackageSource = differentSource;
+
+ PackageSource activeSource = options.ActivePackageSource;
+
+ Assert.IsNull (activeSource);
+ }
+
+ [Test]
+ public void ActivePackageSource_ActivePackageSourceChanged_ActivePackageSourceSectionRemovedFromSettings ()
+ {
+ CreateOptions ();
+
+ options.ActivePackageSource = new PackageSource ("http://sharpdevelop.com", "Test");
+
+ bool sectionDeleted = fakeSettings.IsActivePackageSourceSectionDeleted;
+
+ Assert.IsTrue (sectionDeleted);
+ }
+
+ [Test]
+ public void ActivePackageSource_OneActivePackageSourceInSettingsAndActivePackageSourceSetToNull_ActivePackageSourceSectionRemoved ()
+ {
+ CreateSettings ();
+ var expectedSource = new PackageSource ("http://source-url", "Test");
+ fakeSettings.SetFakeActivePackageSource (expectedSource);
+ fakeSettings.AddFakePackageSource (expectedSource);
+ CreateOptions (fakeSettings);
+
+ options.ActivePackageSource = null;
+
+ bool sectionRemoved = fakeSettings.IsActivePackageSourceSectionDeleted;
+
+ Assert.IsTrue (sectionRemoved);
+ }
+
+ [Test]
+ public void ActivePackageSource_SettingsFilesDoesNotExistSoSettingsReturnsNullForActivePackageSourceSection_DoesNotThrowException ()
+ {
+ CreateSettings ();
+ fakeSettings.MakeActivePackageSourceSectionNull ();
+ CreateOptions (fakeSettings);
+
+ PackageSource activePackageSource = null;
+ Assert.DoesNotThrow (() => activePackageSource = options.ActivePackageSource);
+ }
+
+ [Test]
+ public void RecentPackages_OneRecentPackageAddedAndOptionsReloadedFromSavedProperties_ContainsOneRecentPackageThatWasSavedPreviously ()
+ {
+ CreateOptions ();
+ var package = new FakePackage ("Test");
+ var recentPackage = new RecentPackageInfo (package);
+ options.RecentPackages.Add (recentPackage);
+ CreateOptions (properties);
+
+ IList<RecentPackageInfo> recentPackages = options.RecentPackages;
+
+ var expectedRecentPackages = new RecentPackageInfo[] {
+ new RecentPackageInfo (package)
+ };
+
+ RecentPackageInfoCollectionAssert.AreEqual (expectedRecentPackages, recentPackages);
+ }
+
+ [Test]
+ public void RecentPackages_SaveRecentPackages_DoesNotThrowInvalidOperationException ()
+ {
+ CreateOptions ();
+ AddRecentPackageToOptions ("id", "1.0");
+
+ Assert.DoesNotThrow (() => SaveOptions ());
+ }
+
+ [Test]
+ public void ActivePackageSource_AggregatePackageSourceIsActivePackageSourceInSettings_ReturnsAggregatePackageSource ()
+ {
+ CreateSettings ();
+ PackageSource expectedPackageSource = RegisteredPackageSourceSettings.AggregatePackageSource;
+ fakeSettings.SetFakeActivePackageSource (expectedPackageSource);
+ CreateOptions (fakeSettings);
+
+ PackageSource activePackageSource = options.ActivePackageSource;
+
+ Assert.AreEqual (expectedPackageSource, activePackageSource);
+ }
+
+ [Test]
+ public void PackageSources_OneEnabledPackageSourceInSettings_ContainsSingleEnabledPackageSourceFromSettings ()
+ {
+ CreateSettings ();
+ var packageSource = new PackageSource ("http://codeplex.com", "Test") { IsEnabled = true };
+ fakeSettings.AddFakePackageSource (packageSource);
+ CreateOptions (fakeSettings);
+
+ RegisteredPackageSources actualSources = options.PackageSources;
+
+ Assert.IsTrue (actualSources [0].IsEnabled);
+ }
+
+ [Test]
+ public void PackageSources_OneDisabledPackageSourceInSettings_ContainsSingleDisabledPackageSourceFromSettings ()
+ {
+ CreateSettings ();
+ var packageSource = new PackageSource ("http://codeplex.com", "Test") { IsEnabled = false };
+ fakeSettings.AddFakePackageSource (packageSource);
+ fakeSettings.AddDisabledPackageSource (packageSource);
+ CreateOptions (fakeSettings);
+
+ RegisteredPackageSources actualSources = options.PackageSources;
+
+ Assert.IsFalse (actualSources [0].IsEnabled);
+ }
+
+ [Test]
+ public void PackageSources_OnePackageSourceAdded_DisabledPackageSourcesSectionDeletedFromSettings ()
+ {
+ CreateSettings ();
+ CreateOptions (fakeSettings);
+ RegisteredPackageSources registeredPackageSources = options.PackageSources;
+
+ var packageSource = new PackageSource ("http://codeplex.com", "Test");
+ registeredPackageSources.Clear ();
+ registeredPackageSources.Add (packageSource);
+
+ bool sectionDeleted = fakeSettings.IsDisabledPackageSourcesSectionDeleted;
+
+ Assert.IsTrue (sectionDeleted);
+ }
+
+ [Test]
+ public void PackageSources_OneDisabledPackageSourceAdded_DisabledPackageSourcesSectionSaved ()
+ {
+ CreateSettings ();
+ CreateOptions (fakeSettings);
+ RegisteredPackageSources registeredPackageSources = options.PackageSources;
+
+ var packageSource = new PackageSource ("http://codeplex.com", "Test") { IsEnabled = false };
+ registeredPackageSources.Clear ();
+ registeredPackageSources.Add (packageSource);
+
+ var expectedSavedPackageSourceSettings = new List<KeyValuePair<string, string>> ();
+ expectedSavedPackageSourceSettings.Add (new KeyValuePair<string, string> (packageSource.Name, "true"));
+
+ IList<KeyValuePair<string, string>> actualSavedPackageSourceSettings =
+ fakeSettings.GetValuesPassedToSetValuesForDisabledPackageSourcesSection ();
+ Assert.AreEqual (expectedSavedPackageSourceSettings, actualSavedPackageSourceSettings);
+ }
+
+ [Test]
+ public void PackageSources_OneEnabledPackageSourceAdded_DisabledPackageSourcesSectionNotChanged ()
+ {
+ CreateSettings ();
+ CreateOptions (fakeSettings);
+ RegisteredPackageSources registeredPackageSources = options.PackageSources;
+
+ var packageSource = new PackageSource ("http://codeplex.com", "Test") { IsEnabled = true };
+ registeredPackageSources.Clear ();
+ registeredPackageSources.Add (packageSource);
+
+ IList<KeyValuePair<string, string>> actualSavedPackageSourceSettings =
+ fakeSettings.GetValuesPassedToSetValuesForDisabledPackageSourcesSection ();
+ Assert.AreEqual (0, actualSavedPackageSourceSettings.Count);
+ }
+
+ [Test]
+ public void IsPackageRestoreEnabled_EnabledInSettings_ReturnsTrue ()
+ {
+ CreateSettings ();
+ EnablePackageRestoreInSettings ();
+ CreateOptions (fakeSettings);
+
+ bool enabled = options.IsPackageRestoreEnabled;
+
+ Assert.IsTrue (enabled);
+ }
+
+ [Test]
+ public void IsPackageRestoreEnabled_PackageRestoreNotInSettings_ReturnsTrue ()
+ {
+ CreateOptions ();
+
+ bool enabled = options.IsPackageRestoreEnabled;
+
+ Assert.IsTrue (enabled);
+ }
+
+ [Test]
+ public void IsPackageRestoreEnabled_NotInSettingsOriginallyButSetToTrue_PackageRestoreEnabledInSettings ()
+ {
+ CreateOptions ();
+
+ options.IsPackageRestoreEnabled = true;
+
+ KeyValuePair<string, string> keyPair = fakeSettings.GetValuePassedToSetValueForPackageRestoreSection ();
+
+ Assert.AreEqual ("enabled", keyPair.Key);
+ Assert.AreEqual ("True", keyPair.Value);
+ }
+
+ [Test]
+ public void IsPackageRestoreEnabled_OriginallyEnabledInSettingsButSetToTrue_PackageRestoreSectionIsNotDeletedFromSettings ()
+ {
+ CreateSettings ();
+ EnablePackageRestoreInSettings ();
+ CreateOptions (fakeSettings);
+
+ options.IsPackageRestoreEnabled = false;
+
+ bool deleted = fakeSettings.IsPackageRestoreSectionDeleted;
+ Assert.IsFalse (deleted);
+ }
+
+ [Test]
+ public void IsPackageRestoreEnabled_OriginallyEnabledInSettingsButSetToTrue_PackageRestoreIsFalseInSettings ()
+ {
+ CreateSettings ();
+ EnablePackageRestoreInSettings ();
+ CreateOptions (fakeSettings);
+
+ options.IsPackageRestoreEnabled = false;
+
+ KeyValuePair<string, string> keyValuePair = fakeSettings.GetValuePassedToSetValueForPackageRestoreSection ();
+ Assert.AreEqual ("False", keyValuePair.Value);
+ }
+
+ [Test]
+ public void PackageSources_SolutionOpenedAfterInitialPackageSourcesLoaded_ContainsPackageSourceFromSolutionSpecificSettings ()
+ {
+ CreateSettings ();
+ var packageSource = new PackageSource ("https://www.nuget.org/api/v2/", "Official NuGet Gallery");
+ fakeSettings.AddFakePackageSource (packageSource);
+ CreateOptions (fakeSettings);
+ RegisteredPackageSources initialSources = options.PackageSources;
+ var expectedInitialSources = new List<PackageSource> ();
+ expectedInitialSources.Add (packageSource);
+ ChangeSettingsReturnedBySettingsProvider ();
+ packageSource = new PackageSource ("https://www.nuget.org/api/v2/", "Official NuGet Gallery");
+ fakeSettings.AddFakePackageSource (packageSource);
+ var expectedSources = new List<PackageSource> ();
+ expectedSources.Add (packageSource);
+ packageSource = new PackageSource ("http://codeplex.com", "ProjectSource");
+ fakeSettings.AddFakePackageSource (packageSource);
+ expectedSources.Add (packageSource);
+ OpenSolution ();
+
+ RegisteredPackageSources actualSources = options.PackageSources;
+
+ Assert.AreEqual (expectedInitialSources, initialSources);
+ Assert.AreEqual (expectedSources, actualSources);
+ }
+
+ [Test]
+ public void PackageSources_SolutionClosedAfterInitialPackageSourcesLoaded_PackageSourcesReloaded ()
+ {
+ CreateSettings ();
+ var packageSource = new PackageSource ("https://www.nuget.org/api/v2/", "Official NuGet Gallery");
+ fakeSettings.AddFakePackageSource (packageSource);
+ var expectedInitialSources = new List<PackageSource> ();
+ expectedInitialSources.Add (packageSource);
+ packageSource = new PackageSource ("http://projectsource.org", "ProjectSource");
+ fakeSettings.AddFakePackageSource (packageSource);
+ expectedInitialSources.Add (packageSource);
+ OpenSolution ();
+ CreateOptions (fakeSettings);
+ RegisteredPackageSources initialSources = options.PackageSources;
+ ChangeSettingsReturnedBySettingsProvider ();
+ packageSource = new PackageSource ("https://www.nuget.org/api/v2/", "Official NuGet Gallery");
+ fakeSettings.AddFakePackageSource (packageSource);
+ var expectedSources = new List<PackageSource> ();
+ expectedSources.Add (packageSource);
+ CloseSolution ();
+
+ RegisteredPackageSources actualSources = options.PackageSources;
+
+ Assert.AreEqual (expectedInitialSources, initialSources);
+ Assert.AreEqual (expectedSources, actualSources);
+ }
+
+ [Test]
+ public void PackageSources_SolutionClosedAfterInitialPackageSourcesLoaded_ActivePackageSourceReloaded ()
+ {
+ CreateSettings ();
+ var packageSource = new PackageSource ("https://www.nuget.org/api/v2/", "Official NuGet Gallery");
+ fakeSettings.AddFakePackageSource (packageSource);
+ var expectedInitialSources = new List<PackageSource> ();
+ expectedInitialSources.Add (packageSource);
+ var initialActivePackageSource = new PackageSource ("http://projectsource.org", "ProjectSource");
+ fakeSettings.AddFakePackageSource (initialActivePackageSource);
+ fakeSettings.SetFakeActivePackageSource (initialActivePackageSource);
+ expectedInitialSources.Add (initialActivePackageSource);
+ OpenSolution ();
+ CreateOptions (fakeSettings);
+ RegisteredPackageSources actualInitialPackageSources = options.PackageSources;
+ PackageSource actualInitialActivePackageSource = options.ActivePackageSource;
+ ChangeSettingsReturnedBySettingsProvider ();
+ var expectedActivePackageSource = new PackageSource ("https://www.nuget.org/api/v2/", "Official NuGet Gallery");
+ fakeSettings.SetFakeActivePackageSource (expectedActivePackageSource);
+ fakeSettings.AddFakePackageSource (expectedActivePackageSource);
+ CloseSolution ();
+
+ PackageSource actualSource = options.ActivePackageSource;
+
+ Assert.AreEqual (initialActivePackageSource, actualInitialActivePackageSource);
+ Assert.AreEqual (expectedActivePackageSource, actualSource);
+ Assert.AreEqual (expectedInitialSources, actualInitialPackageSources);
+ Assert.AreEqual (new PackageSource[] { expectedActivePackageSource }, options.PackageSources);
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementOptionsViewModelTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementOptionsViewModelTests.cs
new file mode 100644
index 0000000000..8686205e1f
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementOptionsViewModelTests.cs
@@ -0,0 +1,332 @@
+//
+// PackageManagementOptionsViewModelTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using NUnit.Framework;
+using MonoDevelop.Core;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class PackageManagementOptionsViewModelTests
+ {
+ PackageManagementOptionsViewModel viewModel;
+ FakeRecentPackageRepository fakeRecentRepository;
+ FakeMachinePackageCache fakeMachineCache;
+ FakeProcess fakeProcess;
+ List<string> propertiesChanged;
+ PackageManagementOptions options;
+ FakeSettings fakeSettings;
+
+ void CreateRecentRepository ()
+ {
+ fakeRecentRepository = new FakeRecentPackageRepository ();
+ }
+
+ void CreateMachineCache ()
+ {
+ fakeMachineCache = new FakeMachinePackageCache ();
+ }
+
+ void CreateOptions ()
+ {
+ var properties = new Properties ();
+ var projectService = new FakePackageManagementProjectService ();
+ fakeSettings = new FakeSettings ();
+ SettingsProvider settingsProvider = TestablePackageManagementOptions.CreateSettingsProvider (fakeSettings, projectService);
+ options = new PackageManagementOptions (properties, settingsProvider);
+ }
+
+ void EnablePackageRestoreInOptions ()
+ {
+ fakeSettings.SetPackageRestoreSetting (true);
+ }
+
+ void DisablePackageRestoreInOptions ()
+ {
+ fakeSettings.SetPackageRestoreSetting (false);
+ }
+
+ void CreateViewModelUsingCreatedMachineCache ()
+ {
+ CreateRecentRepository ();
+ CreateOptions ();
+ fakeProcess = new FakeProcess ();
+ CreateViewModel (options);
+ }
+
+ void CreateViewModelUsingCreatedRecentRepository ()
+ {
+ CreateMachineCache ();
+ CreateOptions ();
+ fakeProcess = new FakeProcess ();
+ CreateViewModel (options);
+ }
+
+ void CreateViewModel (PackageManagementOptions options)
+ {
+ viewModel = new PackageManagementOptionsViewModel (options, fakeRecentRepository, fakeMachineCache, fakeProcess);
+ }
+
+ void AddPackageToRecentRepository ()
+ {
+ fakeRecentRepository.FakePackages.Add (new FakePackage ());
+ fakeRecentRepository.HasRecentPackages = true;
+ }
+
+ void AddPackageToMachineCache ()
+ {
+ fakeMachineCache.FakePackages.Add (new FakePackage ());
+ }
+
+ void RecordPropertyChanges ()
+ {
+ propertiesChanged = new List<string> ();
+ viewModel.PropertyChanged += (sender, e) => propertiesChanged.Add (e.PropertyName);
+ }
+
+ [Test]
+ public void HasNoRecentPackages_RecentPackageRepositoryHasNoPackages_ReturnsTrue ()
+ {
+ CreateRecentRepository ();
+ CreateViewModelUsingCreatedRecentRepository ();
+ fakeRecentRepository.HasRecentPackages = false;
+
+ bool hasPackages = viewModel.HasNoRecentPackages;
+
+ Assert.IsTrue (hasPackages);
+ }
+
+ [Test]
+ public void HasNoRecentPackages_RecentPackageRepositoryHasOnePackage_ReturnsFalse ()
+ {
+ CreateRecentRepository ();
+ fakeRecentRepository.HasRecentPackages = true;
+ AddPackageToRecentRepository ();
+ CreateViewModelUsingCreatedRecentRepository ();
+
+ bool hasPackages = viewModel.HasNoRecentPackages;
+
+ Assert.IsFalse (hasPackages);
+ }
+
+ [Test]
+ public void HasNoCachedPackages_MachinePackageCacheHasNoPackages_ReturnsTrue ()
+ {
+ CreateMachineCache ();
+ CreateViewModelUsingCreatedMachineCache ();
+
+ bool hasPackages = viewModel.HasNoCachedPackages;
+
+ Assert.IsTrue (hasPackages);
+ }
+
+ [Test]
+ public void HasNoCachedPackages_MachinePackageCacheHasOnePackage_ReturnsFalse ()
+ {
+ CreateMachineCache ();
+ AddPackageToMachineCache ();
+ CreateViewModelUsingCreatedMachineCache ();
+
+ bool hasPackages = viewModel.HasNoCachedPackages;
+
+ Assert.IsFalse (hasPackages);
+ }
+
+ [Test]
+ public void ClearRecentPackagesCommandCanExecute_OneRecentPackage_CanExecuteReturnsTrue ()
+ {
+ CreateRecentRepository ();
+ AddPackageToRecentRepository ();
+ CreateViewModelUsingCreatedRecentRepository ();
+
+ bool canExecute = viewModel.ClearRecentPackagesCommand.CanExecute (null);
+
+ Assert.IsTrue (canExecute);
+ }
+
+ [Test]
+ public void ClearRecentPackagesCommandCanExecute_NoRecentPackages_CanExecuteReturnsFalse ()
+ {
+ CreateRecentRepository ();
+ CreateViewModelUsingCreatedRecentRepository ();
+
+ bool canExecute = viewModel.ClearRecentPackagesCommand.CanExecute (null);
+
+ Assert.IsFalse (canExecute);
+ }
+
+ [Test]
+ public void ClearCachedPackagesCommandCanExecute_OneCachedPackage_CanExecuteReturnsTrue ()
+ {
+ CreateMachineCache ();
+ AddPackageToMachineCache ();
+ CreateViewModelUsingCreatedMachineCache ();
+
+ bool canExecute = viewModel.ClearCachedPackagesCommand.CanExecute (null);
+
+ Assert.IsTrue (canExecute);
+ }
+
+ [Test]
+ public void ClearCachedPackagesCommandCanExecute_NoCachedPackages_CanExecuteReturnsFalse ()
+ {
+ CreateMachineCache ();
+ CreateViewModelUsingCreatedMachineCache ();
+
+ bool canExecute = viewModel.ClearCachedPackagesCommand.CanExecute (null);
+
+ Assert.IsFalse (canExecute);
+ }
+
+ [Test]
+ public void ClearCachedPackagesCommandExecute_OneCachedPackage_ClearsPackagesFromCache ()
+ {
+ CreateMachineCache ();
+ AddPackageToMachineCache ();
+ CreateViewModelUsingCreatedMachineCache ();
+
+ viewModel.ClearCachedPackagesCommand.Execute (null);
+
+ Assert.IsTrue (fakeMachineCache.IsClearCalled);
+ }
+
+ [Test]
+ public void ClearRecentPackagesCommandExecute_OneRecentPackage_ClearsPackages ()
+ {
+ CreateMachineCache ();
+ AddPackageToRecentRepository ();
+ CreateViewModelUsingCreatedRecentRepository ();
+
+ viewModel.ClearRecentPackagesCommand.Execute (null);
+
+ Assert.IsTrue (fakeRecentRepository.IsClearCalled);
+ }
+
+ [Test]
+ public void ClearRecentPackages_OneRecentPackage_HasNoRecentPackagesIsTrue ()
+ {
+ CreateRecentRepository ();
+ AddPackageToRecentRepository ();
+ CreateViewModelUsingCreatedRecentRepository ();
+
+ RecordPropertyChanges ();
+ viewModel.ClearRecentPackages ();
+ fakeRecentRepository.HasRecentPackages = false;
+
+ bool hasPackages = viewModel.HasNoRecentPackages;
+
+ Assert.IsTrue (hasPackages);
+ }
+
+ [Test]
+ public void ClearCachedPackages_OneCachedPackage_HasNoCachedPackagesReturnsTrue ()
+ {
+ CreateMachineCache ();
+ AddPackageToMachineCache ();
+ CreateViewModelUsingCreatedMachineCache ();
+
+ RecordPropertyChanges ();
+ viewModel.ClearCachedPackages ();
+
+ bool hasPackages = viewModel.HasNoCachedPackages;
+
+ Assert.IsTrue (hasPackages);
+ }
+
+ [Test]
+ public void ClearRecentPackages_OneRecentPackage_HasNoRecentPackagesPropertyChangedEventFired ()
+ {
+ CreateRecentRepository ();
+ AddPackageToRecentRepository ();
+ CreateViewModelUsingCreatedMachineCache ();
+
+ RecordPropertyChanges ();
+ viewModel.ClearRecentPackages ();
+
+ bool fired = propertiesChanged.Contains ("HasNoRecentPackages");
+
+ Assert.IsTrue (fired);
+ }
+
+ [Test]
+ public void ClearCachedPackages_OneCachedPackage_HasNoCachedPackagesPropertyChangedEventFired ()
+ {
+ CreateMachineCache ();
+ AddPackageToMachineCache ();
+ CreateViewModelUsingCreatedMachineCache ();
+
+ RecordPropertyChanges ();
+ viewModel.ClearCachedPackages ();
+
+ bool fired = propertiesChanged.Contains ("HasNoCachedPackages");
+
+ Assert.IsTrue (fired);
+ }
+
+ [Test]
+ public void BrowseCachedPackagesCommandCanExecute_OneCachedPackage_ReturnsTrue ()
+ {
+ CreateMachineCache ();
+ AddPackageToMachineCache ();
+ CreateViewModelUsingCreatedMachineCache ();
+
+ bool canExecute = viewModel.BrowseCachedPackagesCommand.CanExecute (null);
+
+ Assert.IsTrue (canExecute);
+ }
+
+ [Test]
+ public void BrowseCachedPackagesCommandCanExecute_NoCachedPackages_ReturnsFalse ()
+ {
+ CreateMachineCache ();
+ CreateViewModelUsingCreatedMachineCache ();
+
+ bool canExecute = viewModel.BrowseCachedPackagesCommand.CanExecute (null);
+
+ Assert.IsFalse (canExecute);
+ }
+
+ [Test]
+ public void BrowseCachedPackagesCommandExecute_OneCachedPackage_StartsProcessToOpenMachineCacheFolder ()
+ {
+ CreateMachineCache ();
+ CreateViewModelUsingCreatedMachineCache ();
+
+ string expectedFileName = @"d:\projects\nugetpackages";
+ fakeMachineCache.Source = expectedFileName;
+
+ viewModel.BrowseCachedPackagesCommand.Execute (null);
+
+ string fileName = fakeProcess.FileNamePassedToStart;
+
+ Assert.AreEqual (expectedFileName, fileName);
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementProjectTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementProjectTests.cs
new file mode 100644
index 0000000000..fc0ec4fda5
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementProjectTests.cs
@@ -0,0 +1,775 @@
+//
+// PackageManagementProjectTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+using ICSharpCode.PackageManagement;
+using NuGet;
+using NUnit.Framework;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class PackageManagementProjectTests
+ {
+ FakePackageManagerFactory fakePackageManagerFactory;
+ FakePackageRepository fakeSourceRepository;
+ FakeDotNetProject fakeProject;
+ PackageManagementProject project;
+ FakeProjectManager fakeProjectManager;
+ FakePackageManager fakePackageManager;
+ PackageManagementEvents packageManagementEvents;
+ FakeInstallPackageAction fakeInstallAction;
+ FakeUninstallPackageAction fakeUninstallAction;
+ FakeUpdatePackageAction fakeUpdateAction;
+ UpdatePackagesAction updatePackagesAction;
+
+ void CreateProject ()
+ {
+ fakeSourceRepository = new FakePackageRepository ();
+ CreateProject (fakeSourceRepository);
+ }
+
+ void CreateProject (IPackageRepository sourceRepository)
+ {
+ fakePackageManagerFactory = new FakePackageManagerFactory ();
+ fakePackageManager = fakePackageManagerFactory.FakePackageManager;
+ fakeProjectManager = fakePackageManager.FakeProjectManager;
+ fakeProject = new FakeDotNetProject ();
+ packageManagementEvents = new PackageManagementEvents ();
+
+ project = new PackageManagementProject (
+ sourceRepository,
+ fakeProject,
+ packageManagementEvents,
+ fakePackageManagerFactory);
+ }
+
+ FakeInstallPackageAction CreateFakeInstallAction ()
+ {
+ fakeInstallAction = new FakeInstallPackageAction ();
+ return fakeInstallAction;
+ }
+
+ FakeUninstallPackageAction CreateFakeUninstallAction ()
+ {
+ fakeUninstallAction = new FakeUninstallPackageAction (project);
+ return fakeUninstallAction;
+ }
+
+ FakeUpdatePackageAction CreateFakeUpdateAction ()
+ {
+ fakeUpdateAction = new FakeUpdatePackageAction (project);
+ return fakeUpdateAction;
+ }
+
+ void CreateUpdatePackagesAction ()
+ {
+ updatePackagesAction = new UpdatePackagesAction (project, null);
+ }
+
+ [Test]
+ public void IsInstalled_PackageIsInstalled_ReturnsTrue ()
+ {
+ CreateProject ();
+ fakeProjectManager.IsInstalledReturnValue = true;
+ var package = new FakePackage ("Test");
+
+ bool installed = project.IsPackageInstalled (package);
+
+ Assert.IsTrue (installed);
+ }
+
+ [Test]
+ public void IsInstalled_PackageIsNotInstalled_ReturnsFalse ()
+ {
+ CreateProject ();
+ fakeProjectManager.IsInstalledReturnValue = false;
+ var package = new FakePackage ("Test");
+
+ bool installed = project.IsPackageInstalled (package);
+
+ Assert.IsFalse (installed);
+ }
+
+ [Test]
+ public void IsInstalled_PackageIsInstalled_PackagePassedToProjectManager ()
+ {
+ CreateProject ();
+ fakeProjectManager.IsInstalledReturnValue = false;
+ var expectedPackage = new FakePackage ("Test");
+
+ project.IsPackageInstalled (expectedPackage);
+ IPackage actualPackage = fakeProjectManager.PackagePassedToIsInstalled;
+
+ Assert.AreEqual (expectedPackage, actualPackage);
+ }
+
+ [Test]
+ public void Constructor_RepositoryAndProjectPassed_RepositoryUsedToCreatePackageManager ()
+ {
+ CreateProject ();
+ IPackageRepository actualrepository = fakePackageManagerFactory.PackageRepositoryPassedToCreatePackageManager;
+
+ Assert.AreEqual (fakeSourceRepository, actualrepository);
+ }
+
+ [Test]
+ public void Constructor_RepositoryAndProjectPassed_ProjectUsedToCreatePackageManager ()
+ {
+ CreateProject ();
+ var actualProject = fakePackageManagerFactory.ProjectPassedToCreateRepository;
+
+ Assert.AreEqual (fakeProject, actualProject);
+ }
+
+ [Test]
+ public void GetPackages_ProjectManagerLocalRepositoryHasTwoPackages_ReturnsTwoPackages ()
+ {
+ CreateProject ();
+ FakePackageRepository repository = fakeProjectManager.FakeLocalRepository;
+ FakePackage packageA = repository.AddFakePackage ("A");
+ FakePackage packageB = repository.AddFakePackage ("B");
+
+ IQueryable<IPackage> actualPackages = project.GetPackages ();
+
+ var expectedPackages = new FakePackage[] {
+ packageA,
+ packageB
+ };
+
+ PackageCollectionAssert.AreEqual (expectedPackages, actualPackages);
+ }
+
+ [Test]
+ public void GetInstallPackageOperations_IgnoreDependenciesIsTrue_DependenciesIgnoredWhenRetrievingPackageOperations ()
+ {
+ CreateProject ();
+ var package = new FakePackage ();
+ CreateFakeInstallAction ()
+ .IgnoreDependencies = true;
+
+ project.GetInstallPackageOperations (package, fakeInstallAction);
+
+ Assert.IsTrue (fakePackageManager.IgnoreDependenciesPassedToGetInstallPackageOperations);
+ }
+
+ [Test]
+ public void GetInstallPackageOperations_IgnoreDependenciesIsFalse_DependenciesNotIgnoredWhenRetrievingPackageOperations ()
+ {
+ CreateProject ();
+ var package = new FakePackage ();
+ CreateFakeInstallAction ()
+ .IgnoreDependencies = false;
+
+ project.GetInstallPackageOperations (package, fakeInstallAction);
+
+ Assert.IsFalse (fakePackageManager.IgnoreDependenciesPassedToGetInstallPackageOperations);
+ }
+
+ [Test]
+ public void GetInstallPackageOperations_PackagePassed_PackageUsedToRetrievePackageOperations ()
+ {
+ CreateProject ();
+ var expectedPackage = new FakePackage ();
+ CreateFakeInstallAction ()
+ .IgnoreDependencies = true;
+
+ project.GetInstallPackageOperations (expectedPackage, fakeInstallAction);
+
+ IPackage actualPackage = fakePackageManager.PackagePassedToGetInstallPackageOperations;
+
+ Assert.AreEqual (expectedPackage, actualPackage);
+ }
+
+ [Test]
+ public void GetInstallPackageOperations_PackagePassed_ReturnsPackageOperations ()
+ {
+ CreateProject ();
+ var package = new FakePackage ();
+ CreateFakeInstallAction ()
+ .IgnoreDependencies = true;
+
+ IEnumerable<PackageOperation> operations = project.GetInstallPackageOperations (package, fakeInstallAction);
+
+ IEnumerable<PackageOperation> expectedOperations = fakePackageManager.PackageOperationsToReturnFromGetInstallPackageOperations;
+
+ Assert.AreEqual (expectedOperations, operations);
+ }
+
+ [Test]
+ public void Logger_SetLogger_LoggerOnPackageManagerIsSet ()
+ {
+ CreateProject ();
+ var expectedLogger = new FakeLogger ();
+
+ project.Logger = expectedLogger;
+
+ Assert.AreEqual (expectedLogger, fakePackageManager.Logger);
+ }
+
+ [Test]
+ public void Logger_GetLogger_LoggerOnPackageManagerIsReturned ()
+ {
+ CreateProject ();
+
+ ILogger logger = project.Logger;
+ ILogger expectedLogger = fakePackageManager.Logger;
+
+ Assert.AreEqual (expectedLogger, logger);
+ }
+
+ [Test]
+ public void InstallPackage_PackagePassed_PackageInstalled ()
+ {
+ CreateProject ();
+ var package = new FakePackage ();
+ CreateFakeInstallAction ()
+ .Package = package;
+
+ project.InstallPackage (package, fakeInstallAction);
+
+ IPackage expectedPackage = fakePackageManager.PackagePassedToInstallPackage;
+
+ Assert.AreEqual (expectedPackage, package);
+ }
+
+ [Test]
+ public void InstallPackage_IgnoreDependenciesIsTrue_DependenciesAreIgnoredWhenPackageIsInstalled ()
+ {
+ CreateProject ();
+ CreateFakeInstallAction ()
+ .IgnoreDependencies = true;
+ project.InstallPackage (null, fakeInstallAction);
+
+ Assert.IsTrue (fakePackageManager.IgnoreDependenciesPassedToInstallPackage);
+ }
+
+ [Test]
+ public void InstallPackage_IgnoreDependenciesIsFalse_DependenciesAreNotIgnoredWhenPackageIsInstalled ()
+ {
+ CreateProject ();
+ CreateFakeInstallAction ()
+ .IgnoreDependencies = false;
+ project.InstallPackage (null, fakeInstallAction);
+
+ Assert.IsFalse (fakePackageManager.IgnoreDependenciesPassedToInstallPackage);
+ }
+
+ [Test]
+ public void InstallPackage_PackageOperationsPassed_PackageOperationsUsedToInstallPackage ()
+ {
+ CreateProject ();
+ var expectedOperations = new List<PackageOperation> ();
+ CreateFakeInstallAction ()
+ .Operations = expectedOperations;
+ project.InstallPackage (null, fakeInstallAction);
+
+ IEnumerable<PackageOperation> actualOperations = fakePackageManager.PackageOperationsPassedToInstallPackage;
+
+ Assert.AreEqual (expectedOperations, actualOperations);
+ }
+
+ [Test]
+ public void SourceRepository_NewInstance_ReturnsRepositoryUsedToCreateInstance ()
+ {
+ CreateProject ();
+ IPackageRepository repository = project.SourceRepository;
+
+ Assert.AreEqual (fakeSourceRepository, repository);
+ }
+
+ [Test]
+ public void UninstallPackage_PackagePassed_PackageUninstalled ()
+ {
+ CreateProject ();
+ CreateFakeUninstallAction ();
+ fakeUninstallAction.ForceRemove = true;
+ fakeUninstallAction.RemoveDependencies = true;
+ var package = new FakePackage ();
+
+ project.UninstallPackage (package, fakeUninstallAction);
+
+ IPackage expectedPackage = fakePackageManager.PackagePassedToUninstallPackage;
+
+ Assert.AreEqual (expectedPackage, package);
+ }
+
+ [Test]
+ public void UninstallPackage_ForceRemoveIsTrue_PackageUninstallIsForced ()
+ {
+ CreateProject ();
+ CreateFakeUninstallAction ();
+ fakeUninstallAction.ForceRemove = true;
+ fakeUninstallAction.RemoveDependencies = false;
+
+ project.UninstallPackage (null, fakeUninstallAction);
+
+ Assert.IsTrue (fakePackageManager.ForceRemovePassedToUninstallPackage);
+ }
+
+ [Test]
+ public void UninstallPackage_ForceRemoveIsFalse_PackageUninstallIsNotForced ()
+ {
+ CreateProject ();
+ CreateFakeUninstallAction ();
+ fakeUninstallAction.ForceRemove = false;
+ fakeUninstallAction.RemoveDependencies = true;
+
+ project.UninstallPackage (null, fakeUninstallAction);
+
+ Assert.IsFalse (fakePackageManager.ForceRemovePassedToUninstallPackage);
+ }
+
+ [Test]
+ public void UninstallPackage_RemoveDependenciesIsTrue_PackageDependenciesIsRemoved ()
+ {
+ CreateProject ();
+ CreateFakeUninstallAction ();
+ fakeUninstallAction.ForceRemove = false;
+ fakeUninstallAction.RemoveDependencies = true;
+
+ project.UninstallPackage (null, fakeUninstallAction);
+
+ Assert.IsTrue (fakePackageManager.RemoveDependenciesPassedToUninstallPackage);
+ }
+
+ [Test]
+ public void UninstallPackage_RemoveDependenciesIsFalse_PackageDependenciesNotRemoved ()
+ {
+ CreateProject ();
+ CreateFakeUninstallAction ();
+ fakeUninstallAction.ForceRemove = true;
+ fakeUninstallAction.RemoveDependencies = false;
+
+ project.UninstallPackage (null, fakeUninstallAction);
+
+ Assert.IsFalse (fakePackageManager.RemoveDependenciesPassedToUninstallPackage);
+ }
+
+ [Test]
+ public void UpdatePackage_PackagePassed_PackageUpdated ()
+ {
+ CreateProject ();
+ var package = new FakePackage ();
+ CreateFakeUpdateAction ()
+ .UpdateDependencies = true;
+
+ project.UpdatePackage (package, fakeUpdateAction);
+
+ IPackage expectedPackage = fakePackageManager.PackagePassedToUpdatePackage;
+
+ Assert.AreEqual (expectedPackage, package);
+ }
+
+ [Test]
+ public void UpdatePackage_UpdateDependenciesIsTrue_DependenciesUpdatedWhenPackageIsUpdated ()
+ {
+ CreateProject ();
+ CreateFakeUpdateAction ()
+ .UpdateDependencies = true;
+
+ project.UpdatePackage (null, fakeUpdateAction);
+
+ Assert.IsTrue (fakePackageManager.UpdateDependenciesPassedToUpdatePackage);
+ }
+
+ [Test]
+ public void UpdatePackage_UpdateDependenciesIsFalse_DependenciesAreNotUpdatedWhenPackageIsUpdated ()
+ {
+ CreateProject ();
+ CreateFakeUpdateAction ()
+ .UpdateDependencies = false;
+
+ project.UpdatePackage (null, fakeUpdateAction);
+
+ Assert.IsFalse (fakePackageManager.UpdateDependenciesPassedToUpdatePackage);
+ }
+
+ [Test]
+ public void UpdatePackage_PackageOperationsPassed_PackageOperationsUsedToUpdatePackage ()
+ {
+ CreateProject ();
+ var expectedOperations = new List<PackageOperation> ();
+ CreateFakeUpdateAction ()
+ .Operations = expectedOperations;
+
+ project.UpdatePackage (null, fakeUpdateAction);
+
+ IEnumerable<PackageOperation> actualOperations = fakePackageManager.PackageOperationsPassedToUpdatePackage;
+
+ Assert.AreEqual (expectedOperations, actualOperations);
+ }
+
+ [Test]
+ public void Logger_SetLogger_ProjectManagerUsesLogger ()
+ {
+ CreateProject ();
+ ILogger expectedLogger = new NullLogger ();
+ project.Logger = expectedLogger;
+ ILogger actualLogger = fakePackageManager.ProjectManager.Logger;
+
+ Assert.AreEqual (expectedLogger, actualLogger);
+ }
+
+ [Test]
+ public void Logger_SetLogger_ProjectManagerProjectSystemUsesLogger ()
+ {
+ CreateProject ();
+ ILogger expectedLogger = new NullLogger ();
+ project.Logger = expectedLogger;
+ ILogger actualLogger = fakePackageManager.ProjectManager.Project.Logger;
+
+ Assert.AreEqual (expectedLogger, actualLogger);
+ }
+
+ [Test]
+ public void Logger_SetLogger_PackageManagerFileSystemUsesLogger ()
+ {
+ CreateProject ();
+ ILogger expectedLogger = new NullLogger ();
+ project.Logger = expectedLogger;
+ ILogger actualLogger = fakePackageManager.FileSystem.Logger;
+
+ Assert.AreEqual (expectedLogger, actualLogger);
+ }
+
+ [Test]
+ public void Logger_GetLogger_ReturnsLogger ()
+ {
+ CreateProject ();
+ ILogger expectedLogger = new NullLogger ();
+ project.Logger = expectedLogger;
+ ILogger actualLogger = project.Logger;
+
+ Assert.AreEqual (expectedLogger, actualLogger);
+ }
+
+ [Test]
+ public void PackageInstalled_PackagerManagerPackageInstalledEventFired_EventFiresWithPackage ()
+ {
+ CreateProject ();
+ PackageOperationEventArgs eventArgs = null;
+ project.PackageInstalled += (sender, e) => eventArgs = e;
+
+ var expectedEventArgs = new PackageOperationEventArgs (new FakePackage (), null, String.Empty);
+ fakePackageManager.FirePackageInstalled (expectedEventArgs);
+
+ Assert.AreEqual (expectedEventArgs, eventArgs);
+ }
+
+ [Test]
+ public void PackageUninstalled_PackagerManagerPackageUninstalledEventFired_EventFiresWithPackage ()
+ {
+ CreateProject ();
+ PackageOperationEventArgs eventArgs = null;
+ project.PackageUninstalled += (sender, e) => eventArgs = e;
+
+ var expectedEventArgs = new PackageOperationEventArgs (new FakePackage (), null, String.Empty);
+ fakePackageManager.FirePackageUninstalled (expectedEventArgs);
+
+ Assert.AreEqual (expectedEventArgs, eventArgs);
+ }
+
+ [Test]
+ public void PackageReferenceAdded_ProjectManagerPackageReferenceAddedEventFired_EventFiresWithPackage ()
+ {
+ CreateProject ();
+ PackageOperationEventArgs eventArgs = null;
+ project.PackageReferenceAdded += (sender, e) => eventArgs = e;
+
+ var expectedPackage = new FakePackage ();
+ fakeProjectManager.FirePackageReferenceAdded (expectedPackage);
+
+ Assert.AreEqual (expectedPackage, eventArgs.Package);
+ }
+
+ [Test]
+ public void PackageReferenceRemoved_ProjectManagerPackageReferenceRemovedEventFired_EventFiresWithPackage ()
+ {
+ CreateProject ();
+ PackageOperationEventArgs eventArgs = null;
+ project.PackageReferenceRemoved += (sender, e) => eventArgs = e;
+
+ var expectedPackage = new FakePackage ();
+ fakeProjectManager.FirePackageReferenceRemoved (expectedPackage);
+
+ Assert.AreEqual (expectedPackage, eventArgs.Package);
+ }
+
+ [Test]
+ public void Name_MSBuildProjectNameIsSet_ReturnsMSBuildProjectName ()
+ {
+ CreateProject ();
+ fakeProject.Name = "MyProject";
+
+ string name = project.Name;
+
+ Assert.AreEqual ("MyProject", name);
+ }
+
+ [Test]
+ public void IsInstalled_PackageIdPassedAndPackageIsInstalled_ReturnsTrue ()
+ {
+ CreateProject ();
+ fakeProjectManager.IsInstalledReturnValue = true;
+
+ bool installed = project.IsPackageInstalled ("Test");
+
+ Assert.IsTrue (installed);
+ }
+
+ [Test]
+ public void IsInstalled_PackageIdPassedAndPackageIsNotInstalled_ReturnsFalse ()
+ {
+ CreateProject ();
+ fakeProjectManager.IsInstalledReturnValue = false;
+
+ bool installed = project.IsPackageInstalled ("Test");
+
+ Assert.IsFalse (installed);
+ }
+
+ [Test]
+ public void IsInstalled_PackageIdPassedPackageIsInstalled_PackageIdPassedToProjectManager ()
+ {
+ CreateProject ();
+ fakeProjectManager.IsInstalledReturnValue = false;
+
+ project.IsPackageInstalled ("Test");
+ string id = fakeProjectManager.PackageIdPassedToIsInstalled;
+
+ Assert.AreEqual ("Test", id);
+ }
+
+ [Test]
+ public void GetPackagesInReverseDependencyOrder_TwoPackages_ReturnsPackagesFromProjectLocalRepositoryInCorrectOrder ()
+ {
+ CreateProject ();
+ FakePackage packageA = fakeProjectManager.FakeLocalRepository.AddFakePackageWithVersion ("A", "1.0");
+ FakePackage packageB = fakeProjectManager.FakeLocalRepository.AddFakePackageWithVersion ("B", "1.0");
+
+ packageB.DependenciesList.Add (new PackageDependency ("A"));
+
+ var expectedPackages = new FakePackage[] {
+ packageB,
+ packageA
+ };
+
+ IEnumerable<IPackage> packages = project.GetPackagesInReverseDependencyOrder ();
+
+ PackageCollectionAssert.AreEqual (expectedPackages, packages);
+ }
+
+ [Test]
+ public void InstallPackage_AllowPrereleaseVersionsIsTrue_PrereleaseVersionsAreNotAllowedWhenPackageIsInstalled ()
+ {
+ CreateProject ();
+ CreateFakeInstallAction ()
+ .AllowPrereleaseVersions = false;
+ project.InstallPackage (null, fakeInstallAction);
+
+ Assert.IsFalse (fakePackageManager.AllowPrereleaseVersionsPassedToInstallPackage);
+ }
+
+ [Test]
+ public void InstallPackage_AllowPrereleaseVersionsIsFalse_PrereleaseVersionsAreAllowedWhenPackageIsInstalled ()
+ {
+ CreateProject ();
+ CreateFakeInstallAction ()
+ .AllowPrereleaseVersions = true;
+ project.InstallPackage (null, fakeInstallAction);
+
+ Assert.IsTrue (fakePackageManager.AllowPrereleaseVersionsPassedToInstallPackage);
+ }
+
+ [Test]
+ public void GetInstallPackageOperations_AllowPrereleaseVersionsIsTrue_PrereleaseVersionsAllowedWhenRetrievingPackageOperations ()
+ {
+ CreateProject ();
+ var package = new FakePackage ();
+ CreateFakeInstallAction ()
+ .AllowPrereleaseVersions = true;
+
+ project.GetInstallPackageOperations (package, fakeInstallAction);
+
+ Assert.IsTrue (fakePackageManager.AllowPrereleaseVersionsPassedToGetInstallPackageOperations);
+ }
+
+ [Test]
+ public void GetInstallPackageOperations_AllowPrereleaseVersionsIsFalse_PrereleaseVersionsNotAllowedWhenRetrievingPackageOperations ()
+ {
+ CreateProject ();
+ var package = new FakePackage ();
+ CreateFakeInstallAction ()
+ .AllowPrereleaseVersions = false;
+
+ project.GetInstallPackageOperations (package, fakeInstallAction);
+
+ Assert.IsFalse (fakePackageManager.AllowPrereleaseVersionsPassedToGetInstallPackageOperations);
+ }
+
+ [Test]
+ public void UpdatePackage_AllowPrereleaseVersionsIsTrue_PrereleaseVersionsNotAllowedWhenPackageIsUpdated ()
+ {
+ CreateProject ();
+ CreateFakeUpdateAction ()
+ .AllowPrereleaseVersions = true;
+
+ project.UpdatePackage (null, fakeUpdateAction);
+
+ Assert.IsTrue (fakePackageManager.AllowPrereleaseVersionsPassedToInstallPackage);
+ }
+
+ [Test]
+ public void UpdatePackage_AllowPrereleaseVersionsIsFalse_PrereleaseVersionsNotAllowedWhenPackageIsUpdated ()
+ {
+ CreateProject ();
+ CreateFakeUpdateAction ()
+ .AllowPrereleaseVersions = false;
+
+ project.UpdatePackage (null, fakeUpdateAction);
+
+ Assert.IsFalse (fakePackageManager.AllowPrereleaseVersionsPassedToInstallPackage);
+ }
+
+ [Test]
+ public void UpdatePackages_ActionHasOperationsAndPackages_ActionPassedToPackageManager ()
+ {
+ CreateProject ();
+ CreateUpdatePackagesAction ();
+
+ project.UpdatePackages (updatePackagesAction);
+
+ Assert.AreEqual (updatePackagesAction, fakePackageManager.UpdatePackagesActionsPassedToUpdatePackages);
+ }
+
+ [Test]
+ public void GetUpdatePackagesOperations_ActionPassed_ActionPassedToPackageManager ()
+ {
+ CreateProject ();
+ CreateUpdatePackagesAction ();
+ var expectedPackages = new FakePackage[] { new FakePackage ("Test") };
+ updatePackagesAction.AddPackages (expectedPackages);
+
+ project.GetUpdatePackagesOperations (updatePackagesAction.Packages, updatePackagesAction);
+
+ Assert.AreEqual (updatePackagesAction, fakePackageManager.SettingsPassedToGetUpdatePackageOperations);
+ Assert.AreEqual (expectedPackages, fakePackageManager.PackagesPassedToGetUpdatePackageOperations);
+ }
+
+ [Test]
+ public void GetUpdatePackagesOperations_ActionPassed_PackageOperationsReturned ()
+ {
+ CreateProject ();
+ CreateUpdatePackagesAction ();
+ List<PackageOperation> expectedOperations = PackageOperationHelper.CreateListWithOneInstallOperationWithFile ("readme.txt");
+ fakePackageManager.PackageOperationsToReturnFromGetUpdatePackageOperations = expectedOperations;
+
+ IEnumerable<PackageOperation> operations = project.GetUpdatePackagesOperations (updatePackagesAction.Packages, updatePackagesAction);
+
+ CollectionAssert.AreEqual (expectedOperations, operations);
+ }
+
+ [Test]
+ public void RunPackageOperations_OneOperation_PackageOperationsRunByPackageManager ()
+ {
+ CreateProject ();
+ CreateUpdatePackagesAction ();
+ List<PackageOperation> expectedOperations = PackageOperationHelper.CreateListWithOneInstallOperationWithFile ("readme.txt");
+
+ project.RunPackageOperations (expectedOperations);
+
+ CollectionAssert.AreEqual (expectedOperations, fakePackageManager.PackageOperationsPassedToRunPackageOperations);
+ }
+
+ [Test]
+ public void HasOlderPackageInstalled_TestPackage_PackagePassedToProjectManager ()
+ {
+ CreateProject ();
+ CreateUpdatePackagesAction ();
+ var expectedPackage = new FakePackage ("Test");
+
+ project.HasOlderPackageInstalled (expectedPackage);
+
+ Assert.AreEqual (expectedPackage, fakeProjectManager.PackagePassedToHasOlderPackageInstalled);
+ }
+
+ [Test]
+ public void HasOlderPackageInstalled_PackageIsInstalled_ReturnsTrue ()
+ {
+ CreateProject ();
+ fakeProjectManager.HasOlderPackageInstalledReturnValue = true;
+ var package = new FakePackage ("Test");
+
+ bool installed = project.HasOlderPackageInstalled (package);
+
+ Assert.IsTrue (installed);
+ }
+
+ [Test]
+ public void HasOlderPackageInstalled_PackageIsNotInstalled_ReturnsFalse ()
+ {
+ CreateProject ();
+ fakeProjectManager.HasOlderPackageInstalledReturnValue = false;
+ var package = new FakePackage ("Test");
+
+ bool installed = project.HasOlderPackageInstalled (package);
+
+ Assert.IsFalse (installed);
+ }
+
+ [Test]
+ public void UpdatePackageReference_PackageAndUpdateActionPassed_BothPassedToPackageManager ()
+ {
+ CreateProject ();
+ CreateUpdatePackagesAction ();
+ var package = new FakePackage ("Test");
+
+ project.UpdatePackageReference (package, updatePackagesAction);
+
+ Assert.AreEqual (package, fakePackageManager.PackagePassedToUpdatePackageReference);
+ Assert.AreEqual (updatePackagesAction, fakePackageManager.SettingsPassedToUpdatePackageReference);
+ }
+
+ [Test]
+ public void Logger_SetLoggerWhenSourceRepositoryIsAggregateRepository_LoggerOnAggregateRepositoryIsSet ()
+ {
+ var aggregateRepository = new AggregateRepository (new FakePackageRepository [0]);
+ CreateProject (aggregateRepository);
+ var expectedLogger = new FakeLogger ();
+
+ project.Logger = expectedLogger;
+
+ Assert.AreEqual (expectedLogger, aggregateRepository.Logger);
+ }
+ }
+}
+
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementSelectedProjectTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementSelectedProjectTests.cs
new file mode 100644
index 0000000000..ab4f35a0aa
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementSelectedProjectTests.cs
@@ -0,0 +1,85 @@
+//
+// PackageManagementSelectedProjectTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class PackageManagementSelectedProjectTests
+ {
+ PackageManagementSelectedProject selectedProject;
+ FakePackageManagementProject fakeProject;
+
+ void CreateFakePackageManagementProject ()
+ {
+ fakeProject = new FakePackageManagementProject ();
+ }
+
+ void CreateSelectedProject (FakePackageManagementProject fakeProject)
+ {
+ selectedProject = new PackageManagementSelectedProject (fakeProject);
+ }
+
+ [Test]
+ public void Name_PackageManagementProjectNameIsTest_ReturnsTest ()
+ {
+ CreateFakePackageManagementProject ();
+ CreateSelectedProject (fakeProject);
+ fakeProject.Name = "Test";
+
+ string name = selectedProject.Name;
+
+ Assert.AreEqual ("Test", name);
+ }
+
+ [Test]
+ public void IsSelected_SelectedNotSpecifiedInConstructor_ReturnsFalse ()
+ {
+ CreateFakePackageManagementProject ();
+ CreateSelectedProject (fakeProject);
+
+ bool selected = selectedProject.IsSelected;
+
+ Assert.IsFalse (selected);
+ }
+
+ [Test]
+ public void IsEnabled_EnabledNotSpecifiedInConstructor_ReturnsTrue ()
+ {
+ CreateFakePackageManagementProject ();
+ CreateSelectedProject (fakeProject);
+
+ bool enabled = selectedProject.IsEnabled;
+
+ Assert.IsTrue (enabled);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementSelectedProjectsTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementSelectedProjectsTests.cs
new file mode 100644
index 0000000000..97c363af45
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementSelectedProjectsTests.cs
@@ -0,0 +1,536 @@
+//
+// PackageManagementSelectedProjectsTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+using ICSharpCode.PackageManagement;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class PackageManagementSelectedProjectsTests
+ {
+ PackageManagementSelectedProjects selectedProjects;
+ FakePackageManagementSolution fakeSolution;
+
+ void CreateSelectedProjects ()
+ {
+ selectedProjects = new PackageManagementSelectedProjects (fakeSolution);
+ }
+
+ void CreateFakeSolution ()
+ {
+ fakeSolution = new FakePackageManagementSolution ();
+ }
+
+ List<FakeDotNetProject> AddSolutionWithOneProjectToProjectService ()
+ {
+ FakeDotNetProject project = ProjectHelper.CreateTestProject ("Test1");
+ fakeSolution.FakeDotNetProjects.Add (project);
+
+ return fakeSolution.FakeDotNetProjects;
+ }
+
+ List<FakeDotNetProject> AddSolutionWithTwoProjectsToProjectService ()
+ {
+ ISolution solution = ProjectHelper.CreateSolution ();
+ FakeDotNetProject project1 = ProjectHelper.CreateTestProject (solution, "Test1");
+ FakeDotNetProject project2 = ProjectHelper.CreateTestProject ("Test2");
+
+ fakeSolution.FakeDotNetProjects.Add (project1);
+ fakeSolution.FakeDotNetProjects.Add (project2);
+
+ return fakeSolution.FakeDotNetProjects;
+ }
+
+ void NoProjectsSelected ()
+ {
+ fakeSolution.NoProjectsSelected ();
+ }
+
+ [Test]
+ public void GetProjects_SolutionHasTwoProjectsAndOneProjectSelectedInProjectsBrowser_ReturnsProjectSelectedInProjects ()
+ {
+ CreateFakeSolution ();
+ List<FakeDotNetProject> projectsAddedToSolution = AddSolutionWithTwoProjectsToProjectService ();
+ FakeDotNetProject project = projectsAddedToSolution [1];
+ project.Name = "MyProject";
+ fakeSolution.FakeActiveDotNetProject = project;
+
+ fakeSolution.AddFakeProjectToReturnFromGetProject ("MyProject");
+ CreateSelectedProjects ();
+
+ var fakePackage = new FakePackage ();
+ var projects = new List<IPackageManagementSelectedProject> ();
+ projects.AddRange (selectedProjects.GetProjects (fakePackage));
+
+ var expectedProject = new PackageManagementSelectedProject ("MyProject", selected: false, enabled: true);
+ var expectedProjects = new List<IPackageManagementSelectedProject> ();
+ expectedProjects.Add (expectedProject);
+
+ SelectedProjectCollectionAssert.AreEqual (expectedProjects, projects);
+ }
+
+ [Test]
+ public void GetProjects_SolutionHasTwoProjectsAndOneProjectSelectedInitiallyAndGetProjectsCalledAgainAfterNoProjectsAreSelected_ReturnsProjectSelectedInProjects ()
+ {
+ CreateFakeSolution ();
+ List<FakeDotNetProject> projectsAddedToSolution = AddSolutionWithTwoProjectsToProjectService ();
+ FakeDotNetProject project = projectsAddedToSolution [1];
+ project.Name = "MyProject";
+ fakeSolution.FakeActiveDotNetProject = project;
+
+ fakeSolution.AddFakeProjectToReturnFromGetProject ("MyProject");
+ CreateSelectedProjects ();
+
+ var fakePackage = new FakePackage ();
+ var projects = new List<IPackageManagementSelectedProject> ();
+ projects.AddRange (selectedProjects.GetProjects (fakePackage));
+
+ projects.Clear ();
+
+ NoProjectsSelected ();
+ projects.AddRange (selectedProjects.GetProjects (fakePackage));
+
+ var expectedProject = new PackageManagementSelectedProject ("MyProject", selected: false, enabled: true);
+ var expectedProjects = new List<IPackageManagementSelectedProject> ();
+ expectedProjects.Add (expectedProject);
+
+ SelectedProjectCollectionAssert.AreEqual (expectedProjects, projects);
+ }
+
+ [Test]
+ public void HasMultipleProjects_SolutionHasTwoProjectsAndOneProjectSelectedInProjectsBrowser_ReturnsFalse ()
+ {
+ CreateFakeSolution ();
+ List<FakeDotNetProject> projectsAddedToSolution = AddSolutionWithTwoProjectsToProjectService ();
+ FakeDotNetProject expectedProject = projectsAddedToSolution [1];
+ fakeSolution.FakeActiveDotNetProject = expectedProject;
+ CreateSelectedProjects ();
+
+ bool hasMultipleProjects = selectedProjects.HasMultipleProjects ();
+
+ Assert.IsFalse (hasMultipleProjects);
+ }
+
+ [Test]
+ public void GetProjects_SolutionHasTwoProjectsAndNoProjectSelectedInProjectsBrowser_ReturnsAllProjectsInSolutionForPackage ()
+ {
+ CreateFakeSolution ();
+ List<FakeDotNetProject> projectsAddedToSolution = AddSolutionWithTwoProjectsToProjectService ();
+ projectsAddedToSolution [0].Name = "Project A";
+ projectsAddedToSolution [1].Name = "Project B";
+ fakeSolution.FakeActiveProject = null;
+
+ fakeSolution.AddFakeProjectToReturnFromGetProject ("Project A");
+ fakeSolution.AddFakeProjectToReturnFromGetProject ("Project B");
+ CreateSelectedProjects ();
+
+ var fakePackage = new FakePackage ();
+ var projects = new List<IPackageManagementSelectedProject> ();
+ projects.AddRange (selectedProjects.GetProjects (fakePackage));
+
+ var expectedProjects = new List<IPackageManagementSelectedProject> ();
+ expectedProjects.Add (new PackageManagementSelectedProject ("Project A", selected: false, enabled: true));
+ expectedProjects.Add (new PackageManagementSelectedProject ("Project B", selected: false, enabled: true));
+
+ SelectedProjectCollectionAssert.AreEqual (expectedProjects, projects);
+ }
+
+ [Test]
+ public void HasMultipleProjects_SolutionHasTwoProjectsAndNoProjectSelectedInProjectsBrowser_ReturnsTrue ()
+ {
+ CreateFakeSolution ();
+ AddSolutionWithTwoProjectsToProjectService ();
+ fakeSolution.FakeActiveProject = null;
+ CreateSelectedProjects ();
+
+ bool hasMultipleProjects = selectedProjects.HasMultipleProjects ();
+
+ Assert.IsTrue (hasMultipleProjects);
+ }
+
+ [Test]
+ public void HasMultipleProjects_SolutionHasOneProjectAndNoProjectSelectedInProjectsBrowser_ReturnsFalse ()
+ {
+ CreateFakeSolution ();
+ AddSolutionWithOneProjectToProjectService ();
+ fakeSolution.FakeActiveProject = null;
+ CreateSelectedProjects ();
+
+ bool hasMultipleProjects = selectedProjects.HasMultipleProjects ();
+
+ Assert.IsFalse (hasMultipleProjects);
+ }
+
+ [Test]
+ public void SelectionName_SolutionHasOneProject_ReturnsProjectNameWithoutFileExtension ()
+ {
+ CreateFakeSolution ();
+ List<FakeDotNetProject> projectsAddedToSolution = AddSolutionWithOneProjectToProjectService ();
+ projectsAddedToSolution [0].Name = "MyProject";
+ fakeSolution.FakeActiveDotNetProject = projectsAddedToSolution [0];
+ CreateSelectedProjects ();
+
+ string name = selectedProjects.SelectionName;
+
+ Assert.AreEqual ("MyProject", name);
+ }
+
+ [Test]
+ public void SelectionName_SolutionHasTwoProjectsAndNoProjectSelected_ReturnsSolutionFileNameWithoutFullPath ()
+ {
+ CreateFakeSolution ();
+ AddSolutionWithTwoProjectsToProjectService ();
+ NoProjectsSelected ();
+ fakeSolution.FileName = @"d:\projects\MyProject\MySolution.sln".ToNativePath ();
+ CreateSelectedProjects ();
+
+ string name = selectedProjects.SelectionName;
+
+ Assert.AreEqual ("MySolution.sln", name);
+ }
+
+ [Test]
+ public void IsPackageInstalled_PackageInstalledInSolutionWithTwoProjectsAndNoProjectSelected_ReturnsTrue ()
+ {
+ CreateFakeSolution ();
+ AddSolutionWithTwoProjectsToProjectService ();
+ NoProjectsSelected ();
+
+ var package = new FakePackage ("Test");
+ fakeSolution.FakeInstalledPackages.Add (package);
+ CreateSelectedProjects ();
+
+ bool installed = selectedProjects.IsPackageInstalled (package);
+
+ Assert.IsTrue (installed);
+ }
+
+ [Test]
+ public void IsPackageInstalled_PackageIsInstalledInSolutionWithTwoProjectsAndNoProjectSelected_ReturnsFalse ()
+ {
+ CreateFakeSolution ();
+ AddSolutionWithTwoProjectsToProjectService ();
+ NoProjectsSelected ();
+ CreateSelectedProjects ();
+
+ var package = new FakePackage ("Test");
+ bool installed = selectedProjects.IsPackageInstalled (package);
+
+ Assert.IsFalse (installed);
+ }
+
+ [Test]
+ public void IsPackageInstalled_PackageIsInstalledInProjectAndProjectSelected_ReturnsTrue ()
+ {
+ CreateFakeSolution ();
+ List<FakeDotNetProject> projectsAddedToSolution = AddSolutionWithTwoProjectsToProjectService ();
+ fakeSolution.FakeActiveDotNetProject = projectsAddedToSolution [0];
+
+ var package = new FakePackage ("Test");
+ fakeSolution.FakeProjectToReturnFromGetProject.FakePackages.Add (package);
+ CreateSelectedProjects ();
+
+ bool installed = selectedProjects.IsPackageInstalled (package);
+
+ Assert.IsTrue (installed);
+ }
+
+ [Test]
+ public void IsPackageInstalled_PackageIsNotInstalledInProjectAndProjectSelected_ReturnsFalse ()
+ {
+ CreateFakeSolution ();
+ List<FakeDotNetProject> projectsAddedToSolution = AddSolutionWithTwoProjectsToProjectService ();
+ fakeSolution.FakeActiveDotNetProject = projectsAddedToSolution [0];
+ CreateSelectedProjects ();
+
+ var package = new FakePackage ("Test");
+ bool installed = selectedProjects.IsPackageInstalled (package);
+
+ Assert.IsFalse (installed);
+ }
+
+ [Test]
+ public void IsPackageInstalled_PackagePackageIsNotInstalledInProjectAndProjectSelected_ProjectCreatedUsingPackageRepository ()
+ {
+ CreateFakeSolution ();
+ List<FakeDotNetProject> projectsAddedToSolution = AddSolutionWithTwoProjectsToProjectService ();
+ fakeSolution.FakeActiveDotNetProject = projectsAddedToSolution [0];
+ CreateSelectedProjects ();
+
+ var package = new FakePackage ("Test");
+ selectedProjects.IsPackageInstalled (package);
+
+ IPackageRepository repository = fakeSolution.RepositoryPassedToGetProject;
+ IPackageRepository expectedRepository = package.FakePackageRepository;
+
+ Assert.AreEqual (expectedRepository, repository);
+ }
+
+ [Test]
+ public void IsPackageInstalledInSolution_PackageInstalledInSolutionWithTwoProjectsAndOneProjectSelected_ReturnsTrue ()
+ {
+ CreateFakeSolution ();
+ List<FakeDotNetProject> projectsAddedToSolution = AddSolutionWithTwoProjectsToProjectService ();
+ fakeSolution.FakeActiveDotNetProject = projectsAddedToSolution [0];
+
+ var package = new FakePackage ("Test");
+ fakeSolution.FakeInstalledPackages.Add (package);
+ CreateSelectedProjects ();
+
+ bool installed = selectedProjects.Solution.IsPackageInstalled (package);
+
+ Assert.IsTrue (installed);
+ }
+
+ [Test]
+ public void IsPackageInstalledInSolution_PackageNotInstalledInSolutionWithTwoProjectsAndOneProjectSelected_ReturnsFalse ()
+ {
+ CreateFakeSolution ();
+ List<FakeDotNetProject> projectsAddedToSolution = AddSolutionWithTwoProjectsToProjectService ();
+ fakeSolution.FakeActiveDotNetProject = projectsAddedToSolution [0];
+ CreateSelectedProjects ();
+
+ var package = new FakePackage ("Test");
+
+ bool installed = selectedProjects.Solution.IsPackageInstalled (package);
+
+ Assert.IsFalse (installed);
+ }
+
+ [Test]
+ public void GetPackagesInstalledInSolution_PackageInstalledInSolutionAndProjectNotSelected_ReturnsPackageInstalledInSolution ()
+ {
+ CreateFakeSolution ();
+ AddSolutionWithTwoProjectsToProjectService ();
+ NoProjectsSelected ();
+
+ var package = new FakePackage ("Test");
+ fakeSolution.FakeInstalledPackages.Add (package);
+ CreateSelectedProjects ();
+
+ IQueryable<IPackage> packages = selectedProjects.Solution.GetPackages ();
+
+ var expectedPackages = new FakePackage[] {
+ package
+ };
+
+ PackageCollectionAssert.AreEqual (expectedPackages, packages);
+ }
+
+ [Test]
+ public void GetSingleProjectSelected_ProjectSelected_ReturnsProject ()
+ {
+ CreateFakeSolution ();
+ List<FakeDotNetProject> projectsAddedToSolution = AddSolutionWithTwoProjectsToProjectService ();
+ fakeSolution.FakeActiveDotNetProject = projectsAddedToSolution [0];
+ CreateSelectedProjects ();
+
+ var repository = new FakePackageRepository ();
+ IPackageManagementProject project = selectedProjects.GetSingleProjectSelected (repository);
+
+ FakePackageManagementProject expectedProject = fakeSolution.FakeProjectToReturnFromGetProject;
+
+ Assert.AreEqual (expectedProject, project);
+ }
+
+ [Test]
+ public void GetSingleProjectSelected_ProjectSelectedAndRepositoryPassed_ReturnsProjectCreatedWithRepository ()
+ {
+ CreateFakeSolution ();
+ List<FakeDotNetProject> projectsAddedToSolution = AddSolutionWithTwoProjectsToProjectService ();
+ fakeSolution.FakeActiveDotNetProject = projectsAddedToSolution [0];
+ CreateSelectedProjects ();
+
+ var repository = new FakePackageRepository ();
+ selectedProjects.GetSingleProjectSelected (repository);
+
+ Assert.AreEqual (repository, fakeSolution.RepositoryPassedToGetProject);
+ }
+
+ [Test]
+ public void GetSingleProjectSelected_NoProjectSelectedAndRepositoryPassed_ReturnsProjectCreatedWithRepository ()
+ {
+ CreateFakeSolution ();
+ List<FakeDotNetProject> projectsAddedToSolution = AddSolutionWithTwoProjectsToProjectService ();
+ fakeSolution.FakeActiveDotNetProject = projectsAddedToSolution [0];
+ CreateSelectedProjects ();
+
+ var repository = new FakePackageRepository ();
+ selectedProjects.GetSingleProjectSelected (repository);
+
+ Assert.AreEqual (repository, fakeSolution.RepositoryPassedToGetProject);
+ }
+
+ [Test]
+ public void HasSingleProjectSelected_SolutionHasTwoProjectsAndOneProjectSelectedInProjectsBrowser_ReturnsTrue ()
+ {
+ CreateFakeSolution ();
+ List<FakeDotNetProject> projectsAddedToSolution = AddSolutionWithTwoProjectsToProjectService ();
+ FakeDotNetProject expectedProject = projectsAddedToSolution [1];
+ fakeSolution.FakeActiveDotNetProject = expectedProject;
+ CreateSelectedProjects ();
+
+ bool singleProjectSelected = selectedProjects.HasSingleProjectSelected ();
+
+ Assert.IsTrue (singleProjectSelected);
+ }
+
+ [Test]
+ public void HasSingleProjectSelected_SolutionHasTwoProjectsAndNoProjectsSelectedInProjectsBrowser_ReturnsFalse ()
+ {
+ CreateFakeSolution ();
+ AddSolutionWithTwoProjectsToProjectService ();
+ NoProjectsSelected ();
+ CreateSelectedProjects ();
+
+ bool singleProjectSelected = selectedProjects.HasSingleProjectSelected ();
+
+ Assert.IsFalse (singleProjectSelected);
+ }
+
+ [Test]
+ public void HasSingleProjectSelected_NoProjectsInitiallySelectedAndProjectSelectedAfterInitialCall_IsUnchangedAndReturnsFalse ()
+ {
+ CreateFakeSolution ();
+ AddSolutionWithTwoProjectsToProjectService ();
+ NoProjectsSelected ();
+ CreateSelectedProjects ();
+
+ bool singleProjectSelected = selectedProjects.HasSingleProjectSelected ();
+ fakeSolution.FakeActiveDotNetProject = fakeSolution.FakeDotNetProjects [0];
+ singleProjectSelected = selectedProjects.HasSingleProjectSelected ();
+
+ Assert.IsFalse (singleProjectSelected);
+ }
+
+ [Test]
+ public void GetInstalledPackages_PackageInstalledInSolutionAndProjectNotSelected_ReturnsPackageInstalledInSolution ()
+ {
+ CreateFakeSolution ();
+ AddSolutionWithTwoProjectsToProjectService ();
+ NoProjectsSelected ();
+
+ var package = new FakePackage ("Test");
+ fakeSolution.FakeInstalledPackages.Add (package);
+ CreateSelectedProjects ();
+
+ var repository = new FakePackageRepository ();
+ IQueryable<IPackage> packages = selectedProjects.GetInstalledPackages (repository);
+
+ var expectedPackages = new FakePackage[] {
+ package
+ };
+
+ PackageCollectionAssert.AreEqual (expectedPackages, packages);
+ }
+
+ [Test]
+ public void GetInstalledPackages_PackageInstalledInProjectAndProjectIsSelected_ReturnsPackageInstalledInProject ()
+ {
+ CreateFakeSolution ();
+ List<FakeDotNetProject> projectsAddedToSolution = AddSolutionWithTwoProjectsToProjectService ();
+ fakeSolution.FakeActiveDotNetProject = projectsAddedToSolution [0];
+ fakeSolution.FakeActiveDotNetProject.Name = "MyProject";
+
+ var package = new FakePackage ("Test");
+ var project = new FakePackageManagementProject ("MyProject");
+ project.FakePackages.Add (package);
+ fakeSolution.FakeProjectsToReturnFromGetProject.Add ("MyProject", project);
+ CreateSelectedProjects ();
+
+ var repository = new FakePackageRepository ();
+ IQueryable<IPackage> packages = selectedProjects.GetInstalledPackages (repository);
+
+ var expectedPackages = new FakePackage[] {
+ package
+ };
+
+ PackageCollectionAssert.AreEqual (expectedPackages, packages);
+ }
+
+ [Test]
+ public void GetInstalledPackages_PackageInstalledInProjectAndProjectIsSelected_CreatesProjectUsingRepository ()
+ {
+ CreateFakeSolution ();
+ List<FakeDotNetProject> projectsAddedToSolution = AddSolutionWithTwoProjectsToProjectService ();
+ fakeSolution.FakeActiveDotNetProject = projectsAddedToSolution [0];
+ CreateSelectedProjects ();
+
+ var expectedRepository = new FakePackageRepository ();
+ selectedProjects.GetInstalledPackages (expectedRepository);
+
+ IPackageRepository repository = fakeSolution.RepositoryPassedToGetProject;
+
+ Assert.AreEqual (expectedRepository, repository);
+ }
+
+ [Test]
+ public void GetSingleProjectSelected_NoProjectSelected_ReturnsNull ()
+ {
+ CreateFakeSolution ();
+ AddSolutionWithTwoProjectsToProjectService ();
+ NoProjectsSelected ();
+ CreateSelectedProjects ();
+
+ var repository = new FakePackageRepository ();
+ IPackageManagementProject project = selectedProjects.GetSingleProjectSelected (repository);
+
+ Assert.IsNull (project);
+ }
+
+ [Test]
+ public void GetProjects_SolutionHasTwoProjectsAndOneProjectSelectedInitiallyAndActiveProjectChangedInSolutionAfterInstanceCreated_ReturnsProjectSelectedInProjects ()
+ {
+ CreateFakeSolution ();
+ List<FakeDotNetProject> projectsAddedToSolution = AddSolutionWithTwoProjectsToProjectService ();
+ FakeDotNetProject project = projectsAddedToSolution [1];
+ project.Name = "MyProject";
+ fakeSolution.FakeActiveDotNetProject = project;
+ fakeSolution.AddFakeProjectToReturnFromGetProject ("MyProject");
+ CreateSelectedProjects ();
+
+ NoProjectsSelected ();
+
+ var fakePackage = new FakePackage ();
+ List<IPackageManagementSelectedProject> projects = selectedProjects.GetProjects (fakePackage).ToList ();
+
+ var expectedProject = new PackageManagementSelectedProject ("MyProject", selected: false, enabled: true);
+ var expectedProjects = new List<IPackageManagementSelectedProject> ();
+ expectedProjects.Add (expectedProject);
+
+ SelectedProjectCollectionAssert.AreEqual (expectedProjects, projects);
+ }
+ }
+}
+
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementSolutionTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementSolutionTests.cs
new file mode 100644
index 0000000000..b9b4485edd
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementSolutionTests.cs
@@ -0,0 +1,665 @@
+//
+// PackageManagementSolutionTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using ICSharpCode.PackageManagement;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class PackageManagementSolutionTests
+ {
+ PackageManagementSolution solution;
+ FakeRegisteredPackageRepositories fakeRegisteredPackageRepositories;
+ OneRegisteredPackageSourceHelper packageSourcesHelper;
+ FakePackageManagementProjectService fakeProjectService;
+ FakePackageManagementProjectFactory fakeProjectFactory;
+ FakeDotNetProject testProject;
+ FakeSolutionPackageRepositoryFactory fakeSolutionPackageRepositoryFactory;
+ FakeSolutionPackageRepository fakeSolutionPackageRepository;
+
+ void CreatePackageSources ()
+ {
+ packageSourcesHelper = new OneRegisteredPackageSourceHelper ();
+ }
+
+ void CreateSolution ()
+ {
+ CreatePackageSources ();
+ CreateSolution (packageSourcesHelper.Options);
+ }
+
+ void CreateSolution (PackageManagementOptions options)
+ {
+ testProject = ProjectHelper.CreateTestProject ();
+ fakeRegisteredPackageRepositories = new FakeRegisteredPackageRepositories ();
+ fakeProjectFactory = new FakePackageManagementProjectFactory ();
+ fakeProjectService = new FakePackageManagementProjectService ();
+
+ fakeProjectService.CurrentProject = testProject;
+ fakeProjectService.OpenSolution = testProject.ParentSolution;
+
+ fakeSolutionPackageRepositoryFactory = new FakeSolutionPackageRepositoryFactory ();
+ fakeSolutionPackageRepository = fakeSolutionPackageRepositoryFactory.FakeSolutionPackageRepository;
+
+ solution =
+ new PackageManagementSolution (
+ fakeRegisteredPackageRepositories,
+ fakeProjectService,
+ fakeProjectFactory,
+ fakeSolutionPackageRepositoryFactory);
+ }
+
+ FakeDotNetProject AddProjectToOpenProjects (string projectName)
+ {
+ FakeDotNetProject project = ProjectHelper.CreateTestProject (projectName);
+ fakeProjectService.OpenProjects.Add (project);
+ return project;
+ }
+
+ FakePackage AddPackageInReverseDependencyOrderToSolution (string packageId)
+ {
+ var package = new FakePackage (packageId);
+ fakeSolutionPackageRepository.FakePackagesByReverseDependencyOrder.Add (package);
+ return package;
+ }
+
+ [Test]
+ public void GetActiveProject_ProjectIsSelected_CreatesProjectUsingCurrentProjectSelectedInSharpDevelop ()
+ {
+ CreateSolution ();
+
+ solution.GetActiveProject ();
+
+ IProject actualProject = fakeProjectFactory.FirstProjectPassedToCreateProject;
+ Assert.AreEqual (testProject, actualProject);
+ }
+
+ [Test]
+ public void GetActiveProject_ProjectIsSelected_CreatesProjectUsingAggregateRepository ()
+ {
+ CreateSolution ();
+ fakeProjectService.CurrentProject = new FakeDotNetProject ();
+
+ solution.GetActiveProject ();
+
+ IPackageRepository repository = fakeProjectFactory.FirstRepositoryPassedToCreateProject;
+ IPackageRepository expectedRepository = fakeRegisteredPackageRepositories.FakeAggregateRepository;
+
+ Assert.AreEqual (expectedRepository, repository);
+ }
+
+ [Test]
+ public void GetActiveProject_ProjectIsSelected_ReturnsProjectCreatedByFactory ()
+ {
+ CreateSolution ();
+ fakeProjectService.CurrentProject = new FakeDotNetProject ();
+
+ IPackageManagementProject activeProject = solution.GetActiveProject ();
+ IPackageManagementProject expectedProject = fakeProjectFactory.FirstFakeProjectCreated;
+
+ Assert.AreEqual (expectedProject, activeProject);
+ }
+
+ [Test]
+ public void GetActiveProject_RepositoryPassed_CreatesProjectUsingRepository ()
+ {
+ CreateSolution ();
+ var expectedRepository = new FakePackageRepository ();
+ solution.GetActiveProject (expectedRepository);
+
+ IPackageRepository repository = fakeProjectFactory.FirstRepositoryPassedToCreateProject;
+
+ Assert.AreEqual (expectedRepository, repository);
+ }
+
+ [Test]
+ public void GetActiveProject_RepositoryPassed_CreatesProjectUsingCurrentActiveProject ()
+ {
+ CreateSolution ();
+ var expectedRepository = new FakePackageRepository ();
+ FakeDotNetProject expectedProject = ProjectHelper.CreateTestProject ();
+ fakeProjectService.CurrentProject = expectedProject;
+
+ solution.GetActiveProject (expectedRepository);
+
+ IDotNetProject project = fakeProjectFactory.FirstProjectPassedToCreateProject;
+
+ Assert.AreEqual (expectedProject, project);
+ }
+
+ [Test]
+ public void GetActiveProject_RepositoryPassed_ReturnsProjectFromProjectFactory ()
+ {
+ CreateSolution ();
+ var expectedRepository = new FakePackageRepository ();
+ IPackageManagementProject project = solution.GetActiveProject (expectedRepository);
+
+ FakePackageManagementProject expectedProject = fakeProjectFactory.FirstFakeProjectCreated;
+
+ Assert.AreEqual (expectedProject, project);
+ }
+
+ [Test]
+ public void GetProject_PackagesSourceAndProjectNamePassed_CreatesProjectUsingFoundProjectMatchingName ()
+ {
+ CreateSolution ();
+ FakeDotNetProject expectedProject = AddProjectToOpenProjects ("Test");
+ var source = new PackageSource ("http://sharpdevelop.net");
+
+ solution.GetProject (source, "Test");
+
+ IDotNetProject project = fakeProjectFactory.FirstProjectPassedToCreateProject;
+
+ Assert.AreEqual (expectedProject, project);
+ }
+
+ [Test]
+ public void GetProject_PackagesSourceAndProjectNameWithDifferentCasePassed_CreatesProjectUsingFoundProjectMatchingName ()
+ {
+ CreateSolution ();
+ FakeDotNetProject expectedProject = AddProjectToOpenProjects ("Test");
+ var source = new PackageSource ("http://sharpdevelop.net");
+
+ solution.GetProject (source, "TEST");
+
+ IDotNetProject project = fakeProjectFactory.FirstProjectPassedToCreateProject;
+
+ Assert.AreEqual (expectedProject, project);
+ }
+
+ [Test]
+ public void GetProject_PackagesSourceAndProjectPassed_ReturnsProjectFromProjectFactory ()
+ {
+ CreateSolution ();
+ AddProjectToOpenProjects ("Test");
+ var source = new PackageSource ("http://sharpdevelop.net");
+ IPackageManagementProject project = solution.GetProject (source, "Test");
+
+ FakePackageManagementProject expectedProject = fakeProjectFactory.FirstFakeProjectCreated;
+
+ Assert.AreEqual (expectedProject, project);
+ }
+
+ [Test]
+ public void GetProject_PackagesSourceAndProjectPassed_PackageSourceUsedToCreateRepository ()
+ {
+ CreateSolution ();
+ AddProjectToOpenProjects ("Test");
+ var expectedSource = new PackageSource ("http://sharpdevelop.net");
+ solution.GetProject (expectedSource, "Test");
+
+ PackageSource actualSource = fakeRegisteredPackageRepositories.PackageSourcePassedToCreateRepository;
+
+ Assert.AreEqual (expectedSource, actualSource);
+ }
+
+ [Test]
+ public void GetProject_PackagesRepositoryAndProjectNamePassed_CreatesProjectUsingFoundProjectMatchingName ()
+ {
+ CreateSolution ();
+ FakeDotNetProject expectedProject = AddProjectToOpenProjects ("Test");
+ var repository = new FakePackageRepository ();
+
+ solution.GetProject (repository, "Test");
+
+ IDotNetProject project = fakeProjectFactory.FirstProjectPassedToCreateProject;
+
+ Assert.AreEqual (expectedProject, project);
+ }
+
+ [Test]
+ public void GetProject_PackagesRepositoryAndProjectPassed_CreatesProjectUsingProjectPassed ()
+ {
+ CreateSolution ();
+ FakeDotNetProject expectedProject = AddProjectToOpenProjects ("Test");
+ var repository = new FakePackageRepository ();
+
+ solution.GetProject (repository, expectedProject);
+
+ IDotNetProject project = fakeProjectFactory.FirstProjectPassedToCreateProject;
+
+ Assert.AreEqual (expectedProject, project);
+ }
+
+ [Test]
+ public void GetProject_PackagesRepositoryAndProjectPassed_ReturnsProjectCreatedFromProjectFactory ()
+ {
+ CreateSolution ();
+ FakeDotNetProject msbuildProject = AddProjectToOpenProjects ("Test");
+ var repository = new FakePackageRepository ();
+
+ IPackageManagementProject project = solution.GetProject (repository, msbuildProject);
+
+ FakePackageManagementProject expectedProject = fakeProjectFactory.FirstFakeProjectCreated;
+
+ Assert.AreEqual (expectedProject, project);
+ }
+
+ [Test]
+ public void GetProject_PackagesRepositoryAndProjectPassed_CreatesProjectUsingRepository ()
+ {
+ CreateSolution ();
+ FakeDotNetProject expectedProject = AddProjectToOpenProjects ("Test");
+ var expectedRepository = new FakePackageRepository ();
+
+ solution.GetProject (expectedRepository, expectedProject);
+
+ IPackageRepository repository = fakeProjectFactory.FirstRepositoryPassedToCreateProject;
+
+ Assert.AreEqual (expectedRepository, repository);
+ }
+
+ [Test]
+ public void GetProject_RepositoryAndProjectNameWithDifferentCasePassed_CreatesProjectUsingFoundProjectMatchingName ()
+ {
+ CreateSolution ();
+ FakeDotNetProject expectedProject = AddProjectToOpenProjects ("Test");
+ var repository = new FakePackageRepository ();
+
+ solution.GetProject (repository, "TEST");
+
+ IDotNetProject project = fakeProjectFactory.FirstProjectPassedToCreateProject;
+
+ Assert.AreEqual (expectedProject, project);
+ }
+
+ [Test]
+ public void GetProject_RepositoryAndProjectNamePassed_ReturnsProject ()
+ {
+ CreateSolution ();
+ AddProjectToOpenProjects ("Test");
+ var repository = new FakePackageRepository ();
+
+ IPackageManagementProject project = solution.GetProject (repository, "Test");
+
+ FakePackageManagementProject expectedProject = fakeProjectFactory.FirstFakeProjectCreated;
+
+ Assert.AreEqual (expectedProject, project);
+ }
+
+ [Test]
+ public void GetProject_RepositoryAndProjectNamePassed_RepositoryUsedToCreateProject ()
+ {
+ CreateSolution ();
+ AddProjectToOpenProjects ("Test");
+ var expectedRepository = new FakePackageRepository ();
+
+ solution.GetProject (expectedRepository, "Test");
+
+ IPackageRepository actualRepository = fakeProjectFactory.FirstRepositoryPassedToCreateProject;
+
+ Assert.AreEqual (expectedRepository, actualRepository);
+ }
+
+ [Test]
+ public void GetMSBuildProjects_TwoProjectsInOpenSolution_ReturnsTwoProjects ()
+ {
+ CreateSolution ();
+ AddProjectToOpenProjects ("A");
+ AddProjectToOpenProjects ("B");
+
+ IEnumerable<IDotNetProject> projects = solution.GetDotNetProjects ();
+ IEnumerable<IDotNetProject> expectedProjects = fakeProjectService.OpenProjects;
+
+ CollectionAssert.AreEqual (expectedProjects, projects);
+ }
+
+ [Test]
+ public void IsOpen_NoSolutionOpen_ReturnsFalse ()
+ {
+ CreateSolution ();
+ fakeProjectService.OpenSolution = null;
+
+ bool open = solution.IsOpen;
+
+ Assert.IsFalse (open);
+ }
+
+ [Test]
+ public void IsOpen_SolutionIsOpen_ReturnsTrue ()
+ {
+ CreateSolution ();
+ fakeProjectService.OpenSolution = new FakeSolution ();
+
+ bool open = solution.IsOpen;
+
+ Assert.IsTrue (open);
+ }
+
+ [Test]
+ public void GetActiveMSBuildProject_CurrentProjectIsSetInProjectService_ReturnsProjectCurrentlySelected ()
+ {
+ CreateSolution ();
+ fakeProjectService.CurrentProject = testProject;
+
+ IProject activeProject = solution.GetActiveDotNetProject ();
+
+ Assert.AreEqual (testProject, activeProject);
+ }
+
+ [Test]
+ public void HasMultipleProjects_OneProjectInSolution_ReturnsFalse ()
+ {
+ CreateSolution ();
+ FakeDotNetProject project = ProjectHelper.CreateTestProject ();
+ fakeProjectService.OpenProjects.Add (project);
+
+ bool hasMultipleProjects = solution.HasMultipleProjects ();
+
+ Assert.IsFalse (hasMultipleProjects);
+ }
+
+ [Test]
+ public void HasMultipleProjects_TwoProjectsInSolution_ReturnsTrue ()
+ {
+ CreateSolution ();
+ FakeDotNetProject project1 = ProjectHelper.CreateTestProject ();
+ fakeProjectService.OpenProjects.Add (project1);
+ FakeDotNetProject project2 = ProjectHelper.CreateTestProject ();
+ fakeProjectService.OpenProjects.Add (project2);
+
+ bool hasMultipleProjects = solution.HasMultipleProjects ();
+
+ Assert.IsTrue (hasMultipleProjects);
+ }
+
+ [Test]
+ public void FileName_SolutionHasFileName_ReturnsSolutionFileName ()
+ {
+ CreateSolution ();
+ string expectedFileName = @"d:\projects\myproject\Project.sln".ToNativePath ();
+ var solution = new FakeSolution (expectedFileName);
+ fakeProjectService.OpenSolution = solution;
+
+ string fileName = this.solution.FileName;
+
+ Assert.AreEqual (expectedFileName, fileName);
+ }
+
+ [Test]
+ public void IsInstalled_PackageIsInstalledInSolutionLocalRepository_ReturnsTrue ()
+ {
+ CreateSolution ();
+ FakePackage package = FakePackage.CreatePackageWithVersion ("Test", "1.3.4.5");
+ fakeSolutionPackageRepository.FakeSharedRepository.FakePackages.Add (package);
+
+ bool installed = solution.IsPackageInstalled (package);
+
+ Assert.IsTrue (installed);
+ }
+
+ [Test]
+ public void IsInstalled_PackageIsNotInstalledInSolutionLocalRepository_ReturnsFalse ()
+ {
+ CreateSolution ();
+ FakePackage package = FakePackage.CreatePackageWithVersion ("Test", "1.3.4.5");
+
+ bool installed = solution.IsPackageInstalled (package);
+
+ Assert.IsFalse (installed);
+ }
+
+ [Test]
+ public void IsInstalled_PackageIsNotInstalledInSolutionLocalRepository_ActivSolutionUsedToCreateSolutionPackageRepository ()
+ {
+ CreateSolution ();
+ FakePackage package = FakePackage.CreatePackageWithVersion ("Test", "1.3.4.5");
+
+ solution.IsPackageInstalled (package);
+
+ ISolution expectedSolution = fakeProjectService.OpenSolution;
+ ISolution solutionUsedToCreateSolutionPackageRepository =
+ fakeSolutionPackageRepositoryFactory.SolutionPassedToCreateSolutionPackageRepository;
+
+ Assert.AreEqual (expectedSolution, solutionUsedToCreateSolutionPackageRepository);
+ }
+
+ [Test]
+ public void GetActiveProject_SolutionOpenButNoProjectSelected_ReturnsNull ()
+ {
+ CreateSolution ();
+ fakeProjectService.CurrentProject = null;
+
+ IPackageManagementProject activeProject = solution.GetActiveProject ();
+
+ Assert.IsNull (activeProject);
+ }
+
+ [Test]
+ public void GetActiveProject_RepositoryPassedWhenSolutionOpenButNoProjectSelected_ReturnsNull ()
+ {
+ CreateSolution ();
+ fakeProjectService.CurrentProject = null;
+
+ var repository = new FakePackageRepository ();
+ IPackageManagementProject activeProject = solution.GetActiveProject (repository);
+
+ Assert.IsNull (activeProject);
+ }
+
+ [Test]
+ public void GetPackages_OnePackageInSolutionRepository_ReturnsOnePackage ()
+ {
+ CreateSolution ();
+ fakeProjectService.CurrentProject = null;
+ FakePackage package = FakePackage.CreatePackageWithVersion ("Test", "1.3.4.5");
+ fakeSolutionPackageRepository.FakeSharedRepository.FakePackages.Add (package);
+ AddProjectToOpenProjects ("Test");
+ var project = new FakePackageManagementProject ();
+ fakeProjectFactory.CreatePackageManagementProject = (repository, msbuildProject) => {
+ return project;
+ };
+ project.FakePackages.Add (package);
+
+ IQueryable<IPackage> packages = solution.GetPackages ();
+
+ var expectedPackages = new FakePackage[] {
+ package
+ };
+ PackageCollectionAssert.AreEqual (expectedPackages, packages);
+ }
+
+ [Test]
+ public void GetPackagesInReverseDependencyOrder_TwoPackages_ReturnsPackagesFromSolutionLocalRepositoryInCorrectOrder ()
+ {
+ CreateSolution ();
+ FakePackage packageA = AddPackageInReverseDependencyOrderToSolution ("A");
+ FakePackage packageB = AddPackageInReverseDependencyOrderToSolution ("A");
+
+ packageB.DependenciesList.Add (new PackageDependency ("A"));
+
+ var expectedPackages = new FakePackage[] {
+ packageB,
+ packageA
+ };
+
+ IEnumerable<IPackage> packages = solution.GetPackagesInReverseDependencyOrder ();
+
+ PackageCollectionAssert.AreEqual (expectedPackages, packages);
+ }
+
+ [Test]
+ public void GetProjects_SolutionHasOneProject_ReturnsOneProject ()
+ {
+ CreateSolution ();
+ AddProjectToOpenProjects ("MyProject");
+ var repository = new FakePackageRepository ();
+ List<IPackageManagementProject> projects = solution.GetProjects (repository).ToList ();
+
+ Assert.AreEqual (1, projects.Count);
+ }
+
+ [Test]
+ public void GetProjects_SolutionHasOneProject_RepositoryUsedToCreateProject ()
+ {
+ CreateSolution ();
+ AddProjectToOpenProjects ("MyProject");
+ var expectedRepository = new FakePackageRepository ();
+ solution.GetProjects (expectedRepository).ToList ();
+
+ IPackageRepository repository = fakeProjectFactory.FirstRepositoryPassedToCreateProject;
+
+ Assert.AreEqual (expectedRepository, repository);
+ }
+
+ [Test]
+ public void GetProjects_SolutionHasOneProject_MSBuildProjectUsedToCreateProject ()
+ {
+ CreateSolution ();
+ FakeDotNetProject expectedProject = AddProjectToOpenProjects ("MyProject");
+ var repository = new FakePackageRepository ();
+ solution.GetProjects (repository).ToList ();
+
+ IDotNetProject project = fakeProjectFactory.FirstProjectPassedToCreateProject;
+
+ Assert.AreEqual (expectedProject, project);
+ }
+
+ [Test]
+ public void GetProjects_SolutionHasNoProjects_ReturnsNoProjects ()
+ {
+ CreateSolution ();
+ var repository = new FakePackageRepository ();
+ List<IPackageManagementProject> projects = solution.GetProjects (repository).ToList ();
+
+ Assert.AreEqual (0, projects.Count);
+ }
+
+ [Test]
+ public void GetProjects_SolutionHasTwoProjects_ReturnsTwoProjects ()
+ {
+ CreateSolution ();
+ AddProjectToOpenProjects ("One");
+ AddProjectToOpenProjects ("Two");
+ var repository = new FakePackageRepository ();
+ List<IPackageManagementProject> projects = solution.GetProjects (repository).ToList ();
+
+ Assert.AreEqual (2, projects.Count);
+ }
+
+ [Test]
+ public void GetInstallPath_OnePackageInSolutionRepository_ReturnsPackageInstallPath ()
+ {
+ CreateSolution ();
+ FakePackage package = FakePackage.CreatePackageWithVersion ("Test", "1.3.4.5");
+ string expectedInstallPath = @"d:\projects\MyProject\packages\TestPackage".ToNativePath ();
+ fakeSolutionPackageRepository.InstallPathToReturn = expectedInstallPath;
+
+ string installPath = solution.GetInstallPath (package);
+
+ Assert.AreEqual (expectedInstallPath, installPath);
+ Assert.AreEqual (package, fakeSolutionPackageRepository.PackagePassedToGetInstallPath);
+ }
+
+ [Test]
+ public void GetPackages_OnePackageInstalledIntoOneProjectButTwoPackagesInSolutionRepository_ReturnsOnePackageInstalledInProject ()
+ {
+ CreateSolution ();
+ fakeProjectService.CurrentProject = null;
+ AddProjectToOpenProjects ("Test");
+ var project = new FakePackageManagementProject ();
+ fakeProjectFactory.CreatePackageManagementProject = (repository, msbuildProject) => {
+ return project;
+ };
+ FakePackage notInstalledPackage = FakePackage.CreatePackageWithVersion ("NotInstalled", "1.0.0.0");
+ fakeSolutionPackageRepository.FakeSharedRepository.FakePackages.Add (notInstalledPackage);
+ FakePackage installedPackage = FakePackage.CreatePackageWithVersion ("Installed", "1.0.0.0");
+ fakeSolutionPackageRepository.FakeSharedRepository.FakePackages.Add (installedPackage);
+ project.FakePackages.Add (installedPackage);
+
+ IQueryable<IPackage> packages = solution.GetPackages ();
+
+ var expectedPackages = new FakePackage[] {
+ installedPackage
+ };
+
+ Assert.AreEqual (expectedPackages, packages);
+ }
+
+ [Test]
+ public void GetPackages_OnePackageInstalledIntoOneProjectButTwoPackagesInSolutionRepository_ReturnsOnlyOneProjectPackage ()
+ {
+ CreateSolution ();
+ fakeProjectService.CurrentProject = null;
+ AddProjectToOpenProjects ("Test");
+ var project = new FakePackageManagementProject ();
+ fakeProjectFactory.CreatePackageManagementProject = (repository, msbuildProject) => {
+ return project;
+ };
+ FakePackage installedSolutionPackage = FakePackage.CreatePackageWithVersion ("SolutionPackage", "1.0.0.0");
+ fakeSolutionPackageRepository.FakeSharedRepository.FakePackages.Add (installedSolutionPackage);
+ FakePackage installedProjectPackage = FakePackage.CreatePackageWithVersion ("ProjectPackage", "1.0.0.0");
+ fakeSolutionPackageRepository.FakeSharedRepository.FakePackages.Add (installedProjectPackage);
+ project.FakePackages.Add (installedProjectPackage);
+
+ IQueryable<IPackage> packages = solution.GetPackages ();
+
+ var expectedPackages = new FakePackage[] {
+ installedProjectPackage
+ };
+
+ Assert.AreEqual (expectedPackages, packages);
+ }
+
+ [Test]
+ public void GetPackages_TwoProjectsButNoPackagesInstalledInProjects_PackageProjectsCreatedUsingActiveRepository ()
+ {
+ CreateSolution ();
+ fakeProjectService.CurrentProject = null;
+ FakeDotNetProject testProject1 = AddProjectToOpenProjects ("Test1");
+ FakeDotNetProject testProject2 = AddProjectToOpenProjects ("Test2");
+
+ solution.GetPackages ();
+
+ Assert.AreEqual (testProject1, fakeProjectFactory.ProjectsPassedToCreateProject [0]);
+ Assert.AreEqual (testProject2, fakeProjectFactory.ProjectsPassedToCreateProject [1]);
+ Assert.AreEqual (fakeRegisteredPackageRepositories.ActiveRepository, fakeProjectFactory.RepositoriesPassedToCreateProject [0]);
+ Assert.AreEqual (fakeRegisteredPackageRepositories.ActiveRepository, fakeProjectFactory.RepositoriesPassedToCreateProject [1]);
+ }
+
+ [Test]
+ public void GetPackages_OnePackageInstalledIntoPackagesFolderOnly_ReturnsNoPackages ()
+ {
+ CreateSolution ();
+ fakeProjectService.CurrentProject = null;
+ FakePackage fakePackage = FakePackage.CreatePackageWithVersion ("One", "1.0");
+ fakeSolutionPackageRepository.FakeSharedRepository.FakePackages.Add (fakePackage);
+
+ IQueryable<IPackage> packages = solution.GetPackages ();
+
+ var expectedPackages = new FakePackage [0];
+ Assert.AreEqual (expectedPackages, packages);
+ }
+ }
+}
+
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageOperationMessageTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageOperationMessageTests.cs
new file mode 100644
index 0000000000..6f5c077c16
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageOperationMessageTests.cs
@@ -0,0 +1,73 @@
+//
+// PackageOperationMessageTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class PackageOperationMessageTests
+ {
+ [Test]
+ public void Level_CreateInfoMessage_CreatesMessageWithMessageLevelSetToInfo ()
+ {
+ var message = new PackageOperationMessage (MessageLevel.Info, "test");
+
+ Assert.AreEqual (MessageLevel.Info, message.Level);
+ }
+
+ [Test]
+ public void Level_CreateWarningMessage_CreatesMessageWithMessageLevelSetToWarning ()
+ {
+ var message = new PackageOperationMessage (MessageLevel.Warning, "test");
+
+ Assert.AreEqual (MessageLevel.Warning, message.Level);
+ }
+
+ [Test]
+ public void ToString_CreateWarningMessage_ReturnsMessage ()
+ {
+ var message = new PackageOperationMessage (MessageLevel.Warning, "test");
+ var text = message.ToString ();
+
+ Assert.AreEqual ("test", text);
+ }
+
+ [Test]
+ public void ToString_CreateFormattedWarningMessage_ReturnsFormattedMessage ()
+ {
+ string format = "Test '{0}'.";
+ var message = new PackageOperationMessage (MessageLevel.Warning, format, "A");
+ var text = message.ToString ();
+
+ var expectedText = "Test 'A'.";
+ Assert.AreEqual (expectedText, text);
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageRepositoryCacheTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageRepositoryCacheTests.cs
new file mode 100644
index 0000000000..8520911df4
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageRepositoryCacheTests.cs
@@ -0,0 +1,414 @@
+//
+// PackageRepositoryCacheTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using ICSharpCode.PackageManagement;
+using NuGet;
+using NUnit.Framework;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class PackageRepositoryCacheTests
+ {
+ PackageRepositoryCache cache;
+ FakePackageRepositoryFactory fakePackageRepositoryFactory;
+ PackageSource nuGetPackageSource;
+ OneRegisteredPackageSourceHelper packageSourcesHelper;
+ RecentPackageInfo[] recentPackagesPassedToCreateRecentPackageRepository;
+ FakePackageRepository fakeAggregateRepositoryPassedToCreateRecentPackageRepository;
+
+ void CreateCache ()
+ {
+ CreatePackageSources ();
+ CreateCacheUsingPackageSources ();
+ }
+
+ void CreatePackageSources ()
+ {
+ packageSourcesHelper = new OneRegisteredPackageSourceHelper ();
+ }
+
+ void CreateCacheUsingPackageSources ()
+ {
+ nuGetPackageSource = new PackageSource ("http://nuget.org", "NuGet");
+ fakePackageRepositoryFactory = new FakePackageRepositoryFactory ();
+ cache = new PackageRepositoryCache (packageSourcesHelper.Options, fakePackageRepositoryFactory);
+ }
+
+ FakePackageRepository AddFakePackageRepositoryForPackageSource (string source)
+ {
+ return fakePackageRepositoryFactory.AddFakePackageRepositoryForPackageSource (source);
+ }
+
+ IPackageRepository CreateRecentPackageRepositoryPassingAggregateRepository ()
+ {
+ recentPackagesPassedToCreateRecentPackageRepository = new RecentPackageInfo[0];
+ fakeAggregateRepositoryPassedToCreateRecentPackageRepository = new FakePackageRepository ();
+
+ return cache.CreateRecentPackageRepository (
+ recentPackagesPassedToCreateRecentPackageRepository,
+ fakeAggregateRepositoryPassedToCreateRecentPackageRepository);
+ }
+
+ RecentPackageInfo AddOneRecentPackage ()
+ {
+ var recentPackage = new RecentPackageInfo ("Id", new SemanticVersion ("1.0"));
+ packageSourcesHelper.Options.RecentPackages.Add (recentPackage);
+ return recentPackage;
+ }
+
+ [Test]
+ public void CreateRepository_CacheCastToISharpDevelopPackageRepositoryFactory_CreatesPackageRepositoryUsingPackageRepositoryFactoryPassedInConstructor ()
+ {
+ CreateCache ();
+ var factory = cache as ISharpDevelopPackageRepositoryFactory;
+ IPackageRepository repository = factory.CreateRepository (nuGetPackageSource.Source);
+
+ Assert.AreEqual (fakePackageRepositoryFactory.FakePackageRepository, repository);
+ }
+
+ [Test]
+ public void CreateRepository_PackageSourcePassed_PackageSourceUsedToCreateRepository ()
+ {
+ CreateCache ();
+ cache.CreateRepository (nuGetPackageSource.Source);
+
+ string actualPackageSource = fakePackageRepositoryFactory.FirstPackageSourcePassedToCreateRepository;
+ Assert.AreEqual (nuGetPackageSource.Source, actualPackageSource);
+ }
+
+ [Test]
+ public void CreateRepository_RepositoryAlreadyCreatedForPackageSource_NoRepositoryCreated ()
+ {
+ CreateCache ();
+ cache.CreateRepository (nuGetPackageSource.Source);
+ fakePackageRepositoryFactory.PackageSourcesPassedToCreateRepository.Clear ();
+
+ cache.CreateRepository (nuGetPackageSource.Source);
+
+ Assert.AreEqual (0, fakePackageRepositoryFactory.PackageSourcesPassedToCreateRepository.Count);
+ }
+
+ [Test]
+ public void CreateRepository_RepositoryAlreadyCreatedForPackageSource_RepositoryOriginallyCreatedIsReturned ()
+ {
+ CreateCache ();
+ IPackageRepository originallyCreatedRepository = cache.CreateRepository (nuGetPackageSource.Source);
+ fakePackageRepositoryFactory.PackageSourcesPassedToCreateRepository.Clear ();
+
+ IPackageRepository repository = cache.CreateRepository (nuGetPackageSource.Source);
+
+ Assert.AreSame (originallyCreatedRepository, repository);
+ }
+
+ [Test]
+ public void CreateSharedRepository_MethodCalled_ReturnsSharedPackageRepository ()
+ {
+ CreateCache ();
+ ISharedPackageRepository repository = cache.CreateSharedRepository (null, null, null);
+ Assert.IsNotNull (repository);
+ }
+
+ [Test]
+ public void CreatedSharedRepository_PathResolverPassed_PathResolverUsedToCreatedSharedRepository ()
+ {
+ CreateCache ();
+ FakePackagePathResolver resolver = new FakePackagePathResolver ();
+ cache.CreateSharedRepository (resolver, null, null);
+
+ Assert.AreEqual (resolver, fakePackageRepositoryFactory.PathResolverPassedToCreateSharedRepository);
+ }
+
+ [Test]
+ public void CreatedSharedRepository_FileSystemPassed_FileSystemUsedToCreatedSharedRepository ()
+ {
+ CreateCache ();
+ FakeFileSystem fileSystem = new FakeFileSystem ();
+ cache.CreateSharedRepository (null, fileSystem, null);
+
+ Assert.AreEqual (fileSystem, fakePackageRepositoryFactory.FileSystemPassedToCreateSharedRepository);
+ }
+
+ [Test]
+ public void CreatedSharedRepository_ConfigSettingsFileSystemPassed_FileSystemUsedToCreatedSharedRepository ()
+ {
+ CreateCache ();
+ FakeFileSystem fileSystem = new FakeFileSystem ();
+ cache.CreateSharedRepository (null, null, fileSystem);
+
+ Assert.AreEqual (fileSystem, fakePackageRepositoryFactory.ConfigSettingsFileSystemPassedToCreateSharedRepository);
+ }
+
+ [Test]
+ public void CreateAggregatePackageRepository_TwoRegisteredPackageRepositories_ReturnsAggregateRepositoryFromFactory ()
+ {
+ CreatePackageSources ();
+ packageSourcesHelper.AddTwoPackageSources ("Source1", "Source2");
+ CreateCacheUsingPackageSources ();
+
+ IPackageRepository aggregateRepository = cache.CreateAggregateRepository ();
+ FakePackageRepository expectedRepository = fakePackageRepositoryFactory.FakeAggregateRepository;
+
+ Assert.AreEqual (expectedRepository, aggregateRepository);
+ }
+
+ [Test]
+ public void CreateAggregatePackageRepository_TwoRegisteredPackageSourcesButOneDisabled_ReturnsAggregateRepositoryCreatedWithOnlyEnabledPackageSource ()
+ {
+ CreatePackageSources ();
+ packageSourcesHelper.AddTwoPackageSources ("Source1", "Source2");
+ packageSourcesHelper.RegisteredPackageSources [0].IsEnabled = false;
+ CreateCacheUsingPackageSources ();
+ AddFakePackageRepositoryForPackageSource ("Source1");
+ FakePackageRepository repository2 = AddFakePackageRepositoryForPackageSource ("Source2");
+ var expectedRepositories = new FakePackageRepository[] {
+ repository2
+ };
+
+ cache.CreateAggregateRepository ();
+
+ IEnumerable<IPackageRepository> repositoriesUsedToCreateAggregateRepository =
+ fakePackageRepositoryFactory.RepositoriesPassedToCreateAggregateRepository;
+
+ var actualRepositoriesAsList = new List<IPackageRepository> (repositoriesUsedToCreateAggregateRepository);
+ IPackageRepository[] actualRepositories = actualRepositoriesAsList.ToArray ();
+
+ CollectionAssert.AreEqual (expectedRepositories, actualRepositories);
+ }
+
+ [Test]
+ public void CreateAggregatePackageRepository_TwoRegisteredPackageRepositories_AllRegisteredRepositoriesUsedToCreateAggregateRepositoryFromFactory ()
+ {
+ CreatePackageSources ();
+ packageSourcesHelper.AddTwoPackageSources ("Source1", "Source2");
+ CreateCacheUsingPackageSources ();
+
+ FakePackageRepository repository1 = AddFakePackageRepositoryForPackageSource ("Source1");
+ FakePackageRepository repository2 = AddFakePackageRepositoryForPackageSource ("Source2");
+ var expectedRepositories = new FakePackageRepository[] {
+ repository1,
+ repository2
+ };
+
+ cache.CreateAggregateRepository ();
+
+ IEnumerable<IPackageRepository> repositoriesUsedToCreateAggregateRepository =
+ fakePackageRepositoryFactory.RepositoriesPassedToCreateAggregateRepository;
+
+ var actualRepositoriesAsList = new List<IPackageRepository> (repositoriesUsedToCreateAggregateRepository);
+ IPackageRepository[] actualRepositories = actualRepositoriesAsList.ToArray ();
+
+ CollectionAssert.AreEqual (expectedRepositories, actualRepositories);
+ }
+
+ [Test]
+ public void CreateAggregatePackageRepository_OnePackageRepositoryPassed_ReturnsAggregateRepositoryFromFactory ()
+ {
+ CreateCache ();
+
+ var repositories = new FakePackageRepository[] {
+ new FakePackageRepository ()
+ };
+ IPackageRepository aggregateRepository = cache.CreateAggregateRepository (repositories);
+
+ FakePackageRepository expectedRepository = fakePackageRepositoryFactory.FakeAggregateRepository;
+
+ Assert.AreEqual (expectedRepository, aggregateRepository);
+ }
+
+ [Test]
+ public void CreateAggregatePackageRepository_OnePackageRepositoryPassed_RepositoryUsedToCreateAggregateRepository ()
+ {
+ CreateCache ();
+
+ var repositories = new FakePackageRepository[] {
+ new FakePackageRepository ()
+ };
+ cache.CreateAggregateRepository (repositories);
+
+ IEnumerable<IPackageRepository> repositoriesUsedToCreateAggregateRepository =
+ fakePackageRepositoryFactory.RepositoriesPassedToCreateAggregateRepository;
+
+ Assert.AreEqual (repositories, repositoriesUsedToCreateAggregateRepository);
+ }
+
+ [Test]
+ public void RecentPackageRepository_NoRecentPackages_ReturnsRecentRepositoryCreatedByFactory ()
+ {
+ CreateCache ();
+ IRecentPackageRepository repository = cache.RecentPackageRepository;
+ FakeRecentPackageRepository expectedRepository = fakePackageRepositoryFactory.FakeRecentPackageRepository;
+
+ Assert.AreEqual (expectedRepository, repository);
+ }
+
+ [Test]
+ public void RecentPackageRepository_NoRecentPackages_CreatedWithAggregateRepository ()
+ {
+ CreateCache ();
+ IRecentPackageRepository repository = cache.RecentPackageRepository;
+
+ IPackageRepository expectedRepository = MachineCache.Default;
+ IPackageRepository actualRepository = fakePackageRepositoryFactory.AggregateRepositoryPassedToCreateRecentPackageRepository;
+
+ Assert.AreEqual (expectedRepository, actualRepository);
+ }
+
+ [Test]
+ public void RecentPackageRepository_OneRecentPackage_RecentPackageUsedToCreateRecentPackageRepository ()
+ {
+ CreateCache ();
+ RecentPackageInfo recentPackage = AddOneRecentPackage ();
+
+ IRecentPackageRepository repository = cache.RecentPackageRepository;
+
+ IList<RecentPackageInfo> actualRecentPackages = fakePackageRepositoryFactory.RecentPackagesPassedToCreateRecentPackageRepository;
+
+ var expectedRecentPackages = new RecentPackageInfo[] {
+ recentPackage
+ };
+
+ Assert.AreEqual (expectedRecentPackages, actualRecentPackages);
+ }
+
+ [Test]
+ public void RecentPackageRepository_PropertyAccessedTwice_AggregateRepositoryCreatedOnce ()
+ {
+ CreateCache ();
+ IRecentPackageRepository repository = cache.RecentPackageRepository;
+ fakePackageRepositoryFactory.RepositoriesPassedToCreateAggregateRepository = null;
+ repository = cache.RecentPackageRepository;
+
+ Assert.IsNull (fakePackageRepositoryFactory.RepositoriesPassedToCreateAggregateRepository);
+ }
+
+ [Test]
+ public void CreateRecentPackageRepository_AggregateRepositoryPassedAndNoRecentPackagesPassed_UsesFactoryToCreateRepository ()
+ {
+ CreateCache ();
+ IPackageRepository repository = CreateRecentPackageRepositoryPassingAggregateRepository ();
+
+ FakeRecentPackageRepository expectedRepository = fakePackageRepositoryFactory.FakeRecentPackageRepository;
+
+ Assert.AreEqual (expectedRepository, repository);
+ }
+
+ [Test]
+ public void CreateRecentPackageRepository_AggregateRepositoryPassedAndNoRecentPackagesPassed_AggregateIsUsedToCreateRepository ()
+ {
+ CreateCache ();
+ CreateRecentPackageRepositoryPassingAggregateRepository ();
+
+ IPackageRepository actualRepository = fakePackageRepositoryFactory.AggregateRepositoryPassedToCreateRecentPackageRepository;
+
+ Assert.AreEqual (fakeAggregateRepositoryPassedToCreateRecentPackageRepository, actualRepository);
+ }
+
+ [Test]
+ public void CreateRecentPackageRepository_AggregateRepositoryPassedAndNoRecentPackagesPassed_RecentPackagesUsedToCreateRepository ()
+ {
+ CreateCache ();
+ CreateRecentPackageRepositoryPassingAggregateRepository ();
+
+ IList<RecentPackageInfo> recentPackages = fakePackageRepositoryFactory.RecentPackagesPassedToCreateRecentPackageRepository;
+
+ Assert.AreEqual (recentPackagesPassedToCreateRecentPackageRepository, recentPackages);
+ }
+
+ [Test]
+ public void CreateRecentPackageRepository_MethodCalledTwice_RecentPackageRepositoryCreatedOnce ()
+ {
+ CreateCache ();
+ CreateRecentPackageRepositoryPassingAggregateRepository ();
+ fakePackageRepositoryFactory.AggregateRepositoryPassedToCreateRecentPackageRepository = null;
+ CreateRecentPackageRepositoryPassingAggregateRepository ();
+
+ Assert.IsNull (fakePackageRepositoryFactory.AggregateRepositoryPassedToCreateRecentPackageRepository);
+ }
+
+ [Test]
+ public void CreateRepository_NewRepositoryCreated_RepositoryCreatedEventFired ()
+ {
+ CreateCache ();
+ PackageRepositoryFactoryEventArgs eventArgs = null;
+ cache.RepositoryCreated += (sender, e) => eventArgs = e;
+
+ cache.CreateRepository (nuGetPackageSource.Source);
+
+ Assert.AreEqual (fakePackageRepositoryFactory.FakePackageRepository, eventArgs.Repository);
+ }
+
+ [Test]
+ public void CreateRepository_RepositoryCreatedTwice_RepositoryCreatedEventIsNotFiredOnSecondCallToCreateRepository ()
+ {
+ CreateCache ();
+ cache.CreateRepository (nuGetPackageSource.Source);
+ PackageRepositoryFactoryEventArgs eventArgs = null;
+ cache.RepositoryCreated += (sender, e) => eventArgs = e;
+
+ cache.CreateRepository (nuGetPackageSource.Source);
+
+ Assert.IsNull (eventArgs);
+ }
+
+ [Test]
+ public void CreateAggregateRepository_SolutionClosedAndEnabledPackageSourcesChangedAfterCacheCreated_AggregateRepositoryContainsCorrectEnabledPackageRepositories ()
+ {
+ CreatePackageSources ();
+ packageSourcesHelper.AddTwoPackageSources ("Source1", "Source2");
+ CreateCacheUsingPackageSources ();
+ FakePackageRepository source1Repo = AddFakePackageRepositoryForPackageSource ("Source1");
+ FakePackageRepository source2Repo = AddFakePackageRepositoryForPackageSource ("Source2");
+ fakePackageRepositoryFactory.CreateAggregrateRepositoryAction = (repositories) => {
+ return new AggregateRepository (repositories);
+ };
+ var initialAggregateRepository = cache.CreateAggregateRepository () as AggregateRepository;
+ var expectedInitialRepositories = new FakePackageRepository [] {
+ source1Repo,
+ source2Repo
+ };
+ List<IPackageRepository> actualInitialRepositories = initialAggregateRepository.Repositories.ToList ();
+ packageSourcesHelper.Options.ProjectService.RaiseSolutionUnloadedEvent ();
+ packageSourcesHelper.Options.PackageSources.Clear ();
+ packageSourcesHelper.Options.PackageSources.Add (new PackageSource ("Source3"));
+ FakePackageRepository source3Repo = AddFakePackageRepositoryForPackageSource ("Source3");
+ var expectedRepositories = new FakePackageRepository [] {
+ source3Repo
+ };
+
+ var aggregateRepository = cache.CreateAggregateRepository () as AggregateRepository;
+ List<IPackageRepository> actualRepositories = aggregateRepository.Repositories.ToList ();
+
+ CollectionAssert.AreEqual (expectedInitialRepositories, actualInitialRepositories);
+ CollectionAssert.AreEqual (expectedRepositories, actualRepositories);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageSearchCriteriaTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageSearchCriteriaTests.cs
new file mode 100644
index 0000000000..123013b58e
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageSearchCriteriaTests.cs
@@ -0,0 +1,82 @@
+//
+// PackageSearchCriteriaTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class PackageSearchCriteriaTests
+ {
+ PackageSearchCriteria search;
+
+ void CreateSearch (string text)
+ {
+ search = new PackageSearchCriteria (text);
+ }
+
+ [TestCase ("NUnit", false)]
+ [TestCase ("NUnit version:*", true)]
+ [TestCase ("NUnit version:", true)]
+ [TestCase ("NUnit ver", false)]
+ [TestCase ("NUnit VERSION:*", true)]
+ [TestCase ("NUnit aversion:", false)]
+ [TestCase ("NUnit Version:*", true)]
+ [TestCase (" NUnit Version: ", true)]
+ [TestCase (" NUnit Version:* ", true)]
+ public void IsPackageVersionSearch (string searchText, bool expectedResult)
+ {
+ CreateSearch (searchText);
+
+ bool result = search.IsPackageVersionSearch;
+
+ Assert.AreEqual (expectedResult, result);
+ }
+
+ [TestCase ("NUnit version:", "1.0", true)]
+ [TestCase ("NUnit version:*", "1.0", true)]
+ [TestCase ("NUnit version:1.0", "1.0", true)]
+ [TestCase ("NUnit version:1.0", "1.1", false)]
+ [TestCase ("NUnit version:1", "1.0", true)]
+ [TestCase ("NUnit version:1", "1.1", true)]
+ [TestCase ("NUnit version:1", "1.9", true)]
+ [TestCase ("NUnit version:1", "1.9.2", true)]
+ [TestCase ("NUnit version:1", "2.0", false)]
+ [TestCase (" NUnit version:1 ", "2.0", false)]
+ [TestCase (" NUnit version:1 ", "1.9", true)]
+ public void IsVersionMatch (string searchText, string versionToMatch, bool expectedResult)
+ {
+ CreateSearch (searchText);
+
+ bool result = search.IsVersionMatch (new SemanticVersion (versionToMatch));
+
+ Assert.AreEqual (expectedResult, result);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageSourceViewModelTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageSourceViewModelTests.cs
new file mode 100644
index 0000000000..1790b4c647
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageSourceViewModelTests.cs
@@ -0,0 +1,158 @@
+//
+// PackageSourceViewModelTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class PackageSourceViewModelTests
+ {
+ PackageSourceViewModel viewModel;
+ PackageSource packageSource;
+
+ void CreatePackageSource ()
+ {
+ CreatePackageSource ("http://sharpdevelop.codeplex.com", "Test");
+ }
+
+ void CreatePackageSource (string source, string name)
+ {
+ packageSource = new PackageSource (source, name);
+ }
+
+ void CreatePackageSourceWithName (string name)
+ {
+ CreatePackageSource ("http://sharpdevelop.codeplex.com", name);
+ }
+
+ void CreatePackageSourceWithSourceUrl (string sourceUrl)
+ {
+ CreatePackageSource (sourceUrl, "Test");
+ }
+
+ void CreateViewModel (PackageSource packageSource)
+ {
+ viewModel = new PackageSourceViewModel (packageSource);
+ }
+
+ void CreateEnabledPackageSource ()
+ {
+ CreatePackageSource ();
+ packageSource.IsEnabled = true;
+ }
+
+ void CreateDisabledPackageSource ()
+ {
+ CreatePackageSource ();
+ packageSource.IsEnabled = false;
+ }
+
+ [Test]
+ public void Name_InstanceCreatedWithRegisteredPackageSource_MatchesRegisteredPackageSourceName ()
+ {
+ CreatePackageSourceWithName ("Test");
+ CreateViewModel (packageSource);
+
+ Assert.AreEqual ("Test", viewModel.Name);
+ }
+
+ [Test]
+ public void Name_Changed_NamePropertyIsChanged ()
+ {
+ CreatePackageSourceWithName ("Test");
+ CreateViewModel (packageSource);
+ viewModel.Name = "changed";
+
+ Assert.AreEqual ("changed", viewModel.Name);
+ }
+
+ [Test]
+ public void SourceUrl_InstanceCreatedWithRegisteredPackageSource_MatchesRegisteredPackageSourceSourceUrl ()
+ {
+ CreatePackageSourceWithSourceUrl ("Test-url");
+ CreateViewModel (packageSource);
+
+ Assert.AreEqual ("Test-url", viewModel.SourceUrl);
+ }
+
+ [Test]
+ public void Source_Changed_SourcePropertyIsChanged ()
+ {
+ CreatePackageSourceWithSourceUrl ("source-url");
+ CreateViewModel (packageSource);
+ viewModel.SourceUrl = "changed";
+
+ Assert.AreEqual ("changed", viewModel.SourceUrl);
+ }
+
+ [Test]
+ public void IsEnabled_PackageSourceIsEnabled_ReturnsTrue ()
+ {
+ CreateEnabledPackageSource ();
+ CreateViewModel (packageSource);
+
+ Assert.IsTrue (viewModel.IsEnabled);
+ }
+
+ [Test]
+ public void IsEnabled_PackageSourceIsNotEnabled_ReturnsFalse ()
+ {
+ CreateDisabledPackageSource ();
+ CreateViewModel (packageSource);
+
+ Assert.IsFalse (viewModel.IsEnabled);
+ }
+
+ [Test]
+ public void IsEnabled_ChangedFromTrueToFalse_UpdatesPackageSource ()
+ {
+ CreateEnabledPackageSource ();
+ CreateViewModel (packageSource);
+
+ viewModel.IsEnabled = false;
+
+ PackageSource updatedPackageSource = viewModel.GetPackageSource ();
+ Assert.IsFalse (updatedPackageSource.IsEnabled);
+ }
+
+ [Test]
+ public void IsEnabled_ChangedFromFalseToTrue_UpdatesPackageSource ()
+ {
+ CreateDisabledPackageSource ();
+ CreateViewModel (packageSource);
+
+ viewModel.IsEnabled = true;
+
+ PackageSource updatedPackageSource = viewModel.GetPackageSource ();
+ Assert.IsTrue (updatedPackageSource.IsEnabled);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageViewModelTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageViewModelTests.cs
new file mode 100644
index 0000000000..9b0fffb681
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageViewModelTests.cs
@@ -0,0 +1,807 @@
+//
+// PackageViewModelTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class PackageViewModelTests
+ {
+ TestablePackageViewModel viewModel;
+ FakePackage fakePackage;
+ FakePackageManagementSolution fakeSolution;
+ PackageManagementEvents packageManagementEvents;
+ FakeUninstallPackageAction fakeUninstallPackageAction;
+ FakeLogger fakeLogger;
+ List<PackageManagementSelectedProject> fakeSelectedProjects;
+ AvailablePackagesViewModel viewModelParent;
+
+ void CreateFakeSolution ()
+ {
+ fakeSolution = new FakePackageManagementSolution ();
+ fakeSolution.FakeActiveDotNetProject = ProjectHelper.CreateTestProject ();
+ }
+
+ void CreateViewModel ()
+ {
+ CreateFakeSolution ();
+ CreateViewModel (fakeSolution);
+ }
+
+ void CreateViewModel (FakePackageManagementSolution solution)
+ {
+ viewModelParent = CreateViewModelParent ();
+ viewModel = new TestablePackageViewModel (viewModelParent, solution);
+ fakePackage = viewModel.FakePackage;
+ this.fakeSolution = solution;
+ packageManagementEvents = viewModel.PackageManagementEvents;
+ fakeLogger = viewModel.FakeLogger;
+ fakeUninstallPackageAction = solution.FakeProjectToReturnFromGetProject.FakeUninstallPackageAction;
+ }
+
+ AvailablePackagesViewModel CreateViewModelParent ()
+ {
+ var taskFactory = new FakeTaskFactory ();
+ var registeredPackageRepositories = new FakeRegisteredPackageRepositories ();
+ var packageViewModelFactory = new FakePackageViewModelFactory ();
+ var recentPackageRepository = new FakeRecentPackageRepository ();
+
+ return new AvailablePackagesViewModel (
+ registeredPackageRepositories,
+ recentPackageRepository,
+ packageViewModelFactory,
+ taskFactory);
+ }
+
+ void AddProjectToSolution ()
+ {
+ FakeDotNetProject project = ProjectHelper.CreateTestProject ();
+ fakeSolution.FakeDotNetProjects.Add (project);
+ }
+
+ void CreateViewModelWithTwoProjectsSelected (string projectName1, string projectName2)
+ {
+ CreateFakeSolution ();
+ AddTwoProjectsSelected (projectName1, projectName2);
+ CreateViewModel (fakeSolution);
+ }
+
+ void AddTwoProjectsSelected (string projectName1, string projectName2)
+ {
+ AddProjectToSolution ();
+ AddProjectToSolution ();
+ fakeSolution.FakeDotNetProjects [0].Name = projectName1;
+ fakeSolution.FakeDotNetProjects [1].Name = projectName2;
+ fakeSolution.NoProjectsSelected ();
+
+ fakeSolution.AddFakeProjectToReturnFromGetProject (projectName1);
+ fakeSolution.AddFakeProjectToReturnFromGetProject (projectName2);
+ }
+
+ void SetPackageIdAndVersion (string id, string version)
+ {
+ fakePackage.Id = id;
+ fakePackage.Version = new SemanticVersion (version);
+ }
+
+ void UserCancelsProjectSelection ()
+ {
+ packageManagementEvents.SelectProjects += (sender, e) => {
+ e.IsAccepted = false;
+ };
+ }
+
+ void UserAcceptsProjectSelection ()
+ {
+ packageManagementEvents.SelectProjects += (sender, e) => {
+ e.IsAccepted = true;
+ };
+ }
+
+ List<PackageManagementSelectedProject> CreateTwoFakeSelectedProjects ()
+ {
+ fakeSelectedProjects = new List<PackageManagementSelectedProject> ();
+ var projectA = new FakePackageManagementProject ("Project A");
+ fakeSelectedProjects.Add (new PackageManagementSelectedProject (projectA));
+
+ var projectB = new FakePackageManagementProject ("Project B");
+ fakeSelectedProjects.Add (new PackageManagementSelectedProject (projectB));
+ return fakeSelectedProjects;
+ }
+
+ FakePackageOperation AddFakeInstallPackageOperationWithPackageThatRequiresLicenseAcceptance (PackageManagementSelectedProject selectedProject)
+ {
+ return AddFakeInstallPackageOperationWithPackage (selectedProject, requireLicenseAcceptance: true);
+ }
+
+ FakePackageOperation AddFakeInstallPackageOperationWithPackageThatDoesNotRequireLicenseAcceptance (PackageManagementSelectedProject selectedProject)
+ {
+ return AddFakeInstallPackageOperationWithPackage (selectedProject, requireLicenseAcceptance: false);
+ }
+
+ FakePackageOperation AddFakeInstallPackageOperationWithPackage (PackageManagementSelectedProject selectedProject, bool requireLicenseAcceptance)
+ {
+ var project = selectedProject.Project as FakePackageManagementProject;
+ FakePackageOperation operation = project.AddFakeInstallOperation ();
+ operation.FakePackage.RequireLicenseAcceptance = requireLicenseAcceptance;
+ return operation;
+ }
+
+ FakePackageOperation AddFakeUninstallPackageOperationWithPackageThatRequiresLicenseAcceptance (PackageManagementSelectedProject selectedProject)
+ {
+ var project = selectedProject.Project as FakePackageManagementProject;
+ FakePackageOperation uninstallOperation = project.AddFakeUninstallOperation ();
+ uninstallOperation.FakePackage.RequireLicenseAcceptance = true;
+ return uninstallOperation;
+ }
+
+ PackageManagementSelectedProject FirstFakeSelectedProject {
+ get { return fakeSelectedProjects [0]; }
+ }
+
+ PackageManagementSelectedProject SecondFakeSelectedProject {
+ get { return fakeSelectedProjects [1]; }
+ }
+
+ void ParentAllowsPrereleasePackages ()
+ {
+ viewModelParent.IncludePrerelease = true;
+ }
+
+ [Test]
+ public void AddPackageCommand_CommandExecuted_InstallsPackage ()
+ {
+ CreateViewModel ();
+ viewModel.AddOneFakeInstallPackageOperationForViewModelPackage ();
+
+ viewModel.AddPackageCommand.Execute (null);
+
+ IPackage package = fakeSolution.FakeProjectToReturnFromGetProject.LastInstallPackageCreated.Package;
+ Assert.AreEqual (fakePackage, package);
+ }
+
+ [Test]
+ public void AddPackage_PackageAddedSuccessfully_SourcePackageRepositoryUsedToCreateProject ()
+ {
+ CreateViewModel ();
+ viewModel.AddOneFakeInstallPackageOperationForViewModelPackage ();
+
+ viewModel.AddPackage ();
+
+ Assert.AreEqual (fakePackage.Repository, fakeSolution.RepositoryPassedToGetProject);
+ }
+
+ [Test]
+ public void AddPackage_PackageAddedSuccessfully_PackageOperationsUsedWhenInstallingPackage ()
+ {
+ CreateViewModel ();
+ viewModel.AddOneFakeInstallPackageOperationForViewModelPackage ();
+ viewModel.AddPackage ();
+
+ PackageOperation[] expectedOperations = new PackageOperation[] {
+ new PackageOperation (fakePackage, PackageAction.Install)
+ };
+
+ FakeInstallPackageAction action = fakeSolution.FakeProjectToReturnFromGetProject.LastInstallPackageCreated;
+ CollectionAssert.AreEqual (expectedOperations, action.Operations);
+ }
+
+ [Test]
+ public void HasLicenseUrl_PackageHasLicenseUrl_ReturnsTrue ()
+ {
+ CreateViewModel ();
+ fakePackage.LicenseUrl = new Uri ("http://sharpdevelop.com");
+
+ Assert.IsTrue (viewModel.HasLicenseUrl);
+ }
+
+ [Test]
+ public void HasLicenseUrl_PackageHasNoLicenseUrl_ReturnsFalse ()
+ {
+ CreateViewModel ();
+ fakePackage.LicenseUrl = null;
+
+ Assert.IsFalse (viewModel.HasLicenseUrl);
+ }
+
+ [Test]
+ public void HasProjectUrl_PackageHasProjectUrl_ReturnsTrue ()
+ {
+ CreateViewModel ();
+ fakePackage.ProjectUrl = new Uri ("http://sharpdevelop.com");
+
+ Assert.IsTrue (viewModel.HasProjectUrl);
+ }
+
+ [Test]
+ public void HasProjectUrl_PackageHasNoProjectUrl_ReturnsFalse ()
+ {
+ CreateViewModel ();
+ fakePackage.ProjectUrl = null;
+
+ Assert.IsFalse (viewModel.HasProjectUrl);
+ }
+
+ [Test]
+ public void HasReportAbuseUrl_PackageHasReportAbuseUrl_ReturnsTrue ()
+ {
+ CreateViewModel ();
+ fakePackage.ReportAbuseUrl = new Uri ("http://sharpdevelop.com");
+
+ Assert.IsTrue (viewModel.HasReportAbuseUrl);
+ }
+
+ [Test]
+ public void HasReportAbuseUrl_PackageHasNoReportAbuseUrl_ReturnsFalse ()
+ {
+ CreateViewModel ();
+ fakePackage.ReportAbuseUrl = null;
+
+ Assert.IsFalse (viewModel.HasReportAbuseUrl);
+ }
+
+ [Test]
+ public void IsAdded_ProjectHasPackageAdded_ReturnsTrue ()
+ {
+ CreateViewModel ();
+ fakeSolution.FakeProjectToReturnFromGetProject.FakePackages.Add (fakePackage);
+
+ Assert.IsTrue (viewModel.IsAdded);
+ }
+
+ [Test]
+ public void IsAdded_ProjectDoesNotHavePackageInstalled_ReturnsFalse ()
+ {
+ CreateViewModel ();
+ fakeSolution.FakeProjectToReturnFromGetProject.FakePackages.Clear ();
+
+ Assert.IsFalse (viewModel.IsAdded);
+ }
+
+ [Test]
+ public void RemovePackageCommand_CommandExecuted_UninstallsPackage ()
+ {
+ CreateViewModel ();
+ viewModel.RemovePackageCommand.Execute (null);
+
+ Assert.AreEqual (fakePackage, fakeUninstallPackageAction.Package);
+ }
+
+ [Test]
+ public void RemovePackage_PackageRemovedSuccessfully_RepositoryUsedToCreateProject ()
+ {
+ CreateViewModel ();
+ viewModel.RemovePackage ();
+
+ Assert.AreEqual (fakePackage.Repository, fakeSolution.RepositoryPassedToGetProject);
+ }
+
+ [Test]
+ public void PackageChanged_PackageRemovedSuccessfully_PropertyNotifyChangedFiredForIsAddedProperty ()
+ {
+ CreateViewModel ();
+ string propertyChangedName = null;
+ viewModel.PropertyChanged += (sender, e) => propertyChangedName = e.PropertyName;
+ viewModel.RemovePackage ();
+
+ Assert.AreEqual ("IsAdded", propertyChangedName);
+ }
+
+ [Test]
+ public void PackageChanged_PackageRemovedSuccessfully_PropertyNotifyChangedFiredAfterPackageUninstalled ()
+ {
+ CreateViewModel ();
+ IPackage packagePassedToUninstallPackageWhenPropertyNameChanged = null;
+ viewModel.PropertyChanged += (sender, e) => {
+ packagePassedToUninstallPackageWhenPropertyNameChanged = fakeUninstallPackageAction.Package;
+ };
+ viewModel.RemovePackage ();
+
+ Assert.AreEqual (fakePackage, packagePassedToUninstallPackageWhenPropertyNameChanged);
+ }
+
+ [Test]
+ public void HasDependencies_PackageHasNoDependencies_ReturnsFalse ()
+ {
+ CreateViewModel ();
+ fakePackage.HasDependencies = false;
+
+ Assert.IsFalse (viewModel.HasDependencies);
+ }
+
+ [Test]
+ public void HasDependencies_PackageHasDependency_ReturnsTrue ()
+ {
+ CreateViewModel ();
+ fakePackage.AddDependency ("Dependency");
+
+ Assert.IsTrue (viewModel.HasDependencies);
+ }
+
+ [Test]
+ public void HasNoDependencies_PackageHasNoDependencies_ReturnsTrue ()
+ {
+ CreateViewModel ();
+
+ Assert.IsTrue (viewModel.HasNoDependencies);
+ }
+
+ [Test]
+ public void HasNoDependencies_PackageHasOneDependency_ReturnsFalse ()
+ {
+ CreateViewModel ();
+ fakePackage.AddDependency ("Dependency");
+
+ Assert.IsFalse (viewModel.HasNoDependencies);
+ }
+
+ [Test]
+ public void HasDownloadCount_DownloadCountIsZero_ReturnsTrue ()
+ {
+ CreateViewModel ();
+ fakePackage.DownloadCount = 0;
+
+ Assert.IsTrue (viewModel.HasDownloadCount);
+ }
+
+ [Test]
+ public void HasDownloadCount_DownloadCountIsMinusOne_ReturnsFalse ()
+ {
+ CreateViewModel ();
+ fakePackage.DownloadCount = -1;
+
+ Assert.IsFalse (viewModel.HasDownloadCount);
+ }
+
+ [Test]
+ public void HasLastPublished_PackageHasPublishedDate_ReturnsTrue ()
+ {
+ CreateViewModel ();
+ fakePackage.Published = new DateTime (2011, 1, 2);
+
+ Assert.IsTrue (viewModel.HasLastPublished);
+ }
+
+ [Test]
+ public void HasLastPublished_PackageHasNoPublishedDate_ReturnsFalse ()
+ {
+ CreateViewModel ();
+ fakePackage.Published = null;
+
+ Assert.IsFalse (viewModel.HasLastPublished);
+ }
+
+ [Test]
+ public void LastPublished_PackageHasPublishedDate_ReturnsPackagePublishedDate ()
+ {
+ CreateViewModel ();
+ fakePackage.Published = new DateTime (2011, 1, 2);
+
+ Assert.AreEqual (fakePackage.Published, viewModel.LastPublished);
+ }
+
+ [Test]
+ public void LastPublished_PackageHasNoPublishedDate_ReturnsNull ()
+ {
+ CreateViewModel ();
+ fakePackage.Published = null;
+
+ Assert.IsNull (viewModel.LastPublished);
+ }
+
+ [Test]
+ public void AddPackage_CheckLoggerUsed_PackageViewModelLoggerUsedWhenResolvingPackageOperations ()
+ {
+ CreateViewModel ();
+ viewModel.AddOneFakeInstallPackageOperationForViewModelPackage ();
+ viewModel.AddPackage ();
+
+ ILogger expectedLogger = viewModel.OperationLoggerCreated;
+ ILogger actualLogger = fakeSolution.FakeProjectToReturnFromGetProject.Logger;
+ Assert.AreEqual (expectedLogger, actualLogger);
+ }
+
+ [Test]
+ public void AddPackage_PackageAddedSuccessfully_InstallingPackageMessageIsFirstMessageLogged ()
+ {
+ CreateViewModel ();
+ viewModel.AddOneFakeInstallPackageOperationForViewModelPackage ();
+ fakePackage.Id = "Test.Package";
+ fakePackage.Version = new SemanticVersion (1, 2, 0, 55);
+ viewModel.AddPackage ();
+
+ string expectedMessage = "------- Installing...Test.Package 1.2.0.55 -------";
+ string actualMessage = fakeLogger.FirstFormattedMessageLogged;
+
+ Assert.AreEqual (expectedMessage, actualMessage);
+ }
+
+ [Test]
+ public void AddPackage_PackageAddedSuccessfully_NextToLastMessageLoggedMarksEndOfInstallation ()
+ {
+ CreateViewModel ();
+ viewModel.AddOneFakeInstallPackageOperationForViewModelPackage ();
+ viewModel.AddPackage ();
+
+ string expectedMessage = "==============================";
+ string actualMessage = fakeLogger.NextToLastFormattedMessageLogged;
+
+ Assert.AreEqual (expectedMessage, actualMessage);
+ }
+
+ [Test]
+ public void AddPackage_PackageAddedSuccessfully_LastMessageLoggedIsEmptyLine ()
+ {
+ CreateViewModel ();
+ viewModel.AddOneFakeInstallPackageOperationForViewModelPackage ();
+ viewModel.AddPackage ();
+
+ string expectedMessage = String.Empty;
+ string actualMessage = fakeLogger.LastFormattedMessageLogged;
+
+ Assert.AreEqual (expectedMessage, actualMessage);
+ }
+
+ [Test]
+ public void RemovePackage_PackageRemovedSuccessfully_UninstallingPackageMessageIsFirstMessageLogged ()
+ {
+ CreateViewModel ();
+ viewModel.AddOneFakeInstallPackageOperationForViewModelPackage ();
+ fakePackage.Id = "Test.Package";
+ fakePackage.Version = new SemanticVersion (1, 2, 0, 55);
+ viewModel.RemovePackage ();
+
+ string expectedMessage = "------- Uninstalling...Test.Package 1.2.0.55 -------";
+ string actualMessage = fakeLogger.FirstFormattedMessageLogged;
+
+ Assert.AreEqual (expectedMessage, actualMessage);
+ }
+
+ [Test]
+ public void RemovePackage_PackageRemovedSuccessfully_NextToLastMessageLoggedMarksEndOfInstallation ()
+ {
+ CreateViewModel ();
+ viewModel.AddOneFakeInstallPackageOperationForViewModelPackage ();
+ viewModel.RemovePackage ();
+
+ string expectedMessage = "==============================";
+ string actualMessage = fakeLogger.NextToLastFormattedMessageLogged;
+
+ Assert.AreEqual (expectedMessage, actualMessage);
+ }
+
+ [Test]
+ public void RemovePackage_PackageRemovedSuccessfully_LastMessageLoggedIsEmptyLine ()
+ {
+ CreateViewModel ();
+ viewModel.RemovePackage ();
+
+ string expectedMessage = String.Empty;
+ string actualMessage = fakeLogger.LastFormattedMessageLogged;
+
+ Assert.AreEqual (expectedMessage, actualMessage);
+ }
+
+ [Test]
+ public void AddPackage_PackagesInstalledSuccessfully_ViewModelPackageUsedWhenResolvingPackageOperations ()
+ {
+ CreateViewModel ();
+ viewModel.AddOneFakeInstallPackageOperationForViewModelPackage ();
+ viewModel.AddPackage ();
+
+ FakePackage expectedPackage = fakePackage;
+ IPackage actualPackage = fakeSolution
+ .FakeProjectToReturnFromGetProject
+ .PackagePassedToGetInstallPackageOperations;
+
+ Assert.AreEqual (expectedPackage, actualPackage);
+ }
+
+ [Test]
+ public void AddPackage_PackagesInstalledSuccessfully_PackageDependenciesNotIgnoredWhenCheckingForPackageOperations ()
+ {
+ CreateViewModel ();
+ viewModel.AddOneFakeInstallPackageOperationForViewModelPackage ();
+ viewModel.AddPackage ();
+
+ bool result = fakeSolution
+ .FakeProjectToReturnFromGetProject
+ .IgnoreDependenciesPassedToGetInstallPackageOperations;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void AddPackage_PackagesInstalledSuccessfully_PrereleaseVersionsNotAllowedWhenCheckingForPackageOperations ()
+ {
+ CreateViewModel ();
+ viewModel.AddOneFakeInstallPackageOperationForViewModelPackage ();
+ viewModel.AddPackage ();
+
+ bool result = fakeSolution
+ .FakeProjectToReturnFromGetProject
+ .AllowPrereleaseVersionsPassedToGetInstallPackageOperations;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void AddPackage_ParentHasIncludePrereleaseSetToTrueWhenInstalling_PrereleaseVersionsAllowedWhenCheckingForPackageOperations ()
+ {
+ CreateViewModel ();
+ ParentAllowsPrereleasePackages ();
+ viewModel.AddOneFakeInstallPackageOperationForViewModelPackage ();
+ viewModel.AddPackage ();
+
+ bool result = fakeSolution
+ .FakeProjectToReturnFromGetProject
+ .AllowPrereleaseVersionsPassedToGetInstallPackageOperations;
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void IsAdded_SolutionSelectedContainingOneProjectAndPackageIsInstalledInSolutionSharedRepository_ReturnsTrue ()
+ {
+ CreateFakeSolution ();
+ AddProjectToSolution ();
+ fakeSolution.NoProjectsSelected ();
+ fakeSolution.FakeInstalledPackages.Add (fakePackage);
+ CreateViewModel (fakeSolution);
+
+ bool added = viewModel.IsAdded;
+
+ Assert.IsTrue (added);
+ }
+
+ [Test]
+ public void IsAdded_SolutionSelectedContainingOneProjectAndPackageIsNotInstalledInSolutionSharedRepository_ReturnsFalse ()
+ {
+ CreateViewModel ();
+ AddProjectToSolution ();
+ fakeSolution.NoProjectsSelected ();
+
+ bool added = viewModel.IsAdded;
+
+ Assert.IsFalse (added);
+ }
+
+ [Test]
+ public void IsManaged_SolutionSelectedContainingTwoProjects_ReturnsTrue ()
+ {
+ CreateFakeSolution ();
+ AddProjectToSolution ();
+ AddProjectToSolution ();
+ fakeSolution.NoProjectsSelected ();
+ CreateViewModel (fakeSolution);
+
+ bool managed = viewModel.IsManaged;
+
+ Assert.IsTrue (managed);
+ }
+
+ [Test]
+ public void IsManaged_SolutionSelectedContainingOneProject_ReturnsTrue ()
+ {
+ CreateFakeSolution ();
+ AddProjectToSolution ();
+ fakeSolution.NoProjectsSelected ();
+ CreateViewModel (fakeSolution);
+
+ bool managed = viewModel.IsManaged;
+
+ Assert.IsTrue (managed);
+ }
+
+ [Test]
+ public void IsManaged_SolutionWithOneProjectSelected_ReturnsFalse ()
+ {
+ CreateFakeSolution ();
+ AddProjectToSolution ();
+ fakeSolution.FakeActiveDotNetProject = fakeSolution.FakeDotNetProjects [0];
+ CreateViewModel (fakeSolution);
+
+ bool managed = viewModel.IsManaged;
+
+ Assert.IsFalse (managed);
+ }
+
+ [Test]
+ public void Summary_PackageHasSummary_PackageSummaryReturned ()
+ {
+ CreateViewModel ();
+ fakePackage.Summary = "Expected summary";
+
+ string summary = viewModel.Summary;
+
+ Assert.AreEqual ("Expected summary", summary);
+ }
+
+ [Test]
+ public void Summary_PackageHasDescriptionButNoSummary_PackageDescriptionReturned ()
+ {
+ CreateViewModel ();
+ fakePackage.Summary = String.Empty;
+ fakePackage.Description = "Expected description";
+
+ string summary = viewModel.Summary;
+
+ Assert.AreEqual ("Expected description", summary);
+ }
+
+ [Test]
+ public void Name_PackageHasIdButNoTitle_ReturnsPackageId ()
+ {
+ CreateViewModel ();
+ fakePackage.Id = "MyPackage";
+
+ string name = viewModel.Name;
+
+ Assert.AreEqual ("MyPackage", name);
+ }
+
+ [Test]
+ public void Name_PackageHasIdAndTitle_ReturnsPackageId ()
+ {
+ CreateViewModel ();
+ fakePackage.Id = "MyPackage";
+ fakePackage.Title = "My Package Title";
+
+ string name = viewModel.Name;
+
+ Assert.AreEqual ("My Package Title", name);
+ }
+
+ [Test]
+ public void GalleryUrl_PackageHasGalleryUrl_ReturnsUrl ()
+ {
+ CreateViewModel ();
+ var expectedUrl = new Uri ("http://test.com/MyPackage");
+ fakePackage.GalleryUrl = expectedUrl;
+
+ Uri url = viewModel.GalleryUrl;
+
+ Assert.AreEqual (expectedUrl, url);
+ }
+
+ [Test]
+ public void HasGalleryUrl_PackageHasGalleryUrl_ReturnsTrue ()
+ {
+ CreateViewModel ();
+ var expectedUrl = new Uri ("http://test.com/MyPackage");
+ fakePackage.GalleryUrl = expectedUrl;
+
+ bool result = viewModel.HasGalleryUrl;
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void HasNoGalleryUrl_PackageHasNoGalleryUrl_ReturnsFalse ()
+ {
+ CreateViewModel ();
+ fakePackage.GalleryUrl = null;
+
+ bool result = viewModel.HasGalleryUrl;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void HasNoGalleryUrl_PackageHasGalleryUrl_ReturnsFalse ()
+ {
+ CreateViewModel ();
+ var expectedUrl = new Uri ("http://test.com/MyPackage");
+ fakePackage.GalleryUrl = expectedUrl;
+
+ bool result = viewModel.HasNoGalleryUrl;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void IsGalleryUrlMissing_PackageHasNoGalleryUrl_ReturnsTrue ()
+ {
+ CreateViewModel ();
+ fakePackage.GalleryUrl = null;
+
+ bool result = viewModel.HasNoGalleryUrl;
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void AddPackage_PackageRepositoryIsOperationAwareAndPackageAddedSuccessfully_InstallOperationStartedForPackage ()
+ {
+ CreateViewModel ();
+ var operationAwareRepository = new FakeOperationAwarePackageRepository ();
+ fakePackage.FakePackageRepository = operationAwareRepository;
+ fakePackage.Id = "MyPackage";
+
+ viewModel.AddPackage ();
+
+ operationAwareRepository.AssertOperationWasStartedAndDisposed (RepositoryOperationNames.Install, "MyPackage");
+ }
+
+ [Test]
+ public void ManagePackage_TwoProjectsNeitherSelectedAndSourceRepositoryIsOperationAware_InstallOperationStarted ()
+ {
+ CreateViewModelWithTwoProjectsSelected ("Project A", "Project B");
+ UserAcceptsProjectSelection ();
+ var operationAwareRepository = new FakeOperationAwarePackageRepository ();
+ fakePackage.FakePackageRepository = operationAwareRepository;
+ fakePackage.Id = "MyPackage";
+
+ viewModel.ManagePackage ();
+
+ operationAwareRepository.AssertOperationWasStartedAndDisposed (RepositoryOperationNames.Install, "MyPackage");
+ }
+
+ [Test]
+ public void GetDownloadCountOrVersionDisplayText_PackageDownloadCountIsMinusOne_ReturnsEmptyString ()
+ {
+ CreateViewModel ();
+ fakePackage.DownloadCount = -1;
+
+ string result = viewModel.GetDownloadCountOrVersionDisplayText ();
+
+ Assert.AreEqual (String.Empty, result);
+ }
+
+ [Test]
+ public void GetDownloadCountOrVersionDisplayText_PackageHasTenThousandDownloads_ReturnsDownloadCountFormattedForLocale ()
+ {
+ CreateViewModel ();
+ fakePackage.DownloadCount = 10000;
+
+ string result = viewModel.GetDownloadCountOrVersionDisplayText ();
+
+ string expectedResult = 10000.ToString ("N0");
+ Assert.AreEqual (expectedResult, result);
+ }
+
+ [Test]
+ public void GetDownloadCountOrVersionDisplayText_PackageWasPartOfGroupIncludingAllVersions_ReturnsVersionNumberInsteadOfDownloadCount ()
+ {
+ CreateViewModel ();
+ viewModel.ShowVersionInsteadOfDownloadCount = true;
+ fakePackage.DownloadCount = 10000;
+ fakePackage.Version = new SemanticVersion ("1.2.3.4");
+
+ string result = viewModel.GetDownloadCountOrVersionDisplayText ();
+
+ Assert.AreEqual ("1.2.3.4", result);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/ProcessPackageActionTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/ProcessPackageActionTests.cs
new file mode 100644
index 0000000000..ef9622d12d
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/ProcessPackageActionTests.cs
@@ -0,0 +1,110 @@
+//
+// ProcessPackageActionTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class ProcessPackageActionTests
+ {
+ TestableProcessPackageAction action;
+ FakePackageManagementProject fakeProject;
+ ExceptionThrowingProcessPackageAction exceptionThrowingAction;
+
+ void CreateAction ()
+ {
+ action = new TestableProcessPackageAction ();
+ fakeProject = action.FakeProject;
+ }
+
+ ILogger AddLoggerToAction ()
+ {
+ var logger = new NullLogger ();
+ action.Logger = logger;
+ return logger;
+ }
+
+ void CreateActionWithExceptionThrownInExecuteCore ()
+ {
+ exceptionThrowingAction = new ExceptionThrowingProcessPackageAction ();
+ }
+
+ [Test]
+ public void Execute_LoggerIsNull_LoggerUsedByProjectIsPackageManagementLogger ()
+ {
+ CreateAction ();
+ action.Execute ();
+
+ ILogger actualLogger = fakeProject.Logger;
+
+ Assert.IsInstanceOf<PackageManagementLogger> (actualLogger);
+ }
+
+ [Test]
+ public void Execute_LoggerIsDefined_LoggerDefinedIsUsedByProjectManager ()
+ {
+ CreateAction ();
+ ILogger expectedLogger = AddLoggerToAction ();
+ action.Execute ();
+
+ ILogger actualLogger = fakeProject.Logger;
+
+ Assert.AreEqual (expectedLogger, actualLogger);
+ }
+
+ [Test]
+ public void BeforeExecute_LoggerIsDefined_LoggerUsedByProjectIsConfiguredBeforeInstallPackageCalled ()
+ {
+ CreateAction ();
+ ILogger expectedLogger = AddLoggerToAction ();
+ action.CallBeforeExecute ();
+
+ ILogger actualLogger = fakeProject.Logger;
+
+ Assert.AreEqual (expectedLogger, actualLogger);
+ }
+
+ [Test]
+ public void Execute_ExceptionThrownInExecuteCore_ExceptionThrownByExecuteMethod ()
+ {
+ CreateActionWithExceptionThrownInExecuteCore ();
+ var expectedException = new Exception ("Error");
+ exceptionThrowingAction.ExceptionToThrowInExecuteCore = expectedException;
+
+ Exception exception = Assert.Throws<Exception> (() => exceptionThrowingAction.Execute ());
+
+ Assert.AreEqual (expectedException, exception);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/ProjectHelper.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/ProjectHelper.cs
new file mode 100644
index 0000000000..0ea0adcad9
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/ProjectHelper.cs
@@ -0,0 +1,129 @@
+//
+// ProjectHelper.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.Core;
+using MonoDevelop.PackageManagement;
+using MonoDevelop.Projects;
+using System.Linq;
+
+namespace MonoDevelop.PackageManagement.Tests.Helpers
+{
+ public static class ProjectHelper
+ {
+ public static ISolution CreateSolution ()
+ {
+ return new FakeSolution ();
+ }
+
+ public static FakeDotNetProject CreateTestProject ()
+ {
+ return CreateTestProject ("TestProject");
+ }
+
+ public static FakeDotNetProject CreateTestProject (string name)
+ {
+ ISolution solution = CreateSolution ();
+
+ return CreateTestProject (solution, name);
+ }
+
+ public static FakeDotNetProject CreateTestProject (
+ ISolution parentSolution,
+ string name,
+ string fileName = null)
+ {
+ return new FakeDotNetProject {
+ ParentSolution = parentSolution,
+ FileName = new FilePath (fileName),
+ Name = name
+ };
+ }
+
+ public static FakeDotNetProject CreateTestWebApplicationProject ()
+ {
+ FakeDotNetProject project = CreateTestProject ();
+ AddWebApplicationProjectType (project);
+ return project;
+ }
+
+ public static FakeDotNetProject CreateTestWebSiteProject ()
+ {
+ FakeDotNetProject project = CreateTestProject ();
+ AddWebSiteProjectType (project);
+ return project;
+ }
+
+ public static void AddWebApplicationProjectType (FakeDotNetProject project)
+ {
+ AddProjectType (project, DotNetProjectExtensions.WebApplication);
+ }
+
+ public static void AddWebSiteProjectType (FakeDotNetProject project)
+ {
+ AddProjectType (project, DotNetProjectExtensions.WebSite);
+ }
+
+ public static void AddProjectType (FakeDotNetProject project, Guid guid)
+ {
+ project.AddProjectType (guid);
+ }
+
+ public static void AddReference (FakeDotNetProject project, string referenceName, string hintPath = null)
+ {
+ var reference = new ProjectReference (ReferenceType.Assembly, referenceName, hintPath);
+ project.References.Add (reference);
+ }
+
+ public static void AddGacReference (FakeDotNetProject project, string referenceName)
+ {
+ var reference = new ProjectReference (ReferenceType.Package, referenceName);
+ project.References.Add (reference);
+ }
+
+ public static void AddFile (FakeDotNetProject project, string fileName)
+ {
+ project.Files.Add (new ProjectFile (fileName.ToNativePath ()));
+ }
+
+ public static ProjectReference GetReference (FakeDotNetProject project, string referenceName)
+ {
+ foreach (ProjectReference referenceProjectItem in project.References) {
+ if (referenceProjectItem.Reference == referenceName) {
+ return referenceProjectItem;
+ }
+ }
+ return null;
+ }
+
+ public static ProjectFile GetFile (FakeDotNetProject project, string fileName)
+ {
+ return project.FilesAdded.FirstOrDefault (file => file.FilePath == new FilePath (fileName));
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/RecentPackageInfoTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/RecentPackageInfoTests.cs
new file mode 100644
index 0000000000..0ed79dbc6c
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/RecentPackageInfoTests.cs
@@ -0,0 +1,91 @@
+//
+// RecentPackageInfoTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class RecentPackageInfoTests
+ {
+ [Test]
+ public void ToString_IdAndVersionSpecified_ContainsIdAndVersion ()
+ {
+ var recentPackageInfo = new RecentPackageInfo ("id", new SemanticVersion ("1.0"));
+
+ string actual = recentPackageInfo.ToString ();
+
+ string expected = "[RecentPackageInfo Id=id, Version=1.0]";
+ Assert.AreEqual (expected, actual);
+ }
+
+ [Test]
+ public void IsMatch_PackageWithSameIdAndVersionPassed_ReturnsTrue ()
+ {
+ string id = "id";
+ var version = new SemanticVersion (1, 0, 0, 0);
+ var recentPackageInfo = new RecentPackageInfo (id, version);
+ var package = new FakePackage (id);
+ package.Version = version;
+
+ bool result = recentPackageInfo.IsMatch (package);
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void IsMatch_PackageWithSameIdButDifferentVersionPassed_ReturnsFalse ()
+ {
+ string id = "id";
+ var version = new SemanticVersion (1, 0, 0, 0);
+ var recentPackageInfo = new RecentPackageInfo (id, version);
+ var package = new FakePackage (id);
+ package.Version = new SemanticVersion (2, 0, 0, 0);
+
+ bool result = recentPackageInfo.IsMatch (package);
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void IsMatch_PackageWithDifferentIdButSameVersionPassed_ReturnsFalse ()
+ {
+ var version = new SemanticVersion (1, 0, 0, 0);
+ var recentPackageInfo = new RecentPackageInfo ("id", version);
+ var package = new FakePackage ("different-id");
+ package.Version = version;
+
+ bool result = recentPackageInfo.IsMatch (package);
+
+ Assert.IsFalse (result);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/RecentPackageRepositoryTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/RecentPackageRepositoryTests.cs
new file mode 100644
index 0000000000..52f8577756
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/RecentPackageRepositoryTests.cs
@@ -0,0 +1,216 @@
+//
+// RecentPackageRepositoryTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class RecentPackageRepositoryTests
+ {
+ RecentPackageRepository repository;
+ FakePackageRepository aggregateRepository;
+ List<RecentPackageInfo> recentPackages;
+
+ void CreateRepository ()
+ {
+ CreateRecentPackages ();
+ CreateRepository (recentPackages);
+ }
+
+ void CreateRecentPackages ()
+ {
+ recentPackages = new List<RecentPackageInfo> ();
+ aggregateRepository = new FakePackageRepository ();
+ }
+
+ void CreateRepository (IList<RecentPackageInfo> recentPackages)
+ {
+ repository = new RecentPackageRepository (recentPackages, aggregateRepository);
+ }
+
+ FakePackage AddOnePackageToRepository (string id)
+ {
+ var package = new FakePackage (id);
+ repository.AddPackage (package);
+ return package;
+ }
+
+ IEnumerable<IPackage> AddTwoDifferentPackagesToRepository ()
+ {
+ yield return AddOnePackageToRepository ("Test.Package.1");
+ yield return AddOnePackageToRepository ("Test.Package.2");
+ }
+
+ IEnumerable<IPackage> AddFourDifferentPackagesToRepository ()
+ {
+ yield return AddOnePackageToRepository ("Test.Package.1");
+ yield return AddOnePackageToRepository ("Test.Package.2");
+ yield return AddOnePackageToRepository ("Test.Package.3");
+ yield return AddOnePackageToRepository ("Test.Package.4");
+ }
+
+ FakePackage CreateRepositoryWithOneRecentPackageSavedInOptions ()
+ {
+ CreateRecentPackages ();
+ var package = new FakePackage ("Test");
+ aggregateRepository.FakePackages.Add (package);
+ recentPackages.Add (new RecentPackageInfo (package));
+ CreateRepository (recentPackages);
+ return package;
+ }
+
+ [Test]
+ public void Source_NewRecentRepositoryCreated_IsRecentPackages ()
+ {
+ CreateRepository ();
+ Assert.AreEqual ("RecentPackages", repository.Source);
+ }
+
+ [Test]
+ public void GetPackages_RepositoryIsEmptyAndOnePackageAdded_ReturnsPackageAdded ()
+ {
+ CreateRepository ();
+ var package = AddOnePackageToRepository ("Test.Package");
+
+ var packages = repository.GetPackages ();
+
+ var expectedPackages = new FakePackage[] {
+ package
+ };
+
+ PackageCollectionAssert.AreEqual (expectedPackages, packages);
+ }
+
+ [Test]
+ public void GetPackages_RepositoryIsEmptyAndTwoDifferentPackagesAdded_ReturnsPackagesInReverseOrderWithLastAddedFirst ()
+ {
+ CreateRepository ();
+ var packagesAdded = AddTwoDifferentPackagesToRepository ();
+
+ var packages = repository.GetPackages ();
+
+ var expectedPackages = packagesAdded.Reverse ();
+
+ PackageCollectionAssert.AreEqual (expectedPackages, packages);
+ }
+
+ [Test]
+ public void GetPackages_RepositoryCanHoldThreePackagesAndFourPackagesAdded_ReturnsLastThreePackagesAddedInReverseOrder ()
+ {
+ CreateRepository ();
+ repository.MaximumPackagesCount = 3;
+ var packagesAdded = AddFourDifferentPackagesToRepository ();
+
+ var packages = repository.GetPackages ();
+
+ var expectedPackages = packagesAdded.Reverse ().Take (3);
+
+ PackageCollectionAssert.AreEqual (expectedPackages, packages);
+ }
+
+ [Test]
+ public void GetPackages_RepositoryIsEmptyAndSamePackageIsAddedTwice_OnePackageReturned ()
+ {
+ CreateRepository ();
+ AddOnePackageToRepository ("Test");
+ var package = AddOnePackageToRepository ("Test");
+
+ var packages = repository.GetPackages ();
+
+ var expectedPackages = new FakePackage[] {
+ package
+ };
+
+ PackageCollectionAssert.AreEqual (expectedPackages, packages);
+ }
+
+ [Test]
+ public void AddPackage_RepositoryIsEmptyAndTwoPackagesAddedFromDifferentSources_BothRecentPackagesAdded ()
+ {
+ CreateRepository ();
+ var package1 = AddOnePackageToRepository ("Test1");
+ var package2 = AddOnePackageToRepository ("Test2");
+
+ var expectedPackages = new IPackage[] {
+ package2,
+ package1
+ };
+
+ PackageCollectionAssert.AreEqual (expectedPackages, repository.GetPackages ());
+ }
+
+ public void Clear_OneRecentPackage_PackagesRemoved ()
+ {
+ CreateRepository ();
+ AddOnePackageToRepository ("Test1");
+
+ repository.Clear ();
+
+ int count = repository.GetPackages ().Count ();
+
+ Assert.AreEqual (0, count);
+ }
+
+ [Test]
+ public void Clear_OneRecentPackageInOptions_RecentPackagesAreRemovedFromOptions ()
+ {
+ CreateRepositoryWithOneRecentPackageSavedInOptions ();
+
+ repository.Clear ();
+
+ int count = recentPackages.Count;
+
+ Assert.AreEqual (0, count);
+ }
+
+ [Test]
+ public void HasRecentPackages_NoSavedRecentPackages_ReturnsFalse ()
+ {
+ CreateRepository ();
+
+ bool hasRecentPackages = repository.HasRecentPackages;
+
+ Assert.IsFalse (hasRecentPackages);
+ }
+
+ [Test]
+ public void HasRecentPackages_OneSavedRecentPackages_ReturnsTrue ()
+ {
+ CreateRepositoryWithOneRecentPackageSavedInOptions ();
+
+ bool hasRecentPackages = repository.HasRecentPackages;
+
+ Assert.IsTrue (hasRecentPackages);
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/ReducedPackageOperationsTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/ReducedPackageOperationsTests.cs
new file mode 100644
index 0000000000..644f16fa5a
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/ReducedPackageOperationsTests.cs
@@ -0,0 +1,188 @@
+//
+// ReducedPackageOperationsTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using ICSharpCode.PackageManagement;
+using NuGet;
+using NUnit.Framework;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class ReducedPackageOperationsTests
+ {
+ ReducedPackageOperations reducedPackageOperations;
+ FakePackageOperationResolver fakePackageOperationResolver;
+ List<IPackage> packages;
+
+ void CreateReducedPackageOperations ()
+ {
+ packages = new List<IPackage> ();
+ fakePackageOperationResolver = new FakePackageOperationResolver ();
+ reducedPackageOperations = new ReducedPackageOperations (fakePackageOperationResolver, packages);
+ }
+
+ IPackage AddPackage (string id, string version)
+ {
+ IPackage package = CreatePackage (id, version);
+ packages.Add (package);
+
+ return package;
+ }
+
+ IPackage CreatePackage (string id, string version)
+ {
+ return new TestPackageHelper (id, version).Package;
+ }
+
+ PackageOperation AddInstallOperationForPackage (IPackage package)
+ {
+ var operation = new PackageOperation (package, PackageAction.Install);
+ AddInstallOperationsForPackage (package, operation);
+ return operation;
+ }
+
+ void AddInstallOperationsForPackage (IPackage package, params PackageOperation[] operations)
+ {
+ fakePackageOperationResolver.AddOperations (package, operations);
+ }
+
+ PackageOperation CreatePackageOperation (string id, string version, PackageAction action)
+ {
+ IPackage package = CreatePackage (id, version);
+ return new PackageOperation (package, action);
+ }
+
+ void AssertReducedOperationsContains (PackageOperation operation)
+ {
+ Assert.IsTrue (reducedPackageOperations.Operations.ToList ().Contains (operation));
+ }
+
+ [Test]
+ public void Reduce_OnePackage_ReturnsPackageOperationsFromResolverForPackage ()
+ {
+ CreateReducedPackageOperations ();
+ IPackage package = AddPackage ("Test", "1.0");
+ PackageOperation operation = AddInstallOperationForPackage (package);
+
+ reducedPackageOperations.Reduce ();
+
+ Assert.AreEqual (1, reducedPackageOperations.Operations.Count ());
+ Assert.AreEqual (operation, reducedPackageOperations.Operations.First ());
+ }
+
+ [Test]
+ public void Reduce_TwoPackages_ReturnsPackageOperationsForBothPackages ()
+ {
+ CreateReducedPackageOperations ();
+ IPackage package1 = AddPackage ("Test", "1.0");
+ IPackage package2 = AddPackage ("Test2", "1.0");
+ PackageOperation operation1 = AddInstallOperationForPackage (package1);
+ PackageOperation operation2 = AddInstallOperationForPackage (package2);
+
+ reducedPackageOperations.Reduce ();
+
+ Assert.AreEqual (2, reducedPackageOperations.Operations.Count ());
+ AssertReducedOperationsContains (operation1);
+ AssertReducedOperationsContains (operation2);
+ }
+
+ [Test]
+ public void Reduce_OncePackageOperationInstallsPackageWhilstOneUninstallsSamePackage_PackageOperationNotIncludedInReducedSet ()
+ {
+ CreateReducedPackageOperations ();
+ IPackage package = AddPackage ("Test", "1.0");
+ PackageOperation installOperation = CreatePackageOperation ("Foo", "1.0", PackageAction.Install);
+ PackageOperation uninstallOperation = CreatePackageOperation ("Foo", "1.0", PackageAction.Uninstall);
+ AddInstallOperationsForPackage (package, installOperation, uninstallOperation);
+
+ reducedPackageOperations.Reduce ();
+
+ Assert.AreEqual (0, reducedPackageOperations.Operations.Count ());
+ }
+
+ [Test]
+ public void Reduce_OnePackageOperationMatchesPackageBeingInstalled_ReturnsOnlyOnePackageInstallOperationForThisPackage ()
+ {
+ CreateReducedPackageOperations ();
+ IPackage package1 = AddPackage ("Test", "1.0");
+ IPackage package2 = AddPackage ("Test2", "1.0");
+ PackageOperation operation1a = CreatePackageOperation ("Test", "1.0", PackageAction.Install);
+ PackageOperation operation1b = CreatePackageOperation ("Test2", "1.0", PackageAction.Install);
+ PackageOperation operation2 = CreatePackageOperation ("Test2", "1.0", PackageAction.Install);
+ AddInstallOperationsForPackage (package1, operation1a, operation1b);
+ AddInstallOperationsForPackage (package2, operation2);
+
+ reducedPackageOperations.Reduce ();
+
+ reducedPackageOperations
+ .Operations
+ .SingleOrDefault (o => o.Package.Id == "Test2");
+ Assert.AreEqual (2, reducedPackageOperations.Operations.Count ());
+ }
+
+ [Test]
+ public void Reduce_OnePackageOperationMatchesPackageBeingInstalledOnlyById_MatchingPackageOperationByIdIncludedInSet ()
+ {
+ CreateReducedPackageOperations ();
+ IPackage package1 = AddPackage ("Test", "1.0");
+ IPackage package2 = AddPackage ("Test2", "1.0");
+ PackageOperation operation1a = CreatePackageOperation ("Test", "1.0", PackageAction.Install);
+ PackageOperation operation1b = CreatePackageOperation ("Test2", "1.1", PackageAction.Install);
+ PackageOperation operation2 = CreatePackageOperation ("Test2", "1.0", PackageAction.Install);
+ AddInstallOperationsForPackage (package1, operation1a, operation1b);
+ AddInstallOperationsForPackage (package2, operation2);
+
+ reducedPackageOperations.Reduce ();
+
+ Assert.AreEqual (3, reducedPackageOperations.Operations.Count ());
+ }
+
+ [Test]
+ public void Reduce_OnePackageOperationMatchesPackageBeingInstalledByIdAndVersionButOneIsInstallAndOneIsUninstall_BothOperationsNotIncludedInSet ()
+ {
+ CreateReducedPackageOperations ();
+ IPackage package1 = AddPackage ("Test", "1.0");
+ IPackage package2 = AddPackage ("Test2", "1.0");
+ PackageOperation operation1a = CreatePackageOperation ("Test", "1.0", PackageAction.Install);
+ PackageOperation operation1b = CreatePackageOperation ("Test2", "1.0", PackageAction.Uninstall);
+ PackageOperation operation2 = CreatePackageOperation ("Test2", "1.0", PackageAction.Install);
+ AddInstallOperationsForPackage (package1, operation1a, operation1b);
+ AddInstallOperationsForPackage (package2, operation2);
+
+ reducedPackageOperations.Reduce ();
+
+ reducedPackageOperations
+ .Operations
+ .SingleOrDefault (o => o.Package.Id == "Test");
+ Assert.AreEqual (1, reducedPackageOperations.Operations.Count ());
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/RegisteredPackageRepositoriesTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/RegisteredPackageRepositoriesTests.cs
new file mode 100644
index 0000000000..1986c835e6
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/RegisteredPackageRepositoriesTests.cs
@@ -0,0 +1,314 @@
+//
+// RegisteredPackageRepositoriesTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class RegisteredPackageRepositoriesTests
+ {
+ RegisteredPackageRepositories registeredRepositories;
+ OneRegisteredPackageSourceHelper packageSourcesHelper;
+ FakePackageRepositoryFactory fakeRepositoryCache;
+
+ void CreateRegisteredPackageRepositories ()
+ {
+ CreatePackageSourcesHelper ();
+ CreateRegisteredPackageRepositoriesWithExistingPackageSourcesHelper ();
+ }
+
+ void CreatePackageSourcesHelper ()
+ {
+ packageSourcesHelper = new OneRegisteredPackageSourceHelper ();
+ }
+
+ void CreateRegisteredPackageRepositoriesWithExistingPackageSourcesHelper ()
+ {
+ fakeRepositoryCache = new FakePackageRepositoryFactory ();
+ registeredRepositories = new RegisteredPackageRepositories (fakeRepositoryCache, packageSourcesHelper.Options);
+ }
+
+ [Test]
+ public void RecentPackageRepository_PropertyAccessed_ReturnsRecentPackageRepositoryFromCache ()
+ {
+ CreateRegisteredPackageRepositories ();
+ IRecentPackageRepository recentRepository = registeredRepositories.RecentPackageRepository;
+ FakeRecentPackageRepository expectedRepository = fakeRepositoryCache.FakeRecentPackageRepository;
+
+ Assert.AreEqual (expectedRepository, recentRepository);
+ }
+
+ [Test]
+ public void CreateRepository_PackageSourceSpecified_CreatesRepositoryFromCache ()
+ {
+ CreateRegisteredPackageRepositories ();
+ IPackageRepository repository = registeredRepositories.CreateRepository (new PackageSource ("a"));
+ FakePackageRepository expectedRepository = fakeRepositoryCache.FakePackageRepository;
+
+ Assert.AreEqual (expectedRepository, repository);
+ }
+
+ [Test]
+ public void CreateRepository_PackageSourceSpecified_PackageSourcePassedToCache ()
+ {
+ CreateRegisteredPackageRepositories ();
+ var source = new PackageSource ("Test");
+ registeredRepositories.CreateRepository (source);
+ string actualSource = fakeRepositoryCache.FirstPackageSourcePassedToCreateRepository;
+
+ Assert.AreEqual ("Test", actualSource);
+ }
+
+ [Test]
+ public void CreateAggregateRepository_MethodCalled_ReturnsAggregateRepositoryCreatedFromCache ()
+ {
+ CreateRegisteredPackageRepositories ();
+ IPackageRepository repository = registeredRepositories.CreateAggregateRepository ();
+ FakePackageRepository expectedRepository = fakeRepositoryCache.FakeAggregateRepository;
+
+ Assert.AreEqual (expectedRepository, repository);
+ }
+
+ [Test]
+ public void HasMultiplePackageSources_OnePackageSource_ReturnsFalse ()
+ {
+ CreateRegisteredPackageRepositories ();
+ packageSourcesHelper.AddOnePackageSource ();
+
+ bool result = registeredRepositories.HasMultiplePackageSources;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void HasMultiplePackageSources_TwoPackageSources_ReturnsTrue ()
+ {
+ CreateRegisteredPackageRepositories ();
+ packageSourcesHelper.AddTwoPackageSources ();
+
+ bool result = registeredRepositories.HasMultiplePackageSources;
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void HasMultiplePackageSources_TwoPackageSourcesButOneIsDisabled_ReturnsFalse ()
+ {
+ CreateRegisteredPackageRepositories ();
+ packageSourcesHelper.AddTwoPackageSources ();
+ packageSourcesHelper.RegisteredPackageSources [0].IsEnabled = false;
+
+ bool result = registeredRepositories.HasMultiplePackageSources;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void ActivePackageSource_TwoPackageSources_ByDefaultReturnsFirstPackageSource ()
+ {
+ CreateRegisteredPackageRepositories ();
+ packageSourcesHelper.AddTwoPackageSources ();
+
+ PackageSource expectedPackageSource = packageSourcesHelper.RegisteredPackageSources [0];
+ PackageSource packageSource = registeredRepositories.ActivePackageSource;
+
+ Assert.AreEqual (expectedPackageSource, packageSource);
+ }
+
+ [Test]
+ public void ActivePackageSource_ChangedToSecondRegisteredPackageSources_ReturnsSecondPackageSource ()
+ {
+ CreateRegisteredPackageRepositories ();
+ packageSourcesHelper.AddTwoPackageSources ();
+
+ PackageSource expectedPackageSource = packageSourcesHelper.RegisteredPackageSources [1];
+ registeredRepositories.ActivePackageSource = expectedPackageSource;
+ PackageSource packageSource = registeredRepositories.ActivePackageSource;
+
+ Assert.AreEqual (expectedPackageSource, packageSource);
+ }
+
+ [Test]
+ public void ActivePackageSource_ChangedToNonNullPackageSource_SavedInOptions ()
+ {
+ CreateRegisteredPackageRepositories ();
+ packageSourcesHelper.Options.ActivePackageSource = null;
+ var packageSource = new PackageSource ("http://source-url", "Test");
+ packageSourcesHelper.Options.PackageSources.Add (packageSource);
+
+ registeredRepositories.ActivePackageSource = packageSource;
+
+ PackageSource actualPackageSource = packageSourcesHelper.Options.ActivePackageSource;
+
+ Assert.AreEqual (packageSource, actualPackageSource);
+ }
+
+ [Test]
+ public void ActivePackageSource_ActivePackageSourceNonNullInOptionsBeforeInstanceCreated_ActivePackageSourceReadFromOptions ()
+ {
+ CreatePackageSourcesHelper ();
+ var packageSource = new PackageSource ("http://source-url", "Test");
+ packageSourcesHelper.Options.PackageSources.Add (packageSource);
+ packageSourcesHelper.Options.ActivePackageSource = packageSource;
+ CreateRegisteredPackageRepositoriesWithExistingPackageSourcesHelper ();
+
+ PackageSource actualPackageSource = registeredRepositories.ActivePackageSource;
+
+ Assert.AreEqual (packageSource, actualPackageSource);
+ }
+
+ [Test]
+ public void ActiveRepository_OneRegisteredSource_RepositoryCreatedFromRegisteredSource ()
+ {
+ CreateRegisteredPackageRepositories ();
+ IPackageRepository activeRepository = registeredRepositories.ActiveRepository;
+
+ string actualPackageSource = fakeRepositoryCache.FirstPackageSourcePassedToCreateRepository;
+ PackageSource expectedPackageSource = packageSourcesHelper.PackageSource;
+
+ Assert.AreEqual (expectedPackageSource.Source, actualPackageSource);
+ }
+
+ [Test]
+ public void ActiveRepository_CalledTwice_RepositoryCreatedOnce ()
+ {
+ CreateRegisteredPackageRepositories ();
+ IPackageRepository activeRepository = registeredRepositories.ActiveRepository;
+ activeRepository = registeredRepositories.ActiveRepository;
+
+ int count = fakeRepositoryCache.PackageSourcesPassedToCreateRepository.Count;
+
+ Assert.AreEqual (1, count);
+ }
+
+ [Test]
+ public void ActiveRepository_OneRegisteredSource_ReturnsPackageCreatedFromCache ()
+ {
+ CreateRegisteredPackageRepositories ();
+ IPackageRepository activeRepository = registeredRepositories.ActiveRepository;
+
+ IPackageRepository expectedRepository = fakeRepositoryCache.FakePackageRepository;
+
+ Assert.AreEqual (expectedRepository, activeRepository);
+ }
+
+ [Test]
+ public void ActivePackageRepository_ActivePackageSourceChangedToSecondRegisteredPackageSource_CreatesRepositoryUsingSecondPackageSource ()
+ {
+ CreateRegisteredPackageRepositories ();
+ packageSourcesHelper.AddTwoPackageSources ();
+
+ PackageSource expectedPackageSource = packageSourcesHelper.Options.PackageSources [1];
+ registeredRepositories.ActivePackageSource = expectedPackageSource;
+
+ IPackageRepository repository = registeredRepositories.ActiveRepository;
+ string packageSource = fakeRepositoryCache.FirstPackageSourcePassedToCreateRepository;
+
+ Assert.AreEqual (expectedPackageSource.Source, packageSource);
+ }
+
+ [Test]
+ public void ActiveRepository_ActivePackageSourceChangedAfterActivePackageRepositoryCreated_CreatesNewRepositoryUsingActivePackageSource ()
+ {
+ CreateRegisteredPackageRepositories ();
+ packageSourcesHelper.AddTwoPackageSources ();
+
+ IPackageRepository initialRepository = registeredRepositories.ActiveRepository;
+ fakeRepositoryCache.PackageSourcesPassedToCreateRepository.Clear ();
+
+ PackageSource expectedPackageSource = packageSourcesHelper.Options.PackageSources [1];
+ registeredRepositories.ActivePackageSource = expectedPackageSource;
+
+ IPackageRepository repository = registeredRepositories.ActiveRepository;
+ string packageSource = fakeRepositoryCache.FirstPackageSourcePassedToCreateRepository;
+
+ Assert.AreEqual (expectedPackageSource.Source, packageSource);
+ }
+
+ [Test]
+ public void ActiveRepository_ActivePackageSourceSetToSameValueAfterActivePackageRepositoryCreated_NewRepositoryNotCreated ()
+ {
+ CreateRegisteredPackageRepositories ();
+ packageSourcesHelper.AddOnePackageSource ();
+
+ IPackageRepository initialRepository = registeredRepositories.ActiveRepository;
+ fakeRepositoryCache.PackageSourcesPassedToCreateRepository.Clear ();
+
+ PackageSource expectedPackageSource = packageSourcesHelper.Options.PackageSources [0];
+ registeredRepositories.ActivePackageSource = expectedPackageSource;
+
+ IPackageRepository repository = registeredRepositories.ActiveRepository;
+
+ int count = fakeRepositoryCache.PackageSourcesPassedToCreateRepository.Count;
+
+ Assert.AreEqual (0, count);
+ }
+
+ [Test]
+ public void PackageSources_OnePackageSourceInOptions_ReturnsOnePackageSource ()
+ {
+ CreateRegisteredPackageRepositories ();
+ packageSourcesHelper.AddOnePackageSource ();
+
+ RegisteredPackageSources packageSources = registeredRepositories.PackageSources;
+ RegisteredPackageSources expectedPackageSources = packageSourcesHelper.Options.PackageSources;
+
+ Assert.AreEqual (expectedPackageSources, packageSources);
+ }
+
+ [Test]
+ public void ActivePackageRepository_ActivePackageSourceIsAggregate_ReturnsAggregatePackageRepository ()
+ {
+ CreateRegisteredPackageRepositories ();
+ packageSourcesHelper.AddTwoPackageSources ();
+
+ registeredRepositories.ActivePackageSource = RegisteredPackageSourceSettings.AggregatePackageSource;
+
+ IPackageRepository repository = registeredRepositories.ActiveRepository;
+ FakePackageRepository expectedRepository = fakeRepositoryCache.FakeAggregateRepository;
+
+ Assert.AreEqual (expectedRepository, repository);
+ }
+
+ [Test]
+ public void ActivePackageSource_AllPackageSourcesCleared_ReturnsNullAndDoesNotThrowArgumentOutOfRangeException ()
+ {
+ CreateRegisteredPackageRepositories ();
+ packageSourcesHelper.Options.ActivePackageSource = null;
+ registeredRepositories.PackageSources.Clear ();
+
+ PackageSource activePackageSource = registeredRepositories.ActivePackageSource;
+
+ Assert.IsNull (activePackageSource);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/RegisteredPackageSourcesViewModelTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/RegisteredPackageSourcesViewModelTests.cs
new file mode 100644
index 0000000000..bfb9c04719
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/RegisteredPackageSourcesViewModelTests.cs
@@ -0,0 +1,529 @@
+//
+// RegisteredPackageSourcesViewModelTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.Core;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class RegisteredPackageSourcesViewModelTests
+ {
+ RegisteredPackageSourcesViewModel viewModel;
+ List<string> propertiesChanged;
+ RegisteredPackageSources packageSources;
+ RegisteredPackageRepositories registeredRepositories;
+
+ void CreateViewModel ()
+ {
+ var options = new TestablePackageManagementOptions ();
+ packageSources = options.PackageSources;
+ packageSources.Clear ();
+
+ var cache = new PackageRepositoryCache (packageSources, new RecentPackageInfo [0]);
+ registeredRepositories = new RegisteredPackageRepositories (cache, options);
+
+ viewModel = new RegisteredPackageSourcesViewModel (registeredRepositories);
+ }
+
+ void CreateViewModelWithOnePackageSource ()
+ {
+ CreateViewModel ();
+ AddPackageSourceToOptions ("Source 1", "http://url1");
+ }
+
+ void CreateViewModelWithTwoPackageSources ()
+ {
+ CreateViewModel ();
+ AddPackageSourceToOptions ("Source 1", "http://url1");
+ AddPackageSourceToOptions ("Source 2", "http://url2");
+ }
+
+ void AddPackageSourceToOptions (string name, string url)
+ {
+ var source = new PackageSource (url, name);
+ packageSources.Add (source);
+ }
+
+ void RecordPropertyChanges ()
+ {
+ propertiesChanged = new List<string> ();
+ viewModel.PropertyChanged += (sender, e) => propertiesChanged.Add (e.PropertyName);
+ }
+
+ [Test]
+ public void Constructor_InstanceCreated_NoPackageSourceViewModels ()
+ {
+ CreateViewModel ();
+
+ Assert.AreEqual (0, viewModel.PackageSourceViewModels.Count);
+ }
+
+ [Test]
+ public void Load_OptionsHasOneRegisteredPackageSource_ViewModelHasOnePackageSourceViewModel ()
+ {
+ CreateViewModelWithOnePackageSource ();
+ viewModel.Load ();
+
+ Assert.AreEqual (1, viewModel.PackageSourceViewModels.Count);
+ }
+
+ [Test]
+ public void Load_OptionsHasOneRegisteredPackageSource_ViewModelHasOnePackageSourceViewModelWithPackageSourceFromOptions ()
+ {
+ CreateViewModelWithOnePackageSource ();
+ viewModel.Load ();
+
+ var expectedSources = new PackageSource[] {
+ packageSources [0]
+ };
+
+ PackageSourceCollectionAssert.AreEqual (expectedSources, viewModel.PackageSourceViewModels);
+ }
+
+ [Test]
+ public void Load_OptionsHasTwoRegisteredPackageSources_ViewModelHasTwoPackageSourceViewModelWithPackageSourcesFromOptions ()
+ {
+ CreateViewModelWithTwoPackageSources ();
+ viewModel.Load ();
+
+ var expectedSources = new PackageSource[] {
+ packageSources [0],
+ packageSources [1]
+ };
+
+ PackageSourceCollectionAssert.AreEqual (expectedSources, viewModel.PackageSourceViewModels);
+ }
+
+ [Test]
+ public void Load_PackageSourceModifiedAfterLoadAndSaveNotCalled_RegisteredPackageSourcesInOptionsUnchanged ()
+ {
+ CreateViewModel ();
+ AddPackageSourceToOptions ("Test", "http://sharpdevelop.com");
+ viewModel.Load ();
+
+ PackageSourceViewModel packageSourceViewModel = viewModel.PackageSourceViewModels [0];
+ packageSourceViewModel.Name = "Changed-Name";
+ packageSourceViewModel.SourceUrl = "changed-url";
+
+ var expectedSources = new PackageSource[] {
+ new PackageSource ("http://sharpdevelop.com", "Test")
+ };
+
+ PackageSourceCollectionAssert.AreEqual (expectedSources, packageSources);
+ }
+
+ [Test]
+ public void Save_PackageSourceModifiedAfterLoad_RegisteredPackageSourcesInOptionsUpdated ()
+ {
+ CreateViewModel ();
+ AddPackageSourceToOptions ("Test", "http://sharpdevelop.com");
+ viewModel.Load ();
+
+ PackageSourceViewModel packageSourceViewModel = viewModel.PackageSourceViewModels [0];
+ packageSourceViewModel.Name = "Test-updated";
+ packageSourceViewModel.SourceUrl = "url-updated";
+
+ viewModel.Save ();
+
+ var expectedSources = new PackageSource[] {
+ new PackageSource ("url-updated", "Test-updated")
+ };
+
+ PackageSourceCollectionAssert.AreEqual (expectedSources, packageSources);
+ }
+
+ [Test]
+ public void Save_OnePackageSourceAddedAfterLoadAndBeforeSave_TwoRegisteredPackageSourcesInOptions ()
+ {
+ CreateViewModel ();
+ AddPackageSourceToOptions ("Test", "http://sharpdevelop.com/1");
+ viewModel.Load ();
+
+ var newSource = new PackageSource ("http://sharpdevelop.com/2", "Test");
+
+ var newPackageSourceViewModel = new PackageSourceViewModel (newSource);
+ viewModel.PackageSourceViewModels.Add (newPackageSourceViewModel);
+
+ viewModel.Save ();
+
+ var expectedSource = new PackageSource ("http://sharpdevelop.com/1", "Test");
+
+ var expectedSources = new PackageSource[] {
+ expectedSource,
+ newSource
+ };
+
+ PackageSourceCollectionAssert.AreEqual (expectedSources, packageSources);
+ }
+
+ [Test]
+ public void AddPackageSourceCommand_CommandExecuted_AddsPackageSourceToPackageSourceViewModelsCollection ()
+ {
+ CreateViewModel ();
+ viewModel.Load ();
+ viewModel.NewPackageSourceName = "Test";
+ viewModel.NewPackageSourceUrl = "http://sharpdevelop.com";
+
+ viewModel.AddPackageSourceCommand.Execute (null);
+
+ var expectedSources = new PackageSource[] {
+ new PackageSource ("http://sharpdevelop.com", "Test")
+ };
+
+ PackageSourceCollectionAssert.AreEqual (expectedSources, viewModel.PackageSourceViewModels);
+ }
+
+ [Test]
+ public void AddPackageSourceCommand_NewPackageSourceHasNameButNoUrl_CanExecuteReturnsFalse ()
+ {
+ CreateViewModel ();
+ viewModel.Load ();
+ viewModel.NewPackageSourceName = "Test";
+ viewModel.NewPackageSourceUrl = null;
+
+ bool result = viewModel.AddPackageSourceCommand.CanExecute (null);
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void AddPackageSourceCommand_NewPackageSourceHasNameAndUrl_CanExecuteReturnsTrue ()
+ {
+ CreateViewModel ();
+ viewModel.Load ();
+ viewModel.NewPackageSourceName = "Test";
+ viewModel.NewPackageSourceUrl = "http://codeplex.com";
+
+ bool result = viewModel.AddPackageSourceCommand.CanExecute (null);
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void AddPackageSourceCommand_NewPackageSourceHasUrlButNoName_CanExecuteReturnsFalse ()
+ {
+ CreateViewModel ();
+ viewModel.Load ();
+ viewModel.NewPackageSourceName = null;
+ viewModel.NewPackageSourceUrl = "http://codeplex.com";
+
+ bool result = viewModel.AddPackageSourceCommand.CanExecute (null);
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void AddPackageSource_NoExistingPackageSources_SelectsPackageSourceViewModel ()
+ {
+ CreateViewModel ();
+ viewModel.Load ();
+ viewModel.NewPackageSourceUrl = "http://url";
+ viewModel.NewPackageSourceName = "abc";
+
+ viewModel.AddPackageSource ();
+
+ PackageSourceViewModel expectedViewModel = viewModel.PackageSourceViewModels [0];
+
+ Assert.AreEqual (expectedViewModel, viewModel.SelectedPackageSourceViewModel);
+ }
+
+ [Test]
+ public void NewPackageSourceName_Changed_NewPackageSourceNameUpdated ()
+ {
+ CreateViewModel ();
+ viewModel.Load ();
+ viewModel.NewPackageSourceName = "Test";
+
+ Assert.AreEqual ("Test", viewModel.NewPackageSourceName);
+ }
+
+ [Test]
+ public void NewPackageSourceUrl_Changed_NewPackageSourceUrlUpdated ()
+ {
+ CreateViewModel ();
+ viewModel.Load ();
+ viewModel.NewPackageSourceUrl = "Test";
+
+ Assert.AreEqual ("Test", viewModel.NewPackageSourceUrl);
+ }
+
+ [Test]
+ public void RemovePackageSourceCommand_TwoPackagesSourcesInListAndOnePackageSourceSelected_PackageSourceIsRemoved ()
+ {
+ CreateViewModelWithTwoPackageSources ();
+ viewModel.Load ();
+ viewModel.SelectedPackageSourceViewModel = viewModel.PackageSourceViewModels [0];
+
+ viewModel.RemovePackageSourceCommand.Execute (null);
+
+ var expectedSources = new PackageSource[] {
+ packageSources [1]
+ };
+
+ PackageSourceCollectionAssert.AreEqual (expectedSources, viewModel.PackageSourceViewModels);
+ }
+
+ [Test]
+ public void RemovePackageSourceCommand_NoPackageSourceSelected_CanExecuteReturnsFalse ()
+ {
+ CreateViewModel ();
+ viewModel.Load ();
+ viewModel.SelectedPackageSourceViewModel = null;
+
+ bool result = viewModel.RemovePackageSourceCommand.CanExecute (null);
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void RemovePackageSourceCommand_PackageSourceSelected_CanExecuteReturnsTrue ()
+ {
+ CreateViewModelWithOnePackageSource ();
+
+ viewModel.Load ();
+ viewModel.SelectedPackageSourceViewModel = viewModel.PackageSourceViewModels [0];
+
+ bool result = viewModel.RemovePackageSourceCommand.CanExecute (null);
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void SelectedPackageSourceViewModel_Changed_PropertyChangedEventFiredForCanAddPackageSource ()
+ {
+ CreateViewModelWithOnePackageSource ();
+ viewModel.Load ();
+
+ string propertyName = null;
+ viewModel.PropertyChanged += (sender, e) => propertyName = e.PropertyName;
+
+ viewModel.SelectedPackageSourceViewModel = viewModel.PackageSourceViewModels [0];
+
+ Assert.AreEqual ("CanAddPackageSource", propertyName);
+ }
+
+ [Test]
+ public void MovePackageSourceUpCommand_TwoPackagesSourcesInListAndLastPackageSourceSelected_PackageSourceIsMovedUp ()
+ {
+ CreateViewModelWithTwoPackageSources ();
+ viewModel.Load ();
+ viewModel.SelectedPackageSourceViewModel = viewModel.PackageSourceViewModels [1];
+
+ viewModel.MovePackageSourceUpCommand.Execute (null);
+
+ var expectedSources = new PackageSource[] {
+ packageSources [1],
+ packageSources [0]
+ };
+
+ PackageSourceCollectionAssert.AreEqual (expectedSources, viewModel.PackageSourceViewModels);
+ }
+
+ [Test]
+ public void MovePackageSourceUpCommand_FirstPackageSourceSelected_CanExecuteReturnsFalse ()
+ {
+ CreateViewModelWithTwoPackageSources ();
+ viewModel.Load ();
+ viewModel.SelectedPackageSourceViewModel = viewModel.PackageSourceViewModels [0];
+
+ bool result = viewModel.MovePackageSourceUpCommand.CanExecute (null);
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void MovePackageSourceUpCommand_LastPackageSourceSelected_CanExecuteReturnsTrue ()
+ {
+ CreateViewModelWithTwoPackageSources ();
+ viewModel.Load ();
+ viewModel.SelectedPackageSourceViewModel = viewModel.PackageSourceViewModels [1];
+
+ bool result = viewModel.MovePackageSourceUpCommand.CanExecute (null);
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void CanMovePackageSourceUp_NoPackages_ReturnsFalse ()
+ {
+ CreateViewModel ();
+ viewModel.Load ();
+
+ bool result = viewModel.CanMovePackageSourceUp;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void MovePackageSourceDownCommand_TwoPackagesSourcesAndFirstPackageSourceSelected_PackageSourceIsMovedDown ()
+ {
+ CreateViewModelWithTwoPackageSources ();
+ viewModel.Load ();
+ viewModel.SelectedPackageSourceViewModel = viewModel.PackageSourceViewModels [0];
+
+ viewModel.MovePackageSourceDownCommand.Execute (null);
+
+ var expectedSources = new PackageSource[] {
+ packageSources [1],
+ packageSources [0]
+ };
+
+ PackageSourceCollectionAssert.AreEqual (expectedSources, viewModel.PackageSourceViewModels);
+ }
+
+ [Test]
+ public void MovePackageSourceDownCommand_TwoPackageSourcesAndLastPackageSourceSelected_CanExecuteReturnsFalse ()
+ {
+ CreateViewModelWithTwoPackageSources ();
+ viewModel.Load ();
+ viewModel.SelectedPackageSourceViewModel = viewModel.PackageSourceViewModels [1];
+
+ bool result = viewModel.MovePackageSourceDownCommand.CanExecute (null);
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void MovePackageSourceDownCommand_TwoPackageSourcesAndFirstPackageSourceSelected_CanExecuteReturnsTrue ()
+ {
+ CreateViewModelWithTwoPackageSources ();
+ viewModel.Load ();
+ viewModel.SelectedPackageSourceViewModel = viewModel.PackageSourceViewModels [0];
+
+ bool result = viewModel.MovePackageSourceDownCommand.CanExecute (null);
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void CanMovePackageSourceDown_NoPackageSources_ReturnFalse ()
+ {
+ CreateViewModel ();
+ viewModel.Load ();
+
+ bool result = viewModel.CanMovePackageSourceDown;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void CanMovePackageSourceDown_OnePackageSourceAndPackageSourceIsSelected_ReturnsFalse ()
+ {
+ CreateViewModelWithOnePackageSource ();
+ viewModel.Load ();
+ viewModel.SelectedPackageSourceViewModel = viewModel.PackageSourceViewModels [0];
+
+ bool result = viewModel.CanMovePackageSourceDown;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void CanMovePackageSourceDown_OnePackageSourceAndNothingIsSelected_ReturnsFalse ()
+ {
+ CreateViewModelWithOnePackageSource ();
+ viewModel.Load ();
+ viewModel.SelectedPackageSourceViewModel = null;
+
+ bool result = viewModel.CanMovePackageSourceDown;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void CanMovePackageSourceUp_OnePackageSourceAndNothingIsSelected_ReturnsFalse ()
+ {
+ CreateViewModelWithOnePackageSource ();
+ viewModel.Load ();
+ viewModel.SelectedPackageSourceViewModel = null;
+
+ bool result = viewModel.CanMovePackageSourceUp;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void CanMovePackageSourceUp_TwoPackageSourcesAndNothingIsSelected_ReturnsFalse ()
+ {
+ CreateViewModelWithTwoPackageSources ();
+ viewModel.Load ();
+ viewModel.SelectedPackageSourceViewModel = null;
+
+ bool result = viewModel.CanMovePackageSourceUp;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void CanMovePackageSourceDown_TwoPackageSourcesAndNothingIsSelected_ReturnsFalse ()
+ {
+ CreateViewModelWithTwoPackageSources ();
+ viewModel.Load ();
+ viewModel.SelectedPackageSourceViewModel = null;
+
+ bool result = viewModel.CanMovePackageSourceDown;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void SelectedPackageSourceViewModel_PropertyChanged_FiresPropertyChangedEvent ()
+ {
+ CreateViewModelWithOnePackageSource ();
+ viewModel.Load ();
+ viewModel.SelectedPackageSourceViewModel = viewModel.PackageSourceViewModels [0];
+
+ List<string> propertyNames = new List<string> ();
+ viewModel.PropertyChanged += (sender, e) => propertyNames.Add (e.PropertyName);
+ viewModel.SelectedPackageSourceViewModel = null;
+
+ Assert.IsTrue (propertyNames.Contains ("SelectedPackageSourceViewModel"));
+ }
+
+ [Test]
+ public void AddPackageSource_OneExistingPackageSources_FiresPropertyChangedEventForSelectedPackageSource ()
+ {
+ CreateViewModelWithOnePackageSource ();
+ viewModel.Load ();
+ viewModel.SelectedPackageSourceViewModel = viewModel.PackageSourceViewModels [0];
+ viewModel.NewPackageSourceUrl = "http://url";
+ viewModel.NewPackageSourceName = "Test";
+
+ List<string> propertyNames = new List<string> ();
+ viewModel.PropertyChanged += (sender, e) => propertyNames.Add (e.PropertyName);
+ viewModel.AddPackageSource ();
+
+ Assert.IsTrue (propertyNames.Contains ("SelectedPackageSourceViewModel"));
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/SettingProviderTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/SettingProviderTests.cs
new file mode 100644
index 0000000000..9661a2650f
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/SettingProviderTests.cs
@@ -0,0 +1,102 @@
+//
+// SettingProviderTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+using NuGet;
+using NUnit.Framework;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class SettingsProviderTests
+ {
+ SettingsProvider settingsProvider;
+ FakeSettings fakeSettings;
+ FakePackageManagementProjectService projectService;
+ IFileSystem fileSystemUsedToLoadSettings;
+ string configFileUsedToLoadSettings;
+ IMachineWideSettings machinesettingsUsedToLoadSettings;
+
+ [SetUp]
+ public void SetUp ()
+ {
+ fakeSettings = new FakeSettings ();
+ projectService = new FakePackageManagementProjectService ();
+ SettingsProvider.LoadDefaultSettings = LoadDefaultSettings;
+ settingsProvider = new SettingsProvider (projectService);
+ }
+
+ ISettings LoadDefaultSettings (IFileSystem fileSystem, string configFile, IMachineWideSettings machineSettings)
+ {
+ fileSystemUsedToLoadSettings = fileSystem;
+ configFileUsedToLoadSettings = configFile;
+ machinesettingsUsedToLoadSettings = machineSettings;
+
+ return fakeSettings;
+ }
+
+ void OpenSolution (string fileName)
+ {
+ var solution = new FakeSolution (fileName);
+ projectService.OpenSolution = solution;
+ }
+
+ [TearDown]
+ public void TearDown ()
+ {
+ // This resets SettingsProvider.LoadDefaultSettings.
+ TestablePackageManagementOptions.CreateSettingsProvider (fakeSettings, projectService);
+ }
+
+ [Test]
+ public void LoadSettings_NoSolutionOpen_NullFileSystemAndNullConfigFileAndNullMachineSettingsUsed ()
+ {
+ fileSystemUsedToLoadSettings = new FakeFileSystem ();
+ configFileUsedToLoadSettings = "configFile";
+
+ ISettings settings = settingsProvider.LoadSettings ();
+
+ Assert.IsNull (fileSystemUsedToLoadSettings);
+ Assert.IsNull (configFileUsedToLoadSettings);
+ Assert.IsNull (machinesettingsUsedToLoadSettings);
+ Assert.AreEqual (fakeSettings, settings);
+ }
+
+ [Test]
+ public void LoadSettings_SolutionOpen_FileSystemWithRootSetToSolutionDotNuGetDirectoryUsedToLoadSettings ()
+ {
+ string fileName = @"d:\projects\MyProject\MyProject.sln";
+ OpenSolution (fileName);
+
+ ISettings settings = settingsProvider.LoadSettings ();
+
+ Assert.AreEqual (@"d:\projects\MyProject\.nuget".ToNativePath (), fileSystemUsedToLoadSettings.Root);
+ Assert.AreEqual (fakeSettings, settings);
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/SolutionPackageRepositoryPathTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/SolutionPackageRepositoryPathTests.cs
new file mode 100644
index 0000000000..10c5316833
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/SolutionPackageRepositoryPathTests.cs
@@ -0,0 +1,117 @@
+//
+// SolutionPackageRepositoryPathTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+using NUnit.Framework;
+using MonoDevelop.Core;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class SolutionPackageRepositoryPathTests
+ {
+ SolutionPackageRepositoryPath repositoryPath;
+ FakeProject project;
+ PackageManagementOptions options;
+ FakeSolution solution;
+
+ void CreateSolutionPackageRepositoryPath ()
+ {
+ repositoryPath = new SolutionPackageRepositoryPath (project, options);
+ }
+
+ void CreateSolutionPackageRepositoryPath (ISolution solution)
+ {
+ repositoryPath = new SolutionPackageRepositoryPath (solution, options);
+ }
+
+ void CreateTestProject ()
+ {
+ project = new FakeProject ();
+ }
+
+ void CreateSolution (string fileName)
+ {
+ solution = new FakeSolution (fileName);
+ }
+
+ void CreateOptions ()
+ {
+ options = new TestablePackageManagementOptions ();
+ }
+
+ [Test]
+ public void PackageRepositoryPath_ProjectAndSolutionHaveDifferentFolders_IsConfiguredPackagesFolderInsideSolutionFolder ()
+ {
+ CreateOptions ();
+ CreateTestProject ();
+ CreateSolution (@"d:\projects\MyProject\MySolution.sln");
+ solution.BaseDirectory = @"d:\projects\MyProject\".ToNativePath ();
+ project.ParentSolution = solution;
+ options.PackagesDirectory = "MyPackages";
+ CreateSolutionPackageRepositoryPath ();
+
+ string path = repositoryPath.PackageRepositoryPath;
+ string expectedPath = @"d:\projects\MyProject\MyPackages".ToNativePath ();
+
+ Assert.AreEqual (expectedPath, path);
+ }
+
+ [Test]
+ public void PackageRepositoryPath_PassSolutionToConstructor_IsConfiguredPackagesFolderInsideSolutionFolder ()
+ {
+ CreateOptions ();
+ CreateSolution (@"d:\projects\MySolution\MySolution.sln");
+ options.PackagesDirectory = "Packages";
+ CreateSolutionPackageRepositoryPath (solution);
+
+ string path = repositoryPath.PackageRepositoryPath;
+ string expectedPath = @"d:\projects\MySolution\Packages".ToNativePath ();
+
+ Assert.AreEqual (expectedPath, path);
+ }
+
+ [Test]
+ public void GetInstallPath_GetInstallPathForPackage_ReturnsPackagePathInsideSolutionPackagesRepository ()
+ {
+ CreateOptions ();
+ CreateSolution (@"d:\projects\Test\MySolution\MyProject.sln");
+ options.PackagesDirectory = "MyPackages";
+ CreateSolutionPackageRepositoryPath (solution);
+
+ var package = FakePackage.CreatePackageWithVersion ("MyPackage", "1.2.1.40");
+
+ string installPath = repositoryPath.GetInstallPath (package);
+
+ string expectedInstallPath =
+ @"d:\projects\Test\MySolution\MyPackages\MyPackage.1.2.1.40".ToNativePath ();
+
+ Assert.AreEqual (expectedInstallPath, installPath);
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/SolutionPackageRepositoryTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/SolutionPackageRepositoryTests.cs
new file mode 100644
index 0000000000..6e0d17e198
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/SolutionPackageRepositoryTests.cs
@@ -0,0 +1,247 @@
+//
+// SolutionPackageRepositoryTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+using ICSharpCode.PackageManagement;
+using NuGet;
+using NUnit.Framework;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class SolutionPackageRepositoryTests
+ {
+ SolutionPackageRepository repository;
+ TestablePackageManagementOptions options;
+ FakeSolution solution;
+ FakePackageRepositoryFactory fakeRepositoryFactory;
+ FakeSharedPackageRepository fakeSharedRepository;
+
+ void CreateSolution (string fileName)
+ {
+ solution = new FakeSolution (fileName);
+ }
+
+ void CreateFakeRepositoryFactory ()
+ {
+ fakeRepositoryFactory = new FakePackageRepositoryFactory ();
+ fakeSharedRepository = fakeRepositoryFactory.FakeSharedRepository;
+ }
+
+ void CreateOptions ()
+ {
+ options = new TestablePackageManagementOptions ();
+ }
+
+ void CreateRepository (ISolution solution, TestablePackageManagementOptions options)
+ {
+ CreateFakeRepositoryFactory ();
+ repository = new SolutionPackageRepository (solution, fakeRepositoryFactory, options);
+ }
+
+ void CreateRepository (ISolution solution)
+ {
+ CreateOptions ();
+ CreateRepository (solution, options);
+ }
+
+ void CreateRepository ()
+ {
+ CreateSolution (@"d:\projects\test\myproject\myproject.sln");
+ CreateRepository (solution);
+ }
+
+ FakePackage AddPackageToSharedRepository (string packageId)
+ {
+ FakeSharedPackageRepository sharedRepository = fakeRepositoryFactory.FakeSharedRepository;
+ return sharedRepository.AddFakePackage (packageId);
+ }
+
+ FakePackage AddPackageToSharedRepository (string packageId, string version)
+ {
+ FakeSharedPackageRepository sharedRepository = fakeRepositoryFactory.FakeSharedRepository;
+ return sharedRepository.AddFakePackageWithVersion (packageId, version);
+ }
+
+ [Test]
+ public void GetInstallPath_GetInstallPathForPackage_ReturnsPackagePathInsideSolutionPackagesRepository ()
+ {
+ CreateSolution (@"d:\projects\Test\MySolution\MyProject.sln");
+ CreateOptions ();
+ options.PackagesDirectory = "MyPackages";
+ CreateRepository (solution, options);
+
+ var package = FakePackage.CreatePackageWithVersion ("MyPackage", "1.0.1.40");
+
+ string installPath = repository.GetInstallPath (package);
+
+ string expectedInstallPath =
+ @"d:\projects\Test\MySolution\MyPackages\MyPackage.1.0.1.40".ToNativePath ();
+
+ Assert.AreEqual (expectedInstallPath, installPath);
+ }
+
+ [Test]
+ public void GetPackagesByDependencyOrder_OnePackageInSharedRepository_ReturnsOnePackage ()
+ {
+ CreateRepository ();
+ AddPackageToSharedRepository ("Test");
+
+ List<FakePackage> expectedPackages = fakeSharedRepository.FakePackages;
+
+ List<IPackage> actualPackages = repository.GetPackagesByDependencyOrder ().ToList ();
+
+ PackageCollectionAssert.AreEqual (expectedPackages, actualPackages);
+ }
+
+ [Test]
+ public void GetPackagesByDependencyOrder_OnePackageInSharedRepository_SharedRepositoryCreatedWithPathResolverForSolutionPackagesFolder ()
+ {
+ CreateSolution (@"d:\projects\myproject\myproject.sln");
+ CreateRepository (solution);
+ FakePackage package = AddPackageToSharedRepository ("Test", "1.0");
+
+ repository.GetPackagesByDependencyOrder ().ToList ();
+
+ IPackagePathResolver pathResolver = fakeRepositoryFactory.PathResolverPassedToCreateSharedRepository;
+ string installPath = pathResolver.GetInstallPath (package);
+
+ string expectedInstallPath = @"d:\projects\myproject\packages\Test.1.0".ToNativePath ();
+
+ Assert.AreEqual (expectedInstallPath, installPath);
+ }
+
+ [Test]
+ public void Constructor_CreateInstance_SharedRepositoryCreatedWithFileSystemForSolutionPackagesFolder ()
+ {
+ CreateSolution (@"d:\projects\myproject\myproject.sln");
+ CreateRepository (solution);
+
+ IFileSystem fileSystem = fakeRepositoryFactory.FileSystemPassedToCreateSharedRepository;
+ string rootPath = fileSystem.Root;
+
+ string expectedRootPath = @"d:\projects\myproject\packages".ToNativePath ();
+
+ Assert.AreEqual (expectedRootPath, rootPath);
+ }
+
+ [Test]
+ public void Constructor_CreateInstance_SharedRepositoryCreatedWithConfigSettingsFileSystemForSolutionNuGetFolder ()
+ {
+ CreateSolution (@"d:\projects\myproject\myproject.sln");
+ CreateRepository (solution);
+
+ IFileSystem fileSystem = fakeRepositoryFactory.ConfigSettingsFileSystemPassedToCreateSharedRepository;
+ string rootPath = fileSystem.Root;
+
+ string expectedRootPath = @"d:\projects\myproject\.nuget".ToNativePath ();
+
+ Assert.AreEqual (expectedRootPath, rootPath);
+ }
+
+ [Test]
+ public void GetPackagesByDependencyOrder_TwoPackagesInSharedRepositoryFirstPackageDependsOnSecond_ReturnsSecondPackageFirst ()
+ {
+ CreateSolution (@"d:\projects\myproject\myproject.sln");
+ CreateRepository (solution);
+ FakePackage firstPackage = AddPackageToSharedRepository ("First");
+ firstPackage.AddDependency ("Second");
+ FakePackage secondPackage = AddPackageToSharedRepository ("Second");
+
+ List<IPackage> actualPackages = repository.GetPackagesByDependencyOrder ().ToList ();
+
+ var expectedPackages = new IPackage[] {
+ secondPackage,
+ firstPackage
+ };
+
+ Assert.AreEqual (expectedPackages, actualPackages);
+ }
+
+ [Test]
+ public void GetPackagesByReverseDependencyOrder_TwoPackagesInSharedRepositorySecondPackageDependsOnFirst_ReturnsSecondPackageFirst ()
+ {
+ CreateSolution (@"d:\projects\myproject\myproject.sln");
+ CreateRepository (solution);
+ FakePackage firstPackage = AddPackageToSharedRepository ("First");
+ FakePackage secondPackage = AddPackageToSharedRepository ("Second");
+ secondPackage.AddDependency ("First");
+
+ List<IPackage> actualPackages = repository.GetPackagesByReverseDependencyOrder ().ToList ();
+
+ var expectedPackages = new IPackage[] {
+ secondPackage,
+ firstPackage
+ };
+
+ Assert.AreEqual (expectedPackages, actualPackages);
+ }
+
+ [Test]
+ public void IsInstalled_PackageIsInSharedRepository_ReturnsTrue ()
+ {
+ CreateSolution (@"d:\projects\myproject\myproject.sln");
+ CreateRepository (solution);
+ FakePackage firstPackage = AddPackageToSharedRepository ("First");
+
+ bool installed = repository.IsInstalled (firstPackage);
+
+ Assert.IsTrue (installed);
+ }
+
+ [Test]
+ public void IsInstalled_PackageIsNotInSharedRepository_ReturnsFalse ()
+ {
+ CreateSolution (@"d:\projects\myproject\myproject.sln");
+ CreateRepository (solution);
+ FakePackage testPackage = new FakePackage ("Test");
+
+ bool installed = repository.IsInstalled (testPackage);
+
+ Assert.IsFalse (installed);
+ }
+
+ [Test]
+ public void GetPackages_OnePackageIsInSharedRepository_ReturnsOnePackage ()
+ {
+ CreateSolution (@"d:\projects\myproject\myproject.sln");
+ CreateRepository (solution);
+ FakePackage firstPackage = AddPackageToSharedRepository ("First");
+
+ IQueryable<IPackage> packages = repository.GetPackages ();
+
+ var expectedPackages = new FakePackage[] {
+ firstPackage
+ };
+
+ PackageCollectionAssert.AreEqual (expectedPackages, packages);
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/ThreadSafePackageManagementEventsTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/ThreadSafePackageManagementEventsTests.cs
new file mode 100644
index 0000000000..42810f1dac
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/ThreadSafePackageManagementEventsTests.cs
@@ -0,0 +1,607 @@
+//
+// ThreadSafePackageManagementEventsTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using NuGet;
+using NUnit.Framework;
+using MonoDevelop.Ide;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class ThreadSafePackageManagementEventsTests
+ {
+ ThreadSafePackageManagementEvents threadSafeEvents;
+ PackageManagementEvents unsafeEvents;
+ bool eventHandlerFired;
+ bool isGuiSyncDispatchCalled;
+
+ void CreateEvents ()
+ {
+ isGuiSyncDispatchCalled = false;
+ unsafeEvents = new PackageManagementEvents ();
+ threadSafeEvents = new ThreadSafePackageManagementEvents (unsafeEvents, RunGuiSyncDispatch);
+ }
+
+ void RunGuiSyncDispatch (MessageHandler messageHandler)
+ {
+ isGuiSyncDispatchCalled = true;
+ messageHandler.Invoke ();
+ }
+
+ void OnEventHandlerFired (object sender, EventArgs e)
+ {
+ eventHandlerFired = true;
+ }
+
+ [Test]
+ public void OnPackageOperationsStarting_NoInvokeRequired_NonThreadSafePackageOperationsStartingMethodCalled ()
+ {
+ CreateEvents ();
+ bool called = false;
+ unsafeEvents.PackageOperationsStarting += (sender, e) => called = true;
+ threadSafeEvents.OnPackageOperationsStarting ();
+
+ Assert.IsTrue (called);
+ }
+
+ [Test]
+ public void OnPackageOperationError_NoInvokeRequired_NonThreadSafeOnPackageOperationErrorMethodCalled ()
+ {
+ CreateEvents ();
+ Exception exception = null;
+ unsafeEvents.PackageOperationError += (sender, e) => exception = e.Exception;
+ var expectedException = new Exception ("test");
+
+ threadSafeEvents.OnPackageOperationError (expectedException);
+
+ Assert.AreEqual (expectedException, exception);
+ }
+
+ [Test]
+ public void OnAcceptLicenses_NoInvokeRequired_NonThreadSafeOnAcceptLicensesMethodCalled ()
+ {
+ CreateEvents ();
+ IEnumerable<IPackage> packages = null;
+ unsafeEvents.AcceptLicenses += (sender, e) => packages = e.Packages;
+ var expectedPackages = new List<IPackage> ();
+
+ threadSafeEvents.OnAcceptLicenses (expectedPackages);
+
+ Assert.AreEqual (expectedPackages, packages);
+ }
+
+ [Test]
+ public void OnAcceptLicenses_NoInvokeRequired_NonThreadSafeOnAcceptLicensesMethodCalledAndReturnsResult ()
+ {
+ CreateEvents ();
+ unsafeEvents.AcceptLicenses += (sender, e) => e.IsAccepted = false;
+
+ bool result = threadSafeEvents.OnAcceptLicenses (null);
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void OnParentPackageInstalled_NoInvokeRequired_NonThreadSafeOnParentPackageInstalledMethodCalled ()
+ {
+ CreateEvents ();
+ IPackage package = null;
+ IPackageManagementProject project = null;
+ unsafeEvents.ParentPackageInstalled += (sender, e) => {
+ package = e.Package;
+ project = e.Project;
+ };
+ var expectedPackage = new FakePackage ();
+ var expectedProject = new FakePackageManagementProject ();
+
+ threadSafeEvents.OnParentPackageInstalled (expectedPackage, expectedProject);
+
+ Assert.AreEqual (expectedPackage, package);
+ }
+
+ [Test]
+ public void OnParentPackageUninstalled_NoInvokeRequired_NonThreadSafeOnParentPackageUninstalledMethodCalled ()
+ {
+ CreateEvents ();
+ IPackage package = null;
+ IPackageManagementProject project = null;
+ unsafeEvents.ParentPackageUninstalled += (sender, e) => {
+ package = e.Package;
+ project = e.Project;
+ };
+ var expectedPackage = new FakePackage ();
+ var expectedProject = new FakePackageManagementProject ();
+
+ threadSafeEvents.OnParentPackageUninstalled (expectedPackage, expectedProject);
+
+ Assert.AreEqual (expectedPackage, package);
+ }
+
+ [Test]
+ public void OnPackageOperationMessageLogged_NoInvokeRequired_NonThreadSafeOnPackageOperationMessageLoggedMethodCalled ()
+ {
+ CreateEvents ();
+ MessageLevel actualLevel = MessageLevel.Debug;
+ string actualMessage = null;
+ unsafeEvents.PackageOperationMessageLogged += (sender, e) => {
+ actualLevel = e.Message.Level;
+ actualMessage = e.Message.ToString ();
+ };
+
+ var messageLevel = MessageLevel.Warning;
+ string message = "abc {0}";
+ string arg = "test";
+ threadSafeEvents.OnPackageOperationMessageLogged (messageLevel, message, arg);
+
+ Assert.AreEqual (messageLevel, actualLevel);
+ Assert.AreEqual ("abc test", actualMessage);
+ }
+
+ [Test]
+ public void AcceptLicenses_UnsafeEventFired_ThreadSafeEventFired ()
+ {
+ CreateEvents ();
+ bool fired = false;
+ threadSafeEvents.AcceptLicenses += (sender, e) => fired = true;
+ unsafeEvents.OnAcceptLicenses (null);
+
+ Assert.IsTrue (fired);
+ }
+
+ [Test]
+ public void AcceptLicenses_UnsafeEventFiredAfterEventHandlerRemoved_ThreadSafeEventIsNotFired ()
+ {
+ CreateEvents ();
+ eventHandlerFired = false;
+ threadSafeEvents.AcceptLicenses += OnEventHandlerFired;
+ threadSafeEvents.AcceptLicenses -= OnEventHandlerFired;
+ unsafeEvents.OnAcceptLicenses (null);
+
+ Assert.IsFalse (eventHandlerFired);
+ }
+
+ [Test]
+ public void PackageOperationsStarting_UnsafeEventFired_ThreadSafeEventFired ()
+ {
+ CreateEvents ();
+ bool fired = false;
+ threadSafeEvents.PackageOperationsStarting += (sender, e) => fired = true;
+ unsafeEvents.OnPackageOperationsStarting ();
+
+ Assert.IsTrue (fired);
+ }
+
+ [Test]
+ public void PackageOperationsStarting_UnsafeEventFiredAndInvokeRequired_ThreadSafeEventIsSafelyInvoked ()
+ {
+ CreateEvents ();
+ threadSafeEvents.PackageOperationsStarting += OnEventHandlerFired;
+ unsafeEvents.OnPackageOperationsStarting ();
+
+ Assert.IsTrue (isGuiSyncDispatchCalled);
+ }
+
+ [Test]
+ public void PackageOperationsStarting_UnsafeEventFiredAndInvokeRequiredButNoEventHandlerRegistered_ThreadSafeEventIsNotInvoked ()
+ {
+ CreateEvents ();
+ unsafeEvents.OnPackageOperationsStarting ();
+
+ Assert.IsFalse (isGuiSyncDispatchCalled);
+ }
+
+ [Test]
+ public void PackageOperationsStarting_UnsafeEventFiredAfterEventHandlerRemoved_ThreadSafeEventIsNotFired ()
+ {
+ CreateEvents ();
+ eventHandlerFired = false;
+ threadSafeEvents.PackageOperationsStarting += OnEventHandlerFired;
+ threadSafeEvents.PackageOperationsStarting -= OnEventHandlerFired;
+ unsafeEvents.OnPackageOperationsStarting ();
+
+ Assert.IsFalse (eventHandlerFired);
+ }
+
+ [Test]
+ public void PackageOperationError_UnsafeEventFired_ThreadSafeEventFired ()
+ {
+ CreateEvents ();
+ bool fired = false;
+ threadSafeEvents.PackageOperationError += (sender, e) => fired = true;
+ unsafeEvents.OnPackageOperationError (new Exception ());
+
+ Assert.IsTrue (fired);
+ }
+
+ [Test]
+ public void PackageOperationError_UnsafeEventFiredAndInvokeRequired_ThreadSafeEventIsSafelyInvoked ()
+ {
+ CreateEvents ();
+ threadSafeEvents.PackageOperationError += OnEventHandlerFired;
+ var expectedException = new Exception ("Test");
+
+ unsafeEvents.OnPackageOperationError (expectedException);
+
+ Assert.IsTrue (isGuiSyncDispatchCalled);
+ }
+
+ [Test]
+ public void PackageOperationError_UnsafeEventFiredAndInvokeRequiredButNoEventHandlerRegistered_ThreadSafeEventIsNotInvoked ()
+ {
+ CreateEvents ();
+ unsafeEvents.OnPackageOperationError (new Exception ());
+
+ Assert.IsFalse (isGuiSyncDispatchCalled);
+ }
+
+ [Test]
+ public void PackageOperationError_UnsafeEventFiredAfterEventHandlerRemoved_ThreadSafeEventIsNotFired ()
+ {
+ CreateEvents ();
+ eventHandlerFired = false;
+ threadSafeEvents.PackageOperationError += OnEventHandlerFired;
+ threadSafeEvents.PackageOperationError -= OnEventHandlerFired;
+ unsafeEvents.OnPackageOperationError (new Exception ());
+
+ Assert.IsFalse (eventHandlerFired);
+ }
+
+ [Test]
+ public void ParentPackageInstalled_UnsafeEventFired_ThreadSafeEventFired ()
+ {
+ CreateEvents ();
+ bool fired = false;
+ threadSafeEvents.ParentPackageInstalled += (sender, e) => fired = true;
+ unsafeEvents.OnParentPackageInstalled (null, null);
+
+ Assert.IsTrue (fired);
+ }
+
+ [Test]
+ public void ParentPackageInstalled_UnsafeEventFiredAndInvokeRequired_ThreadSafeEventIsSafelyInvoked ()
+ {
+ CreateEvents ();
+ threadSafeEvents.ParentPackageInstalled += OnEventHandlerFired;
+ var expectedPackage = new FakePackage ();
+
+ unsafeEvents.OnParentPackageInstalled (expectedPackage, null);
+
+ Assert.IsTrue (isGuiSyncDispatchCalled);
+ }
+
+ [Test]
+ public void ParentPackageInstalled_UnsafeEventFiredAndInvokeRequiredButNoEventHandlerRegistered_ThreadSafeEventIsNotInvoked ()
+ {
+ CreateEvents ();
+ unsafeEvents.OnParentPackageInstalled (new FakePackage (), null);
+
+ Assert.IsFalse (isGuiSyncDispatchCalled);
+ }
+
+ [Test]
+ public void ParentPackageInstalled_UnsafeEventFiredAfterEventHandlerRemoved_ThreadSafeEventIsNotFired ()
+ {
+ CreateEvents ();
+ eventHandlerFired = false;
+ threadSafeEvents.ParentPackageInstalled += OnEventHandlerFired;
+ threadSafeEvents.ParentPackageInstalled -= OnEventHandlerFired;
+ unsafeEvents.OnParentPackageInstalled (null, null);
+
+ Assert.IsFalse (eventHandlerFired);
+ }
+
+ [Test]
+ public void ParentPackageUninstalled_UnsafeEventFired_ThreadSafeEventFired ()
+ {
+ CreateEvents ();
+ bool fired = false;
+ threadSafeEvents.ParentPackageUninstalled += (sender, e) => fired = true;
+ unsafeEvents.OnParentPackageUninstalled (null, null);
+
+ Assert.IsTrue (fired);
+ }
+
+ [Test]
+ public void ParentPackageUninstalled_UnsafeEventFiredAndInvokeRequired_ThreadSafeEventIsSafelyInvoked ()
+ {
+ CreateEvents ();
+ threadSafeEvents.ParentPackageUninstalled += OnEventHandlerFired;
+ var expectedPackage = new FakePackage ();
+
+ unsafeEvents.OnParentPackageUninstalled (expectedPackage, null);
+
+ Assert.IsTrue (isGuiSyncDispatchCalled);
+ }
+
+ [Test]
+ public void ParentPackageUninstalled_UnsafeEventFiredAndInvokeRequiredButNoEventHandlerRegistered_ThreadSafeEventIsNotInvoked ()
+ {
+ CreateEvents ();
+ unsafeEvents.OnParentPackageUninstalled (new FakePackage (), null);
+
+ Assert.IsFalse (isGuiSyncDispatchCalled);
+ }
+
+ [Test]
+ public void ParentPackageUninstalled_UnsafeEventFiredAfterEventHandlerRemoved_ThreadSafeEventIsNotFired ()
+ {
+ CreateEvents ();
+ eventHandlerFired = false;
+ threadSafeEvents.ParentPackageUninstalled += OnEventHandlerFired;
+ threadSafeEvents.ParentPackageUninstalled -= OnEventHandlerFired;
+ unsafeEvents.OnParentPackageUninstalled (null, null);
+
+ Assert.IsFalse (eventHandlerFired);
+ }
+
+ [Test]
+ public void PackageOperationMessageLogged_UnsafeEventFired_ThreadSafeEventFired ()
+ {
+ CreateEvents ();
+ bool fired = false;
+ threadSafeEvents.PackageOperationMessageLogged += (sender, e) => fired = true;
+ unsafeEvents.OnPackageOperationMessageLogged (MessageLevel.Info, String.Empty, new object[0]);
+
+ Assert.IsTrue (fired);
+ }
+
+ [Test]
+ public void PackageOperationMessageLogged_UnsafeEventFiredAfterEventHandlerRemoved_ThreadSafeEventIsNotFired ()
+ {
+ CreateEvents ();
+ eventHandlerFired = false;
+ threadSafeEvents.PackageOperationMessageLogged += OnEventHandlerFired;
+ threadSafeEvents.PackageOperationMessageLogged -= OnEventHandlerFired;
+ unsafeEvents.OnPackageOperationMessageLogged (MessageLevel.Info, String.Empty, new object[0]);
+
+ Assert.IsFalse (eventHandlerFired);
+ }
+
+ [Test]
+ public void Dispose_PackageOperationsStartingHandlerExistsAndThreadUnsafeEventFiredAfterDispose_ThreadSafeEventIsNotFired ()
+ {
+ CreateEvents ();
+ eventHandlerFired = false;
+ threadSafeEvents.PackageOperationsStarting += OnEventHandlerFired;
+
+ threadSafeEvents.Dispose ();
+ unsafeEvents.OnPackageOperationsStarting ();
+
+ Assert.IsFalse (eventHandlerFired);
+ }
+
+ [Test]
+ public void Dispose_PackageOperationErrorHandlerExistsAndThreadUnsafeEventFiredAfterDispose_ThreadSafeEventIsNotFired ()
+ {
+ CreateEvents ();
+ eventHandlerFired = false;
+ threadSafeEvents.PackageOperationError += OnEventHandlerFired;
+
+ threadSafeEvents.Dispose ();
+ unsafeEvents.OnPackageOperationError (new Exception ());
+
+ Assert.IsFalse (eventHandlerFired);
+ }
+
+ [Test]
+ public void Dispose_ParentPackageInstalledHandlerExistsAndThreadUnsafeEventFiredAfterDispose_ThreadSafeEventIsNotFired ()
+ {
+ CreateEvents ();
+ eventHandlerFired = false;
+ threadSafeEvents.ParentPackageInstalled += OnEventHandlerFired;
+
+ threadSafeEvents.Dispose ();
+ unsafeEvents.OnParentPackageInstalled (new FakePackage (), null);
+
+ Assert.IsFalse (eventHandlerFired);
+ }
+
+ [Test]
+ public void Dispose_ParentParentPackageUninstalledHandlerExistsAndThreadUnsafeEventFiredAfterDispose_ThreadSafeEventIsNotFired ()
+ {
+ CreateEvents ();
+ eventHandlerFired = false;
+ threadSafeEvents.ParentPackageUninstalled += OnEventHandlerFired;
+
+ threadSafeEvents.Dispose ();
+ unsafeEvents.OnParentPackageUninstalled (new FakePackage (), null);
+
+ Assert.IsFalse (eventHandlerFired);
+ }
+
+ [Test]
+ public void OnSelectProjects_NoInvokeRequired_NonThreadSafeOnSelectProjectsMethodCalled ()
+ {
+ CreateEvents ();
+ IEnumerable<IPackageManagementSelectedProject> selectedProjects = null;
+ unsafeEvents.SelectProjects += (sender, e) => selectedProjects = e.SelectedProjects;
+ var expectedSelectedProjects = new List<IPackageManagementSelectedProject> ();
+
+ threadSafeEvents.OnSelectProjects (expectedSelectedProjects);
+
+ Assert.AreEqual (expectedSelectedProjects, selectedProjects);
+ }
+
+ [Test]
+ public void OnSelectLicenses_NoInvokeRequired_NonThreadSafeOnSelectProjectsMethodCalledAndReturnsResult ()
+ {
+ CreateEvents ();
+ unsafeEvents.SelectProjects += (sender, e) => e.IsAccepted = true;
+ var projects = new List<IPackageManagementSelectedProject> ();
+ bool result = threadSafeEvents.OnSelectProjects (projects);
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void SelectProjects_UnsafeEventFired_ThreadSafeEventFired ()
+ {
+ CreateEvents ();
+ bool fired = false;
+ threadSafeEvents.SelectProjects += (sender, e) => fired = true;
+ var projects = new List<IPackageManagementSelectedProject> ();
+ unsafeEvents.OnSelectProjects (projects);
+
+ Assert.IsTrue (fired);
+ }
+
+ [Test]
+ public void SelectProjects_UnsafeEventFiredAfterEventHandlerRemoved_ThreadSafeEventIsNotFired ()
+ {
+ CreateEvents ();
+ eventHandlerFired = false;
+ threadSafeEvents.SelectProjects += OnEventHandlerFired;
+ threadSafeEvents.SelectProjects -= OnEventHandlerFired;
+ var projects = new List<IPackageManagementSelectedProject> ();
+ unsafeEvents.OnSelectProjects (projects);
+
+ Assert.IsFalse (eventHandlerFired);
+ }
+
+ [Test]
+ public void OnResolveFileConflict_NoInvokeRequired_NonThreadSafeOnResolveFileConflictMethodCalledWithMessage ()
+ {
+ CreateEvents ();
+ string message = null;
+ unsafeEvents.ResolveFileConflict += (sender, e) => message = e.Message.ToString ();
+
+ threadSafeEvents.OnResolveFileConflict ("message");
+
+ Assert.AreEqual ("message", message);
+ }
+
+ [Test]
+ public void OnResolveFileConflict_NoInvokeRequired_ValueReturnedFromNonThreadSafeOnResolveFileConflict ()
+ {
+ CreateEvents ();
+ unsafeEvents.ResolveFileConflict += (sender, e) => {
+ e.Resolution = FileConflictResolution.OverwriteAll;
+ };
+
+ FileConflictResolution result = threadSafeEvents.OnResolveFileConflict ("message");
+
+ Assert.AreEqual (FileConflictResolution.OverwriteAll, result);
+ }
+
+ [Test]
+ public void OnResolveFileConflict_UnsafeEventFired_ThreadSafeEventFired ()
+ {
+ CreateEvents ();
+ bool fired = false;
+ threadSafeEvents.ResolveFileConflict += (sender, e) => fired = true;
+ unsafeEvents.OnResolveFileConflict ("message");
+
+ Assert.IsTrue (fired);
+ }
+
+ [Test]
+ public void ResolveFileConflict_UnsafeEventFired_ThreadSafeEventFired ()
+ {
+ CreateEvents ();
+ bool fired = false;
+ threadSafeEvents.ResolveFileConflict += (sender, e) => fired = true;
+ unsafeEvents.OnResolveFileConflict ("message");
+
+ Assert.IsTrue (fired);
+ }
+
+ [Test]
+ public void ResolveFileConflict_UnsafeEventFiredAfterEventHandlerRemoved_ThreadSafeEventIsNotFired ()
+ {
+ CreateEvents ();
+ eventHandlerFired = false;
+ threadSafeEvents.ResolveFileConflict += OnEventHandlerFired;
+ threadSafeEvents.ResolveFileConflict -= OnEventHandlerFired;
+ unsafeEvents.OnResolveFileConflict ("message");
+
+ Assert.IsFalse (eventHandlerFired);
+ }
+
+ [Test]
+ public void OnParentPackagesUpdated_NoInvokeRequired_NonThreadSafeOnParentPackagesUpdatedMethodCalled ()
+ {
+ CreateEvents ();
+ IEnumerable<IPackage> packages = null;
+ unsafeEvents.ParentPackagesUpdated += (sender, e) => packages = e.Packages;
+ var expectedPackages = new FakePackage[] { new FakePackage () };
+
+ threadSafeEvents.OnParentPackagesUpdated (expectedPackages);
+
+ Assert.AreEqual (expectedPackages, packages);
+ }
+
+ [Test]
+ public void ParentPackagesUpdated_UnsafeEventFired_ThreadSafeEventFired ()
+ {
+ CreateEvents ();
+ bool fired = false;
+ threadSafeEvents.ParentPackagesUpdated += (sender, e) => fired = true;
+ unsafeEvents.OnParentPackagesUpdated (null);
+
+ Assert.IsTrue (fired);
+ }
+
+ [Test]
+ public void ParentPackagesUpdated_UnsafeEventFiredAndInvokeRequired_ThreadSafeEventIsSafelyInvoked ()
+ {
+ CreateEvents ();
+ threadSafeEvents.ParentPackagesUpdated += OnEventHandlerFired;
+ var expectedPackages = new FakePackage[] { new FakePackage () };
+
+ unsafeEvents.OnParentPackagesUpdated (expectedPackages);
+
+ Assert.IsTrue (isGuiSyncDispatchCalled);
+ }
+
+ [Test]
+ public void ParentPackagesUpdated_UnsafeEventFiredAndInvokeRequiredButNoEventHandlerRegistered_ThreadSafeEventIsNotInvoked ()
+ {
+ CreateEvents ();
+ var packages = new FakePackage[] { new FakePackage () };
+ unsafeEvents.OnParentPackagesUpdated (packages);
+
+ Assert.IsFalse (isGuiSyncDispatchCalled);
+ }
+
+ [Test]
+ public void Dispose_ParentPackagesUpdatedHandlerExistsAndThreadUnsafeEventFiredAfterDispose_ThreadSafeEventIsNotFired ()
+ {
+ CreateEvents ();
+ eventHandlerFired = false;
+ threadSafeEvents.ParentPackagesUpdated += OnEventHandlerFired;
+ threadSafeEvents.Dispose ();
+
+ unsafeEvents.OnParentPackagesUpdated (new FakePackage[0]);
+
+ Assert.IsFalse (eventHandlerFired);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UninstallPackageActionTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UninstallPackageActionTests.cs
new file mode 100644
index 0000000000..885c10c377
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UninstallPackageActionTests.cs
@@ -0,0 +1,287 @@
+//
+// UninstallPackageActionTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class UninstallPackageActionTests
+ {
+ UninstallPackageAction action;
+ PackageManagementEvents packageManagementEvents;
+ UninstallPackageHelper uninstallPackageHelper;
+ FakePackageManagementProject fakeProject;
+
+ void CreateAction ()
+ {
+ packageManagementEvents = new PackageManagementEvents ();
+ fakeProject = new FakePackageManagementProject ();
+ action = new UninstallPackageAction (fakeProject, packageManagementEvents);
+ uninstallPackageHelper = new UninstallPackageHelper (action);
+ }
+
+ FakePackage AddOnePackageToProjectSourceRepository (string packageId)
+ {
+ return fakeProject.FakeSourceRepository.AddFakePackage (packageId);
+ }
+
+ FakePackage AddOnePackageToProjectSourceRepository (string packageId, string version)
+ {
+ return fakeProject.FakeSourceRepository.AddFakePackageWithVersion (packageId, version);
+ }
+
+ void AddFileToPackageBeingUninstalled (string fileName)
+ {
+ var package = new FakePackage ();
+ package.AddFile (fileName);
+
+ action.Package = package;
+ }
+
+ [Test]
+ public void Execute_PackageObjectPassed_UninstallsPackageFromProject ()
+ {
+ CreateAction ();
+
+ uninstallPackageHelper.UninstallTestPackage ();
+
+ var actualPackage = fakeProject.PackagePassedToUninstallPackage;
+ var expectedPackage = uninstallPackageHelper.TestPackage;
+
+ Assert.AreEqual (expectedPackage, actualPackage);
+ }
+
+ [Test]
+ public void Execute_PackageAndPackageRepositoryPassed_OnPackageUninstalledCalledWithPackage ()
+ {
+ CreateAction ();
+ IPackage actualPackage = null;
+ packageManagementEvents.ParentPackageUninstalled += (sender, e) => {
+ actualPackage = e.Package;
+ };
+
+ uninstallPackageHelper.UninstallTestPackage ();
+
+ var expectedPackage = uninstallPackageHelper.TestPackage;
+ Assert.AreEqual (expectedPackage, actualPackage);
+ }
+
+ [Test]
+ public void Execute_PackageObjectPassedAndForceRemoveIsFalse_PackageIsNotForcefullyRemoved ()
+ {
+ CreateAction ();
+ fakeProject.AddFakePackageToSourceRepository ("PackageId");
+ uninstallPackageHelper.ForceRemove = false;
+ uninstallPackageHelper.UninstallPackageById ("PackageId");
+
+ bool forceRemove = fakeProject.ForceRemovePassedToUninstallPackage;
+
+ Assert.IsFalse (forceRemove);
+ }
+
+ [Test]
+ public void Execute_PackageObjectPassedAndForceRemoveIsTrue_PackageIsForcefullyRemoved ()
+ {
+ CreateAction ();
+ fakeProject.AddFakePackageToSourceRepository ("PackageId");
+ uninstallPackageHelper.ForceRemove = true;
+ uninstallPackageHelper.UninstallPackageById ("PackageId");
+
+ bool forceRemove = fakeProject.ForceRemovePassedToUninstallPackage;
+
+ Assert.IsTrue (forceRemove);
+ }
+
+ [Test]
+ public void Execute_PackageObjectPassedAndRemoveDependenciesIsFalse_PackageDependenciesAreNotRemoved ()
+ {
+ CreateAction ();
+ fakeProject.AddFakePackageToSourceRepository ("PackageId");
+ uninstallPackageHelper.RemoveDependencies = false;
+ uninstallPackageHelper.UninstallPackageById ("PackageId");
+
+ bool removeDependencies = fakeProject.RemoveDependenciesPassedToUninstallPackage;
+
+ Assert.IsFalse (removeDependencies);
+ }
+
+ [Test]
+ public void Execute_PackageObjectPassedAndRemoveDependenciesIsTrue_PackageDependenciesAreRemoved ()
+ {
+ CreateAction ();
+ fakeProject.AddFakePackageToSourceRepository ("PackageId");
+ uninstallPackageHelper.RemoveDependencies = true;
+ uninstallPackageHelper.UninstallPackageById ("PackageId");
+
+ bool removeDependencies = fakeProject.RemoveDependenciesPassedToUninstallPackage;
+
+ Assert.IsTrue (removeDependencies);
+ }
+
+ [Test]
+ public void Execute_PackageIdSpecifiedAndForceRemoveIsTrue_PackageIsForcefullyRemoved ()
+ {
+ CreateAction ();
+ fakeProject.AddFakePackageToSourceRepository ("PackageId");
+ uninstallPackageHelper.ForceRemove = true;
+ uninstallPackageHelper.UninstallPackageById ("PackageId");
+
+ bool forceRemove = fakeProject.ForceRemovePassedToUninstallPackage;
+
+ Assert.IsTrue (forceRemove);
+ }
+
+ [Test]
+ public void Execute_PackageIdSpecifiedAndRemoveDependenciesIsTrue_PackageDependenciesAreRemoved ()
+ {
+ CreateAction ();
+ fakeProject.AddFakePackageToSourceRepository ("PackageId");
+ uninstallPackageHelper.RemoveDependencies = true;
+ uninstallPackageHelper.UninstallPackageById ("PackageId");
+
+ bool removeDependencies = fakeProject.RemoveDependenciesPassedToUninstallPackage;
+
+ Assert.IsTrue (removeDependencies);
+ }
+
+ [Test]
+ public void Execute_VersionSpecified_VersionUsedWhenSearchingForPackage ()
+ {
+ CreateAction ();
+
+ AddOnePackageToProjectSourceRepository ("PackageId", "1.2.0.0");
+ AddOnePackageToProjectSourceRepository ("PackageId", "1.0.0.0");
+ FakePackage package = AddOnePackageToProjectSourceRepository ("PackageId", "1.1.0");
+
+ uninstallPackageHelper.Version = package.Version;
+ uninstallPackageHelper.UninstallPackageById ("PackageId");
+
+ var actualPackage = fakeProject.PackagePassedToUninstallPackage;
+
+ Assert.AreEqual (package, actualPackage);
+ }
+
+ [Test]
+ public void ForceRemove_DefaultValue_ReturnsFalse ()
+ {
+ CreateAction ();
+ Assert.IsFalse (action.ForceRemove);
+ }
+
+ [Test]
+ public void RemoveDependencies_DefaultValue_ReturnsFalse ()
+ {
+ CreateAction ();
+ Assert.IsFalse (action.RemoveDependencies);
+ }
+
+ [Test]
+ public void HasPackageScriptsToRun_OnePackageInOperationsHasUninstallPowerShellScript_ReturnsTrue ()
+ {
+ CreateAction ();
+ AddFileToPackageBeingUninstalled (@"tools\uninstall.ps1");
+
+ bool hasPackageScripts = action.HasPackageScriptsToRun ();
+
+ Assert.IsTrue (hasPackageScripts);
+ }
+
+ [Test]
+ public void HasPackageScriptsToRun_OnePackageInOperationsHasNoFiles_ReturnsFalse ()
+ {
+ CreateAction ();
+ action.Package = new FakePackage ();
+
+ bool hasPackageScripts = action.HasPackageScriptsToRun ();
+
+ Assert.IsFalse (hasPackageScripts);
+ }
+
+ [Test]
+ public void HasPackageScriptsToRun_OnePackageInOperationsHasUninstallPowerShellScriptInUpperCase_ReturnsTrue ()
+ {
+ CreateAction ();
+ AddFileToPackageBeingUninstalled (@"tools\UNINSTALL.PS1");
+
+ bool hasPackageScripts = action.HasPackageScriptsToRun ();
+
+ Assert.IsTrue (hasPackageScripts);
+ }
+
+ [Test]
+ public void AllowPreleasePackages_DefaultValue_IsTrue ()
+ {
+ CreateAction ();
+
+ Assert.IsTrue (action.AllowPrereleaseVersions);
+ }
+
+ [Test]
+ public void Execute_PackageHasPowerShellUninstallScript_PowerShellWarningLogged ()
+ {
+ CreateAction ();
+ FakePackage package = FakePackage.CreatePackageWithVersion ("Test", "1.0");
+ action.Package = package;
+ package.AddFile (@"tools\uninstall.ps1");
+ string messageLogged = null;
+ packageManagementEvents.PackageOperationMessageLogged += (sender, e) => {
+ if (e.Message.Level == MessageLevel.Warning) {
+ messageLogged = e.Message.ToString ();
+ }
+ };
+
+ action.Execute ();
+
+ Assert.AreEqual ("Test Package contains PowerShell scripts which will not be run.", messageLogged);
+ }
+
+ [Test]
+ public void Execute_PackageHasPowerShellInstallScript_NoPowerShellWarningLogged ()
+ {
+ CreateAction ();
+ FakePackage package = FakePackage.CreatePackageWithVersion ("Test", "1.0");
+ action.Package = package;
+ package.AddFile (@"tools\install.ps1");
+ bool messageLogged = false;
+ packageManagementEvents.PackageOperationMessageLogged += (sender, e) => {
+ if (e.Message.Level == MessageLevel.Warning) {
+ messageLogged = true;
+ }
+ };
+
+ action.Execute ();
+
+ Assert.IsFalse (messageLogged);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UpdateAllPackagesInProjectTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UpdateAllPackagesInProjectTests.cs
new file mode 100644
index 0000000000..4d267ceeae
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UpdateAllPackagesInProjectTests.cs
@@ -0,0 +1,233 @@
+//
+// UpdateAllPackagesInProjectTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using ICSharpCode.PackageManagement;
+using NuGet;
+using NUnit.Framework;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class UpdateAllPackagesInProjectTests
+ {
+ UpdateAllPackagesInProject updateAllPackagesInProject;
+ FakePackageManagementProject fakeProject;
+ List<UpdatePackageAction> updateActions;
+
+ void CreateUpdateAllPackagesInProject ()
+ {
+ fakeProject = new FakePackageManagementProject ();
+ updateAllPackagesInProject = new UpdateAllPackagesInProject (fakeProject);
+ }
+
+ void AddPackageToProject (string packageId)
+ {
+ var package = new FakePackage (packageId, "1.0");
+ fakeProject.FakePackagesInReverseDependencyOrder.Add (package);
+ }
+
+ void CallCreateActions ()
+ {
+ IEnumerable<UpdatePackageAction> actions = updateAllPackagesInProject.CreateActions ();
+ updateActions = actions.ToList ();
+ }
+
+ UpdatePackageAction FirstUpdateAction {
+ get { return updateActions [0]; }
+ }
+
+ [Test]
+ public void CreateActions_OnePackageInProject_ReturnsOneAction ()
+ {
+ CreateUpdateAllPackagesInProject ();
+ AddPackageToProject ("Test");
+ CallCreateActions ();
+
+ Assert.AreEqual (1, updateActions.Count);
+ }
+
+ [Test]
+ public void CreateActions_OnePackageInProject_ActionCreatedFromProject ()
+ {
+ CreateUpdateAllPackagesInProject ();
+ AddPackageToProject ("Test");
+ CallCreateActions ();
+
+ UpdatePackageAction action = updateActions [0];
+ UpdatePackageAction expectedAction = fakeProject.FirstFakeUpdatePackageActionCreated;
+
+ Assert.AreEqual (expectedAction, action);
+ }
+
+ [Test]
+ public void CreateActions_OnePackageInProject_PackageIdSpecifiedInAction ()
+ {
+ CreateUpdateAllPackagesInProject ();
+ AddPackageToProject ("Test");
+ CallCreateActions ();
+
+ string id = FirstUpdateAction.PackageId;
+
+ Assert.AreEqual ("Test", id);
+ }
+
+ [Test]
+ public void CreateActions_OnePackageInProject_PackageVersionSpecifiedInActionIsNull ()
+ {
+ CreateUpdateAllPackagesInProject ();
+ AddPackageToProject ("Test");
+ CallCreateActions ();
+
+ SemanticVersion version = FirstUpdateAction.PackageVersion;
+
+ Assert.IsNull (version);
+ }
+
+ [Test]
+ public void CreateActions_NoPackagesInProject_ReturnsNoActions ()
+ {
+ CreateUpdateAllPackagesInProject ();
+ CallCreateActions ();
+
+ Assert.AreEqual (0, updateActions.Count);
+ }
+
+ [Test]
+ public void CreateActions_TwoPackagesInProject_TwoUpdateActionsCreated ()
+ {
+ CreateUpdateAllPackagesInProject ();
+ AddPackageToProject ("Test1");
+ AddPackageToProject ("Test2");
+ CallCreateActions ();
+
+ Assert.AreEqual (2, updateActions.Count);
+ }
+
+ [Test]
+ public void CreateActions_TwoPackagesInProject_TwoPackageIdsSpecifiedInActions ()
+ {
+ CreateUpdateAllPackagesInProject ();
+ AddPackageToProject ("Test1");
+ AddPackageToProject ("Test2");
+ CallCreateActions ();
+
+ Assert.AreEqual ("Test1", updateActions [0].PackageId);
+ Assert.AreEqual ("Test2", updateActions [1].PackageId);
+ }
+
+ [Test]
+ public void CreateActions_OnePackageInProject_UpdateIfPackageDoesNotExistInProjectIsFalse ()
+ {
+ CreateUpdateAllPackagesInProject ();
+ AddPackageToProject ("Test");
+ CallCreateActions ();
+
+ bool update = FirstUpdateAction.UpdateIfPackageDoesNotExistInProject;
+
+ Assert.IsFalse (update);
+ }
+
+ [Test]
+ public void CreateActions_OnePackageInProjectAndUpdateDependenciesSetToFalse_ActionUpdateDependenciesIsFalse ()
+ {
+ CreateUpdateAllPackagesInProject ();
+ AddPackageToProject ("Test");
+ updateAllPackagesInProject.UpdateDependencies = false;
+
+ CallCreateActions ();
+
+ bool update = FirstUpdateAction.UpdateDependencies;
+
+ Assert.IsFalse (update);
+ }
+
+ [Test]
+ public void UpdateDependencies_NewInstance_ReturnsTrue ()
+ {
+ CreateUpdateAllPackagesInProject ();
+ bool update = updateAllPackagesInProject.UpdateDependencies;
+
+ Assert.IsTrue (update);
+ }
+
+ [Test]
+ public void CreateActions_OnePackageInProjectAndAllowPrereleaseVersionsSetToFalse_ActionPrereleaseVersionsIsFalse ()
+ {
+ CreateUpdateAllPackagesInProject ();
+ AddPackageToProject ("Test");
+ updateAllPackagesInProject.AllowPrereleaseVersions = false;
+
+ CallCreateActions ();
+
+ bool allow = FirstUpdateAction.AllowPrereleaseVersions;
+
+ Assert.IsFalse (allow);
+ }
+
+ [Test]
+ public void CreateActions_OnePackageInProjectAndAllowPrereleaseVersionsSetToTrue_ActionPrereleaseVersionsIsTrue ()
+ {
+ CreateUpdateAllPackagesInProject ();
+ AddPackageToProject ("Test");
+ updateAllPackagesInProject.AllowPrereleaseVersions = true;
+
+ CallCreateActions ();
+
+ bool allow = FirstUpdateAction.AllowPrereleaseVersions;
+
+ Assert.IsTrue (allow);
+ }
+
+ [Test]
+ public void AllowPrereleaseVersions_NewInstance_ReturnsFalse ()
+ {
+ CreateUpdateAllPackagesInProject ();
+ bool allow = updateAllPackagesInProject.AllowPrereleaseVersions;
+
+ Assert.IsFalse (allow);
+ }
+
+ [Test]
+ public void CreateActions_OnePackageInProjectAndUpdateDependenciesSetToTrue_ActionUpdateDependenciesIsTrue ()
+ {
+ CreateUpdateAllPackagesInProject ();
+ AddPackageToProject ("Test");
+ updateAllPackagesInProject.UpdateDependencies = true;
+
+ CallCreateActions ();
+
+ bool update = FirstUpdateAction.UpdateDependencies;
+
+ Assert.IsTrue (update);
+ }
+ }
+}
+
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UpdateAllPackagesInSolutionTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UpdateAllPackagesInSolutionTests.cs
new file mode 100644
index 0000000000..1f0c499aea
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UpdateAllPackagesInSolutionTests.cs
@@ -0,0 +1,258 @@
+//
+// UpdateAllPackagesInSolutionTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using ICSharpCode.PackageManagement;
+using NuGet;
+using NUnit.Framework;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class UpdateAllPackagesInSolutionTests
+ {
+ UpdateAllPackagesInSolution updateAllPackagesInSolution;
+ FakePackageManagementSolution fakeSolution;
+ List<UpdatePackageAction> updateActions;
+ FakePackageRepository fakeSourceRepository;
+
+ void CreateUpdateAllPackagesInSolution ()
+ {
+ fakeSolution = new FakePackageManagementSolution ();
+ fakeSourceRepository = new FakePackageRepository ();
+ updateAllPackagesInSolution = new UpdateAllPackagesInSolution (fakeSolution, fakeSourceRepository);
+ }
+
+ void AddPackageToSolution (string packageId)
+ {
+ var package = new FakePackage (packageId, "1.0");
+ fakeSolution.FakePackagesInReverseDependencyOrder.Add (package);
+ }
+
+ FakePackageManagementProject AddProjectToSolution (string projectName)
+ {
+ return fakeSolution.AddFakeProject (projectName);
+ }
+
+ void CallCreateActions ()
+ {
+ IEnumerable<UpdatePackageAction> actions = updateAllPackagesInSolution.CreateActions ();
+ updateActions = actions.ToList ();
+ }
+
+ UpdatePackageAction FirstUpdateAction {
+ get { return updateActions [0]; }
+ }
+
+ FakePackageManagementProject FirstProjectInSolution {
+ get { return fakeSolution.FakeProjects [0]; }
+ }
+
+ [Test]
+ public void CreateActions_OnePackageInSolutionWithOneProject_ReturnsOneAction ()
+ {
+ CreateUpdateAllPackagesInSolution ();
+ AddProjectToSolution ("MyProject");
+ AddPackageToSolution ("Test");
+ CallCreateActions ();
+
+ Assert.AreEqual (1, updateActions.Count);
+ }
+
+ [Test]
+ public void CreateActions_OnePackageInSolutionWithOneProject_UpdateActionCreatedFromProject ()
+ {
+ CreateUpdateAllPackagesInSolution ();
+ AddProjectToSolution ("MyProject");
+ AddPackageToSolution ("Test");
+ CallCreateActions ();
+
+ UpdatePackageAction action = FirstUpdateAction;
+ UpdatePackageAction expectedAction = FirstProjectInSolution.FirstFakeUpdatePackageActionCreated;
+
+ Assert.AreEqual (expectedAction, action);
+ }
+
+ [Test]
+ public void CreateActions_OnePackageInSolutionWithOneProject_UpdateActionCreatedUsingSourceRepositoryPassedInConstructor ()
+ {
+ CreateUpdateAllPackagesInSolution ();
+ AddProjectToSolution ("MyProject");
+ AddPackageToSolution ("Test");
+ CallCreateActions ();
+
+ IPackageRepository repository = fakeSolution.SourceRepositoryPassedToGetProjects;
+ FakePackageRepository expectedRepository = fakeSourceRepository;
+
+ Assert.AreEqual (expectedRepository, repository);
+ }
+
+ [Test]
+ public void CreateActions_NoPackagesInSolution_NoActionsReturned ()
+ {
+ CreateUpdateAllPackagesInSolution ();
+ CallCreateActions ();
+
+ Assert.AreEqual (0, updateActions.Count);
+ }
+
+ [Test]
+ public void CreateActions_TwoPackagesInSolutionWithOneProject_ReturnsTwoActions ()
+ {
+ CreateUpdateAllPackagesInSolution ();
+ AddProjectToSolution ("MyProject");
+ AddPackageToSolution ("Test1");
+ AddPackageToSolution ("Test2");
+ CallCreateActions ();
+
+ Assert.AreEqual (2, updateActions.Count);
+ }
+
+ [Test]
+ public void CreateActions_TwoPackagesInSolutionWithOneProject_ReturnsTwoActionsWithPackageIdsForTwoPackages ()
+ {
+ CreateUpdateAllPackagesInSolution ();
+ FakePackageManagementProject project = AddProjectToSolution ("MyProject");
+ AddPackageToSolution ("Test1");
+ AddPackageToSolution ("Test2");
+ CallCreateActions ();
+
+ string[] packageIds = new string[] {
+ project.FirstFakeUpdatePackageActionCreated.PackageId,
+ project.SecondFakeUpdatePackageActionCreated.PackageId
+ };
+
+ string[] expectedPackageIds = new string[] {
+ "Test1",
+ "Test2"
+ };
+
+ Assert.AreEqual (expectedPackageIds, packageIds);
+ }
+
+ [Test]
+ public void CreateActions_OnePackageInSolutionWithTwoProjects_ReturnsTwoActions ()
+ {
+ CreateUpdateAllPackagesInSolution ();
+ AddProjectToSolution ("MyProject1");
+ AddProjectToSolution ("MyProject2");
+ AddPackageToSolution ("Test");
+ CallCreateActions ();
+
+ Assert.AreEqual (2, updateActions.Count);
+ }
+
+ [Test]
+ public void CreateActions_OnePackageInSolutionWithTwoProjects_ReturnsTwoActionsCreatedFromProjects ()
+ {
+ CreateUpdateAllPackagesInSolution ();
+ FakePackageManagementProject project1 = AddProjectToSolution ("MyProject1");
+ FakePackageManagementProject project2 = AddProjectToSolution ("MyProject2");
+ AddPackageToSolution ("Test");
+ CallCreateActions ();
+
+ var expectedActions = new UpdatePackageAction[] {
+ project1.FirstFakeUpdatePackageActionCreated,
+ project2.FirstFakeUpdatePackageActionCreated
+ };
+
+ Assert.AreEqual (expectedActions, updateActions);
+ }
+
+ [Test]
+ public void CreateActions_OnePackageInSolutionWithOneProject_UpdateActionDoesNotUpdatePackageIfProjectDoesNotHavePackage ()
+ {
+ CreateUpdateAllPackagesInSolution ();
+ AddProjectToSolution ("MyProject");
+ AddPackageToSolution ("Test");
+ CallCreateActions ();
+
+ bool updateIfPackageDoesNotExist = FirstUpdateAction.UpdateIfPackageDoesNotExistInProject;
+
+ Assert.IsFalse (updateIfPackageDoesNotExist);
+ }
+
+ [Test]
+ public void CreateActions_OnePackageInSolutionWithOneProjectAndUpdateDependenciesIsFalse_UpdateActionDoesNotUpdateDependencies ()
+ {
+ CreateUpdateAllPackagesInSolution ();
+ AddProjectToSolution ("MyProject");
+ AddPackageToSolution ("Test");
+ updateAllPackagesInSolution.UpdateDependencies = false;
+ CallCreateActions ();
+
+ bool updateDependencies = FirstUpdateAction.UpdateDependencies;
+
+ Assert.IsFalse (updateDependencies);
+ }
+
+ [Test]
+ public void CreateActions_OnePackageInSolutionWithOneProjectAndUpdateDependenciesIsTrue_UpdateActionDoesUpdateDependencies ()
+ {
+ CreateUpdateAllPackagesInSolution ();
+ AddProjectToSolution ("MyProject");
+ AddPackageToSolution ("Test");
+ updateAllPackagesInSolution.UpdateDependencies = true;
+ CallCreateActions ();
+
+ bool updateDependencies = FirstUpdateAction.UpdateDependencies;
+
+ Assert.IsTrue (updateDependencies);
+ }
+
+ [Test]
+ public void CreateActions_OnePackageInSolutionWithOneProjectAndAllowPrereleaseVersionsIsFalse_UpdateActionDoesNotAllowPrereleases ()
+ {
+ CreateUpdateAllPackagesInSolution ();
+ AddProjectToSolution ("MyProject");
+ AddPackageToSolution ("Test");
+ updateAllPackagesInSolution.AllowPrereleaseVersions = false;
+ CallCreateActions ();
+
+ bool allowPrereleases = FirstUpdateAction.AllowPrereleaseVersions;
+
+ Assert.IsFalse (allowPrereleases);
+ }
+
+ [Test]
+ public void CreateActions_OnePackageInSolutionWithOneProjectAndAllowPrereleaseVersionsIsTrue_UpdateActionDoesAllowPrereleases ()
+ {
+ CreateUpdateAllPackagesInSolution ();
+ AddProjectToSolution ("MyProject");
+ AddPackageToSolution ("Test");
+ updateAllPackagesInSolution.AllowPrereleaseVersions = true;
+ CallCreateActions ();
+
+ bool allowPrereleases = FirstUpdateAction.AllowPrereleaseVersions;
+
+ Assert.IsTrue (allowPrereleases);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UpdatePackageActionTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UpdatePackageActionTests.cs
new file mode 100644
index 0000000000..b1da8e5976
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UpdatePackageActionTests.cs
@@ -0,0 +1,371 @@
+//
+// UpdatePackageActionTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.PackageManagement;
+using NuGet;
+using NUnit.Framework;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class UpdatePackageActionTests
+ {
+ UpdatePackageAction action;
+ PackageManagementEvents packageManagementEvents;
+ FakePackageManagementProject fakeProject;
+ UpdatePackageHelper updatePackageHelper;
+
+ void CreateSolution ()
+ {
+ packageManagementEvents = new PackageManagementEvents ();
+ fakeProject = new FakePackageManagementProject ();
+ action = new UpdatePackageAction (fakeProject, packageManagementEvents);
+ updatePackageHelper = new UpdatePackageHelper (action);
+ }
+
+ void AddInstallOperationWithFile (string fileName)
+ {
+ var package = new FakePackage ();
+ package.AddFile (fileName);
+
+ var operation = new PackageOperation (package, PackageAction.Install);
+ var operations = new List<PackageOperation> ();
+ operations.Add (operation);
+
+ action.Operations = operations;
+ }
+
+ [Test]
+ public void Execute_PackageAndRepositoryPassed_PackageIsUpdated ()
+ {
+ CreateSolution ();
+ updatePackageHelper.UpdateTestPackage ();
+
+ FakePackage expectedPackage = updatePackageHelper.TestPackage;
+ IPackage actualPackage = fakeProject.PackagePassedToUpdatePackage;
+
+ Assert.AreEqual (expectedPackage, actualPackage);
+ }
+
+ [Test]
+ public void UpdateDependencies_DefaultValue_ReturnsTrue ()
+ {
+ CreateSolution ();
+ Assert.IsTrue (action.UpdateDependencies);
+ }
+
+ [Test]
+ public void AllowPrereleaseVersions_DefaultValue_ReturnsFalse ()
+ {
+ CreateSolution ();
+ Assert.IsFalse (action.AllowPrereleaseVersions);
+ }
+
+ [Test]
+ public void Execute_PackageAndRepositoryPassed_PackageOperationsUsedToUpdatePackage ()
+ {
+ CreateSolution ();
+ updatePackageHelper.UpdateTestPackage ();
+
+ IEnumerable<PackageOperation> expectedOperations = updatePackageHelper.PackageOperations;
+ IEnumerable<PackageOperation> actualOperations = fakeProject.PackageOperationsPassedToUpdatePackage;
+
+ Assert.AreEqual (expectedOperations, actualOperations);
+ }
+
+ [Test]
+ public void Execute_PackageAndRepositoryPassed_DependenciesUpdated ()
+ {
+ CreateSolution ();
+ updatePackageHelper.UpdateDependencies = true;
+ updatePackageHelper.UpdateTestPackage ();
+
+ bool result = fakeProject.UpdateDependenciesPassedToUpdatePackage;
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void Execute_PackageAndRepositoryPassed_PrereleaseVersionsNotAllowed ()
+ {
+ CreateSolution ();
+ updatePackageHelper.AllowPrereleaseVersions = false;
+ updatePackageHelper.UpdateTestPackage ();
+
+ bool result = fakeProject.AllowPrereleaseVersionsPassedToUpdatePackage;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void Execute_PackageAndRepositoryPassedAndAllowPrereleaseVersions_PrereleaseVersionsAllowed ()
+ {
+ CreateSolution ();
+ updatePackageHelper.AllowPrereleaseVersions = true;
+ updatePackageHelper.UpdateTestPackage ();
+
+ bool result = fakeProject.AllowPrereleaseVersionsPassedToUpdatePackage;
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void Execute_PackageAndRepositoryPassedAndUpdateDependenciesIsFalse_DependenciesNotUpdated ()
+ {
+ CreateSolution ();
+ updatePackageHelper.UpdateDependencies = false;
+ updatePackageHelper.UpdateTestPackage ();
+
+ bool result = fakeProject.UpdateDependenciesPassedToUpdatePackage;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void Execute_PackageAndRepositoryPassed_PackageInstalledEventIsFired ()
+ {
+ CreateSolution ();
+ IPackage actualPackage = null;
+ packageManagementEvents.ParentPackageInstalled += (sender, e) => {
+ actualPackage = e.Package;
+ };
+ updatePackageHelper.UpdateTestPackage ();
+
+ FakePackage expectedPackage = updatePackageHelper.TestPackage;
+ Assert.AreEqual (expectedPackage, actualPackage);
+ }
+
+ [Test]
+ public void Execute_PackagePassedButNoPackageOperations_PackageOperationsRetrievedFromProject ()
+ {
+ CreateSolution ();
+ updatePackageHelper.PackageOperations = null;
+ updatePackageHelper.UpdateTestPackage ();
+
+ IEnumerable<PackageOperation> actualOperations = action.Operations;
+ List<FakePackageOperation> expectedOperations = fakeProject.FakeInstallOperations;
+
+ Assert.AreEqual (expectedOperations, actualOperations);
+ }
+
+ [Test]
+ public void Execute_PackagePassedButNoPackageOperations_PackageOperationsCreatedForPackage ()
+ {
+ CreateSolution ();
+ updatePackageHelper.PackageOperations = null;
+ updatePackageHelper.UpdateTestPackage ();
+
+ var expectedPackage = updatePackageHelper.TestPackage;
+ var actualPackage = fakeProject.PackagePassedToGetInstallPackageOperations;
+
+ Assert.AreEqual (expectedPackage, actualPackage);
+ }
+
+ [Test]
+ public void Execute_PackageIdAndSourceAndProjectPassedAndUpdateDependenciesIsTrue_DependenciesUpdatedWhenUpdatingPackage ()
+ {
+ CreateSolution ();
+ fakeProject.AddFakePackageToSourceRepository ("PackageId");
+ updatePackageHelper.UpdateDependencies = true;
+ updatePackageHelper.UpdatePackageById ("PackageId");
+
+ bool result = fakeProject.UpdateDependenciesPassedToUpdatePackage;
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void Execute_PackageIdAndSourceAndProjectPassedAndUpdateDependenciesIsFalse_DependenciesNotUpdatedWhenGettingPackageOperations ()
+ {
+ CreateSolution ();
+ fakeProject.AddFakePackageToSourceRepository ("PackageId");
+ updatePackageHelper.UpdateDependencies = false;
+ updatePackageHelper.UpdatePackageById ("PackageId");
+
+ bool result = fakeProject.UpdateDependenciesPassedToUpdatePackage;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void Execute_UpdatedDepdenciesIsFalseAndNoPackageOperations_DependenciesIgnoredWhenGettingPackageOperations ()
+ {
+ CreateSolution ();
+ fakeProject.AddFakePackageToSourceRepository ("PackageId");
+ updatePackageHelper.UpdateDependencies = false;
+ updatePackageHelper.UpdatePackageById ("PackageId");
+
+ bool result = fakeProject.IgnoreDependenciesPassedToGetInstallPackageOperations;
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void Execute_UpdateDependenciesIsTrueAndNoPackageOperations_DependenciesNotIgnoredWhenGettingPackageOperations ()
+ {
+ CreateSolution ();
+ fakeProject.AddFakePackageToSourceRepository ("PackageId");
+ updatePackageHelper.UpdateDependencies = true;
+ updatePackageHelper.UpdatePackageById ("PackageId");
+
+ bool result = fakeProject.IgnoreDependenciesPassedToGetInstallPackageOperations;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void Execute_AllowPrereleaseVersionsIsFalseAndNoPackageOperations_PrereleaseVersionsNotAllowedWhenGettingPackageOperations ()
+ {
+ CreateSolution ();
+ fakeProject.AddFakePackageToSourceRepository ("PackageId");
+ updatePackageHelper.AllowPrereleaseVersions = false;
+ updatePackageHelper.UpdatePackageById ("PackageId");
+
+ bool result = fakeProject.AllowPrereleaseVersionsPassedToGetInstallPackageOperations;
+
+ Assert.IsFalse (result);
+ }
+
+ [Test]
+ public void Execute_AllowPrereleaseVersionsIsTrueAndNoPackageOperations_PrereleaseVersionsAllowedWhenGettingPackageOperations ()
+ {
+ CreateSolution ();
+ fakeProject.AddFakePackageToSourceRepository ("PackageId");
+ updatePackageHelper.AllowPrereleaseVersions = true;
+ updatePackageHelper.UpdatePackageById ("PackageId");
+
+ bool result = fakeProject.AllowPrereleaseVersionsPassedToGetInstallPackageOperations;
+
+ Assert.IsTrue (result);
+ }
+
+ [Test]
+ public void Execute_PackageAndPackageOperationsSet_OperationsNotRetrievedFromPackageManager ()
+ {
+ CreateSolution ();
+ updatePackageHelper.UpdateTestPackage ();
+
+ IPackage actualPackage = fakeProject.PackagePassedToGetInstallPackageOperations;
+
+ Assert.IsNull (actualPackage);
+ }
+
+ [Test]
+ public void HasPackageScriptsToRun_OnePackageInOperationsHasInitPowerShellScript_ReturnsTrue ()
+ {
+ CreateSolution ();
+ fakeProject.AddFakePackageToSourceRepository ("Test");
+ action.PackageId = "Test";
+ AddInstallOperationWithFile (@"tools\init.ps1");
+
+ bool hasPackageScripts = action.HasPackageScriptsToRun ();
+
+ Assert.IsTrue (hasPackageScripts);
+ }
+
+ [Test]
+ public void HasPackageScriptsToRun_OnePackageInOperationsHasNoFiles_ReturnsFalse ()
+ {
+ CreateSolution ();
+ fakeProject.AddFakePackageToSourceRepository ("Test");
+ action.PackageId = "Test";
+ action.Operations = new List<PackageOperation> ();
+
+ bool hasPackageScripts = action.HasPackageScriptsToRun ();
+
+ Assert.IsFalse (hasPackageScripts);
+ }
+
+ [Test]
+ public void UpdateIfPackageDoesNotExistInProject_NewUpdateActionInstanceCreate_ReturnsTrue ()
+ {
+ CreateSolution ();
+ bool update = action.UpdateIfPackageDoesNotExistInProject;
+
+ Assert.IsTrue (update);
+ }
+
+ [Test]
+ public void Execute_UpdateIfPackageDoesNotExistInProjectSetToFalseAndPackageDoesNotExistInProject_PackageIsNotUpdated ()
+ {
+ CreateSolution ();
+ action.Package = new FakePackage ("Test");
+ action.UpdateIfPackageDoesNotExistInProject = false;
+ action.Execute ();
+
+ bool updated = fakeProject.IsUpdatePackageCalled;
+
+ Assert.IsFalse (updated);
+ }
+
+ [Test]
+ public void Execute_UpdateIfPackageDoesNotExistInProjectSetToFalseAndPackageDoesNotExistInProject_PackageInstalledEventIsNotFired ()
+ {
+ CreateSolution ();
+ bool updated = false;
+ packageManagementEvents.ParentPackageInstalled += (sender, e) => updated = true;
+ action.UpdateIfPackageDoesNotExistInProject = false;
+
+ updatePackageHelper.UpdateTestPackage ();
+
+ Assert.IsFalse (updated);
+ }
+
+ [Test]
+ public void Execute_UpdateIfPackageDoesNotExistInProjectSetToFalseAndPackageExistsInProject_PackageIsUpdated ()
+ {
+ CreateSolution ();
+ action.UpdateIfPackageDoesNotExistInProject = false;
+ action.PackageId = "Test";
+ FakePackage expectedPackage = fakeProject.FakeSourceRepository.AddFakePackageWithVersion ("Test", "1.1");
+ fakeProject.FakePackages.Add (new FakePackage ("Test", "1.0"));
+ action.Execute ();
+
+ IPackage actualPackage = fakeProject.PackagePassedToUpdatePackage;
+
+ Assert.AreEqual (expectedPackage, actualPackage);
+ }
+
+ [Test]
+ public void Execute_PackagePassedAndUpdateIfPackageDoesNotExistInProjectSetToFalseAndPackageExistsInProject_PackageIsUpdated ()
+ {
+ CreateSolution ();
+ action.UpdateIfPackageDoesNotExistInProject = false;
+ var expectedPackage = new FakePackage ("Test");
+ action.Package = expectedPackage;
+ fakeProject.FakePackages.Add (new FakePackage ("Test", "1.0"));
+ action.Execute ();
+
+ IPackage actualPackage = fakeProject.PackagePassedToUpdatePackage;
+
+ Assert.AreEqual (expectedPackage, actualPackage);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UserAgentGeneratorForRepositoryRequestsTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UserAgentGeneratorForRepositoryRequestsTests.cs
new file mode 100644
index 0000000000..6a729abaa7
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UserAgentGeneratorForRepositoryRequestsTests.cs
@@ -0,0 +1,106 @@
+//
+// UserAgentGeneratorForRepositoryRequestsTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Net;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.Core;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class UserAgentGeneratorForRepositoryRequestsTests
+ {
+ UserAgentGeneratorForRepositoryRequests generator;
+
+ FakePackageRepositoryFactoryEvents repositoryFactoryEvents;
+
+ void CreateGenerator ()
+ {
+ repositoryFactoryEvents = new FakePackageRepositoryFactoryEvents ();
+ generator = new UserAgentGeneratorForRepositoryRequests ();
+ generator.Register (repositoryFactoryEvents);
+ }
+
+ IPackageRepository CreatePackageRepository ()
+ {
+ return new FakePackageRepository ();
+ }
+
+ FakePackageRepositoryWithHttpClientEvents CreatePackageRepositoryThatImplementsIHttpClientEvents ()
+ {
+ return new FakePackageRepositoryWithHttpClientEvents ();
+ }
+
+ void FireRepositoryCreatedEvent (FakePackageRepositoryWithHttpClientEvents clientEvents)
+ {
+ FireRepositoryCreatedEvent (clientEvents as IPackageRepository);
+ }
+
+ void FireRepositoryCreatedEvent (IPackageRepository repository)
+ {
+ var eventArgs = new PackageRepositoryFactoryEventArgs (repository);
+ repositoryFactoryEvents.RaiseRepositoryCreatedEvent (eventArgs);
+ }
+
+ WebRequest FireSendingRequestEvent (FakePackageRepositoryWithHttpClientEvents clientEvents)
+ {
+ var request = new FakeWebRequest ();
+ request.Headers = new WebHeaderCollection ();
+
+ var eventArgs = new WebRequestEventArgs (request);
+ clientEvents.RaiseSendingRequestEvent (eventArgs);
+
+ return request;
+ }
+
+ [Test]
+ public void SendingRequest_UserAgentGeneration_UserAgentSetOnRequest ()
+ {
+ CreateGenerator ();
+ var clientEvents = CreatePackageRepositoryThatImplementsIHttpClientEvents ();
+ FireRepositoryCreatedEvent (clientEvents);
+
+ WebRequest request = FireSendingRequestEvent (clientEvents);
+
+ string userAgent = request.Headers [HttpRequestHeader.UserAgent];
+ Assert.IsTrue (userAgent.StartsWith (BrandingService.ApplicationName), userAgent);
+ }
+
+ [Test]
+ public void RepositoryCreated_RepositoryDoesNotImplementIHttpClientEvents_NullReferenceExceptionNotThrown ()
+ {
+ CreateGenerator ();
+ IPackageRepository repository = CreatePackageRepository ();
+
+ FireRepositoryCreatedEvent (repository);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/ViewModelBaseTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/ViewModelBaseTests.cs
new file mode 100644
index 0000000000..ba42df1a92
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/ViewModelBaseTests.cs
@@ -0,0 +1,71 @@
+//
+// ViewModelBaseTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class ViewModelBaseTests
+ {
+ TestableViewModelBase viewModel;
+
+ void CreateTestableViewModel ()
+ {
+ viewModel = new TestableViewModelBase ();
+ }
+
+ [Test]
+ public void PropertyChangedFor_PropertySpecified_ReturnsPropertyName ()
+ {
+ CreateTestableViewModel ();
+ string name = viewModel.PropertyChangedFor (m => m.MyProperty);
+
+ Assert.AreEqual ("MyProperty", name);
+ }
+
+ [Test]
+ public void PropertyChangedFor_TypeSpecified_ReturnsEmptyString ()
+ {
+ CreateTestableViewModel ();
+ string name = viewModel.PropertyChangedFor (m => m);
+
+ Assert.AreEqual (String.Empty, name);
+ }
+
+ [Test]
+ public void PropertyChangedFor_MethodSpecified_ReturnsEmptyString ()
+ {
+ CreateTestableViewModel ();
+ string name = viewModel.PropertyChangedFor (m => m.ToString ());
+
+ Assert.AreEqual (String.Empty, name);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/WildcardVersionSpecTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/WildcardVersionSpecTests.cs
new file mode 100644
index 0000000000..d57e6fb1e5
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/WildcardVersionSpecTests.cs
@@ -0,0 +1,79 @@
+//
+// WildCardVersionSpecTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class WildcardVersionSpecTests
+ {
+ WildcardVersionSpec versionSpec;
+
+ void CreateWildcardVersionSpec (string version)
+ {
+ versionSpec = new WildcardVersionSpec (version);
+ }
+
+ [TestCase ("1.0", "1.0", true)]
+ [TestCase ("1.0", "1.1", false)]
+ [TestCase ("1", "1.0", true)]
+ [TestCase ("1*", "1.1", true)]
+ [TestCase ("1", "1.9.1", true)]
+ [TestCase ("1", "1.10.1", true)]
+ [TestCase ("1", "1.10.1-alpha", true)]
+ [TestCase ("1", "2.0", false)]
+ [TestCase ("*", "1.10.1", true)]
+ [TestCase ("1.1", "1.9.1", false)]
+ [TestCase ("1.1", "1.1.1", true)]
+ [TestCase ("1.1", "1.1.0", true)]
+ [TestCase ("1.1", "1.0.0", false)]
+ [TestCase ("1.1", "2.0.0", false)]
+ [TestCase ("1.1.1", "1.9.1", false)]
+ [TestCase ("1.1.1", "1.1.1", true)]
+ [TestCase ("1.1.1", "1.1.1.1", true)]
+ [TestCase ("1.1.1", "1.1.1.0", true)]
+ [TestCase ("1.1.1", "1.1.1.0-alpha1", true)]
+ [TestCase ("1.1.1", "1.0.0", false)]
+ [TestCase ("1.1.1", "1.1.2.0", false)]
+ [TestCase ("1.1.1.1", "1.1.1.1", true)]
+ [TestCase ("1.1.1.1", "1.1.1.2", false)]
+ [TestCase ("1.1.0", "1.1.1", false)]
+ [TestCase ("1.1.1.0-alpha1", "1.1.1.0-alpha1", true)]
+ [TestCase ("1.1.1.0-alpha1", "1.1.1.0-alpha2", false)]
+ public void VersionSatisfiesWildcardVersionSpec (string wildcard, string versionToMatch, bool expectedResult)
+ {
+ CreateWildcardVersionSpec (wildcard);
+
+ bool result = versionSpec.Satisfies (new SemanticVersion (versionToMatch));
+
+ Assert.AreEqual (expectedResult, result);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/XmlDocumentTransformTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/XmlDocumentTransformTests.cs
new file mode 100644
index 0000000000..f5e0d70c6f
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/XmlDocumentTransformTests.cs
@@ -0,0 +1,147 @@
+//
+// XmlDocumentTransformTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Xml;
+using NUnit.Framework;
+using Microsoft.Web.XmlTransform;
+using System.IO;
+using System.Text;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ /// <summary>
+ /// Tests that patches applied to Microsoft's XML Document Transformation (XDT)
+ /// library for Mono issues are working.
+ /// </summary>
+ [TestFixture]
+ public class XmlDocumentTransformTests
+ {
+ string RunTransform (string input, string xdt)
+ {
+ using (var transformation = new XmlTransformation (xdt, isTransformAFile: false, logger: null)) {
+ using (var document = new XmlTransformableDocument ()) {
+ document.PreserveWhitespace = true;
+
+ document.Load (new StringReader (input));
+
+ bool succeeded = transformation.Apply(document);
+ if (succeeded) {
+ var writer = new StringWriter ();
+ document.Save (writer);
+ return writer.ToString ();
+ }
+ return null;
+ }
+ }
+ }
+
+ /// <summary>
+ /// XDT change:
+ ///
+ /// https://github.com/mrward/xdt/commit/b2c3b5383d589c3f79650a0cab93f88a8741b057
+ /// </summary>
+ [Test]
+ public void RemoveTransformShouldRemoveExistingXmlElements ()
+ {
+ string input =
+@"<?xml version=""1.0"" encoding=""utf-8""?>
+<configuration>
+ <runtime>
+ <assemblyBinding xmlns=""urn:schemas-microsoft-com:asm.v1"">
+ <dependentAssembly>
+ <assemblyIdentity name=""System.Web.WebPages"" publicKeyToken=""31bf3856ad364e35""/>
+ <bindingRedirect oldVersion=""0.0.0.0-0.0.0.0"" newVersion=""0.0.0.0""/>
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration>
+";
+
+ string xdt =
+@"<?xml version=""1.0"" encoding=""utf-8""?>
+<configuration xmlns:xdt=""http://schemas.microsoft.com/XML-Document-Transform"">
+ <runtime>
+ <assemblyBinding xmlns=""urn:schemas-microsoft-com:asm.v1"">
+ <dependentAssembly xdt:Transform=""Remove""
+ xdt:Locator=""Condition(./_defaultNamespace:assemblyIdentity/@name='System.Web.WebPages')"" >
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration>";
+
+ string output = RunTransform (input, xdt);
+
+ Assert.IsFalse (output.Contains ("WebPages"), output);
+
+ // Sanity check that the transform is returning something.
+ Assert.IsTrue (output.Contains ("assemblyBinding"), output);
+ }
+
+ /// <summary>
+ /// XDT change:
+ ///
+ /// https://github.com/mrward/xdt/commit/9ae2e113dc4140fa7da853436f42547795cfebb5
+ /// </summary>
+ [Test]
+ public void SetAttributesTransformShouldSetAttribute ()
+ {
+ string input =
+@"<?xml version=""1.0"" encoding=""utf-8""?>
+<configuration>
+ <connectionStrings>
+ <!-- Example connection to a SQL Server Database on localhost. -->
+ <add name=""MyDB""
+ connectionString=""""
+ providerName=""System.Data.SqlClient""/>
+ </connectionStrings>
+ <appSettings>
+ <add key=""Setting1"" value=""Very""/>
+ <add key=""Setting2"" value=""Easy""/>
+ </appSettings>
+</configuration>
+";
+
+ string xdt =
+@"<?xml version=""1.0""?>
+<configuration xmlns:xdt=""http://schemas.microsoft.com/XML-Document-Transform"">
+ <connectionStrings>
+ <add name=""MyDB""
+ connectionString=""value for the deployed Web.config file""
+ xdt:Transform=""SetAttributes"" xdt:Locator=""Match(name)""/>
+ <add name=""AWLT"" connectionString=""newstring""
+ providerName=""newprovider""
+ xdt:Transform=""Insert"" />
+ </connectionStrings>
+</configuration>";
+
+ string output = RunTransform (input, xdt);
+
+ Assert.IsTrue (output.Contains ("deployed Web.config file"), output);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.addin.xml b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.addin.xml
index eb63e3f1ea..cd25f7298d 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.addin.xml
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.addin.xml
@@ -89,22 +89,16 @@
</Extension>
<Extension path="/MonoDevelop/Core/StockIcons">
- <StockIcon stockid="md-nuget-package" resource="packageicon.png" />
- <StockIcon stockid="md-nuget-package-source" resource="PackageSourceIcon.png" size="Dnd" />
+ <StockIcon stockid="md-nuget-package" resource="reference-light-48.png" />
+ <StockIcon stockid="md-nuget-package-source" resource="package-source-light-32.png" size="Dnd" />
+ <StockIcon stockid="md-prefs-package" resource="prefs-package-light-16.png" size="Menu" />
+ <StockIcon stockid="md-prefs-package-source" resource="prefs-package-source-light-16.png" size="Menu" />
</Extension>
<Extension path="/MonoDevelop/Ide/GlobalOptionsDialog">
<Section id="NuGetPackageManagement" _label="Packages">
- <Section
- id="General"
- _label="General"
- fill="true"
- class="MonoDevelop.PackageManagement.Gui.PackageManagementOptionsPanel" />
- <Section
- id="PackageSources"
- _label="Sources"
- fill="true"
- class="MonoDevelop.PackageManagement.Gui.PackageSourcesOptionsPanel" />
+ <Section id="General" _label="General" fill="true" class="MonoDevelop.PackageManagement.Gui.PackageManagementOptionsPanel" icon="md-prefs-package" />
+ <Section id="PackageSources" _label="Sources" fill="true" class="MonoDevelop.PackageManagement.Gui.PackageSourcesOptionsPanel" icon="md-prefs-package-source" />
</Section>
</Extension>
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.csproj b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.csproj
index d9e42184b0..c8a981a11a 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.csproj
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.csproj
@@ -58,6 +58,7 @@
<HintPath>..\..\..\external\nuget-binary\NuGet.Core.dll</HintPath>
</Reference>
<Reference Include="Mono.Cairo" />
+ <Reference Include="System.Security" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
@@ -125,7 +126,6 @@
<Compile Include="MonoDevelop.PackageManagement\LicenseAcceptanceService.cs" />
<Compile Include="MonoDevelop.PackageManagement\LicenseAcceptanceViewModel.cs" />
<Compile Include="MonoDevelop.PackageManagement\MachinePackageCache.cs" />
- <Compile Include="MonoDevelop.PackageManagement\ManagePackagesUserPrompts.cs" />
<Compile Include="MonoDevelop.PackageManagement\ManagePackagesViewModel.cs" />
<Compile Include="MonoDevelop.PackageManagement\ManagePackagesViewTitle.cs" />
<Compile Include="MonoDevelop.PackageManagement\MonoDevelopCredentialProvider.cs" />
@@ -311,19 +311,55 @@
<Compile Include="MonoDevelop.PackageManagement\PackageListViewTextFormatter.cs" />
<Compile Include="MonoDevelop.PackageManagement.Gui\PackageCellViewCheckBox.cs" />
<Compile Include="MonoDevelop.PackageManagement\PackagesForSelectedPageQuery.cs" />
+ <Compile Include="MonoDevelop.PackageManagement\PackageManagementProgressProvider.cs" />
+ <Compile Include="MonoDevelop.PackageManagement\PackageManagementProgressMonitor.cs" />
+ <Compile Include="MonoDevelop.PackageManagement\ISolution.cs" />
+ <Compile Include="MonoDevelop.PackageManagement\IProject.cs" />
+ <Compile Include="MonoDevelop.PackageManagement\ProjectProxy.cs" />
+ <Compile Include="MonoDevelop.PackageManagement\SolutionProxy.cs" />
+ <Compile Include="MonoDevelop.PackageManagement\IDotNetProject.cs" />
+ <Compile Include="MonoDevelop.PackageManagement\DotNetProjectProxy.cs" />
+ <Compile Include="MonoDevelop.PackageManagement\ISettingsProvider.cs" />
+ <Compile Include="MonoDevelop.PackageManagement\SettingsProvider.cs" />
+ <Compile Include="MonoDevelop.PackageManagement\PackageSearchCriteria.cs" />
+ <Compile Include="MonoDevelop.PackageManagement\WildcardVersionSpec.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="MonoDevelop.PackageManagement.addin.xml" />
<EmbeddedResource Include="gtk-gui\gui.stetic">
<LogicalName>gui.stetic</LogicalName>
</EmbeddedResource>
- <EmbeddedResource Include="icons\PackageSourceIcon.png">
- <LogicalName>PackageSourceIcon.png</LogicalName>
+ <EmbeddedResource Include="icons\light\package-source-32.png">
+ <LogicalName>package-source-light-32.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\package-source-32%402x.png">
+ <LogicalName>package-source-light-32@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-package-16.png">
+ <LogicalName>prefs-package-light-16.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-package-16%402x.png">
+ <LogicalName>prefs-package-light-16@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-package-source-16.png">
+ <LogicalName>prefs-package-source-light-16.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-package-source-16%402x.png">
+ <LogicalName>prefs-package-source-light-16@2x.png</LogicalName>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
- <EmbeddedResource Include="icons\packageicon.png">
- <LogicalName>packageicon.png</LogicalName>
+ <EmbeddedResource Include="icons\dark\reference-48.png">
+ <LogicalName>reference-dark-48.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\dark\reference-48%402x.png">
+ <LogicalName>reference-dark-48@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\reference-48.png">
+ <LogicalName>reference-light-48.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\reference-48%402x.png">
+ <LogicalName>reference-light-48@2x.png</LogicalName>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/AvailablePackagesViewModel.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/AvailablePackagesViewModel.cs
index 635fdb7ff7..bfe93e3fbf 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/AvailablePackagesViewModel.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/AvailablePackagesViewModel.cs
@@ -30,6 +30,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
+using MonoDevelop.PackageManagement;
using NuGet;
namespace ICSharpCode.PackageManagement
@@ -59,51 +60,69 @@ namespace ICSharpCode.PackageManagement
try {
repository = RegisteredPackageRepositories.ActiveRepository;
} catch (Exception ex) {
+ repository = null;
errorMessage = ex.Message;
}
}
-
- protected override IQueryable<IPackage> GetPackages(string search)
+
+ protected override IQueryable<IPackage> GetPackages (PackageSearchCriteria search)
{
if (repository == null) {
- throw new ApplicationException(errorMessage);
+ throw new ApplicationException (errorMessage);
}
+
+ if (search.IsPackageVersionSearch) {
+ return repository
+ .FindPackagesById (search.PackageId)
+ .Where (package => IncludePrerelease || package.IsReleaseVersion ())
+ .AsQueryable ();
+ }
+
if (IncludePrerelease) {
return repository
- .Search (search, new string[0], IncludePrerelease)
+ .Search (search.SearchText, new string[0], IncludePrerelease)
.Where (package => package.IsAbsoluteLatestVersion);
}
return repository
- .Search (search, new string[0], IncludePrerelease)
+ .Search (search.SearchText, new string[0], IncludePrerelease)
.Where (package => package.IsLatestVersion);
}
/// <summary>
/// Order packages by most downloaded first.
/// </summary>
- protected override IQueryable<IPackage> OrderPackages(IQueryable<IPackage> packages)
+ protected override IQueryable<IPackage> OrderPackages (IQueryable<IPackage> packages, PackageSearchCriteria search)
{
- if (GetSearchCriteria () != null) {
+ if (search.IsPackageVersionSearch) {
+ return packages.OrderByDescending (package => package.Version);
+ }
+
+ if (search.SearchText != null) {
// Order by relevance for searches.
return packages;
}
return packages.OrderByDescending(package => package.DownloadCount);
}
- protected override IEnumerable<IPackage> GetFilteredPackagesBeforePagingResults(IQueryable<IPackage> allPackages)
+ protected override IEnumerable<IPackage> GetFilteredPackagesBeforePagingResults (IQueryable<IPackage> allPackages, PackageSearchCriteria search)
{
+ if (search.IsPackageVersionSearch) {
+ return base.GetFilteredPackagesBeforePagingResults (allPackages, search)
+ .Where (package => search.IsVersionMatch (package.Version));
+ }
+
if (IncludePrerelease) {
- return base.GetFilteredPackagesBeforePagingResults(allPackages)
+ return base.GetFilteredPackagesBeforePagingResults(allPackages, search)
.DistinctLast<IPackage>(PackageEqualityComparer.Id);
}
- return base.GetFilteredPackagesBeforePagingResults(allPackages)
+ return base.GetFilteredPackagesBeforePagingResults(allPackages, search)
.Where(package => package.IsReleaseVersion())
.DistinctLast<IPackage>(PackageEqualityComparer.Id);
}
- protected override IEnumerable<IPackage> PrioritizePackages (IEnumerable<IPackage> packages, string searchCriteria)
+ protected override IEnumerable<IPackage> PrioritizePackages (IEnumerable<IPackage> packages, PackageSearchCriteria search)
{
- List<IPackage> recentPackages = GetRecentPackages (searchCriteria).ToList ();
+ List<IPackage> recentPackages = GetRecentPackages (search).ToList ();
if (PackageViewModels.Count == 0) {
foreach (IPackage package in recentPackages) {
@@ -118,9 +137,19 @@ namespace ICSharpCode.PackageManagement
}
}
- IEnumerable<IPackage> GetRecentPackages (string searchCriteria)
+ IEnumerable<IPackage> GetRecentPackages (PackageSearchCriteria search)
+ {
+ if (search.IsPackageVersionSearch) {
+ return Enumerable.Empty<IPackage> ();
+ }
+ return recentPackageRepository.Search (search.SearchText, IncludePrerelease);
+ }
+
+ protected override PackageViewModel CreatePackageViewModel (IPackage package, PackageSearchCriteria search)
{
- return recentPackageRepository.Search (searchCriteria, IncludePrerelease);
+ PackageViewModel viewModel = base.CreatePackageViewModel (package, search);
+ viewModel.ShowVersionInsteadOfDownloadCount = search.IsPackageVersionSearch;
+ return viewModel;
}
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/BackgroundPackageActionRunner.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/BackgroundPackageActionRunner.cs
index 2f230be7eb..d02f01385f 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/BackgroundPackageActionRunner.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/BackgroundPackageActionRunner.cs
@@ -30,6 +30,7 @@ using System.Linq;
using ICSharpCode.PackageManagement;
using MonoDevelop.Core;
using MonoDevelop.Ide;
+using MonoDevelop.Projects;
using NuGet;
namespace MonoDevelop.PackageManagement
@@ -38,13 +39,26 @@ namespace MonoDevelop.PackageManagement
{
IPackageManagementProgressMonitorFactory progressMonitorFactory;
IPackageManagementEvents packageManagementEvents;
+ IProgressProvider progressProvider;
+ List<InstallPackageAction> pendingInstallActions = new List<InstallPackageAction> ();
public BackgroundPackageActionRunner (
IPackageManagementProgressMonitorFactory progressMonitorFactory,
- IPackageManagementEvents packageManagementEvents)
+ IPackageManagementEvents packageManagementEvents,
+ IProgressProvider progressProvider)
{
this.progressMonitorFactory = progressMonitorFactory;
this.packageManagementEvents = packageManagementEvents;
+ this.progressProvider = progressProvider;
+ }
+
+ public IEnumerable<InstallPackageAction> PendingInstallActions {
+ get { return pendingInstallActions; }
+ }
+
+ public IEnumerable<InstallPackageAction> PendingInstallActionsForProject (DotNetProject project)
+ {
+ return pendingInstallActions.Where (action => action.Project.DotNetProject == project);
}
public void Run (ProgressMonitorStatusMessage progressMessage, IPackageAction action)
@@ -54,63 +68,66 @@ namespace MonoDevelop.PackageManagement
public void Run (ProgressMonitorStatusMessage progressMessage, IEnumerable<IPackageAction> actions)
{
- DispatchService.BackgroundDispatch (() => RunActionsWithProgressMonitor (progressMessage, actions.ToList ()));
+ AddInstallActionsToPendingQueue (actions);
+ packageManagementEvents.OnPackageOperationsStarting ();
+ BackgroundDispatch (() => RunActionsWithProgressMonitor (progressMessage, actions.ToList ()));
+ }
+
+ void AddInstallActionsToPendingQueue (IEnumerable<IPackageAction> actions)
+ {
+ foreach (InstallPackageAction action in actions.OfType<InstallPackageAction> ()) {
+ pendingInstallActions.Add (action);
+ }
}
void RunActionsWithProgressMonitor (ProgressMonitorStatusMessage progressMessage, IList<IPackageAction> installPackageActions)
{
using (IProgressMonitor monitor = progressMonitorFactory.CreateProgressMonitor (progressMessage.Status)) {
- using (var eventMonitor = new PackageManagementEventsMonitor (monitor, packageManagementEvents)) {
+ using (PackageManagementEventsMonitor eventMonitor = CreateEventMonitor (monitor)) {
try {
monitor.BeginTask (null, installPackageActions.Count);
RunActionsWithProgressMonitor (monitor, installPackageActions);
eventMonitor.ReportResult (progressMessage);
} catch (Exception ex) {
- LoggingService.LogInternalError (ex);
- monitor.Log.WriteLine (ex.Message);
- monitor.ReportError (progressMessage.Error, null);
- monitor.ShowPackageConsole ();
+ RemoveInstallActions (installPackageActions);
+ eventMonitor.ReportError (progressMessage, ex);
} finally {
monitor.EndTask ();
+ GuiDispatch (() => {
+ RemoveInstallActions (installPackageActions);
+ packageManagementEvents.OnPackageOperationsFinished ();
+ });
}
}
}
}
- void RunActionsWithProgressMonitor (IProgressMonitor monitor, IList<IPackageAction> packageActions)
+ PackageManagementEventsMonitor CreateEventMonitor (IProgressMonitor monitor)
{
- if (!AcceptPackageLicenses (packageActions))
- return;
-
- foreach (IPackageAction action in packageActions) {
- CheckForPowerShellScripts (action);
- action.Execute ();
- monitor.Step (1);
- }
+ return CreateEventMonitor (monitor, packageManagementEvents, progressProvider);
}
- bool AcceptPackageLicenses (IList<IPackageAction> packageActions)
+ protected virtual PackageManagementEventsMonitor CreateEventMonitor (
+ IProgressMonitor monitor,
+ IPackageManagementEvents packageManagementEvents,
+ IProgressProvider progressProvider)
{
- var packagesWithLicenses = new PackagesRequiringLicenseAcceptance ();
- List<IPackage> packages = packagesWithLicenses.GetPackagesRequiringLicenseAcceptance (packageActions).ToList ();
- if (packages.Any ()) {
- return packageManagementEvents.OnAcceptLicenses (packages);
- }
-
- return true;
+ return new PackageManagementEventsMonitor (monitor, packageManagementEvents, progressProvider);
}
- void CheckForPowerShellScripts (IPackageAction action)
+ void RunActionsWithProgressMonitor (IProgressMonitor monitor, IList<IPackageAction> packageActions)
{
- if (action.HasPackageScriptsToRun ()) {
- ReportPowerShellScriptWarning ();
+ foreach (IPackageAction action in packageActions) {
+ action.Execute ();
+ monitor.Step (1);
}
}
- void ReportPowerShellScriptWarning ()
+ void RemoveInstallActions (IList<IPackageAction> installPackageActions)
{
- string message = GettextCatalog.GetString ("Package contains PowerShell scripts which will not be run.");
- packageManagementEvents.OnPackageOperationMessageLogged (MessageLevel.Warning, message);
+ foreach (InstallPackageAction action in installPackageActions.OfType <InstallPackageAction> ()) {
+ pendingInstallActions.Remove (action);
+ }
}
public void ShowError (ProgressMonitorStatusMessage progressMessage, Exception exception)
@@ -127,6 +144,16 @@ namespace MonoDevelop.PackageManagement
monitor.ShowPackageConsole ();
}
}
+
+ protected virtual void BackgroundDispatch (MessageHandler handler)
+ {
+ DispatchService.BackgroundDispatch (handler);
+ }
+
+ protected virtual void GuiDispatch (MessageHandler handler)
+ {
+ DispatchService.GuiDispatch (handler);
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ConfigSettingsFileSystem.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ConfigSettingsFileSystem.cs
index 0bbe79cc15..8e656126b1 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ConfigSettingsFileSystem.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ConfigSettingsFileSystem.cs
@@ -28,6 +28,7 @@
using System;
using System.IO;
+using MonoDevelop.PackageManagement;
using MonoDevelop.Projects;
using NuGet;
@@ -40,7 +41,7 @@ namespace ICSharpCode.PackageManagement
{
}
- public static ConfigSettingsFileSystem CreateConfigSettingsFileSystem(Solution solution)
+ public static ConfigSettingsFileSystem CreateConfigSettingsFileSystem (ISolution solution)
{
string configSettingsFolder = Path.Combine(solution.BaseDirectory, ".nuget");
return new ConfigSettingsFileSystem(configSettingsFolder);
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/DotNetProjectExtensions.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/DotNetProjectExtensions.cs
index 61c4c60a44..8b390d9a91 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/DotNetProjectExtensions.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/DotNetProjectExtensions.cs
@@ -27,11 +27,12 @@
//
using System;
+using System.IO;
+using MonoDevelop.Core;
+using MonoDevelop.PackageManagement;
using MonoDevelop.Projects;
using MonoDevelop.Projects.Formats.MSBuild;
using NuGet;
-using System.IO;
-using MonoDevelop.Core;
namespace ICSharpCode.PackageManagement
{
@@ -40,20 +41,12 @@ namespace ICSharpCode.PackageManagement
public static readonly Guid WebApplication = Guid.Parse("{349C5851-65DF-11DA-9384-00065B846F21}");
public static readonly Guid WebSite = Guid.Parse("{E24C65DC-7377-472B-9ABA-BC803B73C61A}");
- public static bool IsWebProject(this DotNetProject project)
+ public static bool IsWebProject(this IDotNetProject project)
{
return project.HasProjectType(WebApplication) || project.HasProjectType(WebSite);
}
- public static string GetEvaluatedProperty(this DotNetProject project, string name)
- {
- if ("RootNamespace".Equals(name, StringComparison.OrdinalIgnoreCase)) {
- return project.DefaultNamespace;
- }
- return String.Empty;
- }
-
- public static bool HasProjectType(this DotNetProject project, Guid projectTypeGuid)
+ public static bool HasProjectType(this IDotNetProject project, Guid projectTypeGuid)
{
foreach (string guid in project.GetProjectTypeGuids()) {
if (IsMatch(projectTypeGuid, guid)) {
@@ -63,7 +56,7 @@ namespace ICSharpCode.PackageManagement
return false;
}
- public static string[] GetProjectTypeGuids(this DotNetProject project)
+ public static string[] GetProjectTypeGuids(this IDotNetProject project)
{
string projectTypeGuids = project.GetProjectTypeGuidPropertyValue();
return projectTypeGuids.Split(new char[] {';'}, StringSplitOptions.RemoveEmptyEntries);
@@ -78,7 +71,7 @@ namespace ICSharpCode.PackageManagement
return false;
}
- public static string GetProjectTypeGuidPropertyValue(this DotNetProject project)
+ public static string GetProjectTypeGuidPropertyValue (this IDotNetProject project)
{
string propertyValue = null;
if (project.ExtendedProperties.Contains("ProjectTypeGuids")) {
@@ -86,30 +79,6 @@ namespace ICSharpCode.PackageManagement
}
return propertyValue ?? String.Empty;
}
-
- public static void AddImportIfMissing(
- this DotNetProject project,
- string importedProjectFile,
- ProjectImportLocation importLocation)
- {
- var msbuildProject = new MSBuildProject ();
- msbuildProject.Load (project.FileName);
- msbuildProject.AddImportIfMissing (importedProjectFile, importLocation, GetCondition (importedProjectFile));
- msbuildProject.Save (project.FileName);
- }
-
- static string GetCondition(string importedProjectFile)
- {
- return String.Format("Exists('{0}')", importedProjectFile);
- }
-
- public static void RemoveImport(this DotNetProject project, string importedProjectFile)
- {
- var msbuildProject = new MSBuildProject ();
- msbuildProject.Load (project.FileName);
- msbuildProject.RemoveImportIfExists (importedProjectFile);
- msbuildProject.Save (project.FileName);
- }
public static bool HasPackages (this DotNetProject project)
{
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/DotNetProjectProxy.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/DotNetProjectProxy.cs
new file mode 100644
index 0000000000..287a46f396
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/DotNetProjectProxy.cs
@@ -0,0 +1,89 @@
+//
+// DotNetProjectProxy.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using MonoDevelop.Core.Assemblies;
+using MonoDevelop.Projects;
+
+namespace MonoDevelop.PackageManagement
+{
+ public class DotNetProjectProxy : ProjectProxy, IDotNetProject
+ {
+ DotNetProject project;
+
+ public DotNetProjectProxy (DotNetProject project)
+ : base (project)
+ {
+ this.project = project;
+ }
+
+ public DotNetProject DotNetProject {
+ get { return project; }
+ }
+
+ public TargetFrameworkMoniker TargetFrameworkMoniker {
+ get { return project.TargetFramework.Id; }
+ }
+
+ public string DefaultNamespace {
+ get { return project.DefaultNamespace; }
+ }
+
+ public ProjectReferenceCollection References {
+ get { return project.References; }
+ }
+
+ public ProjectFileCollection Files {
+ get { return project.Files; }
+ }
+
+ public void AddFile (ProjectFile projectFile)
+ {
+ project.AddFile (projectFile);
+ }
+
+ public string GetDefaultBuildAction (string fileName)
+ {
+ return project.GetDefaultBuildAction (fileName);
+ }
+
+ public bool IsFileInProject (string fileName)
+ {
+ return project.IsFileInProject (fileName);
+ }
+
+ public void AddImportIfMissing (string name, string condition)
+ {
+ project.AddImportIfMissing (name, condition);
+ }
+
+ public void RemoveImport (string name)
+ {
+ project.RemoveImport (name);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IBackgroundPackageActionRunner.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IBackgroundPackageActionRunner.cs
index 581eb07c14..ecd03752b6 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IBackgroundPackageActionRunner.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IBackgroundPackageActionRunner.cs
@@ -27,11 +27,15 @@
using System;
using System.Collections.Generic;
using ICSharpCode.PackageManagement;
+using MonoDevelop.Projects;
namespace MonoDevelop.PackageManagement
{
public interface IBackgroundPackageActionRunner
{
+ IEnumerable<InstallPackageAction> PendingInstallActions { get; }
+ IEnumerable<InstallPackageAction> PendingInstallActionsForProject (DotNetProject project);
+
void Run (ProgressMonitorStatusMessage progressMessage, IPackageAction action);
void Run (ProgressMonitorStatusMessage progressMessage, IEnumerable<IPackageAction> actions);
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IDotNetProject.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IDotNetProject.cs
new file mode 100644
index 0000000000..8d8c0b98a3
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IDotNetProject.cs
@@ -0,0 +1,48 @@
+//
+// IDotNetProject.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using MonoDevelop.Core.Assemblies;
+using MonoDevelop.Projects;
+
+namespace MonoDevelop.PackageManagement
+{
+ public interface IDotNetProject : IProject
+ {
+ DotNetProject DotNetProject { get; }
+ TargetFrameworkMoniker TargetFrameworkMoniker { get; }
+ string DefaultNamespace { get; }
+ ProjectReferenceCollection References { get; }
+ ProjectFileCollection Files { get; }
+
+ void AddFile (ProjectFile projectFile);
+ string GetDefaultBuildAction (string fileName);
+ bool IsFileInProject (string fileName);
+ void AddImportIfMissing (string name, string condition);
+ void RemoveImport (string name);
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementEvents.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementEvents.cs
index d0268129cc..3ea459082f 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementEvents.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementEvents.cs
@@ -28,6 +28,7 @@
using System;
using System.Collections.Generic;
+using MonoDevelop.Core;
using NuGet;
namespace ICSharpCode.PackageManagement
@@ -35,6 +36,7 @@ namespace ICSharpCode.PackageManagement
public interface IPackageManagementEvents
{
event EventHandler PackageOperationsStarting;
+ event EventHandler PackageOperationsFinished;
event EventHandler<AcceptLicensesEventArgs> AcceptLicenses;
event EventHandler<SelectProjectsEventArgs> SelectProjects;
event EventHandler<ResolveFileConflictEventArgs> ResolveFileConflict;
@@ -44,8 +46,10 @@ namespace ICSharpCode.PackageManagement
event EventHandler<ParentPackagesOperationEventArgs> ParentPackagesUpdated;
event EventHandler<PackageOperationMessageLoggedEventArgs> PackageOperationMessageLogged;
event EventHandler PackagesRestored;
+ event EventHandler<FileEventArgs> FileChanged;
void OnPackageOperationsStarting();
+ void OnPackageOperationsFinished();
void OnPackageOperationError(Exception ex);
bool OnAcceptLicenses(IEnumerable<IPackage> packages);
void OnParentPackageInstalled(IPackage package, IPackageManagementProject project);
@@ -55,5 +59,6 @@ namespace ICSharpCode.PackageManagement
bool OnSelectProjects(IEnumerable<IPackageManagementSelectedProject> selectedProjects);
FileConflictResolution OnResolveFileConflict(string message);
void OnPackagesRestored();
+ void OnFileChanged(string path);
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementFileService.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementFileService.cs
index fdc1a9604b..59920df241 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementFileService.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementFileService.cs
@@ -34,5 +34,6 @@ namespace ICSharpCode.PackageManagement
{
void RemoveFile(string path);
void RemoveDirectory(string path);
+ void OnFileChanged(string path);
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementProjectFactory.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementProjectFactory.cs
index 5a92539b45..b9dbd43d97 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementProjectFactory.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementProjectFactory.cs
@@ -26,13 +26,13 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
-using MonoDevelop.Projects;
+using MonoDevelop.PackageManagement;
using NuGet;
namespace ICSharpCode.PackageManagement
{
public interface IPackageManagementProjectFactory
{
- IPackageManagementProject CreateProject(IPackageRepository sourceRepository, DotNetProject project);
+ IPackageManagementProject CreateProject (IPackageRepository sourceRepository, IDotNetProject project);
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementProjectService.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementProjectService.cs
index 6281427b69..21603b0998 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementProjectService.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementProjectService.cs
@@ -28,18 +28,20 @@
using System;
using System.Collections.Generic;
+using MonoDevelop.PackageManagement;
using MonoDevelop.Projects;
namespace ICSharpCode.PackageManagement
{
public interface IPackageManagementProjectService
{
- Project CurrentProject { get; }
- Solution OpenSolution { get; }
+ event EventHandler SolutionLoaded;
+ event EventHandler SolutionUnloaded;
- void Save(Solution solution);
-
- IEnumerable<Project> GetOpenProjects();
+ IProject CurrentProject { get; }
+ ISolution OpenSolution { get; }
+
+ IEnumerable<IDotNetProject> GetOpenProjects ();
IProjectBrowserUpdater CreateProjectBrowserUpdater();
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementSolution.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementSolution.cs
index acb993f73f..03f279d604 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementSolution.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagementSolution.cs
@@ -30,6 +30,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
+using MonoDevelop.PackageManagement;
using MonoDevelop.Projects;
using NuGet;
@@ -41,11 +42,11 @@ namespace ICSharpCode.PackageManagement
IPackageManagementProject GetActiveProject(IPackageRepository sourceRepository);
IPackageManagementProject GetProject(PackageSource source, string projectName);
IPackageManagementProject GetProject(IPackageRepository sourceRepository, string projectName);
- IPackageManagementProject GetProject(IPackageRepository sourceRepository, Project project);
+ IPackageManagementProject GetProject (IPackageRepository sourceRepository, IDotNetProject project);
IEnumerable<IPackageManagementProject> GetProjects(IPackageRepository sourceRepository);
- Project GetActiveDotNetProject();
- IEnumerable<Project> GetDotNetProjects();
+ IDotNetProject GetActiveDotNetProject ();
+ IEnumerable<IDotNetProject> GetDotNetProjects ();
bool HasMultipleProjects();
bool IsPackageInstalled(IPackage package);
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagerFactory.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagerFactory.cs
index ec4285d316..0428fa1a84 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagerFactory.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IPackageManagerFactory.cs
@@ -27,15 +27,15 @@
//
using System;
-using MonoDevelop.Projects;
+using MonoDevelop.PackageManagement;
using NuGet;
namespace ICSharpCode.PackageManagement
{
public interface IPackageManagerFactory
{
- ISharpDevelopPackageManager CreatePackageManager(
+ ISharpDevelopPackageManager CreatePackageManager (
IPackageRepository sourceRepository,
- DotNetProject project);
+ IDotNetProject project);
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IProject.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IProject.cs
new file mode 100644
index 0000000000..d359be3c57
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/IProject.cs
@@ -0,0 +1,44 @@
+//
+// IProject.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections;
+using MonoDevelop.Core;
+
+namespace MonoDevelop.PackageManagement
+{
+ public interface IProject
+ {
+ string Name { get; }
+ FilePath FileName { get; }
+ FilePath BaseDirectory { get; }
+ ISolution ParentSolution { get; }
+ IDictionary ExtendedProperties { get; }
+
+ void Save ();
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ISettingsProvider.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ISettingsProvider.cs
new file mode 100644
index 0000000000..aa0fa620cf
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ISettingsProvider.cs
@@ -0,0 +1,38 @@
+//
+// ISettingsProvider.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement
+{
+ public interface ISettingsProvider
+ {
+ event EventHandler SettingsChanged;
+ ISettings LoadSettings();
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ISolution.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ISolution.cs
new file mode 100644
index 0000000000..abfd279ea7
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ISolution.cs
@@ -0,0 +1,38 @@
+//
+// ISolution.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using MonoDevelop.Core;
+
+namespace MonoDevelop.PackageManagement
+{
+ public interface ISolution
+ {
+ FilePath BaseDirectory { get; }
+ FilePath FileName { get; }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ISolutionPackageRepositoryFactory.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ISolutionPackageRepositoryFactory.cs
index c3ab8c2652..c9cc090a9c 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ISolutionPackageRepositoryFactory.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ISolutionPackageRepositoryFactory.cs
@@ -27,12 +27,13 @@
//
using System;
+using MonoDevelop.PackageManagement;
using MonoDevelop.Projects;
namespace ICSharpCode.PackageManagement
{
public interface ISolutionPackageRepositoryFactory
{
- ISolutionPackageRepository CreateSolutionPackageRepository(Solution solution);
+ ISolutionPackageRepository CreateSolutionPackageRepository (ISolution solution);
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/InstallPackageAction.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/InstallPackageAction.cs
index f7aa75de1a..a5726d465c 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/InstallPackageAction.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/InstallPackageAction.cs
@@ -54,5 +54,9 @@ namespace ICSharpCode.PackageManagement
Project.InstallPackage(Package, this);
OnParentPackageInstalled();
}
+
+ protected override string StartingMessageFormat {
+ get { return "Adding {0}..."; }
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MSBuildProjectExtensions.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MSBuildProjectExtensions.cs
index b474eacc33..7ef89003a4 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MSBuildProjectExtensions.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MSBuildProjectExtensions.cs
@@ -77,13 +77,13 @@ namespace ICSharpCode.PackageManagement
return project.AddImportElementAtTop (importedProjectFile);
}
XmlElement import = project.CreateImportElement (importedProjectFile);
- project.doc.DocumentElement.AppendChild (import);
+ project.Document.DocumentElement.AppendChild (import);
return import;
}
static XmlElement CreateImportElement(this MSBuildProject project, string importedProjectFile)
{
- XmlElement import = project.doc.CreateElement ("Import", MSBuildProject.Schema);
+ XmlElement import = project.Document.CreateElement ("Import", MSBuildProject.Schema);
import.SetAttribute ("Project", importedProjectFile);
return import;
}
@@ -91,7 +91,7 @@ namespace ICSharpCode.PackageManagement
static XmlElement AddImportElementAtTop (this MSBuildProject project, string importedProjectFile)
{
XmlElement import = project.CreateImportElement (importedProjectFile);
- XmlElement projectRoot = project.doc.DocumentElement;
+ XmlElement projectRoot = project.Document.DocumentElement;
projectRoot.InsertBefore (import, projectRoot.FirstChild);
return import;
}
@@ -118,7 +118,7 @@ namespace ICSharpCode.PackageManagement
static IEnumerable <XmlElement> Imports (this MSBuildProject project)
{
- foreach (XmlElement import in project.doc.DocumentElement.SelectNodes ("tns:Import", namespaceManager)) {
+ foreach (XmlElement import in project.Document.DocumentElement.SelectNodes ("tns:Import", namespaceManager)) {
yield return import;
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ManagePackagesUserPrompts.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ManagePackagesUserPrompts.cs
deleted file mode 100644
index 9680004b52..0000000000
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ManagePackagesUserPrompts.cs
+++ /dev/null
@@ -1,124 +0,0 @@
-//
-// ManagePackagesUserPrompts.cs
-//
-// Author:
-// Matt Ward <ward.matt@gmail.com>
-//
-// Copyright (C) 2013 Matthew Ward
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using NuGet;
-
-namespace ICSharpCode.PackageManagement
-{
- public class ManagePackagesUserPrompts
- {
- ILicenseAcceptanceService licenseAcceptanceService;
- ISelectProjectsService selectProjectsService;
- IPackageManagementEvents packageManagementEvents;
- IFileConflictResolver fileConflictResolver;
- FileConflictResolution lastFileConflictResolution;
-
- public ManagePackagesUserPrompts(IPackageManagementEvents packageManagementEvents)
- : this(
- packageManagementEvents,
- new LicenseAcceptanceService(),
- new SelectProjectsService(),
- new FileConflictResolver())
- {
- }
-
- public ManagePackagesUserPrompts(
- IPackageManagementEvents packageManagementEvents,
- ILicenseAcceptanceService licenseAcceptanceService,
- ISelectProjectsService selectProjectsService,
- IFileConflictResolver fileConflictResolver)
- {
- this.packageManagementEvents = packageManagementEvents;
- this.licenseAcceptanceService = licenseAcceptanceService;
- this.selectProjectsService = selectProjectsService;
- this.fileConflictResolver = fileConflictResolver;
-
- ResetFileConflictResolution();
- SubscribeToEvents();
- }
-
- void ResetFileConflictResolution()
- {
- lastFileConflictResolution = FileConflictResolution.Overwrite;
- }
-
- void SubscribeToEvents()
- {
- packageManagementEvents.AcceptLicenses += AcceptLicenses;
- packageManagementEvents.SelectProjects += SelectProjects;
- packageManagementEvents.ResolveFileConflict += ResolveFileConflict;
- packageManagementEvents.PackageOperationsStarting += PackageOperationsStarting;
- }
-
- void AcceptLicenses(object sender, AcceptLicensesEventArgs e)
- {
- e.IsAccepted = licenseAcceptanceService.AcceptLicenses(e.Packages);
- }
-
- void SelectProjects(object sender, SelectProjectsEventArgs e)
- {
- e.IsAccepted = selectProjectsService.SelectProjects(e.SelectedProjects);
- }
-
- void ResolveFileConflict(object sender, ResolveFileConflictEventArgs e)
- {
- if (UserPreviouslySelectedOverwriteAllOrIgnoreAll()) {
- e.Resolution = lastFileConflictResolution;
- } else {
- e.Resolution = fileConflictResolver.ResolveFileConflict(e.Message);
- lastFileConflictResolution = e.Resolution;
- }
- }
-
- bool UserPreviouslySelectedOverwriteAllOrIgnoreAll()
- {
- return
- (lastFileConflictResolution == FileConflictResolution.IgnoreAll) ||
- (lastFileConflictResolution == FileConflictResolution.OverwriteAll);
- }
-
- void PackageOperationsStarting(object sender, EventArgs e)
- {
- ResetFileConflictResolution();
- }
-
- public void Dispose()
- {
- UnsubscribeFromEvents();
- }
-
- public void UnsubscribeFromEvents()
- {
- packageManagementEvents.SelectProjects -= SelectProjects;
- packageManagementEvents.AcceptLicenses -= AcceptLicenses;
- packageManagementEvents.ResolveFileConflict -= ResolveFileConflict;
- packageManagementEvents.PackageOperationsStarting -= PackageOperationsStarting;
- }
- }
-}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ManagePackagesViewModel.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ManagePackagesViewModel.cs
index 5d0313197f..d794208cbc 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ManagePackagesViewModel.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ManagePackagesViewModel.cs
@@ -37,7 +37,6 @@ namespace ICSharpCode.PackageManagement
public class ManagePackagesViewModel : ViewModelBase<ManagePackagesViewModel>, IDisposable
{
IThreadSafePackageManagementEvents packageManagementEvents;
- ManagePackagesUserPrompts userPrompts;
PackagesViewModels packagesViewModels;
ManagePackagesViewTitle viewTitle;
string message;
@@ -46,13 +45,11 @@ namespace ICSharpCode.PackageManagement
public ManagePackagesViewModel(
PackagesViewModels packagesViewModels,
ManagePackagesViewTitle viewTitle,
- IThreadSafePackageManagementEvents packageManagementEvents,
- ManagePackagesUserPrompts userPrompts)
+ IThreadSafePackageManagementEvents packageManagementEvents)
{
this.packagesViewModels = packagesViewModels;
this.viewTitle = viewTitle;
this.packageManagementEvents = packageManagementEvents;
- this.userPrompts = userPrompts;
packageManagementEvents.PackageOperationError += PackageOperationError;
packageManagementEvents.PackageOperationsStarting += PackageOperationsStarting;
@@ -81,7 +78,6 @@ namespace ICSharpCode.PackageManagement
public void Dispose()
{
packagesViewModels.Dispose();
- userPrompts.Dispose();
packageManagementEvents.PackageOperationError -= PackageOperationError;
packageManagementEvents.PackageOperationsStarting -= PackageOperationsStarting;
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopCredentialProvider.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopCredentialProvider.cs
index 0e6e01e143..e9dbe4417b 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopCredentialProvider.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopCredentialProvider.cs
@@ -29,23 +29,18 @@
using System;
using System.Net;
using NuGet;
-using WebService = MonoDevelop.Core.Web.WebService;
namespace ICSharpCode.PackageManagement
{
- public class MonoDevelopCredentialProvider : ICredentialProvider
+ class MonoDevelopCredentialProvider : ICredentialProvider
{
public ICredentials GetCredentials(Uri uri, IWebProxy proxy, CredentialType credentialType, bool retrying)
{
- if (WebService.CredentialProvider == null)
+ var cp = MonoDevelop.Core.WebRequestHelper.CredentialProvider;
+ if (cp == null)
return null;
- return WebService.CredentialProvider.GetCredentials (uri, proxy, GetCredentialType (credentialType), null, retrying);
- }
-
- MonoDevelop.Core.Web.CredentialType GetCredentialType (CredentialType credentialType)
- {
- return (MonoDevelop.Core.Web.CredentialType)credentialType;
+ return cp.GetCredentials (uri, proxy, (MonoDevelop.Core.Web.CredentialType)credentialType, retrying);
}
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/NuGetPackageRestoreCommandLine.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/NuGetPackageRestoreCommandLine.cs
index 6422633538..20f1136e4b 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/NuGetPackageRestoreCommandLine.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/NuGetPackageRestoreCommandLine.cs
@@ -35,8 +35,25 @@ namespace ICSharpCode.PackageManagement
{
public class NuGetPackageRestoreCommandLine
{
- public NuGetPackageRestoreCommandLine(IPackageManagementSolution solution)
+ MonoRuntimeInfo monoRuntime;
+ bool isMonoRuntime;
+
+ public NuGetPackageRestoreCommandLine (IPackageManagementSolution solution)
+ : this (
+ solution,
+ MonoRuntimeInfo.FromCurrentRuntime (),
+ EnvironmentUtility.IsMonoRuntime)
{
+ }
+
+ public NuGetPackageRestoreCommandLine (
+ IPackageManagementSolution solution,
+ MonoRuntimeInfo monoRuntime,
+ bool isMonoRuntime)
+ {
+ this.monoRuntime = monoRuntime;
+ this.isMonoRuntime = isMonoRuntime;
+
GenerateCommandLine(solution);
GenerateWorkingDirectory(solution);
}
@@ -47,7 +64,7 @@ namespace ICSharpCode.PackageManagement
void GenerateCommandLine(IPackageManagementSolution solution)
{
- if (EnvironmentUtility.IsMonoRuntime) {
+ if (isMonoRuntime) {
GenerateMonoCommandLine(solution);
} else {
GenerateWindowsCommandLine(solution);
@@ -61,8 +78,7 @@ namespace ICSharpCode.PackageManagement
NuGetExePath.GetPath(),
solution.FileName);
- string monoPrefix = MonoRuntimeInfo.FromCurrentRuntime().Prefix;
- Command = Path.Combine(monoPrefix, "bin", "mono");
+ Command = Path.Combine (monoRuntime.Prefix, "bin", "mono");
}
void GenerateWindowsCommandLine(IPackageManagementSolution solution)
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/OpenDotNetProjects.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/OpenDotNetProjects.cs
index 4845f95ae9..cd3138b4bc 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/OpenDotNetProjects.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/OpenDotNetProjects.cs
@@ -29,6 +29,7 @@
using System;
using System.Collections.Generic;
using MonoDevelop.Projects;
+using MonoDevelop.PackageManagement;
namespace ICSharpCode.PackageManagement
{
@@ -36,30 +37,30 @@ namespace ICSharpCode.PackageManagement
{
IPackageManagementProjectService projectService;
- public OpenDotNetProjects(IPackageManagementProjectService projectService)
+ public OpenDotNetProjects (IPackageManagementProjectService projectService)
{
this.projectService = projectService;
}
- public DotNetProject FindProject(string name)
+ public IDotNetProject FindProject (string name)
{
- foreach (Project project in projectService.GetOpenProjects()) {
- if (IsProjectNameMatch(project, name)) {
- return project as DotNetProject;
+ foreach (IProject project in projectService.GetOpenProjects ()) {
+ if (IsProjectNameMatch (project, name)) {
+ return project as IDotNetProject;
}
}
return null;
}
- bool IsProjectNameMatch(Project project, string name)
+ bool IsProjectNameMatch (IProject project, string name)
{
- return IsMatchIgnoringCase(project.Name, name) ||
+ return IsMatchIgnoringCase (project.Name, name) ||
(project.FileName == name);
}
- bool IsMatchIgnoringCase(string a, string b)
+ bool IsMatchIgnoringCase (string a, string b)
{
- return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);
+ return String.Equals (a, b, StringComparison.OrdinalIgnoreCase);
}
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementEvents.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementEvents.cs
index 5c1da3244a..60ee0b8373 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementEvents.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementEvents.cs
@@ -43,6 +43,15 @@ namespace ICSharpCode.PackageManagement
PackageOperationsStarting(this, new EventArgs());
}
}
+
+ public event EventHandler PackageOperationsFinished;
+
+ public void OnPackageOperationsFinished()
+ {
+ if (PackageOperationsFinished != null) {
+ PackageOperationsFinished(this, new EventArgs());
+ }
+ }
public event EventHandler<PackageOperationExceptionEventArgs> PackageOperationError;
@@ -135,5 +144,14 @@ namespace ICSharpCode.PackageManagement
PackagesRestored(this, new EventArgs());
}
}
+
+ public event EventHandler<FileEventArgs> FileChanged;
+
+ public void OnFileChanged (string path)
+ {
+ if (FileChanged != null) {
+ FileChanged (this, new FileEventArgs (new FilePath (path), false));
+ }
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementEventsMonitor.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementEventsMonitor.cs
index eae2427809..7594cb305e 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementEventsMonitor.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementEventsMonitor.cs
@@ -25,6 +25,8 @@
// THE SOFTWARE.
using System;
+using System.Collections.Generic;
+using System.Linq;
using ICSharpCode.PackageManagement;
using MonoDevelop.Core;
using MonoDevelop.Ide;
@@ -36,26 +38,37 @@ namespace MonoDevelop.PackageManagement
{
IProgressMonitor progressMonitor;
IPackageManagementEvents packageManagementEvents;
+ IProgressProvider progressProvider;
FileConflictResolution lastFileConflictResolution;
IFileConflictResolver fileConflictResolver = new FileConflictResolver ();
+ string currentProgressOperation;
+ List<FileEventArgs> fileChangedEvents = new List<FileEventArgs> ();
public PackageManagementEventsMonitor (
IProgressMonitor progressMonitor,
- IPackageManagementEvents packageManagementEvents)
+ IPackageManagementEvents packageManagementEvents,
+ IProgressProvider progressProvider)
{
this.progressMonitor = progressMonitor;
this.packageManagementEvents = packageManagementEvents;
+ this.progressProvider = progressProvider;
packageManagementEvents.PackageOperationMessageLogged += PackageOperationMessageLogged;
packageManagementEvents.ResolveFileConflict += ResolveFileConflict;
packageManagementEvents.AcceptLicenses += AcceptLicenses;
+ packageManagementEvents.FileChanged += FileChanged;
+ progressProvider.ProgressAvailable += ProgressAvailable;
}
-
+
public void Dispose ()
{
+ progressProvider.ProgressAvailable -= ProgressAvailable;
+ packageManagementEvents.FileChanged -= FileChanged;
packageManagementEvents.AcceptLicenses -= AcceptLicenses;
packageManagementEvents.ResolveFileConflict -= ResolveFileConflict;
packageManagementEvents.PackageOperationMessageLogged -= PackageOperationMessageLogged;
+
+ NotifyFilesChanged ();
}
void ResolveFileConflict(object sender, ResolveFileConflictEventArgs e)
@@ -63,7 +76,7 @@ namespace MonoDevelop.PackageManagement
if (UserPreviouslySelectedOverwriteAllOrIgnoreAll ()) {
e.Resolution = lastFileConflictResolution;
} else {
- DispatchService.GuiSyncDispatch (() => {
+ GuiSyncDispatch (() => {
e.Resolution = fileConflictResolver.ResolveFileConflict (e.Message);
});
lastFileConflictResolution = e.Resolution;
@@ -76,7 +89,12 @@ namespace MonoDevelop.PackageManagement
(lastFileConflictResolution == FileConflictResolution.IgnoreAll) ||
(lastFileConflictResolution == FileConflictResolution.OverwriteAll);
}
-
+
+ protected virtual void GuiSyncDispatch (MessageHandler handler)
+ {
+ DispatchService.GuiSyncDispatch (handler);
+ }
+
void PackageOperationMessageLogged (object sender, PackageOperationMessageLoggedEventArgs e)
{
if (e.Message.Level == MessageLevel.Warning) {
@@ -104,7 +122,7 @@ namespace MonoDevelop.PackageManagement
public void ReportResult (ProgressMonitorStatusMessage progressMessage)
{
if (HasWarnings) {
- progressMonitor.ReportSuccess (progressMessage.Warning);
+ progressMonitor.ReportWarning (progressMessage.Warning);
} else {
progressMonitor.ReportSuccess (progressMessage.Success);
}
@@ -121,7 +139,7 @@ namespace MonoDevelop.PackageManagement
void ReportLicenseAgreementWarning (IPackage package)
{
string message = GettextCatalog.GetString (
- "The package {0} has a license agreement which is available at {1}{2}" +
+ "The {0} package has a license agreement which is available at {1}{2}" +
"Please review this license agreement and remove the package if you do not accept the agreement.{2}" +
"Check the package for additional dependencies which may also have license agreements.{2}" +
"Using this package and any dependencies constitutes your acceptance of these license agreements.",
@@ -131,6 +149,51 @@ namespace MonoDevelop.PackageManagement
ReportWarning (message);
}
+
+ void ProgressAvailable (object sender, ProgressEventArgs e)
+ {
+ if (currentProgressOperation == e.Operation)
+ return;
+
+ currentProgressOperation = e.Operation;
+ progressMonitor.Log.WriteLine (e.Operation);
+ }
+
+ void FileChanged (object sender, FileEventArgs e)
+ {
+ fileChangedEvents.Add (e);
+ }
+
+ void NotifyFilesChanged ()
+ {
+ GuiSyncDispatch (() => {
+ FilePath[] files = fileChangedEvents
+ .SelectMany (fileChangedEvent => fileChangedEvent.ToArray ())
+ .Select (fileInfo => fileInfo.FileName)
+ .ToArray ();
+
+ NotifyFilesChanged (files);
+ });
+ }
+
+ protected virtual void NotifyFilesChanged (FilePath[] files)
+ {
+ FileService.NotifyFilesChanged (files);
+ }
+
+ public void ReportError (ProgressMonitorStatusMessage progressMessage, Exception ex)
+ {
+ LoggingService.LogInternalError (ex);
+ progressMonitor.Log.WriteLine (ex.Message);
+ progressMonitor.ReportError (progressMessage.Error, null);
+ ShowPackageConsole (progressMonitor);
+ packageManagementEvents.OnPackageOperationError (ex);
+ }
+
+ protected virtual void ShowPackageConsole (IProgressMonitor progressMonitor)
+ {
+ progressMonitor.ShowPackageConsole ();
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementFileService.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementFileService.cs
index ab8f8dfd26..4c8b99917e 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementFileService.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementFileService.cs
@@ -34,6 +34,18 @@ namespace ICSharpCode.PackageManagement
{
public class PackageManagementFileService : IPackageManagementFileService
{
+ IPackageManagementEvents packageManagementEvents;
+
+ public PackageManagementFileService ()
+ : this (PackageManagementServices.PackageManagementEvents)
+ {
+ }
+
+ public PackageManagementFileService (IPackageManagementEvents packageManagementEvents)
+ {
+ this.packageManagementEvents = packageManagementEvents;
+ }
+
public void RemoveFile(string path)
{
FileService.DeleteFile(path);
@@ -43,5 +55,10 @@ namespace ICSharpCode.PackageManagement
{
FileService.DeleteDirectory(path);
}
+
+ public void OnFileChanged (string path)
+ {
+ packageManagementEvents.OnFileChanged (path);
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementOptions.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementOptions.cs
index cd41218ec6..4fab702b76 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementOptions.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementOptions.cs
@@ -31,6 +31,7 @@ using System.Collections.Generic;
using System.Collections.Specialized;
using MonoDevelop.Core;
+using MonoDevelop.PackageManagement;
using NuGet;
namespace ICSharpCode.PackageManagement
@@ -45,19 +46,21 @@ namespace ICSharpCode.PackageManagement
Properties properties;
List<RecentPackageInfo> recentPackages;
PackageRestoreConsent packageRestoreConsent;
-
- public PackageManagementOptions(Properties properties, ISettings settings)
+
+ public PackageManagementOptions (
+ Properties properties,
+ ISettingsProvider settingsProvider)
{
this.properties = properties;
- registeredPackageSourceSettings = new RegisteredPackageSourceSettings(settings);
- packageRestoreConsent = new PackageRestoreConsent(settings);
+ registeredPackageSourceSettings = new RegisteredPackageSourceSettings (settingsProvider);
+ packageRestoreConsent = new PackageRestoreConsent (settingsProvider.LoadSettings());
}
-
- public PackageManagementOptions(Properties properties)
- : this(properties, Settings.LoadDefaultSettings(null, null, null))
+
+ public PackageManagementOptions (Properties properties)
+ : this (properties, new SettingsProvider ())
{
}
-
+
public PackageManagementOptions()
: this(PropertyService.Get("PackageManagementSettings", new Properties()))
{
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementOptionsViewModel.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementOptionsViewModel.cs
index 0f23c12de1..9b2993006a 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementOptionsViewModel.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementOptionsViewModel.cs
@@ -56,7 +56,6 @@ namespace ICSharpCode.PackageManagement
this.HasNoRecentPackages = !RecentPackageRepositoryHasPackages();
this.HasNoCachedPackages = !MachinePackageCacheHasPackages();
- this.IsPackageRestoreEnabled = options.IsPackageRestoreEnabled;
this.IsAutomaticPackageRestoreOnOpeningSolutionEnabled = options.IsAutomaticPackageRestoreOnOpeningSolutionEnabled;
CreateCommands();
@@ -64,7 +63,6 @@ namespace ICSharpCode.PackageManagement
public bool HasNoRecentPackages { get; private set; }
public bool HasNoCachedPackages { get; private set; }
- public bool IsPackageRestoreEnabled { get; set; }
public bool IsAutomaticPackageRestoreOnOpeningSolutionEnabled { get; set; }
bool MachinePackageCacheHasPackages()
@@ -112,7 +110,6 @@ namespace ICSharpCode.PackageManagement
public void SaveOptions()
{
- options.IsPackageRestoreEnabled = IsPackageRestoreEnabled;
options.IsAutomaticPackageRestoreOnOpeningSolutionEnabled = IsAutomaticPackageRestoreOnOpeningSolutionEnabled;
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProgressMonitor.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProgressMonitor.cs
new file mode 100644
index 0000000000..74076d6d47
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProgressMonitor.cs
@@ -0,0 +1,194 @@
+//
+// PackageManagementProgressMonitor.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using MonoDevelop.Core;
+using MonoDevelop.Core.Execution;
+using MonoDevelop.Core.ProgressMonitoring;
+using System.IO;
+
+namespace MonoDevelop.PackageManagement
+{
+ public class PackageManagementProgressMonitor : IProgressMonitor, IAsyncOperation
+ {
+ IProgressMonitor consoleMonitor;
+ IProgressMonitor statusMonitor;
+ List<string> warnings = new List<string> ();
+ List<string> errors = new List<string> ();
+
+ public IProgressMonitor ConsoleMonitor {
+ get { return consoleMonitor; }
+ }
+
+ public IConsole Console {
+ get { return (IConsole)this.consoleMonitor; }
+ }
+
+ public PackageManagementProgressMonitor (IProgressMonitor consoleMonitor, IProgressMonitor statusMonitor)
+ {
+ this.consoleMonitor = consoleMonitor;
+ this.statusMonitor = statusMonitor;
+
+ consoleMonitor.CancelRequested += OnCancelRequested;
+ statusMonitor.CancelRequested += OnCancelRequested;
+ }
+
+ public void BeginTask (string name, int totalWork)
+ {
+ statusMonitor.BeginTask (name, totalWork);
+ }
+
+ public void BeginStepTask (string name, int totalWork, int stepSize)
+ {
+ statusMonitor.BeginStepTask (name, totalWork, stepSize);
+ }
+
+ public void EndTask ()
+ {
+ statusMonitor.EndTask ();
+ }
+
+ public void Step (int work)
+ {
+ statusMonitor.Step (work);
+ }
+
+ public TextWriter Log
+ {
+ get { return consoleMonitor.Log; }
+ }
+
+ public void ReportSuccess (string message)
+ {
+ consoleMonitor.ReportSuccess (message);
+ statusMonitor.ReportSuccess (message);
+ }
+
+ public void ReportWarning (string message)
+ {
+ warnings.Add (message);
+ statusMonitor.ReportWarning (message);
+ }
+
+ public void ReportError (string message, Exception ex)
+ {
+ errors.Add (message);
+ statusMonitor.ReportError (message, ex);
+ }
+
+ public void Dispose ()
+ {
+ consoleMonitor.CancelRequested -= OnCancelRequested;
+ statusMonitor.CancelRequested -= OnCancelRequested;
+
+ // Do not report warnings if there are errors otherwise the warnings will
+ // appear at the end of the Package Console and hide the error which
+ // should be the last line of text visible to the user.
+ if (errors.Count == 0) {
+ ReportAllWarningsButLastToConsole ();
+ }
+
+ ReportAllErrorsButLastToConsole ();
+
+ consoleMonitor.Dispose ();
+ statusMonitor.Dispose ();
+ }
+
+ void ReportAllWarningsButLastToConsole ()
+ {
+ RemoveLastItem (warnings);
+ warnings.ForEach (warning => consoleMonitor.ReportWarning (warning));
+ }
+
+ void ReportAllErrorsButLastToConsole ()
+ {
+ RemoveLastItem (errors);
+ errors.ForEach (error => consoleMonitor.ReportError (error, null));
+ }
+
+ static void RemoveLastItem (List<string> items)
+ {
+ if (items.Count > 0) {
+ items.RemoveAt (items.Count - 1);
+ }
+ }
+
+ public bool IsCancelRequested
+ {
+ get {
+ return consoleMonitor.IsCancelRequested || statusMonitor.IsCancelRequested;
+ }
+ }
+
+ public object SyncRoot {
+ get { return this; }
+ }
+
+ void OnCancelRequested (IProgressMonitor sender)
+ {
+ AsyncOperation.Cancel ();
+ }
+
+ public IAsyncOperation AsyncOperation
+ {
+ get { return this; }
+ }
+
+ void IAsyncOperation.Cancel ()
+ {
+ consoleMonitor.AsyncOperation.Cancel ();
+ }
+
+ void IAsyncOperation.WaitForCompleted ()
+ {
+ consoleMonitor.AsyncOperation.WaitForCompleted ();
+ }
+
+ public bool IsCompleted {
+ get { return consoleMonitor.AsyncOperation.IsCompleted; }
+ }
+
+ bool IAsyncOperation.Success {
+ get { return consoleMonitor.AsyncOperation.Success; }
+ }
+
+ bool IAsyncOperation.SuccessWithWarnings {
+ get { return consoleMonitor.AsyncOperation.SuccessWithWarnings; }
+ }
+
+ public event MonitorHandler CancelRequested {
+ add { consoleMonitor.CancelRequested += value; }
+ remove { consoleMonitor.CancelRequested -= value; }
+ }
+
+ public event OperationHandler Completed {
+ add { consoleMonitor.AsyncOperation.Completed += value; }
+ remove { consoleMonitor.AsyncOperation.Completed -= value; }
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProgressMonitorFactory.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProgressMonitorFactory.cs
index af40d574e2..d15afde849 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProgressMonitorFactory.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProgressMonitorFactory.cs
@@ -48,9 +48,7 @@ namespace MonoDevelop.PackageManagement
false,
pad);
- var monitor = new AggregatedProgressMonitor (consoleMonitor);
- monitor.AddSlaveMonitor (statusMonitor);
- return monitor;
+ return new PackageManagementProgressMonitor (consoleMonitor, statusMonitor);
}
IProgressMonitor CreatePackageConsoleOutputMonitor ()
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProgressProvider.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProgressProvider.cs
new file mode 100644
index 0000000000..4c2353b194
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProgressProvider.cs
@@ -0,0 +1,71 @@
+//
+// PackageManagementProgressProvider.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using ICSharpCode.PackageManagement;
+using NuGet;
+using MonoDevelop.Ide;
+
+namespace MonoDevelop.PackageManagement
+{
+ public class PackageManagementProgressProvider : IProgressProvider
+ {
+ Action<MessageHandler> guiDispatcher;
+
+ public PackageManagementProgressProvider (IPackageRepositoryFactoryEvents repositoryFactoryEvents)
+ : this (repositoryFactoryEvents, DispatchService.GuiDispatch)
+ {
+ }
+
+ public PackageManagementProgressProvider (
+ IPackageRepositoryFactoryEvents repositoryFactoryEvents,
+ Action<MessageHandler> guiDispatcher)
+ {
+ repositoryFactoryEvents.RepositoryCreated += RepositoryCreated;
+ this.guiDispatcher = guiDispatcher;
+ }
+
+ void RepositoryCreated (object sender, PackageRepositoryFactoryEventArgs e)
+ {
+ var progressProvider = e.Repository as IProgressProvider;
+ if (progressProvider != null) {
+ progressProvider.ProgressAvailable += OnProgressAvailable;
+ }
+ }
+
+ public event EventHandler<ProgressEventArgs> ProgressAvailable;
+
+ void OnProgressAvailable (object sender, ProgressEventArgs e)
+ {
+ guiDispatcher (() => {
+ if (ProgressAvailable != null) {
+ ProgressAvailable (sender, e);
+ }
+ });
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProject.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProject.cs
index 4a206370e3..fd51ce0da0 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProject.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProject.cs
@@ -30,9 +30,10 @@ using System;
using System.Collections.Generic;
using System.Linq;
+using System.Runtime.Versioning;
+using MonoDevelop.PackageManagement;
using MonoDevelop.Projects;
using NuGet;
-using System.Runtime.Versioning;
namespace ICSharpCode.PackageManagement
{
@@ -41,29 +42,29 @@ namespace ICSharpCode.PackageManagement
ISharpDevelopPackageManager packageManager;
ISharpDevelopProjectManager projectManager;
IPackageManagementEvents packageManagementEvents;
- DotNetProject msbuildProject;
+ IDotNetProject project;
ProjectTargetFramework targetFramework;
- public PackageManagementProject(
+ public PackageManagementProject (
IPackageRepository sourceRepository,
- DotNetProject project,
+ IDotNetProject project,
IPackageManagementEvents packageManagementEvents,
IPackageManagerFactory packageManagerFactory)
{
SourceRepository = sourceRepository;
- msbuildProject = project;
+ this.project = project;
this.packageManagementEvents = packageManagementEvents;
- packageManager = packageManagerFactory.CreatePackageManager(sourceRepository, project);
+ packageManager = packageManagerFactory.CreatePackageManager (sourceRepository, project);
projectManager = packageManager.ProjectManager;
}
public string Name {
- get { return msbuildProject.Name; }
+ get { return project.Name; }
}
public DotNetProject DotNetProject {
- get { return msbuildProject; }
+ get { return project.DotNetProject; }
}
public FrameworkName TargetFramework {
@@ -73,7 +74,7 @@ namespace ICSharpCode.PackageManagement
FrameworkName GetTargetFramework()
{
if (targetFramework == null) {
- targetFramework = new ProjectTargetFramework(msbuildProject);
+ targetFramework = new ProjectTargetFramework(project);
}
return targetFramework.TargetFrameworkName;
}
@@ -88,6 +89,16 @@ namespace ICSharpCode.PackageManagement
projectManager.Logger = value;
projectManager.Project.Logger = value;
+
+ ConfigureLoggerForSourceRepository ();
+ }
+ }
+
+ void ConfigureLoggerForSourceRepository ()
+ {
+ var aggregateRepository = SourceRepository as AggregateRepository;
+ if (aggregateRepository != null) {
+ aggregateRepository.Logger = Logger;
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProjectFactory.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProjectFactory.cs
index 5e3c276d1f..6dfe3931de 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProjectFactory.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProjectFactory.cs
@@ -27,7 +27,7 @@
//
using System;
-using MonoDevelop.Projects;
+using MonoDevelop.PackageManagement;
using NuGet;
namespace ICSharpCode.PackageManagement
@@ -42,11 +42,11 @@ namespace ICSharpCode.PackageManagement
this.packageManagementEvents = packageManagementEvents;
}
- public IPackageManagementProject CreateProject(
+ public IPackageManagementProject CreateProject (
IPackageRepository sourceRepository,
- DotNetProject project)
+ IDotNetProject project)
{
- return new PackageManagementProject(sourceRepository, project, packageManagementEvents, factory);
+ return new PackageManagementProject (sourceRepository, project, packageManagementEvents, factory);
}
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProjectService.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProjectService.cs
index b2a64025ef..9aeb8430a3 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProjectService.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProjectService.cs
@@ -30,38 +30,70 @@ using System;
using System.Collections.Generic;
using System.Linq;
using MonoDevelop.Ide;
+using MonoDevelop.PackageManagement;
using MonoDevelop.Projects;
namespace ICSharpCode.PackageManagement
{
public class PackageManagementProjectService : IPackageManagementProjectService
{
- public PackageManagementProjectService()
+ public PackageManagementProjectService ()
{
+ IdeApp.Workspace.SolutionLoaded += (sender, e) => OnSolutionLoaded (e.Solution);
+ IdeApp.Workspace.SolutionUnloaded += (sender, e) => OnSolutionUnloaded ();
}
-
- public Project CurrentProject {
- get { return IdeApp.ProjectOperations.CurrentSelectedProject; }
- }
-
- public Solution OpenSolution {
- get { return IdeApp.ProjectOperations.CurrentSelectedSolution; }
+
+ public event EventHandler SolutionLoaded;
+
+ void OnSolutionLoaded (Solution solution)
+ {
+ OpenSolution = new SolutionProxy (solution);
+
+ EventHandler handler = SolutionLoaded;
+ if (handler != null) {
+ handler (this, new EventArgs ());
+ }
}
-
- public IEnumerable<Project> GetOpenProjects()
+
+ public event EventHandler SolutionUnloaded;
+
+ void OnSolutionUnloaded ()
{
- Solution solution = OpenSolution;
- if (solution != null) {
- return solution.GetAllProjects();
+ OpenSolution = null;
+
+ var handler = SolutionUnloaded;
+ if (handler != null) {
+ handler (this, new EventArgs ());
}
- return new Project[0];
}
-
- public void Save(Solution solution)
+
+ public IProject CurrentProject {
+ get {
+ Project project = IdeApp.ProjectOperations.CurrentSelectedProject;
+ if (project != null) {
+ if (project is DotNetProject) {
+ return new DotNetProjectProxy ((DotNetProject)project);
+ }
+ return new ProjectProxy (project);
+ }
+ return null;
+ }
+ }
+
+ public ISolution OpenSolution { get; private set; }
+
+ public IEnumerable<IDotNetProject> GetOpenProjects ()
{
- solution.Save();
+ Solution solution = IdeApp.ProjectOperations.CurrentSelectedSolution;
+ if (solution != null) {
+ return solution
+ .GetAllProjects ()
+ .OfType<DotNetProject> ()
+ .Select (project => new DotNetProjectProxy (project));
+ }
+ return new IDotNetProject [0];
}
-
+
public IProjectBrowserUpdater CreateProjectBrowserUpdater()
{
return new ThreadSafeProjectBrowserUpdater();
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementSelectedProject.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementSelectedProject.cs
index c2fb5ca2f1..d4eef0a928 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementSelectedProject.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementSelectedProject.cs
@@ -44,13 +44,21 @@ namespace ICSharpCode.PackageManagement
{
}
- public PackageManagementSelectedProject(
+ public PackageManagementSelectedProject (
IPackageManagementProject project,
bool selected,
bool enabled)
+ : this (project.Name, selected, enabled)
{
this.Project = project;
- this.Name = Project.Name;
+ }
+
+ public PackageManagementSelectedProject (
+ string name,
+ bool selected,
+ bool enabled)
+ {
+ this.Name = name;
this.IsSelected = selected;
this.IsEnabled = enabled;
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementSelectedProjects.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementSelectedProjects.cs
index aac384d23c..d2d5b69700 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementSelectedProjects.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementSelectedProjects.cs
@@ -30,16 +30,18 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Runtime.Versioning;
using MonoDevelop.Projects;
using NuGet;
+using MonoDevelop.PackageManagement;
namespace ICSharpCode.PackageManagement
{
public class PackageManagementSelectedProjects
{
bool? singleProjectSelected;
- Project singleDotNetProjectSelected;
+ IDotNetProject singleDotNetProjectSelected;
public PackageManagementSelectedProjects(IPackageManagementSolution solution)
{
@@ -54,8 +56,8 @@ namespace ICSharpCode.PackageManagement
if (HasSingleProjectSelected()) {
yield return GetSingleProjectSelected(package);
} else {
- foreach (Project project in GetOpenProjects()) {
- yield return CreateSelectedProject(project, package);
+ foreach (IDotNetProject project in GetOpenProjects ()) {
+ yield return CreateSelectedProject (project, package);
}
}
}
@@ -74,7 +76,7 @@ namespace ICSharpCode.PackageManagement
singleProjectSelected = singleDotNetProjectSelected != null;
}
- IEnumerable<Project> GetOpenProjects()
+ IEnumerable<IDotNetProject> GetOpenProjects ()
{
return Solution.GetDotNetProjects();
}
@@ -84,7 +86,7 @@ namespace ICSharpCode.PackageManagement
return CreateSelectedProject(singleDotNetProjectSelected, package);
}
- IPackageManagementSelectedProject CreateSelectedProject(Project dotNetProject, IPackageFromRepository package)
+ IPackageManagementSelectedProject CreateSelectedProject(IDotNetProject dotNetProject, IPackageFromRepository package)
{
IPackageManagementProject project = Solution.GetProject(package.Repository, dotNetProject);
return CreateSelectedProject(project, package);
@@ -186,5 +188,14 @@ namespace ICSharpCode.PackageManagement
}
return false;
}
+
+ public FrameworkName GetTargetFramework ()
+ {
+ if (HasSingleProjectSelected ()) {
+ return new ProjectTargetFramework (singleDotNetProjectSelected)
+ .TargetFrameworkName;
+ }
+ return null;
+ }
}
} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementServices.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementServices.cs
index 0c30ba8beb..de9578309f 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementServices.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementServices.cs
@@ -47,22 +47,25 @@ namespace ICSharpCode.PackageManagement
static readonly UserAgentGeneratorForRepositoryRequests userAgentGenerator;
static readonly BackgroundPackageActionRunner backgroundPackageActionRunner;
static readonly IPackageManagementProgressMonitorFactory progressMonitorFactory;
+ static readonly PackageManagementProgressProvider progressProvider;
static PackageManagementServices()
{
options = new PackageManagementOptions();
- packageRepositoryCache = new PackageRepositoryCache(options.PackageSources, options.RecentPackages);
- userAgentGenerator = new UserAgentGeneratorForRepositoryRequests(packageRepositoryCache);
+ packageRepositoryCache = new PackageRepositoryCache (options);
+ userAgentGenerator = new UserAgentGeneratorForRepositoryRequests ();
+ userAgentGenerator.Register (packageRepositoryCache);
+ progressProvider = new PackageManagementProgressProvider (packageRepositoryCache);
registeredPackageRepositories = new RegisteredPackageRepositories(packageRepositoryCache, options);
projectTemplatePackageSources = new RegisteredProjectTemplatePackageSources();
projectTemplatePackageRepositoryCache = new ProjectTemplatePackageRepositoryCache(projectTemplatePackageSources);
outputMessagesView = new PackageManagementOutputMessagesView(packageManagementEvents);
- solution = new PackageManagementSolution(registeredPackageRepositories, packageManagementEvents);
+ solution = new PackageManagementSolution (registeredPackageRepositories, projectService, packageManagementEvents);
packageActionRunner = new PackageActionRunner(packageManagementEvents);
progressMonitorFactory = new PackageManagementProgressMonitorFactory ();
- backgroundPackageActionRunner = new BackgroundPackageActionRunner (progressMonitorFactory, packageManagementEvents);
+ backgroundPackageActionRunner = new BackgroundPackageActionRunner (progressMonitorFactory, packageManagementEvents, progressProvider);
InitializeCredentialProvider();
}
@@ -79,11 +82,6 @@ namespace ICSharpCode.PackageManagement
return new SettingsCredentialProvider(credentialProvider, packageSourceProvider);
}
- public static void DisablePromptForCredentials ()
- {
- HttpClient.DefaultCredentialProvider = CreateSettingsCredentialProvider (NullCredentialProvider.Instance);
- }
-
public static PackageManagementOptions Options {
get { return options; }
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementSolution.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementSolution.cs
index cadcd39ca0..7623d05b57 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementSolution.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementSolution.cs
@@ -29,7 +29,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using MonoDevelop.Projects;
+using MonoDevelop.PackageManagement;
using NuGet;
namespace ICSharpCode.PackageManagement
@@ -43,10 +43,11 @@ namespace ICSharpCode.PackageManagement
public PackageManagementSolution(
IRegisteredPackageRepositories registeredPackageRepositories,
+ IPackageManagementProjectService projectService,
IPackageManagementEvents packageManagementEvents)
: this(
registeredPackageRepositories,
- new PackageManagementProjectService(),
+ projectService,
new PackageManagementProjectFactory(packageManagementEvents),
new SolutionPackageRepositoryFactory())
{
@@ -68,14 +69,14 @@ namespace ICSharpCode.PackageManagement
get { return OpenSolution.FileName; }
}
- Solution OpenSolution {
+ ISolution OpenSolution {
get { return projectService.OpenSolution; }
}
-
+
public IPackageManagementProject GetActiveProject()
{
if (HasActiveProject()) {
- return GetActiveProject(ActivePackageRepository);
+ return GetActiveProject(registeredPackageRepositories.CreateAggregateRepository());
}
return null;
}
@@ -85,9 +86,12 @@ namespace ICSharpCode.PackageManagement
return GetActiveDotNetProject() != null;
}
- public Project GetActiveDotNetProject()
+ public IDotNetProject GetActiveDotNetProject ()
{
- return projectService.CurrentProject;
+ if (projectService.CurrentProject != null) {
+ return projectService.CurrentProject as IDotNetProject;
+ }
+ return null;
}
IPackageRepository ActivePackageRepository {
@@ -96,18 +100,18 @@ namespace ICSharpCode.PackageManagement
public IPackageManagementProject GetActiveProject(IPackageRepository sourceRepository)
{
- var activeProject = GetActiveDotNetProject() as DotNetProject;
+ IDotNetProject activeProject = GetActiveDotNetProject ();
if (activeProject != null) {
- return CreateProject(sourceRepository, activeProject);
+ return CreateProject (sourceRepository, activeProject);
}
return null;
}
-
- IPackageManagementProject CreateProject(IPackageRepository sourceRepository, DotNetProject project)
+
+ IPackageManagementProject CreateProject (IPackageRepository sourceRepository, IDotNetProject project)
{
- return projectFactory.CreateProject(sourceRepository, project);
+ return projectFactory.CreateProject (sourceRepository, project);
}
-
+
IPackageRepository CreatePackageRepository(PackageSource source)
{
return registeredPackageRepositories.CreateRepository(source);
@@ -115,17 +119,17 @@ namespace ICSharpCode.PackageManagement
public IPackageManagementProject GetProject(PackageSource source, string projectName)
{
- DotNetProject project = GetDotNetProject(projectName);
+ IDotNetProject project = GetDotNetProject (projectName);
return CreateProject(source, project);
}
- DotNetProject GetDotNetProject(string name)
+ IDotNetProject GetDotNetProject (string name)
{
var openProjects = new OpenDotNetProjects(projectService);
return openProjects.FindProject(name);
}
- IPackageManagementProject CreateProject(PackageSource source, DotNetProject project)
+ IPackageManagementProject CreateProject (PackageSource source, IDotNetProject project)
{
IPackageRepository sourceRepository = CreatePackageRepository(source);
return CreateProject(sourceRepository, project);
@@ -133,19 +137,18 @@ namespace ICSharpCode.PackageManagement
public IPackageManagementProject GetProject(IPackageRepository sourceRepository, string projectName)
{
- DotNetProject project = GetDotNetProject(projectName);
+ IDotNetProject project = GetDotNetProject (projectName);
return CreateProject(sourceRepository, project);
}
- public IPackageManagementProject GetProject(IPackageRepository sourceRepository, Project project)
+ public IPackageManagementProject GetProject (IPackageRepository sourceRepository, IDotNetProject project)
{
- var dotNetProject = project as DotNetProject;
- return CreateProject(sourceRepository, dotNetProject);
+ return CreateProject (sourceRepository, project);
}
- public IEnumerable<Project> GetDotNetProjects()
+ public IEnumerable<IDotNetProject> GetDotNetProjects ()
{
- return projectService.GetOpenProjects();
+ return projectService.GetOpenProjects ();
}
public bool IsOpen {
@@ -165,7 +168,7 @@ namespace ICSharpCode.PackageManagement
ISolutionPackageRepository CreateSolutionPackageRepository()
{
- return solutionPackageRepositoryFactory.CreateSolutionPackageRepository(OpenSolution);
+ return solutionPackageRepositoryFactory.CreateSolutionPackageRepository (OpenSolution);
}
public IQueryable<IPackage> GetPackages()
@@ -199,7 +202,7 @@ namespace ICSharpCode.PackageManagement
public IEnumerable<IPackageManagementProject> GetProjects(IPackageRepository sourceRepository)
{
- foreach (DotNetProject dotNetProject in GetDotNetProjects()) {
+ foreach (IDotNetProject dotNetProject in GetDotNetProjects ()) {
yield return projectFactory.CreateProject(sourceRepository, dotNetProject);
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementViewModels.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementViewModels.cs
index 80e8e1d65e..8132c0eea9 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementViewModels.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementViewModels.cs
@@ -57,8 +57,7 @@ namespace ICSharpCode.PackageManagement
new ManagePackagesViewModel(
packagesViewModels,
new ManagePackagesViewTitle(solution),
- packageManagementEvents,
- new ManagePackagesUserPrompts(packageManagementEvents));
+ packageManagementEvents);
}
void CreateRegisteredPackageRepositories()
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRepositoryCache.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRepositoryCache.cs
index 378fd81901..0315f4530a 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRepositoryCache.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRepositoryCache.cs
@@ -36,32 +36,38 @@ namespace ICSharpCode.PackageManagement
public class PackageRepositoryCache : IPackageRepositoryCache, IPackageRepositoryFactoryEvents
{
ISharpDevelopPackageRepositoryFactory factory;
- RegisteredPackageSources registeredPackageSources;
+ RegisteredPackageSources packageSources;
+ PackageManagementOptions options;
IList<RecentPackageInfo> recentPackages;
IRecentPackageRepository recentPackageRepository;
ConcurrentDictionary<string, IPackageRepository> repositories =
new ConcurrentDictionary<string, IPackageRepository>();
- public PackageRepositoryCache(
- ISharpDevelopPackageRepositoryFactory factory,
- RegisteredPackageSources registeredPackageSources,
- IList<RecentPackageInfo> recentPackages)
+ public PackageRepositoryCache (
+ PackageManagementOptions options,
+ ISharpDevelopPackageRepositoryFactory factory)
{
+ this.options = options;
this.factory = factory;
- this.registeredPackageSources = registeredPackageSources;
- this.recentPackages = recentPackages;
+ this.recentPackages = options.RecentPackages;
}
- public PackageRepositoryCache(
- RegisteredPackageSources registeredPackageSources,
- IList<RecentPackageInfo> recentPackages)
+ public PackageRepositoryCache (PackageManagementOptions options)
: this(
- new SharpDevelopPackageRepositoryFactory(),
- registeredPackageSources,
- recentPackages)
+ options,
+ new SharpDevelopPackageRepositoryFactory ())
{
}
-
+
+ public PackageRepositoryCache (
+ RegisteredPackageSources packageSources,
+ IList<RecentPackageInfo> recentPackages)
+ {
+ this.factory = new SharpDevelopPackageRepositoryFactory ();
+ this.recentPackages = recentPackages;
+ this.packageSources = packageSources;
+ }
+
public event EventHandler<PackageRepositoryFactoryEventArgs> RepositoryCreated;
public IPackageRepository CreateRepository(string packageSource)
@@ -112,10 +118,19 @@ namespace ICSharpCode.PackageManagement
IEnumerable<IPackageRepository> CreateAllEnabledRepositories()
{
- foreach (PackageSource source in registeredPackageSources.GetEnabledPackageSources()) {
+ foreach (PackageSource source in PackageSources.GetEnabledPackageSources ()) {
yield return CreateRepository(source.Source);
}
}
+
+ RegisteredPackageSources PackageSources {
+ get {
+ if (packageSources != null) {
+ return packageSources;
+ }
+ return options.PackageSources;
+ }
+ }
public IPackageRepository CreateAggregateRepository(IEnumerable<IPackageRepository> repositories)
{
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRestoreRunner.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRestoreRunner.cs
index 4811c4bca2..fdfcc8454a 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRestoreRunner.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRestoreRunner.cs
@@ -95,13 +95,13 @@ namespace MonoDevelop.PackageManagement
ProgressMonitorStatusMessage progressMessage,
NuGetPackageRestoreCommandLine commandLine)
{
- var aggregatedMonitor = (AggregatedProgressMonitor)progressMonitor;
+ var aggregatedMonitor = (PackageManagementProgressMonitor)progressMonitor;
Runtime.ProcessService.StartConsoleProcess(
commandLine.Command,
commandLine.Arguments,
commandLine.WorkingDirectory,
- aggregatedMonitor.MasterMonitor as IConsole,
+ aggregatedMonitor.Console,
(sender, e) => {
using (progressMonitor) {
OnPackageRestoreCompleted ((IAsyncOperation)sender, progressMonitor, progressMessage);
@@ -117,10 +117,21 @@ namespace MonoDevelop.PackageManagement
{
if (operation.Success) {
RefreshProjectReferences ();
+ ForceCreationOfSharedRepositoriesConfigFile ();
}
ReportOutcome (operation, progressMonitor, progressMessage);
}
+ /// <summary>
+ /// Creating package managers for all the projects will force the
+ /// repositories.config file to be created.
+ /// </summary>
+ void ForceCreationOfSharedRepositoriesConfigFile ()
+ {
+ var repository = PackageManagementServices.RegisteredPackageRepositories.CreateAggregateRepository ();
+ solution.GetProjects (repository).ToList ();
+ }
+
void RefreshProjectReferences ()
{
DispatchService.GuiDispatch (() => {
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageSearchCriteria.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageSearchCriteria.cs
new file mode 100644
index 0000000000..476d72222f
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageSearchCriteria.cs
@@ -0,0 +1,93 @@
+//
+// PackageSearchCriteria.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement
+{
+ public class PackageSearchCriteria
+ {
+ WildcardVersionSpec wildcardVersionSpec;
+
+ public PackageSearchCriteria (string searchText)
+ {
+ SearchText = RemoveWhitespace (searchText);
+ ParseSearchText (SearchText);
+ }
+
+ public string PackageId { get; private set; }
+ public string SearchText { get; private set; }
+
+ public bool IsPackageVersionSearch {
+ get { return !String.IsNullOrEmpty (PackageId); }
+ }
+
+ public bool IsVersionMatch (SemanticVersion version)
+ {
+ if (wildcardVersionSpec == null)
+ return true;
+
+ return wildcardVersionSpec.Satisfies (version);
+ }
+
+ string RemoveWhitespace (string searchText)
+ {
+ if (String.IsNullOrWhiteSpace (searchText))
+ return null;
+
+ return searchText;
+ }
+
+ void ParseSearchText (string searchText)
+ {
+ if (searchText == null)
+ return;
+
+ string[] parts = searchText.Split (new [] {' '}, StringSplitOptions.RemoveEmptyEntries);
+ if (parts.Length < 2)
+ return;
+
+ if (!IsVersionOption (parts [1]))
+ return;
+
+ PackageId = parts [0].Trim ();
+
+ wildcardVersionSpec = new WildcardVersionSpec (GetVersion (parts [1]));
+ }
+
+ bool IsVersionOption (string option)
+ {
+ return option.StartsWith ("version:", StringComparison.OrdinalIgnoreCase);
+ }
+
+ string GetVersion (string option)
+ {
+ int index = option.IndexOf (':');
+ return option.Substring (index + 1);
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageSourceViewModel.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageSourceViewModel.cs
index e837a6f2ed..dab268d647 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageSourceViewModel.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageSourceViewModel.cs
@@ -72,6 +72,11 @@ namespace ICSharpCode.PackageManagement
set { packageSource.Password = value; }
}
+ public bool HasPassword ()
+ {
+ return !String.IsNullOrEmpty (Password);
+ }
+
public bool IsValid { get; set; }
public string ValidationFailureMessage { get; set; }
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageSourceViewModelChecker.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageSourceViewModelChecker.cs
index d5cf85c7f5..354881eeab 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageSourceViewModelChecker.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageSourceViewModelChecker.cs
@@ -80,7 +80,7 @@ namespace MonoDevelop.PackageManagement
PackageSourceViewModelCheckedEventArgs CheckHttpPackageSource (PackageSourceViewModel packageSource)
{
- var httpClient = new HttpClient (new Uri (packageSource.SourceUrl));
+ HttpClient httpClient = CreateHttpClient (packageSource);
try {
using (var response = (HttpWebResponse)httpClient.GetResponse ()) {
if (response.StatusCode == HttpStatusCode.OK) {
@@ -97,6 +97,34 @@ namespace MonoDevelop.PackageManagement
}
}
+ /// <summary>
+ /// Do not use cached credentials for the first request sent to a package source.
+ ///
+ /// Once NuGet has a valid credential for a package source it is used from that point
+ /// onwards. So if the user changes a valid username/password in Preferences
+ /// to a non-valid username/password they will not see the 'Invalid credentials'
+ /// warning. To workaround this caching we remove the credentials for the request
+ /// the first time it is sent. Also the UseDefaultCredentials is set to true.
+ /// This forces NuGet to get the credentials from the IPackageSourceProvider,
+ /// which is implemented by the RegisteredPackageSourcesViewModel, and will
+ /// contain the latest usernames and passwords for all package sources.
+ /// </summary>
+ HttpClient CreateHttpClient(PackageSourceViewModel packageSource)
+ {
+ var httpClient = new HttpClient (new Uri (packageSource.SourceUrl));
+
+ bool resetCredentials = true;
+ httpClient.SendingRequest += (sender, e) => {
+ if (resetCredentials && packageSource.HasPassword ()) {
+ resetCredentials = false;
+ e.Request.Credentials = null;
+ e.Request.UseDefaultCredentials = true;
+ }
+ };
+
+ return httpClient;
+ }
+
PackageSourceViewModelCheckedEventArgs CheckFileSystemPackageSource (PackageSourceViewModel packageSource)
{
if (Directory.Exists (packageSource.SourceUrl)) {
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageViewModel.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageViewModel.cs
index 6cc610fce2..8bcac9262e 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageViewModel.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageViewModel.cs
@@ -30,6 +30,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
+using System.Runtime.Versioning;
using MonoDevelop.PackageManagement;
using NuGet;
@@ -49,6 +50,7 @@ namespace ICSharpCode.PackageManagement
IPackageActionRunner actionRunner;
IPackageViewModelParent parent;
string summary;
+ List<PackageDependency> dependencies;
public PackageViewModel(
IPackageViewModelParent parent,
@@ -135,12 +137,20 @@ namespace ICSharpCode.PackageManagement
return selectedProjects.IsPackageInstalled(package);
}
- public IEnumerable<PackageDependencySet> Dependencies {
- get { return package.DependencySets; }
+ public IEnumerable<PackageDependency> Dependencies {
+ get {
+ if (dependencies == null) {
+ FrameworkName targetFramework = selectedProjects.GetTargetFramework ();
+ dependencies = package
+ .GetCompatiblePackageDependencies (targetFramework)
+ .ToList ();
+ }
+ return dependencies;
+ }
}
public bool HasDependencies {
- get { return package.HasDependencies; }
+ get { return Dependencies.Any (); }
}
public bool HasNoDependencies {
@@ -539,7 +549,16 @@ namespace ICSharpCode.PackageManagement
return String.Empty;
}
- public string GetDownloadCountDisplayText()
+ public string GetDownloadCountOrVersionDisplayText ()
+ {
+ if (ShowVersionInsteadOfDownloadCount) {
+ return Version.ToString ();
+ }
+
+ return GetDownloadCountDisplayText ();
+ }
+
+ public string GetDownloadCountDisplayText ()
{
if (HasDownloadCount) {
return DownloadCount.ToString ("N0");
@@ -550,10 +569,8 @@ namespace ICSharpCode.PackageManagement
public string GetPackageDependenciesDisplayText ()
{
var displayText = new StringBuilder ();
- foreach (PackageDependencySet dependencySet in Dependencies) {
- foreach (PackageDependency dependency in dependencySet.Dependencies) {
- displayText.AppendLine (dependency.ToString ());
- }
+ foreach (PackageDependency dependency in Dependencies) {
+ displayText.AppendLine (dependency.ToString ());
}
return displayText.ToString ();
}
@@ -574,5 +591,6 @@ namespace ICSharpCode.PackageManagement
}
public bool IsChecked { get; set; }
+ public bool ShowVersionInsteadOfDownloadCount { get; set; }
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackagesForSelectedPageQuery.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackagesForSelectedPageQuery.cs
index de0715508a..d6177fa592 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackagesForSelectedPageQuery.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackagesForSelectedPageQuery.cs
@@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
+using MonoDevelop.PackageManagement;
using NuGet;
namespace ICSharpCode.PackageManagement
@@ -41,13 +42,13 @@ namespace ICSharpCode.PackageManagement
Skip = viewModel.ItemsBeforeFirstPage;
Take = viewModel.PageSize;
AllPackages = allPackages;
- SearchCriteria = searchCriteria;
+ SearchCriteria = new PackageSearchCriteria (searchCriteria);
TotalPackages = viewModel.TotalItems;
}
public int Skip { get; private set; }
public int Take { get; private set; }
- public string SearchCriteria { get; private set; }
+ public PackageSearchCriteria SearchCriteria { get; private set; }
public int TotalPackages { get; set; }
public IEnumerable<IPackage> AllPackages { get; set; }
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackagesRequiringLicenseAcceptance.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackagesRequiringLicenseAcceptance.cs
index 0353b689f5..d0c0ea3318 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackagesRequiringLicenseAcceptance.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackagesRequiringLicenseAcceptance.cs
@@ -34,16 +34,11 @@ namespace MonoDevelop.PackageManagement
{
public class PackagesRequiringLicenseAcceptance
{
- IPackageManagementSolution solution;
+ IPackageManagementProject project;
- public PackagesRequiringLicenseAcceptance (IPackageManagementSolution solution)
- {
- this.solution = solution;
- }
-
- public PackagesRequiringLicenseAcceptance ()
- : this (PackageManagementServices.Solution)
+ public PackagesRequiringLicenseAcceptance (IPackageManagementProject project)
{
+ this.project = project;
}
public IEnumerable<IPackage> GetPackagesRequiringLicenseAcceptance (IEnumerable<IPackageAction> actions)
@@ -70,12 +65,12 @@ namespace MonoDevelop.PackageManagement
bool PackageRequiresLicenseAcceptance (IPackage package)
{
- return package.RequireLicenseAcceptance && !IsPackageInstalledInSolution (package);
+ return package.RequireLicenseAcceptance && !IsPackageInstalled (package);
}
- bool IsPackageInstalledInSolution(IPackage package)
+ bool IsPackageInstalled(IPackage package)
{
- return solution.IsPackageInstalled (package);
+ return project.IsPackageInstalled (package);
}
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackagesViewModel.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackagesViewModel.cs
index ed27262895..1d1e8a7cdc 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackagesViewModel.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackagesViewModel.cs
@@ -34,6 +34,7 @@ using System.Linq;
using System.Text;
using MonoDevelop.Core;
+using MonoDevelop.PackageManagement;
using NuGet;
namespace ICSharpCode.PackageManagement
@@ -143,7 +144,7 @@ namespace ICSharpCode.PackageManagement
void CreateReadPackagesTask()
{
- var query = new PackagesForSelectedPageQuery(this, allPackages, GetSearchCriteria());
+ var query = new PackagesForSelectedPageQuery (this, allPackages, SearchTerms);
packagesForSelectedPageQuery = query;
task = taskFactory.CreateTask(
@@ -181,7 +182,7 @@ namespace ICSharpCode.PackageManagement
{
HasError = true;
ErrorMessage = GetErrorMessage(ex);
- LoggingService.LogDebug("PackagesViewModel error", ex);
+ LoggingService.LogInfo("PackagesViewModel error", ex);
}
string GetErrorMessage(AggregateException ex)
@@ -197,19 +198,19 @@ namespace ICSharpCode.PackageManagement
TotalItems = result.TotalPackages;
allPackages = result.AllPackages;
- UpdatePackageViewModels (PrioritizePackages (result));
+ UpdatePackageViewModels (PrioritizePackages (result), result.Query.SearchCriteria);
}
IEnumerable<IPackage> PrioritizePackages (PackagesForSelectedPageResult result)
{
- return PrioritizePackages (result.Packages, GetSearchCriteria ());
+ return PrioritizePackages (result.Packages, result.Query.SearchCriteria);
}
- protected virtual IEnumerable<IPackage> PrioritizePackages (IEnumerable<IPackage> packages, string searchCriteria)
+ protected virtual IEnumerable<IPackage> PrioritizePackages (IEnumerable<IPackage> packages, PackageSearchCriteria searchCriteria)
{
return packages;
}
-
+
IEnumerable<IPackage> GetPackagesForSelectedPage(PackagesForSelectedPageQuery query)
{
IEnumerable<IPackage> filteredPackages = GetFilteredPackagesBeforePagingResults(query);
@@ -221,7 +222,7 @@ namespace ICSharpCode.PackageManagement
if (query.AllPackages == null) {
IQueryable<IPackage> packages = GetPackagesFromPackageSource(query.SearchCriteria);
query.TotalPackages = packages.Count();
- query.AllPackages = GetFilteredPackagesBeforePagingResults(packages);
+ query.AllPackages = GetFilteredPackagesBeforePagingResults (packages, query.SearchCriteria);
}
return query.AllPackages;
}
@@ -231,28 +232,20 @@ namespace ICSharpCode.PackageManagement
/// </summary>
public IQueryable<IPackage> GetPackagesFromPackageSource()
{
- return GetPackagesFromPackageSource(GetSearchCriteria());
+ return GetPackagesFromPackageSource(new PackageSearchCriteria (SearchTerms));
}
- IQueryable<IPackage> GetPackagesFromPackageSource(string searchCriteria)
+ IQueryable<IPackage> GetPackagesFromPackageSource (PackageSearchCriteria search)
{
- IQueryable<IPackage> packages = GetPackages(searchCriteria);
- return OrderPackages(packages);
+ IQueryable<IPackage> packages = GetPackages (search);
+ return OrderPackages (packages, search);
}
- protected virtual IQueryable<IPackage> OrderPackages(IQueryable<IPackage> packages)
+ protected virtual IQueryable<IPackage> OrderPackages (IQueryable<IPackage> packages, PackageSearchCriteria search)
{
return packages
.OrderBy(package => package.Id);
}
-
- protected string GetSearchCriteria()
- {
- if (String.IsNullOrWhiteSpace(SearchTerms)) {
- return null;
- }
- return SearchTerms;
- }
IEnumerable<IPackage> GetPackagesForSelectedPage(IEnumerable<IPackage> allPackages, PackagesForSelectedPageQuery query)
{
@@ -272,7 +265,7 @@ namespace ICSharpCode.PackageManagement
/// <summary>
/// Returns packages filtered by search criteria.
/// </summary>
- protected virtual IQueryable<IPackage> GetPackages (string search)
+ protected virtual IQueryable<IPackage> GetPackages (PackageSearchCriteria search)
{
return null;
}
@@ -281,7 +274,7 @@ namespace ICSharpCode.PackageManagement
/// Allows filtering of the packages before paging the results. Call base class method
/// to run default filtering.
/// </summary>
- protected virtual IEnumerable<IPackage> GetFilteredPackagesBeforePagingResults(IQueryable<IPackage> allPackages)
+ protected virtual IEnumerable<IPackage> GetFilteredPackagesBeforePagingResults (IQueryable<IPackage> allPackages, PackageSearchCriteria search)
{
IEnumerable<IPackage> bufferedPackages = GetBufferedPackages(allPackages);
return bufferedPackages;
@@ -292,9 +285,9 @@ namespace ICSharpCode.PackageManagement
return allPackages.AsBufferedEnumerable(30);
}
- void UpdatePackageViewModels(IEnumerable<IPackage> packages)
+ void UpdatePackageViewModels (IEnumerable<IPackage> packages, PackageSearchCriteria search)
{
- IEnumerable<PackageViewModel> currentViewModels = ConvertToPackageViewModels(packages);
+ IEnumerable<PackageViewModel> currentViewModels = ConvertToPackageViewModels (packages, search);
UpdatePackageViewModels(currentViewModels);
}
@@ -311,19 +304,29 @@ namespace ICSharpCode.PackageManagement
PackageViewModels.Clear();
}
- public IEnumerable<PackageViewModel> ConvertToPackageViewModels(IEnumerable<IPackage> packages)
+ public IEnumerable<PackageViewModel> ConvertToPackageViewModels (IEnumerable<IPackage> packages, PackageSearchCriteria search)
{
foreach (IPackage package in packages) {
- yield return CreatePackageViewModel(package);
+ yield return CreatePackageViewModel (package, search);
}
}
- PackageViewModel CreatePackageViewModel(IPackage package)
+ protected virtual PackageViewModel CreatePackageViewModel (IPackage package, PackageSearchCriteria search)
{
- var repository = registeredPackageRepositories.ActiveRepository;
- var packageFromRepository = new PackageFromRepository(package, repository);
+ PackageFromRepository packageFromRepository = CreatePackageFromRepository (package);
return packageViewModelFactory.CreatePackageViewModel(this, packageFromRepository);
}
+
+ PackageFromRepository CreatePackageFromRepository (IPackage package)
+ {
+ var packageFromRepository = package as PackageFromRepository;
+ if (packageFromRepository != null) {
+ return packageFromRepository;
+ }
+
+ var repository = registeredPackageRepositories.ActiveRepository;
+ return new PackageFromRepository(package, repository);
+ }
public int SelectedPageNumber {
get { return pages.SelectedPageNumber; }
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackagesViewModels.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackagesViewModels.cs
index b1d223cdba..2bf7ad3e67 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackagesViewModels.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackagesViewModels.cs
@@ -40,8 +40,8 @@ namespace ICSharpCode.PackageManagement
ITaskFactory taskFactory)
{
var packageViewModelFactory = new PackageViewModelFactory(solution, packageManagementEvents, actionRunner);
- var updatedPackageViewModelFactory = new UpdatedPackageViewModelFactory(packageViewModelFactory);
- var installedPackageViewModelFactory = new InstalledPackageViewModelFactory(packageViewModelFactory);
+ //var updatedPackageViewModelFactory = new UpdatedPackageViewModelFactory(packageViewModelFactory);
+ //var installedPackageViewModelFactory = new InstalledPackageViewModelFactory(packageViewModelFactory);
IRecentPackageRepository recentPackageRepository = PackageManagementServices.RecentPackageRepository;
AvailablePackagesViewModel = new AvailablePackagesViewModel(registeredPackageRepositories, recentPackageRepository, packageViewModelFactory, taskFactory);
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProcessPackageAction.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProcessPackageAction.cs
index bc0ebc57c1..53d3b33c81 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProcessPackageAction.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProcessPackageAction.cs
@@ -27,7 +27,11 @@
//
using System;
+using System.Collections.Generic;
+using System.Linq;
using System.Runtime.Versioning;
+using MonoDevelop.Core;
+using MonoDevelop.PackageManagement;
using NuGet;
namespace ICSharpCode.PackageManagement
@@ -35,6 +39,7 @@ namespace ICSharpCode.PackageManagement
public abstract class ProcessPackageAction : IPackageAction
{
IPackageManagementEvents packageManagementEvents;
+ bool hasBeforeExecuteBeenRun;
public ProcessPackageAction(
IPackageManagementProject project,
@@ -74,18 +79,94 @@ namespace ICSharpCode.PackageManagement
public void Execute()
{
BeforeExecute();
+ CheckForPowerShellScripts ();
+ CheckLicenses ();
//if (PackageScriptRunner != null) {
// ExecuteWithScriptRunner();
//} else {
ExecuteCore();
//}
+ LogEmptyLineForFinishedAction ();
}
protected virtual void BeforeExecute()
{
+ if (hasBeforeExecuteBeenRun)
+ return;
+
GetLoggerIfMissing();
ConfigureProjectLogger();
+ LogStartingMessage ();
GetPackageIfMissing();
+
+ hasBeforeExecuteBeenRun = true;
+ }
+
+ void LogStartingMessage ()
+ {
+ if (ShouldLogStartingMessage ()) {
+ Logger.Log (MessageLevel.Info, GetStartingMessage ());
+ }
+ }
+
+ protected virtual bool ShouldLogStartingMessage ()
+ {
+ return true;
+ }
+
+ string GetStartingMessage ()
+ {
+ return String.Format (
+ GettextCatalog.GetString (StartingMessageFormat),
+ GetPackageId ());
+ }
+
+ protected abstract string StartingMessageFormat { get; }
+
+ void LogEmptyLineForFinishedAction ()
+ {
+ if (!ShouldLogEmptyLineForFinishedAction ())
+ return;
+
+ Logger.Log (MessageLevel.Info, String.Empty);
+ }
+
+ protected virtual bool ShouldLogEmptyLineForFinishedAction ()
+ {
+ return true;
+ }
+
+ void CheckForPowerShellScripts ()
+ {
+ if (HasPackageScriptsToRun ()) {
+ ReportPowerShellScriptWarning ();
+ }
+ }
+
+ void ReportPowerShellScriptWarning ()
+ {
+ string message = GettextCatalog.GetString ("{0} Package contains PowerShell scripts which will not be run.", GetPackageId ());
+ packageManagementEvents.OnPackageOperationMessageLogged (MessageLevel.Warning, message);
+ }
+
+ void CheckLicenses ()
+ {
+ if (!AcceptLicenses ()) {
+ string message = GettextCatalog.GetString ("Licenses not accepted.");
+ throw new ApplicationException (message);
+ }
+ }
+
+ bool AcceptLicenses ()
+ {
+ var packagesWithLicenses = new PackagesRequiringLicenseAcceptance (Project);
+ var actions = new IPackageAction [] { this };
+ List<IPackage> packages = packagesWithLicenses.GetPackagesRequiringLicenseAcceptance (actions).ToList ();
+ if (packages.Any ()) {
+ return packageManagementEvents.OnAcceptLicenses (packages);
+ }
+
+ return true;
}
void ExecuteWithScriptRunner()
@@ -137,7 +218,7 @@ namespace ICSharpCode.PackageManagement
{
Package = Project
.SourceRepository
- .FindPackage(PackageId, PackageVersion, AllowPrereleaseVersions, allowUnlisted: true);
+ .FindPackage(PackageId, PackageVersion, AllowPrereleaseVersions, allowUnlisted: false);
}
void ThrowPackageNotFoundError(string packageId)
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProgressMonitorExtensions.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProgressMonitorExtensions.cs
index 6b7318ed0f..6054ce7cf4 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProgressMonitorExtensions.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProgressMonitorExtensions.cs
@@ -37,8 +37,8 @@ namespace MonoDevelop.PackageManagement
public static void ShowPackageConsole (this IProgressMonitor monitor)
{
DispatchService.GuiDispatch (() => {
- var aggregateMonitor = (AggregatedProgressMonitor)monitor;
- Pad pad = IdeApp.Workbench.ProgressMonitors.GetPadForMonitor (aggregateMonitor.MasterMonitor);
+ var aggregatedMonitor = (PackageManagementProgressMonitor)monitor;
+ Pad pad = IdeApp.Workbench.ProgressMonitors.GetPadForMonitor (aggregatedMonitor.ConsoleMonitor);
if (pad != null) {
pad.BringToFront ();
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProjectProxy.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProjectProxy.cs
new file mode 100644
index 0000000000..7aef3277df
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProjectProxy.cs
@@ -0,0 +1,70 @@
+//
+// ProjectProxy.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections;
+using ICSharpCode.PackageManagement;
+using MonoDevelop.Core;
+using MonoDevelop.Projects;
+
+namespace MonoDevelop.PackageManagement
+{
+ public class ProjectProxy : IProject
+ {
+ Project project;
+
+ public ProjectProxy (Project project)
+ {
+ this.project = project;
+ }
+
+ public string Name {
+ get { return project.Name; }
+ }
+
+ public FilePath FileName {
+ get { return project.FileName; }
+ }
+
+ public FilePath BaseDirectory {
+ get { return project.BaseDirectory; }
+ }
+
+ public ISolution ParentSolution {
+ get { return new SolutionProxy (project.ParentSolution); }
+ }
+
+ public IDictionary ExtendedProperties {
+ get { return project.ExtendedProperties; }
+ }
+
+ public void Save ()
+ {
+ project.Save ();
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProjectTargetFramework.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProjectTargetFramework.cs
index 249dc72c36..9099f6d4c7 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProjectTargetFramework.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProjectTargetFramework.cs
@@ -29,16 +29,17 @@
using System;
using System.Runtime.Versioning;
using MonoDevelop.Core.Assemblies;
+using MonoDevelop.PackageManagement;
using MonoDevelop.Projects;
namespace ICSharpCode.PackageManagement
{
public class ProjectTargetFramework
{
- DotNetProject project;
+ IDotNetProject project;
FrameworkName targetFramework;
-
- public ProjectTargetFramework(DotNetProject project)
+
+ public ProjectTargetFramework (IDotNetProject project)
{
this.project = project;
GetTargetFramework();
@@ -65,7 +66,7 @@ namespace ICSharpCode.PackageManagement
}
TargetFrameworkMoniker TargetFrameworkMoniker {
- get { return project.TargetFramework.Id; }
+ get { return project.TargetFrameworkMoniker; }
}
string UseDefaultIfNullOrEmpty(string value, string defaultValue)
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProjectTemplateNuGetPackageInstaller.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProjectTemplateNuGetPackageInstaller.cs
index 7c94e8bc5c..a29d135b41 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProjectTemplateNuGetPackageInstaller.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProjectTemplateNuGetPackageInstaller.cs
@@ -38,13 +38,11 @@ namespace MonoDevelop.PackageManagement
{
IPackageManagementSolution packageManagementSolution;
IPackageRepositoryCache packageRepositoryCache;
- IPackageManagementEvents packageManagementEvents;
IBackgroundPackageActionRunner backgroundPackageActionRunner;
public ProjectTemplateNuGetPackageInstaller ()
: this(
PackageManagementServices.Solution,
- PackageManagementServices.PackageManagementEvents,
PackageManagementServices.ProjectTemplatePackageRepositoryCache,
PackageManagementServices.BackgroundPackageActionRunner)
{
@@ -52,28 +50,25 @@ namespace MonoDevelop.PackageManagement
public ProjectTemplateNuGetPackageInstaller (
IPackageManagementSolution solution,
- IPackageManagementEvents packageManagementEvents,
IPackageRepositoryCache packageRepositoryCache,
IBackgroundPackageActionRunner backgroundPackageActionRunner)
{
this.packageManagementSolution = solution;
- this.packageManagementEvents = packageManagementEvents;
this.packageRepositoryCache = packageRepositoryCache;
this.backgroundPackageActionRunner = backgroundPackageActionRunner;
}
- public override void Run (IList<PackageReferencesForCreatedProject> packageReferencesForCreatedProjects)
+ public override void Run (Solution solution, IList<PackageReferencesForCreatedProject> packageReferencesForCreatedProjects)
{
- List<InstallPackageAction> installPackageActions = CreateInstallPackageActions (packageReferencesForCreatedProjects);
+ List<InstallPackageAction> installPackageActions = CreateInstallPackageActions (solution, packageReferencesForCreatedProjects);
ProgressMonitorStatusMessage progressMessage = ProgressMonitorStatusMessageFactory.CreateInstallingProjectTemplatePackagesMessage ();
backgroundPackageActionRunner.Run (progressMessage, installPackageActions);
}
- List<InstallPackageAction> CreateInstallPackageActions (IList<PackageReferencesForCreatedProject> packageReferencesForCreatedProjects)
+ List<InstallPackageAction> CreateInstallPackageActions (Solution solution, IList<PackageReferencesForCreatedProject> packageReferencesForCreatedProjects)
{
var installPackageActions = new List<InstallPackageAction> ();
- Solution solution = IdeApp.ProjectOperations.CurrentSelectedSolution;
foreach (PackageReferencesForCreatedProject packageReferences in packageReferencesForCreatedProjects) {
var project = solution.GetAllProjects ().First (p => p.Name == packageReferences.ProjectName) as DotNetProject;
if (project != null) {
@@ -104,8 +99,9 @@ namespace MonoDevelop.PackageManagement
return null;
}
- IPackageManagementProject CreatePackageManagementProject (DotNetProject dotNetProject)
+ IPackageManagementProject CreatePackageManagementProject (DotNetProject project)
{
+ var dotNetProject = new DotNetProjectProxy (project);
return packageManagementSolution.GetProject (packageRepositoryCache.CreateAggregateRepository (), dotNetProject);
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RecentPackageRepository.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RecentPackageRepository.cs
index 51f193e832..f2e8b14cc8 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RecentPackageRepository.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RecentPackageRepository.cs
@@ -41,25 +41,15 @@ namespace ICSharpCode.PackageManagement
int maximumPackagesCount = DefaultMaximumPackagesCount;
IList<RecentPackageInfo> savedRecentPackages;
IPackageRepository aggregateRepository;
- IPackageManagementEvents packageManagementEvents;
-
+
public RecentPackageRepository(
IList<RecentPackageInfo> recentPackages,
- IPackageRepository aggregateRepository,
- IPackageManagementEvents packageManagementEvents)
+ IPackageRepository aggregateRepository)
{
this.savedRecentPackages = recentPackages;
this.aggregateRepository = aggregateRepository;
- this.packageManagementEvents = packageManagementEvents;
//UpdatePackages ();
-
- this.packageManagementEvents.ParentPackageInstalled += ParentPackageInstalled;
- }
-
- void ParentPackageInstalled(object sender, ParentPackageOperationEventArgs e)
- {
- AddPackage(e.Package);
}
public string Source {
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageRepositories.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageRepositories.cs
index 0e99626c06..c326c47d1b 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageRepositories.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageRepositories.cs
@@ -113,12 +113,21 @@ namespace ICSharpCode.PackageManagement
public void UpdatePackageSources (IEnumerable<PackageSource> updatedPackageSources)
{
- PackageSources.Clear ();
- foreach (PackageSource updatedPackageSource in updatedPackageSources) {
- PackageSources.Add (updatedPackageSource);
- }
+ List<PackageSource> packageSourcesBackup = PackageSources.ToList ();
+
+ try {
+ PackageSources.Clear ();
+ foreach (PackageSource updatedPackageSource in updatedPackageSources) {
+ PackageSources.Add (updatedPackageSource);
+ }
- UpdateActivePackageSource ();
+ UpdateActivePackageSource ();
+ } catch (Exception) {
+ PackageSources.AddRange (packageSourcesBackup);
+ UpdateActivePackageSource ();
+
+ throw;
+ }
}
void UpdateActivePackageSource ()
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageSourceSettings.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageSourceSettings.cs
index 9d60350227..e612213e3a 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageSourceSettings.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageSourceSettings.cs
@@ -31,6 +31,8 @@ using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
+using MonoDevelop.Core;
+using MonoDevelop.PackageManagement;
using NuGet;
namespace ICSharpCode.PackageManagement
@@ -43,28 +45,41 @@ namespace ICSharpCode.PackageManagement
new PackageSource("(Aggregate source)", "All");
ISettings settings;
+ ISettingsProvider settingsProvider;
IPackageSourceProvider packageSourceProvider;
PackageSource defaultPackageSource;
RegisteredPackageSources packageSources;
PackageSource activePackageSource;
- public RegisteredPackageSourceSettings(ISettings settings)
+ public RegisteredPackageSourceSettings (ISettingsProvider settingsProvider)
: this(
- settings,
- new PackageSourceProvider(settings, new [] { RegisteredPackageSources.DefaultPackageSource }),
+ settingsProvider,
RegisteredPackageSources.DefaultPackageSource)
{
}
- public RegisteredPackageSourceSettings(
- ISettings settings,
- IPackageSourceProvider packageSourceProvider,
+ public RegisteredPackageSourceSettings (
+ ISettingsProvider settingsProvider,
PackageSource defaultPackageSource)
{
- this.settings = settings;
- this.packageSourceProvider = packageSourceProvider;
+ this.settingsProvider = settingsProvider;
this.defaultPackageSource = defaultPackageSource;
+
+ this.settings = settingsProvider.LoadSettings ();
+ this.packageSourceProvider = CreatePackageSourceProvider (settings);
+
ReadActivePackageSource();
+ RegisterSolutionEvents ();
+ }
+
+ void RegisterSolutionEvents ()
+ {
+ settingsProvider.SettingsChanged += SettingsChanged;
+ }
+
+ IPackageSourceProvider CreatePackageSourceProvider (ISettings settings)
+ {
+ return new PackageSourceProvider (settings, new [] { RegisteredPackageSources.DefaultPackageSource });
}
void ReadActivePackageSource()
@@ -76,11 +91,25 @@ namespace ICSharpCode.PackageManagement
public RegisteredPackageSources PackageSources {
get {
if (packageSources == null) {
- ReadPackageSources();
+ TryReadPackageSources();
}
return packageSources;
}
}
+
+ void TryReadPackageSources()
+ {
+ try {
+ ReadPackageSources ();
+ } catch (Exception ex) {
+ LoggingService.LogError ("Unable to read NuGet.config file.", ex);
+
+ // Fallback to using the default package source only (nuget.org)
+ // and treat NuGet.config as read-only.
+ packageSourceProvider = CreatePackageSourceProvider (NullSettings.Instance);
+ ReadPackageSources ();
+ }
+ }
void ReadPackageSources()
{
@@ -117,6 +146,12 @@ namespace ICSharpCode.PackageManagement
}
set {
activePackageSource = value;
+
+ if (settings is NullSettings) {
+ // NuGet failed to load settings so do not try to update them since this will fail.
+ return;
+ }
+
if (activePackageSource == null) {
RemoveActivePackageSourceSetting();
} else {
@@ -142,5 +177,21 @@ namespace ICSharpCode.PackageManagement
{
settings.SetValue(ActivePackageSourceSectionName, activePackageSource.Key, activePackageSource.Value);
}
+
+ void SettingsChanged (object sender, EventArgs e)
+ {
+ settings = settingsProvider.LoadSettings ();
+ packageSourceProvider = CreatePackageSourceProvider (settings);
+ ReadActivePackageSource ();
+ ResetPackageSources ();
+ }
+
+ void ResetPackageSources ()
+ {
+ if (packageSources != null) {
+ packageSources.CollectionChanged -= PackageSourcesChanged;
+ packageSources = null;
+ }
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageSourcesViewModel.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageSourcesViewModel.cs
index 5b551613ea..9dad10f11e 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageSourcesViewModel.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageSourcesViewModel.cs
@@ -37,7 +37,7 @@ using NuGet;
namespace ICSharpCode.PackageManagement
{
- public class RegisteredPackageSourcesViewModel : ViewModelBase<RegisteredPackageSourcesViewModel>, IDisposable
+ public class RegisteredPackageSourcesViewModel : ViewModelBase<RegisteredPackageSourcesViewModel>, IDisposable, IPackageSourceProvider
{
ObservableCollection<PackageSourceViewModel> packageSourceViewModels =
new ObservableCollection<PackageSourceViewModel>();
@@ -127,19 +127,32 @@ namespace ICSharpCode.PackageManagement
public ICommand BrowsePackageFolderCommand {
get { return browsePackageFolderCommand; }
}
-
+
+ public ICommand UpdatePackageSourceCommand {
+ get { return updatePackageSourceCommand; }
+ }
+
public ObservableCollection<PackageSourceViewModel> PackageSourceViewModels {
get { return packageSourceViewModels; }
}
public void Load()
{
- PackageManagementServices.DisablePromptForCredentials ();
+ ReplaceExistingPackageSourceCredentialProvider ();
foreach (PackageSource packageSource in packageSources) {
AddPackageSourceToViewModel(packageSource);
}
}
+
+ /// <summary>
+ /// Use this class as the source of package source credentials and disable any
+ /// prompt for credentials.
+ /// </summary>
+ void ReplaceExistingPackageSourceCredentialProvider ()
+ {
+ HttpClient.DefaultCredentialProvider = new SettingsCredentialProvider (NullCredentialProvider.Instance, this);
+ }
void AddPackageSourceToViewModel(PackageSource packageSource)
{
@@ -380,5 +393,28 @@ namespace ICSharpCode.PackageManagement
PackageManagementServices.InitializeCredentialProvider ();
}
}
+
+ /// <summary>
+ /// This is called by NuGet's credential provider when a request needs
+ /// a username and password. We return the current package sources
+ /// stored in Preferences with the latest usernames and passwords.
+ /// </summary>
+ IEnumerable<PackageSource> IPackageSourceProvider.LoadPackageSources ()
+ {
+ return packageSourceViewModels.Select (viewModel => viewModel.GetPackageSource ());
+ }
+
+ void IPackageSourceProvider.SavePackageSources (IEnumerable<PackageSource> sources)
+ {
+ }
+
+ void IPackageSourceProvider.DisablePackageSource (PackageSource source)
+ {
+ }
+
+ bool IPackageSourceProvider.IsPackageSourceEnabled (PackageSource source)
+ {
+ return true;
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SearchPackagesDataSource.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SearchPackagesDataSource.cs
index 12244289aa..3887262942 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SearchPackagesDataSource.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SearchPackagesDataSource.cs
@@ -86,11 +86,16 @@ namespace MonoDevelop.PackageManagement
void ISearchDataSource.Activate (int item)
{
var runner = new AddPackagesDialogRunner ();
- runner.Run (searchPattern.Pattern);
+ runner.Run (searchPattern.UnparsedPattern);
}
int ISearchDataSource.ItemCount {
- get { return 1; }
+ get {
+ if (IsProjectSelected ()) {
+ return 1;
+ }
+ return 0;
+ }
}
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SettingsProvider.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SettingsProvider.cs
new file mode 100644
index 0000000000..8d277b8f69
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SettingsProvider.cs
@@ -0,0 +1,88 @@
+//
+// SettingsProvider.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.IO;
+using ICSharpCode.PackageManagement;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement
+{
+ public class SettingsProvider : ISettingsProvider
+ {
+ public static Func<IFileSystem, string, IMachineWideSettings, ISettings> LoadDefaultSettings
+ = Settings.LoadDefaultSettings;
+
+ IPackageManagementProjectService projectService;
+
+ public SettingsProvider ()
+ : this (PackageManagementServices.ProjectService)
+ {
+ }
+
+ public SettingsProvider (IPackageManagementProjectService projectService)
+ {
+ this.projectService = projectService;
+ projectService.SolutionLoaded += OnSettingsChanged;
+ projectService.SolutionUnloaded += OnSettingsChanged;
+ }
+
+ public event EventHandler SettingsChanged;
+
+ void OnSettingsChanged (object sender, EventArgs e)
+ {
+ EventHandler handler = SettingsChanged;
+ if (handler != null) {
+ handler (this, new EventArgs ());
+ }
+ }
+
+ public ISettings LoadSettings ()
+ {
+ return LoadSettings (GetSolutionDirectory ());
+ }
+
+ string GetSolutionDirectory ()
+ {
+ ISolution solution = projectService.OpenSolution;
+ if (solution != null) {
+ return Path.Combine (solution.BaseDirectory, ".nuget");
+ }
+ return null;
+ }
+
+ ISettings LoadSettings (string directory)
+ {
+ if (directory == null) {
+ return LoadDefaultSettings (null, null, null);
+ }
+
+ return LoadDefaultSettings (new PhysicalFileSystem (directory), null, null);
+ }
+ }
+}
+
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SharpDevelopPackageManagerFactory.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SharpDevelopPackageManagerFactory.cs
index 4f5d627629..eda02af109 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SharpDevelopPackageManagerFactory.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SharpDevelopPackageManagerFactory.cs
@@ -26,6 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+using MonoDevelop.PackageManagement;
using MonoDevelop.Projects;
using NuGet;
@@ -57,10 +58,10 @@ namespace ICSharpCode.PackageManagement
public ISharpDevelopPackageManager CreatePackageManager(
IPackageRepository sourceRepository,
- DotNetProject project)
+ IDotNetProject project)
{
- SolutionPackageRepository solutionPackageRepository = CreateSolutionPackageRepository(project.ParentSolution);
- IProjectSystem projectSystem = CreateProjectSystem(project);
+ SolutionPackageRepository solutionPackageRepository = CreateSolutionPackageRepository (project.ParentSolution);
+ IProjectSystem projectSystem = CreateProjectSystem (project.DotNetProject);
PackageOperationsResolverFactory packageOperationResolverFactory = new PackageOperationsResolverFactory();
return new SharpDevelopPackageManager(
@@ -70,9 +71,9 @@ namespace ICSharpCode.PackageManagement
packageOperationResolverFactory);
}
- SolutionPackageRepository CreateSolutionPackageRepository(Solution solution)
+ SolutionPackageRepository CreateSolutionPackageRepository (ISolution solution)
{
- return new SolutionPackageRepository(solution, packageRepositoryFactory, options);
+ return new SolutionPackageRepository (solution, packageRepositoryFactory, options);
}
IProjectSystem CreateProjectSystem(DotNetProject project)
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SharpDevelopPackageRepositoryFactory.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SharpDevelopPackageRepositoryFactory.cs
index ae396a290a..938cf529a5 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SharpDevelopPackageRepositoryFactory.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SharpDevelopPackageRepositoryFactory.cs
@@ -34,18 +34,6 @@ namespace ICSharpCode.PackageManagement
{
public class SharpDevelopPackageRepositoryFactory : PackageRepositoryFactory, ISharpDevelopPackageRepositoryFactory
{
- IPackageManagementEvents packageManagementEvents;
-
- public SharpDevelopPackageRepositoryFactory()
- : this(PackageManagementServices.PackageManagementEvents)
- {
- }
-
- public SharpDevelopPackageRepositoryFactory(IPackageManagementEvents packageManagementEvents)
- {
- this.packageManagementEvents = packageManagementEvents;
- }
-
public ISharedPackageRepository CreateSharedRepository(
IPackagePathResolver pathResolver,
IFileSystem fileSystem,
@@ -58,7 +46,7 @@ namespace ICSharpCode.PackageManagement
IList<RecentPackageInfo> recentPackages,
IPackageRepository aggregateRepository)
{
- return new RecentPackageRepository(recentPackages, aggregateRepository, packageManagementEvents);
+ return new RecentPackageRepository(recentPackages, aggregateRepository);
}
public IPackageRepository CreateAggregateRepository(IEnumerable<IPackageRepository> repositories)
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SharpDevelopProjectSystem.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SharpDevelopProjectSystem.cs
index 02a08690b6..f5cda75a53 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SharpDevelopProjectSystem.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SharpDevelopProjectSystem.cs
@@ -35,31 +35,37 @@ using MonoDevelop.Core;
using MonoDevelop.Ide;
using MonoDevelop.PackageManagement;
using MonoDevelop.Projects;
+using MonoDevelop.Projects.Formats.MSBuild;
using NuGet;
namespace ICSharpCode.PackageManagement
{
public class SharpDevelopProjectSystem : PhysicalFileSystem, IProjectSystem
{
- DotNetProject project;
+ IDotNetProject project;
ProjectTargetFramework targetFramework;
IPackageManagementFileService fileService;
- IPackageManagementProjectService projectService;
-
+ Action<MessageHandler> guiSyncDispatcher;
+
public SharpDevelopProjectSystem(DotNetProject project)
- : this(project, new PackageManagementFileService(), new PackageManagementProjectService())
+ : this (
+ new DotNetProjectProxy (project),
+ new PackageManagementFileService (),
+ PackageManagementServices.ProjectService,
+ DispatchService.GuiSyncDispatch)
{
}
- public SharpDevelopProjectSystem(
- DotNetProject project,
+ public SharpDevelopProjectSystem (
+ IDotNetProject project,
IPackageManagementFileService fileService,
- IPackageManagementProjectService projectService)
- : base(AppendTrailingSlashToDirectory(project.BaseDirectory))
+ IPackageManagementProjectService projectService,
+ Action<MessageHandler> guiSyncDispatcher)
+ : base (AppendTrailingSlashToDirectory (project.BaseDirectory))
{
this.project = project;
this.fileService = fileService;
- this.projectService = projectService;
+ this.guiSyncDispatcher = guiSyncDispatcher;
}
static string AppendTrailingSlashToDirectory(string directory)
@@ -88,14 +94,17 @@ namespace ICSharpCode.PackageManagement
return GuiSyncDispatch (() => project.Name);
}
}
-
- public dynamic GetPropertyValue(string propertyName)
+
+ public dynamic GetPropertyValue (string propertyName)
{
return GuiSyncDispatch (() => {
- return project.GetEvaluatedProperty (propertyName);
+ if ("RootNamespace".Equals(propertyName, StringComparison.OrdinalIgnoreCase)) {
+ return project.DefaultNamespace;
+ }
+ return String.Empty;
});
}
-
+
public void AddReference(string referencePath, Stream stream)
{
GuiSyncDispatch (() => {
@@ -249,15 +258,21 @@ namespace ICSharpCode.PackageManagement
public override void AddFile(string path, Action<Stream> writeToStream)
{
- base.AddFile(path, writeToStream);
+ PhysicalFileSystemAddFile (path, writeToStream);
GuiSyncDispatch (() => AddFileToProject (path));
}
-
+
+ protected virtual void PhysicalFileSystemAddFile (string path, Action<Stream> writeToStream)
+ {
+ base.AddFile(path, writeToStream);
+ }
+
void AddFileToProject(string path)
{
if (ShouldAddFileToProject(path)) {
AddFileProjectItemToProject(path);
}
+ OnFileChanged (path);
LogAddedFileToProject(path);
}
@@ -265,6 +280,11 @@ namespace ICSharpCode.PackageManagement
{
return !IsBinDirectory(path) && !FileExistsInProject(path);
}
+
+ void OnFileChanged (string path)
+ {
+ GuiSyncDispatch (() => fileService.OnFileChanged (GetFullPath (path)));
+ }
bool IsBinDirectory(string path)
{
@@ -376,14 +396,20 @@ namespace ICSharpCode.PackageManagement
{
GuiSyncDispatch (() => {
string relativeTargetPath = GetRelativePath (targetPath);
- project.AddImportIfMissing (relativeTargetPath, null);
+ string condition = GetCondition (relativeTargetPath);
+ project.AddImportIfMissing (relativeTargetPath, condition);
project.Save ();
});
}
+ static string GetCondition (string targetPath)
+ {
+ return String.Format ("Exists('{0}')", targetPath);
+ }
+
string GetRelativePath(string path)
{
- return FileService.AbsoluteToRelativePath(project.BaseDirectory, path);
+ return MSBuildProjectService.ToMSBuildPath (project.BaseDirectory, path);
}
public void RemoveImport(string targetPath)
@@ -391,20 +417,42 @@ namespace ICSharpCode.PackageManagement
GuiSyncDispatch (() => {
string relativeTargetPath = GetRelativePath (targetPath);
project.RemoveImport (relativeTargetPath);
+ RemoveImportWithForwardSlashes (targetPath);
project.Save ();
});
}
+ void RemoveImportWithForwardSlashes (string targetPath)
+ {
+ string relativeTargetPath = FileService.AbsoluteToRelativePath (project.BaseDirectory, targetPath);
+ if (Path.DirectorySeparatorChar == '\\') {
+ relativeTargetPath = relativeTargetPath.Replace ('\\', '/');
+ }
+ project.RemoveImport (relativeTargetPath);
+ }
+
+ /// <summary>
+ /// NuGet sometimes uses CreateFile to replace an existing file.
+ /// This happens when the XML transformation (web.config.transform) is reverted on
+ /// uninstalling a NuGet package. It also happens when an XML document transform
+ /// (.install.xdt, .uninstall.xdt) is run.
+ /// </summary>
+ public override Stream CreateFile (string path)
+ {
+ OnFileChanged (path);
+ return base.CreateFile (path);
+ }
+
T GuiSyncDispatch<T> (Func<T> action)
{
T result = default(T);
- DispatchService.GuiSyncDispatch (() => result = action ());
+ guiSyncDispatcher (() => result = action ());
return result;
}
void GuiSyncDispatch (Action action)
{
- DispatchService.GuiSyncDispatch (() => action ());
+ guiSyncDispatcher (() => action ());
}
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SolutionPackageRepository.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SolutionPackageRepository.cs
index e6cb4013e5..47600b40a3 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SolutionPackageRepository.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SolutionPackageRepository.cs
@@ -30,7 +30,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
-using MonoDevelop.Projects;
+using MonoDevelop.PackageManagement;
using NuGet;
namespace ICSharpCode.PackageManagement
@@ -43,16 +43,16 @@ namespace ICSharpCode.PackageManagement
PhysicalFileSystem fileSystem;
ISharedPackageRepository repository;
- public SolutionPackageRepository(Solution solution)
- : this(
+ public SolutionPackageRepository (ISolution solution)
+ : this (
solution,
new SharpDevelopPackageRepositoryFactory(),
PackageManagementServices.Options)
{
}
- public SolutionPackageRepository(
- Solution solution,
+ public SolutionPackageRepository (
+ ISolution solution,
ISharpDevelopPackageRepositoryFactory repositoryFactory,
PackageManagementOptions options)
{
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SolutionPackageRepositoryFactory.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SolutionPackageRepositoryFactory.cs
index 9ac4dca212..d08e71d5c7 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SolutionPackageRepositoryFactory.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SolutionPackageRepositoryFactory.cs
@@ -27,6 +27,7 @@
//
using System;
+using MonoDevelop.PackageManagement;
using MonoDevelop.Projects;
using NuGet;
@@ -50,9 +51,9 @@ namespace ICSharpCode.PackageManagement
this.options = options;
}
- public ISolutionPackageRepository CreateSolutionPackageRepository(Solution solution)
+ public ISolutionPackageRepository CreateSolutionPackageRepository (ISolution solution)
{
- return new SolutionPackageRepository(solution, repositoryFactory, options);
+ return new SolutionPackageRepository (solution, repositoryFactory, options);
}
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SolutionPackageRepositoryPath.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SolutionPackageRepositoryPath.cs
index 6daca5784d..3265a3984e 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SolutionPackageRepositoryPath.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SolutionPackageRepositoryPath.cs
@@ -28,6 +28,7 @@
using System;
using System.IO;
+using MonoDevelop.PackageManagement;
using MonoDevelop.Projects;
using NuGet;
@@ -36,20 +37,20 @@ namespace ICSharpCode.PackageManagement
public class SolutionPackageRepositoryPath
{
string packagesRelativeDirectory;
- Solution solution;
+ ISolution solution;
DefaultPackagePathResolver pathResolver;
public SolutionPackageRepositoryPath(Project project)
- : this(project, new PackageManagementOptions())
+ : this (new ProjectProxy (project), new PackageManagementOptions ())
{
}
- public SolutionPackageRepositoryPath(Project project, PackageManagementOptions options)
- : this(project.ParentSolution, options)
+ public SolutionPackageRepositoryPath (IProject project, PackageManagementOptions options)
+ : this (project.ParentSolution, options)
{
}
- public SolutionPackageRepositoryPath(Solution solution, PackageManagementOptions options)
+ public SolutionPackageRepositoryPath (ISolution solution, PackageManagementOptions options)
{
packagesRelativeDirectory = options.PackagesDirectory;
this.solution = solution;
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SolutionProxy.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SolutionProxy.cs
new file mode 100644
index 0000000000..a41e940ccd
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SolutionProxy.cs
@@ -0,0 +1,51 @@
+//
+// SolutionProxy.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using MonoDevelop.Core;
+using MonoDevelop.Projects;
+
+namespace MonoDevelop.PackageManagement
+{
+ public class SolutionProxy : ISolution
+ {
+ Solution solution;
+
+ public SolutionProxy (Solution solution)
+ {
+ this.solution = solution;
+ }
+
+ public FilePath BaseDirectory {
+ get { return solution.BaseDirectory; }
+ }
+
+ public FilePath FileName {
+ get { return solution.FileName; }
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ThreadSafePackageManagementEvents.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ThreadSafePackageManagementEvents.cs
index 7c49b831aa..55ff40412a 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ThreadSafePackageManagementEvents.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ThreadSafePackageManagementEvents.cs
@@ -28,25 +28,38 @@
using System;
using System.Collections.Generic;
-using NuGet;
+using MonoDevelop.Core;
using MonoDevelop.Ide;
+using NuGet;
namespace ICSharpCode.PackageManagement
{
public class ThreadSafePackageManagementEvents : IThreadSafePackageManagementEvents
{
+ static Action<MessageHandler> defaultGuiSyncDispatcher = DispatchService.GuiSyncDispatch;
+
+ Action<MessageHandler> guiSyncDispatcher;
IPackageManagementEvents unsafeEvents;
-
- public ThreadSafePackageManagementEvents(IPackageManagementEvents unsafeEvents)
+
+ public ThreadSafePackageManagementEvents (IPackageManagementEvents unsafeEvents)
+ : this (unsafeEvents, defaultGuiSyncDispatcher)
+ {
+ }
+
+ public ThreadSafePackageManagementEvents (
+ IPackageManagementEvents unsafeEvents,
+ Action<MessageHandler> guiSyncDispatcher)
{
this.unsafeEvents = unsafeEvents;
+ this.guiSyncDispatcher = guiSyncDispatcher;
RegisterEventHandlers();
}
-
+
void RegisterEventHandlers()
{
unsafeEvents.PackageOperationsStarting += RaisePackageOperationStartingEventIfHasSubscribers;
+ unsafeEvents.PackageOperationsFinished += RaisePackageOperationFinishedEventIfHasSubscribers;
unsafeEvents.PackageOperationError += RaisePackageOperationErrorEventIfHasSubscribers;
unsafeEvents.ParentPackageInstalled += RaiseParentPackageInstalledEventIfHasSubscribers;
unsafeEvents.ParentPackageUninstalled += RaiseParentPackageUninstalledEventIfHasSubscribers;
@@ -62,6 +75,7 @@ namespace ICSharpCode.PackageManagement
void UnregisterEventHandlers()
{
unsafeEvents.PackageOperationsStarting -= RaisePackageOperationStartingEventIfHasSubscribers;
+ unsafeEvents.PackageOperationsFinished -= RaisePackageOperationFinishedEventIfHasSubscribers;
unsafeEvents.PackageOperationError -= RaisePackageOperationErrorEventIfHasSubscribers;
unsafeEvents.ParentPackageInstalled -= RaiseParentPackageInstalledEventIfHasSubscribers;
unsafeEvents.ParentPackageUninstalled -= RaiseParentPackageUninstalledEventIfHasSubscribers;
@@ -72,7 +86,7 @@ namespace ICSharpCode.PackageManagement
void RaisePackageOperationStartingEventIfHasSubscribers(object sender, EventArgs e)
{
if (PackageOperationsStarting != null) {
- DispatchService.GuiSyncDispatch (() => RaisePackageOperationStartingEvent (sender, e));
+ guiSyncDispatcher (() => RaisePackageOperationStartingEvent (sender, e));
}
}
@@ -82,18 +96,32 @@ namespace ICSharpCode.PackageManagement
}
public event EventHandler PackageOperationsStarting;
-
+
+ void RaisePackageOperationFinishedEventIfHasSubscribers(object sender, EventArgs e)
+ {
+ if (PackageOperationsFinished != null) {
+ guiSyncDispatcher (() => RaisePackageOperationFinishedEvent (sender, e));
+ }
+ }
+
+ void RaisePackageOperationFinishedEvent(object sender, EventArgs e)
+ {
+ PackageOperationsFinished(sender, e);
+ }
+
+ public event EventHandler PackageOperationsFinished;
+
void RaisePackageOperationErrorEventIfHasSubscribers(object sender, PackageOperationExceptionEventArgs e)
{
if (PackageOperationError != null) {
- DispatchService.GuiSyncDispatch (() => RaisePackageOperationErrorEvent(sender, e));
+ guiSyncDispatcher (() => RaisePackageOperationErrorEvent(sender, e));
}
}
void RaisePackageOperationErrorEvent(object sender, PackageOperationExceptionEventArgs e)
{
if (PackageOperationError != null) {
- DispatchService.GuiSyncDispatch (() => PackageOperationError(sender, e));
+ guiSyncDispatcher (() => PackageOperationError(sender, e));
}
}
@@ -102,7 +130,7 @@ namespace ICSharpCode.PackageManagement
void RaiseParentPackageInstalledEventIfHasSubscribers(object sender, ParentPackageOperationEventArgs e)
{
if (ParentPackageInstalled != null) {
- DispatchService.GuiSyncDispatch (() => RaiseParentPackageInstalledEvent(sender, e));
+ guiSyncDispatcher (() => RaiseParentPackageInstalledEvent(sender, e));
}
}
@@ -116,7 +144,7 @@ namespace ICSharpCode.PackageManagement
void RaiseParentPackageUninstalledEventIfHasSubscribers(object sender, ParentPackageOperationEventArgs e)
{
if (ParentPackageUninstalled != null) {
- DispatchService.GuiSyncDispatch (() => RaiseParentPackageUninstalledEvent(sender, e));
+ guiSyncDispatcher (() => RaiseParentPackageUninstalledEvent(sender, e));
}
}
@@ -147,6 +175,11 @@ namespace ICSharpCode.PackageManagement
unsafeEvents.OnPackageOperationsStarting();
}
+ public void OnPackageOperationsFinished()
+ {
+ unsafeEvents.OnPackageOperationsFinished();
+ }
+
public void OnPackageOperationError(Exception ex)
{
unsafeEvents.OnPackageOperationError(ex);
@@ -187,7 +220,7 @@ namespace ICSharpCode.PackageManagement
void RaiseResolveFileConflictEventIfHasSubscribers (object sender, ResolveFileConflictEventArgs e)
{
if (ResolveFileConflict != null) {
- DispatchService.GuiSyncDispatch (() => ResolveFileConflict (sender, e));
+ guiSyncDispatcher (() => ResolveFileConflict (sender, e));
}
}
@@ -201,7 +234,7 @@ namespace ICSharpCode.PackageManagement
void RaiseParentPackagesUpdatedEventIfHasSubscribers(object sender, ParentPackagesOperationEventArgs e)
{
if (ParentPackagesUpdated != null) {
- DispatchService.GuiSyncDispatch (() => RaiseParentPackagesUpdatedEvent(sender, e));
+ guiSyncDispatcher (() => RaiseParentPackagesUpdatedEvent(sender, e));
}
}
@@ -219,5 +252,15 @@ namespace ICSharpCode.PackageManagement
{
unsafeEvents.OnPackagesRestored ();
}
+
+ public event EventHandler<FileEventArgs> FileChanged {
+ add { unsafeEvents.FileChanged += value; }
+ remove { unsafeEvents.FileChanged -= value; }
+ }
+
+ public void OnFileChanged (string path)
+ {
+ unsafeEvents.OnFileChanged (path);
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UninstallPackageAction.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UninstallPackageAction.cs
index 8c8042de51..44296c8438 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UninstallPackageAction.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UninstallPackageAction.cs
@@ -62,5 +62,9 @@ namespace ICSharpCode.PackageManagement
var files = new PackageFiles(Package);
return files.HasUninstallPackageScript();
}
+
+ protected override string StartingMessageFormat {
+ get { return "Removing {0}..."; }
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UpdatePackageAction.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UpdatePackageAction.cs
index 60861dc86a..5ece2f0a90 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UpdatePackageAction.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UpdatePackageAction.cs
@@ -69,5 +69,19 @@ namespace ICSharpCode.PackageManagement
}
return true;
}
+
+ protected override string StartingMessageFormat {
+ get { return "Updating {0}..."; }
+ }
+
+ protected override bool ShouldLogEmptyLineForFinishedAction ()
+ {
+ return ShouldUpdatePackage ();
+ }
+
+ protected override bool ShouldLogStartingMessage ()
+ {
+ return ShouldUpdatePackage ();
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UserAgentGeneratorForRepositoryRequests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UserAgentGeneratorForRepositoryRequests.cs
index 74a93b5ed9..8d878cab00 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UserAgentGeneratorForRepositoryRequests.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UserAgentGeneratorForRepositoryRequests.cs
@@ -34,8 +34,8 @@ namespace ICSharpCode.PackageManagement
public class UserAgentGeneratorForRepositoryRequests
{
MonoDevelopHttpUserAgent userAgent = new MonoDevelopHttpUserAgent();
-
- public UserAgentGeneratorForRepositoryRequests(IPackageRepositoryFactoryEvents repositoryFactoryEvents)
+
+ public void Register (IPackageRepositoryFactoryEvents repositoryFactoryEvents)
{
repositoryFactoryEvents.RepositoryCreated += RepositoryCreated;
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/WildcardVersionSpec.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/WildcardVersionSpec.cs
new file mode 100644
index 0000000000..6633e6ee45
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/WildcardVersionSpec.cs
@@ -0,0 +1,153 @@
+//
+// WildcardVersion.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Linq;
+using NuGet;
+
+namespace MonoDevelop.PackageManagement
+{
+ /// <summary>
+ /// Implicit wildcard version specification.
+ ///
+ /// 1 => 1.*
+ /// 1.2 => 1.2.*
+ /// 1.2.3 => 1.2.3.*
+ /// 1.2.3.4 => 1.2.3.4
+ /// </summary>
+ public class WildcardVersionSpec
+ {
+ string[] parts;
+ int wildcardPart = -1;
+
+ bool HasWildcards {
+ get { return wildcardPart != -1; }
+ }
+
+ public WildcardVersionSpec (string version)
+ {
+ Parse (version);
+ }
+
+ public VersionSpec VersionSpec { get; private set; }
+
+ void Parse (string versionText)
+ {
+ SplitIntoParts (versionText);
+
+ if (!ParseExactVersion (ConvertVersionIfSingleNumber (versionText))) {
+ return;
+ }
+
+ ConfigureMaximumVersion ();
+ }
+
+ void SplitIntoParts (string versionText)
+ {
+ parts = versionText.Split ('.');
+ }
+
+ /// <summary>
+ /// Version "1" will fail to be parsed by the SemanticVersion
+ /// class so append ".0" to allow the conversion to succeed.
+ /// </summary>
+ string ConvertVersionIfSingleNumber (string versionText)
+ {
+ if (parts.Length == 1) {
+ return versionText + ".0";
+ }
+ return versionText;
+ }
+
+ bool ParseExactVersion (string versionText)
+ {
+ SemanticVersion version = null;
+ if (SemanticVersion.TryParse (versionText, out version)) {
+ VersionSpec = new VersionSpec (version);
+ return true;
+ }
+ return false;
+ }
+
+ void ConfigureMaximumVersion ()
+ {
+ if (!NeedsWildCard ())
+ return;
+
+ VersionSpec.IsMaxInclusive = false;
+ VersionSpec.MaxVersion = GetMaximumWildcardVersion (VersionSpec.MinVersion);
+ }
+
+ bool NeedsWildCard ()
+ {
+ return parts.Length < 4;
+ }
+
+ string GetMinimumWildcardVersion (string wildcardVersion)
+ {
+ return wildcardVersion.Replace ('*', '0');
+ }
+
+ SemanticVersion GetMaximumWildcardVersion (SemanticVersion minVersion)
+ {
+ return new SemanticVersion (GetMaximumWildcardVersion (minVersion.Version));
+ }
+
+ Version GetMaximumWildcardVersion (Version minVersion)
+ {
+ switch (parts.Length) {
+ case 1:
+ return new Version (minVersion.Major + 1, 0, 0, 0);
+ case 2:
+ return new Version (minVersion.Major, minVersion.Minor + 1, 0, 0);
+ default:
+ return new Version (minVersion.Major, minVersion.Minor, minVersion.Build + 1, 0);
+ }
+ }
+
+ public bool Satisfies (SemanticVersion version)
+ {
+ if (VersionSpec == null)
+ return true;
+
+ if (!IsSpecial (VersionSpec.MinVersion) && IsSpecial (version)) {
+ version = RemoveSpecialPart (version);
+ }
+ return VersionSpec.Satisfies (version);
+ }
+
+ static bool IsSpecial (SemanticVersion version)
+ {
+ return !String.IsNullOrEmpty (version.SpecialVersion);
+ }
+
+ SemanticVersion RemoveSpecialPart (SemanticVersion version)
+ {
+ return new SemanticVersion (version.Version);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/icons/PackageSourceIcon.png b/main/src/addins/MonoDevelop.PackageManagement/icons/PackageSourceIcon.png
deleted file mode 100644
index e306219c93..0000000000
--- a/main/src/addins/MonoDevelop.PackageManagement/icons/PackageSourceIcon.png
+++ /dev/null
Binary files differ
diff --git a/main/src/addins/MonoDevelop.PackageManagement/icons/dark/reference-48.png b/main/src/addins/MonoDevelop.PackageManagement/icons/dark/reference-48.png
new file mode 100644
index 0000000000..f66f06d6de
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/icons/dark/reference-48.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.PackageManagement/icons/dark/reference-48@2x.png b/main/src/addins/MonoDevelop.PackageManagement/icons/dark/reference-48@2x.png
new file mode 100644
index 0000000000..bc64f22c55
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/icons/dark/reference-48@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.PackageManagement/icons/light/package-source-32.png b/main/src/addins/MonoDevelop.PackageManagement/icons/light/package-source-32.png
new file mode 100644
index 0000000000..7e19f0f3b1
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/icons/light/package-source-32.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.PackageManagement/icons/light/package-source-32@2x.png b/main/src/addins/MonoDevelop.PackageManagement/icons/light/package-source-32@2x.png
new file mode 100644
index 0000000000..3894330a48
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/icons/light/package-source-32@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.PackageManagement/icons/light/prefs-package-16.png b/main/src/addins/MonoDevelop.PackageManagement/icons/light/prefs-package-16.png
new file mode 100644
index 0000000000..b441192270
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/icons/light/prefs-package-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.PackageManagement/icons/light/prefs-package-16@2x.png b/main/src/addins/MonoDevelop.PackageManagement/icons/light/prefs-package-16@2x.png
new file mode 100644
index 0000000000..a59c599aca
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/icons/light/prefs-package-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.PackageManagement/icons/light/prefs-package-source-16.png b/main/src/addins/MonoDevelop.PackageManagement/icons/light/prefs-package-source-16.png
new file mode 100644
index 0000000000..c01c3f5eb0
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/icons/light/prefs-package-source-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.PackageManagement/icons/light/prefs-package-source-16@2x.png b/main/src/addins/MonoDevelop.PackageManagement/icons/light/prefs-package-source-16@2x.png
new file mode 100644
index 0000000000..7e19f0f3b1
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/icons/light/prefs-package-source-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.PackageManagement/icons/light/reference-48.png b/main/src/addins/MonoDevelop.PackageManagement/icons/light/reference-48.png
new file mode 100644
index 0000000000..7301fbb0fe
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/icons/light/reference-48.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.PackageManagement/icons/light/reference-48@2x.png b/main/src/addins/MonoDevelop.PackageManagement/icons/light/reference-48@2x.png
new file mode 100644
index 0000000000..e66a2f6dbc
--- /dev/null
+++ b/main/src/addins/MonoDevelop.PackageManagement/icons/light/reference-48@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.PackageManagement/icons/packageicon.png b/main/src/addins/MonoDevelop.PackageManagement/icons/packageicon.png
deleted file mode 100644
index cae0b9c39b..0000000000
--- a/main/src/addins/MonoDevelop.PackageManagement/icons/packageicon.png
+++ /dev/null
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultMarker.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultMarker.cs
index 4dab2e185a..ee70dd78f1 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultMarker.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultMarker.cs
@@ -32,175 +32,187 @@ using MonoDevelop.Ide.Editor;
namespace MonoDevelop.AnalysisCore.Gui
{
-// class ResultMarker : UnderlineTextSegmentMarker
-// {
-// readonly Result result;
-//
-// public ResultMarker (Result result, ISegment segment) : base ("", segment)
-// {
-// this.result = result;
-// }
-//
-// static bool IsOneLine (Result result)
-// {
-// return result.Region.BeginLine == result.Region.EndLine;
-// }
-//
-// public Result Result { get { return result; } }
-//
-// //utility for debugging
-// public int Line { get { return result.Region.BeginLine; } }
-// public int ColStart { get { return IsOneLine (result)? (result.Region.BeginColumn) : 0; } }
-// public int ColEnd { get { return IsOneLine (result)? (result.Region.EndColumn) : 0; } }
-// public string Message { get { return result.Message; } }
-//
-// static Cairo.Color GetColor (ITextEditor editor, Result result)
-// {
-// switch (result.Level) {
-// case Severity.None:
-// return editor.ColorStyle.PlainText.Background;
-// case Severity.Error:
-// return editor.ColorStyle.UnderlineError.Color;
-// case Severity.Warning:
-// return editor.ColorStyle.UnderlineWarning.Color;
-// case Severity.Suggestion:
-// return editor.ColorStyle.UnderlineSuggestion.Color;
-// case Severity.Hint:
-// return editor.ColorStyle.UnderlineHint.Color;
-// default:
-// throw new System.ArgumentOutOfRangeException ();
-// }
-// }
-//
-// public override void Draw (ITextEditor editor, Cairo.Context cr, Pango.Layout layout, bool selected, int startOffset, int endOffset, double y, double startXPos, double endXPos)
-// {
-// if (Debugger.DebuggingService.IsDebugging)
-// return;
-// int markerStart = Segment.Offset;
-// int markerEnd = Segment.EndOffset;
-// if (markerEnd < startOffset || markerStart > endOffset)
-// return;
-//
-// bool drawOverlay = result.InspectionMark == IssueMarker.GrayOut;
-//
-// if (drawOverlay && editor.IsSomethingSelected) {
-// var selectionRange = editor.SelectionRange;
-// if (selectionRange.Contains (markerStart) && selectionRange.Contains (markerEnd))
-// return;
-// if (selectionRange.Contains (markerEnd))
-// markerEnd = selectionRange.Offset;
-// if (selectionRange.Contains (markerStart))
-// markerStart = selectionRange.EndOffset;
-// if (markerEnd <= markerStart)
-// return;
-// }
-//
-// double drawFrom;
-// double drawTo;
-//
-// if (markerStart < startOffset && endOffset < markerEnd) {
-// drawTo = endXPos;
-// var line = editor.GetLineByOffset (startOffset);
-// int offset = line.GetIndentation (editor.Document).Length;
-// drawFrom = startXPos + (layout.IndexToPos (offset).X / Pango.Scale.PangoScale);
-// } else {
-// int start;
-// if (startOffset < markerStart) {
-// start = markerStart;
-// } else {
-// var line = editor.GetLineByOffset (startOffset);
-// int offset = line.GetIndentation (editor.Document).Length;
-// start = startOffset + offset;
-// }
-// int end = endOffset < markerEnd ? endOffset : markerEnd;
-// int x_pos;
-//
-// x_pos = layout.IndexToPos (start - startOffset).X;
-// drawFrom = startXPos + (int)(x_pos / Pango.Scale.PangoScale);
-// x_pos = layout.IndexToPos (end - startOffset).X;
-//
-// drawTo = startXPos + (int)(x_pos / Pango.Scale.PangoScale);
-// }
-//
-// drawFrom = System.Math.Max (drawFrom, editor.TextViewMargin.XOffset);
-// drawTo = System.Math.Max (drawTo, editor.TextViewMargin.XOffset);
-// if (drawFrom >= drawTo)
-// return;
-//
-// double height = editor.LineHeight / 5;
-// cr.SetSourceColor (GetColor (editor, Result));
-// if (drawOverlay) {
-// cr.Rectangle (drawFrom, y, drawTo - drawFrom, editor.LineHeight);
-// var color = editor.ColorStyle.PlainText.Background;
-// color.A = 0.6;
-// cr.SetSourceColor (color);
-// cr.Fill ();
-// } else if (result.InspectionMark == IssueMarker.WavedLine) {
-// Pango.CairoHelper.ShowErrorUnderline (cr, drawFrom, y + editor.LineHeight - height, drawTo - drawFrom, height);
-// } else if (result.InspectionMark == IssueMarker.DottedLine) {
-// cr.Save ();
-// cr.LineWidth = 1;
-// cr.MoveTo (drawFrom + 1, y + editor.LineHeight - 1 + 0.5);
-// cr.RelLineTo (System.Math.Min (drawTo - drawFrom, 4 * 3), 0);
-// cr.SetDash (new double[] { 2, 2 }, 0);
-// cr.Stroke ();
-// cr.Restore ();
-// } else {
-// cr.MoveTo (drawFrom, y + editor.LineHeight - 1);
-// cr.LineTo (drawTo, y + editor.LineHeight - 1);
-// cr.Stroke ();
-// }
-// }
-// }
-//
-// class GrayOutMarker : ResultMarker, IChunkMarker
-// {
-// public GrayOutMarker (Result result, TextSegment segment) : base (result, segment)
-// {
-// }
-//
-// public override void Draw (ITextEditor editor, Cairo.Context cr, Pango.Layout layout, bool selected, int startOffset, int endOffset, double y, double startXPos, double endXPos)
-// {
-// }
-//
-// #region IChunkMarker implementation
-//
-// void IChunkMarker.TransformChunks (List<Chunk> chunks)
-// {
-// int markerStart = Segment.Offset;
-// int markerEnd = Segment.EndOffset;
-// for (int i = 0; i < chunks.Count; i++) {
-// var chunk = chunks [i];
-// if (chunk.EndOffset < markerStart || markerEnd <= chunk.Offset)
-// continue;
-// if (chunk.Offset == markerStart && chunk.EndOffset == markerEnd)
-// return;
-// if (chunk.Offset < markerStart && chunk.EndOffset > markerEnd) {
-// var newChunk = new Chunk (chunk.Offset, markerStart - chunk.Offset, chunk.Style);
-// chunks.Insert (i, newChunk);
-// chunk.Offset += newChunk.Length;
-// chunk.Length -= newChunk.Length;
-// continue;
-// }
-// }
-// }
-//
-// void IChunkMarker.ChangeForeColor (TextEditor editor, Chunk chunk, ref Cairo.Color color)
-// {
-// if (Debugger.DebuggingService.IsDebugging)
-// return;
-// int markerStart = Segment.Offset;
-// int markerEnd = Segment.EndOffset;
-// if (chunk.EndOffset <= markerStart || markerEnd <= chunk.Offset)
-// return;
-// var bgc = editor.ColorStyle.PlainText.Background;
-// double alpha = 0.6;
-// color = new Cairo.Color (
-// color.R * alpha + bgc.R * (1.0 - alpha),
-// color.G * alpha + bgc.G * (1.0 - alpha),
-// color.B * alpha + bgc.B * (1.0 - alpha)
-// );
-// }
-// #endregion
-// }
+/*
+ class ResultMarker : UnderlineTextSegmentMarker
+ {
+ readonly Result result;
+
+ public ResultMarker (Result result, TextSegment segment) : base ("", segment)
+ {
+ this.result = result;
+ }
+
+ static bool IsOneLine (Result result)
+ {
+ return result.Region.BeginLine == result.Region.EndLine;
+ }
+
+ public Result Result { get { return result; } }
+
+ //utility for debugging
+ public int Line { get { return result.Region.BeginLine; } }
+ public int ColStart { get { return IsOneLine (result)? (result.Region.BeginColumn) : 0; } }
+ public int ColEnd { get { return IsOneLine (result)? (result.Region.EndColumn) : 0; } }
+ public string Message { get { return result.Message; } }
+
+ static Cairo.Color GetColor (TextEditor editor, Result result)
+ {
+ switch (result.Level) {
+ case Severity.None:
+ return editor.ColorStyle.PlainText.Background;
+ case Severity.Error:
+ return editor.ColorStyle.UnderlineError.Color;
+ case Severity.Warning:
+ return editor.ColorStyle.UnderlineWarning.Color;
+ case Severity.Suggestion:
+ return editor.ColorStyle.UnderlineSuggestion.Color;
+ case Severity.Hint:
+ return editor.ColorStyle.UnderlineHint.Color;
+ default:
+ throw new System.ArgumentOutOfRangeException ();
+ }
+ }
+
+ public override void Draw (TextEditor editor, Cairo.Context cr, Pango.Layout layout, bool selected, int startOffset, int endOffset, double y, double startXPos, double endXPos)
+ {
+ if (Debugger.DebuggingService.IsDebugging)
+ return;
+ int markerStart = Segment.Offset;
+ int markerEnd = Segment.EndOffset;
+ if (markerEnd < startOffset || markerStart > endOffset)
+ return;
+
+ bool drawOverlay = result.InspectionMark == IssueMarker.GrayOut;
+
+ if (drawOverlay && editor.IsSomethingSelected) {
+ var selectionRange = editor.SelectionRange;
+ if (selectionRange.Contains (markerStart) && selectionRange.Contains (markerEnd))
+ return;
+ if (selectionRange.Contains (markerEnd))
+ markerEnd = selectionRange.Offset;
+ if (selectionRange.Contains (markerStart))
+ markerStart = selectionRange.EndOffset;
+ if (markerEnd <= markerStart)
+ return;
+ }
+
+ double drawFrom;
+ double drawTo;
+
+ if (markerStart < startOffset && endOffset < markerEnd) {
+ drawTo = endXPos;
+ var line = editor.GetLineByOffset (startOffset);
+ int offset = line.GetIndentation (editor.Document).Length;
+ drawFrom = startXPos + (layout.IndexToPos (offset).X / Pango.Scale.PangoScale);
+ } else {
+ int start;
+ if (startOffset < markerStart) {
+ start = markerStart;
+ } else {
+ var line = editor.GetLineByOffset (startOffset);
+ int offset = line.GetIndentation (editor.Document).Length;
+ start = startOffset + offset;
+ }
+ int end = endOffset < markerEnd ? endOffset : markerEnd;
+ int x_pos;
+
+ x_pos = layout.IndexToPos (start - startOffset).X;
+ drawFrom = startXPos + (int)(x_pos / Pango.Scale.PangoScale);
+ x_pos = layout.IndexToPos (end - startOffset).X;
+
+ drawTo = startXPos + (int)(x_pos / Pango.Scale.PangoScale);
+ }
+
+ drawFrom = System.Math.Max (drawFrom, editor.TextViewMargin.XOffset);
+ drawTo = System.Math.Max (drawTo, editor.TextViewMargin.XOffset);
+ if (drawFrom >= drawTo)
+ return;
+
+ double height = editor.LineHeight / 5;
+ cr.SetSourceColor (GetColor (editor, Result));
+ if (drawOverlay) {
+ cr.Rectangle (drawFrom, y, drawTo - drawFrom, editor.LineHeight);
+ var color = editor.ColorStyle.PlainText.Background;
+ color.A = 0.6;
+ cr.SetSourceColor (color);
+ cr.Fill ();
+ } else if (result.InspectionMark == IssueMarker.WavedLine) {
+ Pango.CairoHelper.ShowErrorUnderline (cr, drawFrom, y + editor.LineHeight - height, drawTo - drawFrom, height);
+ } else if (result.InspectionMark == IssueMarker.DottedLine) {
+ cr.Save ();
+ cr.LineWidth = 1;
+ cr.MoveTo (drawFrom + 1, y + editor.LineHeight - 1 + 0.5);
+ cr.RelLineTo (System.Math.Min (drawTo - drawFrom, 4 * 3), 0);
+ cr.SetDash (new double[] { 2, 2 }, 0);
+ cr.Stroke ();
+ cr.Restore ();
+ } else {
+ cr.MoveTo (drawFrom, y + editor.LineHeight - 1);
+ cr.LineTo (drawTo, y + editor.LineHeight - 1);
+ cr.Stroke ();
+ }
+ }
+ }
+
+ class GrayOutMarker : ResultMarker, IChunkMarker
+ {
+ public GrayOutMarker (Result result, TextSegment segment) : base (result, segment)
+ {
+ }
+
+ public override void Draw (TextEditor editor, Cairo.Context cr, Pango.Layout layout, bool selected, int startOffset, int endOffset, double y, double startXPos, double endXPos)
+ {
+ }
+
+ #region IChunkMarker implementation
+
+ void IChunkMarker.TransformChunks (List<Chunk> chunks)
+ {
+ int markerStart = Segment.Offset;
+ int markerEnd = Segment.EndOffset;
+ for (int i = 0; i < chunks.Count; i++) {
+ var chunk = chunks [i];
+ if (chunk.EndOffset < markerStart || markerEnd <= chunk.Offset)
+ continue;
+ if (chunk.Offset == markerStart && chunk.EndOffset == markerEnd)
+ return;
+
+ if (chunk.Offset <= markerStart && chunk.EndOffset >= markerEnd) {
+ if (markerStart - chunk.Offset > 0) {
+ var newChunk = new Chunk (chunk.Offset, markerStart - chunk.Offset, chunk.Style);
+ chunks.Insert (i, newChunk);
+ chunk.Offset += newChunk.Length;
+ chunk.Length -= newChunk.Length;
+ chunk = newChunk;
+ }
+ if (markerEnd < chunk.EndOffset) {
+ var newChunk = new Chunk (chunk.Offset, markerEnd - chunk.Offset, chunk.Style);
+ chunks.Insert (i, newChunk);
+ chunk.Offset += newChunk.Length;
+ chunk.Length -= newChunk.Length;
+ }
+ continue;
+ }
+ }
+ }
+
+ void IChunkMarker.ChangeForeColor (TextEditor editor, Chunk chunk, ref Cairo.Color color)
+ {
+ if (Debugger.DebuggingService.IsDebugging)
+ return;
+ int markerStart = Segment.Offset;
+ int markerEnd = Segment.EndOffset;
+ if (chunk.EndOffset <= markerStart || markerEnd <= chunk.Offset)
+ return;
+ var bgc = editor.ColorStyle.PlainText.Background;
+ double alpha = 0.6;
+ color = new Cairo.Color (
+ color.R * alpha + bgc.R * (1.0 - alpha),
+ color.G * alpha + bgc.G * (1.0 - alpha),
+ color.B * alpha + bgc.B * (1.0 - alpha)
+ );
+ }
+ #endregion
+ }
+*/
}
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs
index 8e65377f29..aa667f4128 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs
@@ -169,9 +169,9 @@ namespace MonoDevelop.CodeActions
if (token.IsCancellationRequested)
return;
CreateSmartTag (fixes, loc);
- quickFixTimeout = 0;
});
});
+ quickFixTimeout = 0;
return false;
});
} else {
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeAnalysisBatchRunner.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeAnalysisBatchRunner.cs
index 46f64c81ad..1574e7ab64 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeAnalysisBatchRunner.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeAnalysisBatchRunner.cs
@@ -43,63 +43,63 @@ using MonoDevelop.Core.Instrumentation;
using MonoDevelop.Refactoring;
using System.Collections.Generic;
using MonoDevelop.Core;
-using MonoDevelop.Ide.Editor;
-
-namespace MonoDevelop.CodeIssues
-{
- public class CodeAnalysisBatchRunner
- {
- private readonly object _lock = new object ();
-
- private int workerCount;
-
- private readonly AnalysisJobQueue jobQueue = new AnalysisJobQueue ();
-
- public IJobContext QueueJob (IAnalysisJob job)
- {
- jobQueue.Add (job);
- EnsureRunning ();
- return new JobContext (job, jobQueue, this);
- }
-
- private void EnsureRunning ()
- {
- for (; Interlocked.Add (ref workerCount, 1) < Environment.ProcessorCount;) {
- new Thread (() => {
- try {
- ProcessQueue ();
- }
- finally {
- Interlocked.Add (ref workerCount, -1);
- }
- }).Start ();
- }
- }
-
- private void ProcessQueue ()
- {
- while (true) {
- try {
- using (var slice = GetSlice ()) {
- if (slice == null)
- // TODO: Do something smarter if the queue is empty
- return;
- AnalyzeFile (slice, slice.GetJobs ().SelectMany (job => job.GetIssueProviders (slice.File)));
- }
- } catch (Exception e) {
- LoggingService.LogError ("Unhandled exception", e);
- MessageService.ShowException (e);
- }
- }
- }
-
- private JobSlice GetSlice ()
- {
- lock (_lock) {
- return jobQueue.Dequeue (1).FirstOrDefault ();
- }
- }
-
+using MonoDevelop.Ide.Editor;
+
+namespace MonoDevelop.CodeIssues
+{
+ public class CodeAnalysisBatchRunner
+ {
+ private readonly object _lock = new object ();
+
+ private int workerCount;
+
+ private readonly AnalysisJobQueue jobQueue = new AnalysisJobQueue ();
+
+ public IJobContext QueueJob (IAnalysisJob job)
+ {
+ jobQueue.Add (job);
+ EnsureRunning ();
+ return new JobContext (job, jobQueue, this);
+ }
+
+ private void EnsureRunning ()
+ {
+ for (; Interlocked.Add (ref workerCount, 1) < Environment.ProcessorCount;) {
+ new Thread (() => {
+ try {
+ ProcessQueue ();
+ }
+ finally {
+ Interlocked.Add (ref workerCount, -1);
+ }
+ }).Start ();
+ }
+ }
+
+ private void ProcessQueue ()
+ {
+ while (true) {
+ try {
+ using (var slice = GetSlice ()) {
+ if (slice == null)
+ // TODO: Do something smarter if the queue is empty
+ return;
+ AnalyzeFile (slice, slice.GetJobs ().SelectMany (job => job.GetIssueProviders (slice.File)));
+ }
+ } catch (Exception e) {
+ LoggingService.LogError ("Unhandled exception", e);
+ MessageService.ShowException (e);
+ }
+ }
+ }
+
+ private JobSlice GetSlice ()
+ {
+ lock (_lock) {
+ return jobQueue.Dequeue (1).FirstOrDefault ();
+ }
+ }
+
void AnalyzeFile (JobSlice item, IEnumerable<BaseCodeIssueProvider> codeIssueProviders)
{
var file = item.File;
@@ -107,6 +107,9 @@ namespace MonoDevelop.CodeIssues
if (file.BuildAction != BuildAction.Compile)
return;
+ if (!(file.Project is DotNetProject))
+ return;
+
ITextDocument editor;
try {
editor = TextFileProvider.Instance.GetTextEditorData (file.FilePath);
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeIssuePanelWidget.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeIssuePanelWidget.cs
index 913ffb15d0..9e02ecfdb8 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeIssuePanelWidget.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeIssuePanelWidget.cs
@@ -136,21 +136,18 @@ namespace MonoDevelop.CodeIssues
}
}
- Gdk.Color GetColor (Severity severity)
+ Xwt.Drawing.Image GetIcon (Severity severity)
{
switch (severity) {
- case Severity.None:
- return Style.Base (StateType.Normal);
case Severity.Error:
- return (HslColor)DefaultSourceEditorOptions.Instance.GetColorStyle ().UnderlineError.Color;
+ return QuickTaskOverviewMode.ErrorImage;
case Severity.Warning:
- return (HslColor)DefaultSourceEditorOptions.Instance.GetColorStyle ().UnderlineWarning.Color;
+ return QuickTaskOverviewMode.WarningImage;
case Severity.Hint:
- return (HslColor)DefaultSourceEditorOptions.Instance.GetColorStyle ().UnderlineHint.Color;
case Severity.Suggestion:
- return (HslColor)DefaultSourceEditorOptions.Instance.GetColorStyle ().UnderlineSuggestion.Color;
+ return QuickTaskOverviewMode.SuggestionImage;
default:
- throw new ArgumentOutOfRangeException ();
+ return QuickTaskOverviewMode.OkImage;
}
}
@@ -165,7 +162,7 @@ namespace MonoDevelop.CodeIssues
.OrderBy (g => g.Key, StringComparer.Ordinal);
foreach (var g in grouped) {
- TreeIter categoryIter = treeStore.AppendValues ("<b>" + g.Key + "</b>", null, "");
+ TreeIter categoryIter = treeStore.AppendValues ("<b>" + g.Key + "</b>", null, null);
categories [g.Key] = categoryIter;
foreach (var node in g.OrderBy (n => n.Title, StringComparer.Ordinal)) {
@@ -204,7 +201,7 @@ namespace MonoDevelop.CodeIssues
class CustomCellRenderer : CellRendererCombo
{
- public Gdk.Color Color {
+ public Xwt.Drawing.Image Icon {
get;
set;
}
@@ -214,15 +211,7 @@ namespace MonoDevelop.CodeIssues
int w = 10;
var newCellArea = new Gdk.Rectangle (cell_area.X + w, cell_area.Y, cell_area.Width - w, cell_area.Height);
using (var ctx = CairoHelper.Create (window)) {
- var r = 4;
- ctx.Arc (
- cell_area.X + r,
- cell_area.Y + cell_area.Height / 2 + 1,
- r,
- 0,
- Math.PI * 2);
- ctx.SetSourceColor ((HslColor)Color);
- ctx.Fill ();
+ ctx.DrawImage (widget, Icon, cell_area.X - 4, cell_area.Y + Math.Round ((cell_area.Height - Icon.Height) / 2));
}
base.Render (window, widget, background_area, newCellArea, expose_area, flags);
@@ -333,7 +322,7 @@ namespace MonoDevelop.CodeIssues
var severity = severities[provider];
comboRenderer.Visible = true;
comboRenderer.Text = GetDescription (severity);
- comboRenderer.Color = GetColor (severity);
+ comboRenderer.Icon = GetIcon (severity);
});
treeviewInspections.HeadersVisible = false;
treeviewInspections.Model = treeStore;
@@ -357,4 +346,4 @@ namespace MonoDevelop.CodeIssues
kv.Key.SetIsEnabled (kv.Value);
}
}
-} \ No newline at end of file
+}
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Rename/RenameRefactoring.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Rename/RenameRefactoring.cs
index 4330ff14e5..d49e7506a1 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Rename/RenameRefactoring.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Rename/RenameRefactoring.cs
@@ -279,7 +279,7 @@ namespace MonoDevelop.Refactoring.Rename
if (properties.RenameFile && options.SelectedItem is IType) {
var cls = ((IType)options.SelectedItem).GetDefinition ();
int currentPart = 1;
- HashSet<string> alreadyRenamed = new HashSet<string> ();
+ var alreadyRenamed = new HashSet<string> ();
foreach (var part in cls.Parts) {
if (alreadyRenamed.Contains (part.Region.FileName))
continue;
@@ -287,13 +287,16 @@ namespace MonoDevelop.Refactoring.Rename
string oldFileName = System.IO.Path.GetFileNameWithoutExtension (part.Region.FileName);
string newFileName;
- if (oldFileName.ToUpper () == properties.NewName.ToUpper () || oldFileName.ToUpper ().EndsWith ("." + properties.NewName.ToUpper ()))
+ var newName = properties.NewName;
+ if (string.IsNullOrEmpty (oldFileName) || string.IsNullOrEmpty (newName))
continue;
- int idx = oldFileName.IndexOf (cls.Name);
+ if (oldFileName.ToUpper () == newName.ToUpper () || oldFileName.ToUpper ().EndsWith ("." + newName.ToUpper (), StringComparison.Ordinal))
+ continue;
+ int idx = oldFileName.IndexOf (cls.Name, StringComparison.Ordinal);
if (idx >= 0) {
- newFileName = oldFileName.Substring (0, idx) + properties.NewName + oldFileName.Substring (idx + cls.Name.Length);
+ newFileName = oldFileName.Substring (0, idx) + newName + oldFileName.Substring (idx + cls.Name.Length);
} else {
- newFileName = currentPart != 1 ? properties.NewName + currentPart : properties.NewName;
+ newFileName = currentPart != 1 ? newName + currentPart : newName;
currentPart++;
}
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml
index fc75465d12..0d4ef88222 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml
@@ -53,11 +53,11 @@
<Description>Fix handlers. Classes must implement IAnalysisFixHandler.</Description>
<ExtensionNode name="Handler" type="MonoDevelop.AnalysisCore.Extensions.FixHandlerExtensionNode" />
</ExtensionPoint>
-
+ <!--
<Extension path = "/MonoDevelop/Ide/Pads">
<Pad id="MonoDevelop.Refactoring.CodeIssuePad" _label="Code Issues" class="MonoDevelop.CodeIssues.CodeIssuePad" defaultPlacement = "Bottom"/>
- </Extension>
-
+ </Extension> -->
+
<!-- Text editor integration -->
<Extension path = "/MonoDevelop/Ide/TextEditorExtensions">
<Class class = "MonoDevelop.AnalysisCore.Gui.ResultsEditorExtension" />
@@ -162,18 +162,14 @@
<!-- Options panels -->
<Extension path = "/MonoDevelop/Ide/GlobalOptionsDialog/SourceCode">
- <Section id = "C#" _label = "C#">
- <Section id = "CodeIssuePanel" _label = "Code Rules" fill="true"
- class="MonoDevelop.CodeIssues.CodeIssuePanel"/>
- <Section id = "CodeActions" _label = "Code Actions" fill="true"
- icon="md-text-quickfix"
- class="MonoDevelop.CodeActions.CodeActionPanel"/>
+ <Section id="C#" _label="C#" icon="md-prefs-csharp">
+ <Section id="CodeIssuePanel" _label="Code Rules" fill="true" class="MonoDevelop.CodeIssues.CodeIssuePanel" icon="md-prefs-code-rules" />
+ <Section id="CodeActions" _label="Code Actions" fill="true" class="MonoDevelop.CodeActions.CodeActionPanel" icon="md-prefs-code-actions" />
</Section>
</Extension>
<Extension path = "/MonoDevelop/Ide/GlobalOptionsDialog/TextEditor">
- <Section id = "Analysis" _label = "Source Analysis" fill="true"
- class="MonoDevelop.AnalysisCore.Gui.AnalysisOptionsPanel"/>
+ <Section id="Analysis" _label="Source Analysis" fill="true" class="MonoDevelop.AnalysisCore.Gui.AnalysisOptionsPanel" icon="md-prefs-code-analysis" />
</Extension>
<!-- Extensions to the addin points defined by this addin -->
@@ -196,4 +192,10 @@
<Handler fixName="RenameMember" class = "MonoDevelop.AnalysisCore.Fixes.RenameMemberHandler" />
<Handler fixName="Generic" class = "MonoDevelop.AnalysisCore.Fixes.GenericFixHandler" />
</Extension>
+
+ <Extension path="/MonoDevelop/Core/StockIcons">
+ <StockIcon stockid="md-prefs-code-actions" resource="prefs-code-actions-light-16.png" size="Menu" />
+ <StockIcon stockid="md-prefs-code-rules" resource="prefs-code-rules-light-16.png" size="Menu" />
+ <StockIcon stockid="md-prefs-code-analysis" resource="prefs-code-analysis-light-16.png" size="Menu" />
+ </Extension>
</ExtensionModel>
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj
index 131a6a8d7e..0429a13135 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj
@@ -169,6 +169,26 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
+ <EmbeddedResource Include="icons\light\prefs-code-actions-16.png">
+ <LogicalName>prefs-code-actions-light-16.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-code-actions-16%402x.png">
+ <LogicalName>prefs-code-actions-light-16@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-code-rules-16.png">
+ <LogicalName>prefs-code-rules-light-16.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-code-rules-16%402x.png">
+ <LogicalName>prefs-code-rules-light-16@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-code-analysis-16.png">
+ <LogicalName>prefs-code-analysis-light-16.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-code-analysis-16%402x.png">
+ <LogicalName>prefs-code-analysis-light-16@2x.png</LogicalName>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
<ProjectReference Include="..\..\core\MonoDevelop.Ide\MonoDevelop.Ide.csproj">
<Project>{27096E7F-C91C-4AC6-B289-6897A701DF21}</Project>
<Name>MonoDevelop.Ide</Name>
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/ExtensionMethods.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/ExtensionMethods.cs
index 199a11e53f..8ac350afe7 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/ExtensionMethods.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/ExtensionMethods.cs
@@ -41,42 +41,13 @@ namespace MonoDevelop.Refactoring
{
public static class ExtensionMethods
{
-
class ResolverAnnotation
{
public CancellationTokenSource SharedTokenSource;
- public TaskWrapper Task;
+ public Task<CSharpAstResolver> Task;
public CSharpUnresolvedFile ParsedFile;
}
- public class TaskWrapper {
- readonly Task<CSharpAstResolver> underlyingTask;
-
- public CSharpAstResolver Result {
- get {
- if (underlyingTask.IsCanceled)
- return null;
- try {
- return underlyingTask.Result;
- } catch (AggregateException ae) {
- if (ae.InnerException is TaskCanceledException)
- return null;
- throw;
- } catch (TaskCanceledException) {
- return null;
- } catch (Exception e) {
- LoggingService.LogWarning ("Exception while getting shared AST resolver.", e);
- return null;
- }
- }
- }
- public TaskWrapper (Task<CSharpAstResolver> underlyingTask)
- {
- this.underlyingTask = underlyingTask;
- }
-
- }
-
public static TimerCounter ResolveCounter = InstrumentationService.CreateTimerCounter("Resolve document", "Parsing");
/// <summary>
@@ -85,7 +56,7 @@ namespace MonoDevelop.Refactoring
/// resolve navigator.
/// Note: The shared resolver is fully resolved.
/// </summary>
- public static TaskWrapper GetSharedResolver (this Document document)
+ public static Task<CSharpAstResolver> GetSharedResolver (this Document document)
{
var parsedDocument = document.ParsedDocument;
if (parsedDocument == null || document.IsProjectContextInUpdate || document.Project != null && !(document.Project is DotNetProject))
@@ -123,12 +94,25 @@ namespace MonoDevelop.Refactoring
return null;
}
}, token);
- var wrapper = new TaskWrapper (resolveTask);
+
+ var wrapper = resolveTask.ContinueWith (t => {
+ if (t.IsCanceled)
+ return null;
+ if (t.IsFaulted) {
+ var ex = t.Exception.Flatten ().InnerException;
+ if (!(ex is TaskCanceledException))
+ LoggingService.LogWarning ("Exception while getting shared AST resolver.", ex);
+ return null;
+ }
+ return t.Result;
+ }, TaskContinuationOptions.ExecuteSynchronously);
+
document.AddAnnotation (new ResolverAnnotation {
Task = wrapper,
ParsedFile = parsedFile,
SharedTokenSource = tokenSource
});
+
return wrapper;
}
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/FindDerivedSymbolsHandler.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/FindDerivedSymbolsHandler.cs
index 8be16b3e4c..5d5500d472 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/FindDerivedSymbolsHandler.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/FindDerivedSymbolsHandler.cs
@@ -83,48 +83,53 @@ namespace MonoDevelop.Refactoring
{
var assemblies = GetAllAssemblies (doc.Project);
assemblies.ContinueWith (delegate(Task<HashSet<IAssembly>> arg) {
- using (var monitor = IdeApp.Workbench.ProgressMonitors.GetSearchProgressMonitor (true, true)) {
- monitor.BeginTask (GettextCatalog.GetString ("Building type graph in solution ..."), 1);
- var tg = new TypeGraph (arg.Result);
- var node = tg.GetNode (entity.DeclaringTypeDefinition);
- monitor.EndTask ();
- if (node == null)
- return;
- Gtk.Application.Invoke (delegate {
- Stack<IList<TypeGraphNode>> derivedTypes = new Stack<IList<TypeGraphNode>> ();
- derivedTypes.Push (node.DerivedTypes);
- HashSet<ITypeDefinition> visitedType = new HashSet<ITypeDefinition> ();
- while (derivedTypes.Count > 0) {
- foreach (var derived in derivedTypes.Pop ()) {
- if (visitedType.Contains (derived.TypeDefinition))
- continue;
- derivedTypes.Push (tg.GetNode (derived.TypeDefinition).DerivedTypes);
- visitedType.Add (derived.TypeDefinition);
- var impMember = derived.TypeDefinition.Compilation.Import (entity);
- if (impMember == null)
- continue;
- IMember derivedMember;
- if (entity.DeclaringTypeDefinition.Kind == TypeKind.Interface) {
- derivedMember = derived.TypeDefinition.GetMembers (null, GetMemberOptions.IgnoreInheritedMembers).FirstOrDefault (
- m => m.ImplementedInterfaceMembers.Any (im => im.Region == entity.Region)
- );
- } else {
- derivedMember = InheritanceHelper.GetDerivedMember (impMember, derived.TypeDefinition);
- }
- if (derivedMember == null || string.IsNullOrEmpty (derivedMember.Region.FileName))
- continue;
- var tf = TextFileProvider.Instance.GetReadOnlyTextEditorData (derivedMember.Region.FileName);
- var start = tf.LocationToOffset (derivedMember.Region.Begin);
-// tf.SearchRequest.SearchPattern = derivedMember.Name;
-// var sr = tf.SearchForward (start);
-// if (sr != null)
-// start = sr.Offset;
-
- monitor.ReportResult (new MemberReference (derivedMember, derivedMember.Region, start, derivedMember.Name.Length));
+ var monitor = IdeApp.Workbench.ProgressMonitors.GetSearchProgressMonitor (true, true);
+ monitor.BeginTask (GettextCatalog.GetString ("Building type graph in solution ..."), 1);
+ var tg = new TypeGraph (arg.Result);
+ var node = tg.GetNode (entity.DeclaringTypeDefinition);
+ monitor.EndTask ();
+ if (node == null) {
+ monitor.Dispose ();
+ return;
+ }
+ Gtk.Application.Invoke (delegate {
+ try {
+ Stack<IList<TypeGraphNode>> derivedTypes = new Stack<IList<TypeGraphNode>> ();
+ derivedTypes.Push (node.DerivedTypes);
+ HashSet<ITypeDefinition> visitedType = new HashSet<ITypeDefinition> ();
+ while (derivedTypes.Count > 0) {
+ foreach (var derived in derivedTypes.Pop ()) {
+ if (visitedType.Contains (derived.TypeDefinition))
+ continue;
+ derivedTypes.Push (tg.GetNode (derived.TypeDefinition).DerivedTypes);
+ visitedType.Add (derived.TypeDefinition);
+ var impMember = derived.TypeDefinition.Compilation.Import (entity);
+ if (impMember == null)
+ continue;
+ IMember derivedMember;
+ if (entity.DeclaringTypeDefinition.Kind == TypeKind.Interface) {
+ derivedMember = derived.TypeDefinition.GetMembers (null, GetMemberOptions.IgnoreInheritedMembers).FirstOrDefault (
+ m => m.ImplementedInterfaceMembers.Any (im => im.Region == entity.Region)
+ );
+ } else {
+ derivedMember = InheritanceHelper.GetDerivedMember (impMember, derived.TypeDefinition);
}
+ if (derivedMember == null || string.IsNullOrEmpty (derivedMember.Region.FileName))
+ continue;
+ var tf = TextFileProvider.Instance.GetReadOnlyTextEditorData (derivedMember.Region.FileName);
+ var start = tf.LocationToOffset (derivedMember.Region.Begin);
+ tf.SearchRequest.SearchPattern = derivedMember.Name;
+ var sr = tf.SearchForward (start);
+ if (sr != null)
+ start = sr.Offset;
+
+ monitor.ReportResult (new MemberReference (derivedMember, derivedMember.Region, start, derivedMember.Name.Length));
}
- });
- }
+ }
+ } finally {
+ monitor.Dispose ();
+ }
+ });
});
}
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/FindReferencesHandler.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/FindReferencesHandler.cs
index 7eb4fb9562..8e219e7e35 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/FindReferencesHandler.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/FindReferencesHandler.cs
@@ -66,10 +66,8 @@ namespace MonoDevelop.Refactoring
return;
ResolveResult resolveResoult;
object item = CurrentRefactoryOperationsHandler.GetItem (doc, out resolveResoult);
- var entity = item as IEntity;
- if (entity == null)
- return;
- FindRefs (entity);
+ if (item != null)
+ FindRefs (item);
}
}
@@ -102,10 +100,8 @@ namespace MonoDevelop.Refactoring
return;
ResolveResult resolveResoult;
object item = CurrentRefactoryOperationsHandler.GetItem (doc, out resolveResoult);
- var entity = item as IEntity;
- if (entity == null)
- return;
- FindRefs (entity);
+ if (item != null)
+ FindRefs (item);
}
}
}
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOptions.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOptions.cs
index 7422788f22..7a37809077 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOptions.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOptions.cs
@@ -40,12 +40,13 @@ using ICSharpCode.NRefactory.Semantics;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.CSharp.TypeSystem;
using MonoDevelop.Ide.Editor;
+using System.Threading.Tasks;
namespace MonoDevelop.Refactoring
{
public class RefactoringOptions
{
- readonly CSharpAstResolver resolver;
+ readonly Task<CSharpAstResolver> resolver;
public Document Document {
get;
@@ -79,7 +80,7 @@ namespace MonoDevelop.Refactoring
return new TextLocation (Document.Editor.CaretLine, Document.Editor.CaretColumn);
}
}
- public readonly SyntaxTree Unit;
+ //public readonly SyntaxTree Unit;
public RefactoringOptions ()
{
@@ -92,8 +93,8 @@ namespace MonoDevelop.Refactoring
var sharedResolver = doc.GetSharedResolver ();
if (sharedResolver == null)
return;
- resolver = sharedResolver.Result;
- Unit = resolver != null ? resolver.RootNode as SyntaxTree : null;
+ resolver = sharedResolver;
+ //Unit = resolver != null ? resolver.RootNode as SyntaxTree : null;
}
}
@@ -188,7 +189,11 @@ namespace MonoDevelop.Refactoring
public ResolveResult Resolve (AstNode node)
{
- return resolver.Resolve (node);
+ if (!resolver.IsCompleted)
+ resolver.Wait (2000);
+ if (!resolver.IsCompleted)
+ return null;
+ return resolver.Result.Resolve (node);
}
public AstType CreateShortType (IType fullType)
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringPreviewDialog.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringPreviewDialog.cs
index 0d1294e20c..2544fae932 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringPreviewDialog.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringPreviewDialog.cs
@@ -35,6 +35,7 @@ using ICSharpCode.NRefactory.TypeSystem;
using MonoDevelop.Components;
using MonoDevelop.Ide.Editor;
using MonoDevelop.Core.Text;
+using MonoDevelop.Ide.Fonts;
namespace MonoDevelop.Refactoring
@@ -196,14 +197,12 @@ namespace MonoDevelop.Refactoring
class CellRendererDiff : Gtk.CellRendererText
{
Pango.Layout layout;
- Pango.FontDescription font;
bool diffMode;
int width, height, lineHeight;
string[] lines;
public CellRendererDiff ()
{
- font = Pango.FontDescription.FromString (DesktopService.DefaultMonospaceFont);
}
void DisposeLayout ()
@@ -219,10 +218,6 @@ namespace MonoDevelop.Refactoring
{
isDisposed = true;
DisposeLayout ();
- if (font != null) {
- font.Dispose ();
- font = null;
- }
base.OnDestroyed ();
}
@@ -248,28 +243,28 @@ namespace MonoDevelop.Refactoring
}
}
DisposeLayout ();
- layout = CreateLayout (container, lines[maxlin]);
+ CreateLayout (container, lines[maxlin]);
layout.GetPixelSize (out width, out lineHeight);
height = lineHeight * lines.Length;
} else
width = height = 0;
} else {
DisposeLayout ();
- layout = CreateLayout (container, text);
+ CreateLayout (container, text);
layout.GetPixelSize (out width, out height);
}
}
- Pango.Layout CreateLayout (Widget container, string text)
+ void CreateLayout (Widget container, string text)
{
- Pango.Layout layout = new Pango.Layout (container.PangoContext);
+ layout = new Pango.Layout (container.PangoContext);
layout.SingleParagraphMode = false;
if (diffMode) {
- layout.FontDescription = font;
+ layout.FontDescription = FontService.MonospaceFont;
layout.SetText (text);
- } else
+ } else {
layout.SetMarkup (text);
- return layout;
+ }
}
protected override void Render (Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs
index d1d66d6f58..e33d247eb4 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs
@@ -210,7 +210,10 @@ namespace MonoDevelop.Refactoring
if (editor != null && parsedDocument != null && parsedDocument.CreateRefactoringContext != null) {
var ctx = parsedDocument.CreateRefactoringContext (doc, cancellationToken);
if (ctx != null) {
- foreach (var provider in contextActions.Where (fix => disabledNodes.IndexOf (fix.IdString, StringComparison.Ordinal) < 0)) {
+ foreach (var provider in contextActions.Where (fix =>
+ fix.MimeType == editor.MimeType &&
+ disabledNodes.IndexOf (fix.IdString, StringComparison.Ordinal) < 0))
+ {
try {
result.AddRange (provider.GetActions (doc, ctx, loc, cancellationToken));
} catch (Exception ex) {
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoryCommands.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoryCommands.cs
index d352ab4dde..4383b931a1 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoryCommands.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoryCommands.cs
@@ -81,7 +81,7 @@ namespace MonoDevelop.Refactoring
{
ITextEditorResolver textEditorResolver = doc.GetContent<ITextEditorResolver> ();
if (textEditorResolver != null)
- return textEditorResolver.GetLanguageItem (doc.Editor.CaretOffset);
+ return textEditorResolver.GetLanguageItem (doc.Editor.IsSomethingSelected ? doc.Editor.SelectionStart : doc.Editor.CaretOffset);
return null;
}
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/ResolveCommandHandler.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/ResolveCommandHandler.cs
index e254a1d64c..46d1efda0a 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/ResolveCommandHandler.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/ResolveCommandHandler.cs
@@ -308,6 +308,23 @@ namespace MonoDevelop.Refactoring
return !string.IsNullOrEmpty (result);
}
+ static bool CanReference (Document doc, MonoDevelop.Projects.ProjectReference projectReference)
+ {
+ var project = doc.Project as DotNetProject;
+ if (project == null || projectReference == null || project.ParentSolution == null)
+ return true;
+ switch (projectReference.ReferenceType) {
+ case ReferenceType.Project:
+ var referenceProject = projectReference.ResolveProject (project.ParentSolution) as DotNetProject;
+ if (referenceProject == null)
+ return true;
+ string reason;
+ return project.CanReferenceProject (referenceProject, out reason);
+ }
+ return true;
+
+ }
+
static IEnumerable<PossibleNamespace> GetPossibleNamespaces (Document doc, AstNode node, ResolveResult resolveResult, DocumentLocation location)
{
var unit = doc.ParsedDocument.GetAst<SyntaxTree> ();
@@ -378,7 +395,8 @@ namespace MonoDevelop.Refactoring
if (typeDefinition.Name == aResult.Type.Name &&
typeDefinition.TypeParameterCount == tc &&
lookup.IsAccessible (typeDefinition, false)) {
- yield return new PossibleNamespace (typeDefinition.Namespace, true, requiredReference);
+ if (CanReference(doc, requiredReference))
+ yield return new PossibleNamespace (typeDefinition.Namespace, true, requiredReference);
}
}
}
@@ -392,13 +410,15 @@ namespace MonoDevelop.Refactoring
foreach (var typeDefinition in allTypes) {
if ((typeDefinition.Name == possibleAttributeName || typeDefinition.Name == uiResult.Identifier) && typeDefinition.TypeParameterCount == tc &&
lookup.IsAccessible (typeDefinition, false)) {
- if (typeDefinition.DeclaringTypeDefinition != null) {
- var builder = new TypeSystemAstBuilder (new CSharpResolver (doc.Compilation));
- foundIdentifier = true;
- yield return new PossibleNamespace (builder.ConvertType (typeDefinition.DeclaringTypeDefinition).ToString (), false, requiredReference);
- } else {
- foundIdentifier = true;
- yield return new PossibleNamespace (typeDefinition.Namespace, true, requiredReference);
+ if (CanReference (doc, requiredReference)) {
+ if (typeDefinition.DeclaringTypeDefinition != null) {
+ var builder = new TypeSystemAstBuilder (new CSharpResolver (doc.Compilation));
+ foundIdentifier = true;
+ yield return new PossibleNamespace (builder.ConvertType (typeDefinition.DeclaringTypeDefinition).ToString (), false, requiredReference);
+ } else {
+ foundIdentifier = true;
+ yield return new PossibleNamespace (typeDefinition.Namespace, true, requiredReference);
+ }
}
}
}
@@ -420,7 +440,8 @@ namespace MonoDevelop.Refactoring
true,
out inferredTypes
)) {
- yield return new PossibleNamespace (typeDefinition.Namespace, true, requiredReference);
+ if (CanReference(doc, requiredReference))
+ yield return new PossibleNamespace (typeDefinition.Namespace, true, requiredReference);
goto skipType;
}
}
@@ -439,7 +460,8 @@ namespace MonoDevelop.Refactoring
if ((identifier.Name == possibleAttributeName || identifier.Name == uiResult.Identifier) &&
typeDefinition.TypeParameterCount == tc &&
lookup.IsAccessible (typeDefinition, false))
- yield return new PossibleNamespace (typeDefinition.Namespace, true, requiredReference);
+ if (CanReference(doc, requiredReference))
+ yield return new PossibleNamespace (typeDefinition.Namespace, true, requiredReference);
}
}
}
@@ -464,7 +486,8 @@ namespace MonoDevelop.Refactoring
LoggingService.LogError (string.Format ("Error while looking up identifier {0}", uiResult.Identifier), e);
}
foreach(var kv in lookups)
- yield return new PossibleNamespace (kv.Item1.Namespace, true, new MonoDevelop.Projects.ProjectReference (kv.Item2));
+ if (CanReference(doc, new MonoDevelop.Projects.ProjectReference (kv.Item2)))
+ yield return new PossibleNamespace (kv.Item1.Namespace, true, new MonoDevelop.Projects.ProjectReference (kv.Item2));
}
}
@@ -485,7 +508,8 @@ namespace MonoDevelop.Refactoring
LoggingService.LogError (string.Format ("Error while looking up member resolve result {0}", node), e);
}
foreach(var kv in lookups)
- yield return new PossibleNamespace (kv.Item1.Namespace, true, new MonoDevelop.Projects.ProjectReference (kv.Item2));
+ if (CanReference(doc, new MonoDevelop.Projects.ProjectReference (kv.Item2)))
+ yield return new PossibleNamespace (kv.Item1.Namespace, true, new MonoDevelop.Projects.ProjectReference (kv.Item2));
}
}
diff --git a/main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-actions-16.png b/main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-actions-16.png
new file mode 100644
index 0000000000..3bfcaaa4a0
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-actions-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-actions-16@2x.png b/main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-actions-16@2x.png
new file mode 100644
index 0000000000..d3843fa488
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-actions-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-analysis-16.png b/main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-analysis-16.png
new file mode 100644
index 0000000000..d332c8658f
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-analysis-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-analysis-16@2x.png b/main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-analysis-16@2x.png
new file mode 100644
index 0000000000..ae2a84b99b
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-analysis-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-rules-16.png b/main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-rules-16.png
new file mode 100644
index 0000000000..7bd0114b4f
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-rules-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-rules-16@2x.png b/main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-rules-16@2x.png
new file mode 100644
index 0000000000..7e0f57994c
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Refactoring/icons/light/prefs-code-rules-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/HighlightingPanel.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/HighlightingPanel.cs
index 7830f205c9..778ba94674 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/HighlightingPanel.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/HighlightingPanel.cs
@@ -80,8 +80,7 @@ namespace MonoDevelop.SourceEditor.OptionPanels
void HandleButtonNewClicked (object sender, EventArgs e)
{
var newShemeDialog = new NewColorShemeDialog ();
- MessageService.RunCustomDialog (newShemeDialog, dialog);
- newShemeDialog.Destroy ();
+ MessageService.ShowCustomDialog (newShemeDialog, dialog);
ShowStyles ();
}
@@ -111,8 +110,7 @@ namespace MonoDevelop.SourceEditor.OptionPanels
var editor = new ColorShemeEditor (this);
var colorScheme = (Mono.TextEditor.Highlighting.ColorScheme)this.styleStore.GetValue (selectedIter, 1);
editor.SetSheme (colorScheme);
- MessageService.RunCustomDialog (editor, dialog);
- editor.Destroy ();
+ MessageService.ShowCustomDialog (editor, dialog);
}
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.cs
index d2aa2b69f8..66908e2da2 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.cs
@@ -36,11 +36,42 @@ using System.Linq;
using MonoDevelop.Components;
using Mono.TextEditor.Theatrics;
using MonoDevelop.Ide.Editor;
+using Xwt.Drawing;
namespace MonoDevelop.SourceEditor.QuickTasks
{
public class QuickTaskOverviewMode : DrawingArea
{
+ static Xwt.Drawing.Image searchImage = Xwt.Drawing.Image.FromResource ("issues-busy-light-16.png");
+ static Xwt.Drawing.Image okImage = Xwt.Drawing.Image.FromResource ("issues-ok-light-16.png");
+ static Xwt.Drawing.Image warningImage = Xwt.Drawing.Image.FromResource ("issues-warning-light-16.png");
+ static Xwt.Drawing.Image errorImage = Xwt.Drawing.Image.FromResource ("issues-error-light-16.png");
+ static Xwt.Drawing.Image suggestionImage = Xwt.Drawing.Image.FromResource ("issues-suggestion-light-16.png");
+
+ public static Xwt.Drawing.Image SuggestionImage {
+ get {
+ return suggestionImage;
+ }
+ }
+
+ public static Xwt.Drawing.Image ErrorImage {
+ get {
+ return errorImage;
+ }
+ }
+
+ public static Xwt.Drawing.Image WarningImage {
+ get {
+ return warningImage;
+ }
+ }
+
+ public static Xwt.Drawing.Image OkImage {
+ get {
+ return okImage;
+ }
+ }
+
//TODO: find a way to look these up from the theme
static readonly Cairo.Color win81Background = new Cairo.Color (240/255d, 240/255d, 240/255d);
static readonly Cairo.Color win81Slider = new Cairo.Color (205/255d, 205/255d, 205/255d);
@@ -65,7 +96,7 @@ namespace MonoDevelop.SourceEditor.QuickTasks
}
}
- public IEnumerable<TextLocation> AllUsages {
+ public IEnumerable<Usage> AllUsages {
get {
return parentStrip.AllUsages;
}
@@ -546,55 +577,34 @@ namespace MonoDevelop.SourceEditor.QuickTasks
protected void DrawIndicator (Cairo.Context cr, Severity severity)
{
- Mono.TextEditor.Highlighting.AmbientColor color;
+ Xwt.Drawing.Image image;
switch (severity) {
case Severity.Error:
- color = parentStrip.TextEditor.ColorStyle.AnalysisStatusErrorsIcon;
+ image = errorImage;
break;
case Severity.Warning:
- color = parentStrip.TextEditor.ColorStyle.AnalysisStatusWarningsIcon;
+ image = warningImage;
break;
case Severity.Suggestion:
case Severity.Hint:
- color = parentStrip.TextEditor.ColorStyle.AnalysisStatusSuggestionsIcon;
+ image = suggestionImage;
break;
default:
- color = parentStrip.TextEditor.ColorStyle.AnalysisStatusAllGoodIcon;
+ image = okImage;
break;
}
- DrawIndicator (cr, color.Color, color.BorderColor);
+ DrawIndicator (cr, image);
}
protected void DrawSearchIndicator (Cairo.Context cr)
{
- var darkColor = (HslColor)TextEditor.ColorStyle.SearchResult.Color;
- darkColor.L *= 0.5;
- DrawIndicator (cr, TextEditor.ColorStyle.SearchResultMain.Color, darkColor);
+ DrawIndicator (cr, searchImage);
}
- void DrawIndicator (Cairo.Context cr, Cairo.Color color, Cairo.Color borderColor)
+ void DrawIndicator (Cairo.Context cr, Xwt.Drawing.Image img)
{
- const int indicatorPadding = 3;
- const int indicatorDiameter = 8;
- var x1 = Allocation.Width / 2d;
- var y1 = indicatorPadding + indicatorDiameter / 2d;
-
- cr.Arc (x1, y1 + 1, indicatorDiameter / 2d, 0, 2 * Math.PI);
- cr.SetSourceRGBA (0, 0, 0, 0.2);
- cr.Fill ();
-
- cr.Arc (x1, y1, indicatorDiameter / 2d, 0, 2 * Math.PI);
- cr.SetSourceColor (color);
- cr.Fill ();
-
- cr.Arc (x1, y1, indicatorDiameter / 2d - 1, 0, 2 * Math.PI);
- cr.SetSourceRGBA (1, 1, 1, 0.1);
- cr.Stroke ();
-
- cr.Arc (x1, y1, indicatorDiameter / 2d, 0, 2 * Math.PI);
- cr.SetSourceColor (borderColor);
- cr.Stroke ();
+ cr.DrawImage (this, img, Math.Round ((Allocation.Width - img.Width) / 2), -1);
}
protected override void OnSizeRequested (ref Requisition requisition)
@@ -646,19 +656,29 @@ namespace MonoDevelop.SourceEditor.QuickTasks
protected Severity DrawQuickTasks (Cairo.Context cr)
{
Severity severity = Severity.None;
- /*
+
foreach (var usage in AllUsages) {
- double y = GetYPosition (usage.Line);
+ double y = GetYPosition (usage.Location.Line);
var usageColor = TextEditor.ColorStyle.PlainText.Foreground;
usageColor.A = 0.4;
- cr.Color = usageColor;
+ HslColor color;
+ if ((usage.UsageType & MonoDevelop.Ide.FindInFiles.ReferenceUsageType.Write) != 0) {
+ color = TextEditor.ColorStyle.ChangingUsagesRectangle.Color;
+ } else if ((usage.UsageType & MonoDevelop.Ide.FindInFiles.ReferenceUsageType.Read) != 0) {
+ color = TextEditor.ColorStyle.UsagesRectangle.Color;
+ } else {
+ color = usageColor;
+ }
+ color.L = 0.5;
+ cr.Color = color;
cr.MoveTo (0, y - 3);
cr.LineTo (5, y);
cr.LineTo (0, y + 3);
+ cr.LineTo (0, y - 3);
cr.ClosePath ();
cr.Fill ();
}
-*/
+
foreach (var task in AllTasks) {
double y = GetYPosition (task.Location.Line);
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskStrip.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskStrip.cs
index 14e58e80cc..dd6cef8718 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskStrip.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskStrip.cs
@@ -88,7 +88,7 @@ namespace MonoDevelop.SourceEditor.QuickTasks
}
Dictionary<IQuickTaskProvider, List<QuickTask>> providerTasks = new Dictionary<IQuickTaskProvider, List<QuickTask>> ();
- Dictionary<IUsageProvider, List<Mono.TextEditor.DocumentLocation>> providerUsages = new Dictionary<IUsageProvider, List<Mono.TextEditor.DocumentLocation>> ();
+ Dictionary<IUsageProvider, List<Usage>> providerUsages = new Dictionary<IUsageProvider, List<Usage>> ();
public IEnumerable<QuickTask> AllTasks {
get {
@@ -101,7 +101,7 @@ namespace MonoDevelop.SourceEditor.QuickTasks
}
}
}
- public IEnumerable<TextLocation> AllUsages {
+ public IEnumerable<Usage> AllUsages {
get {
if (providerUsages == null)
yield break;
@@ -179,10 +179,10 @@ namespace MonoDevelop.SourceEditor.QuickTasks
public void Update (IUsageProvider provider)
{
-/* if (providerTasks == null)
+ if (providerTasks == null)
return;
- providerUsages [provider] = new List<DocumentLocation> (provider.Usages);
- OnTaskProviderUpdated (EventArgs.Empty);*/
+ providerUsages [provider] = new List<Usage> (provider.Usages);
+ OnTaskProviderUpdated (EventArgs.Empty);
}
protected virtual void OnTaskProviderUpdated (EventArgs e)
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.addin.xml b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.addin.xml
index 63c864d382..5d7af48f8f 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.addin.xml
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.addin.xml
@@ -118,14 +118,18 @@
<CommandItem id = "MonoDevelop.SourceEditor.SourceEditorCommands.MarkerOperations" />
<CommandItem id = "MonoDevelop.Debugger.DebugCommands.ExpressionEvaluator" />
<SeparatorItem id = "Separator1" />
+ <CommandItem id = "MonoDevelop.Debugger.DebugCommands.RunToCursor" />
+ <CommandItem id = "MonoDevelop.Debugger.DebugCommands.SetNextStatement" />
+ <CommandItem id = "MonoDevelop.Debugger.DebugCommands.ShowNextStatement" />
+ <SeparatorItem id = "Separator2" />
<CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.Cut" />
<CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.Copy" />
<CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.Paste" />
- <SeparatorItem id = "Separator2" />
+ <SeparatorItem id = "Separator3" />
<CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.ToggleCodeComment" />
<CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.IndentSelection" />
<CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.UnIndentSelection" />
- <SeparatorItem id = "Separator3" />
+ <SeparatorItem id = "Separator4" />
<CommandItem id = "MonoDevelop.Ide.Commands.TextEditorCommands.ShowCodeTemplateWindow" />
</Extension>
@@ -158,15 +162,14 @@
<CommandItem id = "MonoDevelop.SourceEditor.SourceEditorCommands.ToggleErrorTextMarker" />
</Extension>
-
- <Extension path = "/MonoDevelop/Ide/GlobalOptionsDialog/TextEditor">
- <Section id = "General" insertbefore="Formatting" _label = "General" icon="md-text-editor" fill="true" class = "MonoDevelop.SourceEditor.OptionPanels.GeneralOptionsPanel"/>
- <Section id = "Markers" _label = "Markers and Rulers" icon="md-markers-rulers" class = "MonoDevelop.SourceEditor.OptionPanels.MarkerPanel"/>
- <Section id = "Behavior" _label = "Behavior" icon="md-text-editor-behavior" class = "MonoDevelop.SourceEditor.OptionPanels.BehaviorPanel"/>
- <Section id = "CompletionBehavior" _label = "Completion Behavior" class = "MonoDevelop.SourceEditor.OptionPanels.CompletionOptionsPanel"/>
-<!-- <Section id = "CompletionCharacters" _label = "Completion Characters" class = "MonoDevelop.SourceEditor.OptionPanels.CompletionCharactersPanel"/> -->
- <Section id = "CompletionAppearance" _label = "Completion Appearance" class = "MonoDevelop.SourceEditor.OptionPanels.CompletionAppearancePanel"/>
- <Section id = "SyntaxHighlighting" _label = "Syntax Highlighting" fill="true" icon="md-syntax-highlighting" class = "MonoDevelop.SourceEditor.OptionPanels.HighlightingPanel"/>
+ <Extension path="/MonoDevelop/Ide/GlobalOptionsDialog/TextEditor">
+ <Section id="General" insertbefore="Formatting" _label="General" fill="true" class="MonoDevelop.SourceEditor.OptionPanels.GeneralOptionsPanel" icon="md-prefs-text-editor-general" />
+ <Section id="Markers" _label="Markers and Rulers" class="MonoDevelop.SourceEditor.OptionPanels.MarkerPanel" icon="md-prefs-markers-rulers" />
+ <Section id="Behavior" _label="Behavior" class="MonoDevelop.SourceEditor.OptionPanels.BehaviorPanel" icon="md-prefs-text-editor-behavior" />
+ <Section id="CompletionBehavior" _label="Completion Behavior" class="MonoDevelop.SourceEditor.OptionPanels.CompletionOptionsPanel" icon="md-prefs-completion-behavior" />
+ <!-- <Section id="CompletionCharacters" _label="Completion Characters" class="MonoDevelop.SourceEditor.OptionPanels.CompletionCharactersPanel" /> -->
+ <Section id="CompletionAppearance" _label="Completion Appearance" class="MonoDevelop.SourceEditor.OptionPanels.CompletionAppearancePanel" icon="md-prefs-completion-appearance" />
+ <Section id="SyntaxHighlighting" _label="Syntax Highlighting" fill="true" class="MonoDevelop.SourceEditor.OptionPanels.HighlightingPanel" icon="md-prefs-syntax-highlighting" />
</Extension>
<Extension path = "/MonoDevelop/Ide/MainMenu/View">
@@ -187,11 +190,11 @@
</ItemSet>
</Extension>
- <Extension path = "/MonoDevelop/Ide/Fonts">
- <Font name ="MessageBubbles" _displayName="Message bubbles" default ="_DEFAULT_SANS" defaultMac = "Lucida Grande 11"/>
- <Font name ="MessageBubbleCounter" _displayName="Message bubbles error count" default ="_DEFAULT_SANS" defaultMac = "Lucida Grande Bold 11"/>
- <Font name ="MessageBubbleTooltip" _displayName="Message bubbles tooltip" default ="_DEFAULT_SANS" defaultMac = "Lucida Grande Bold 11"/>
- <Font name ="LanguageTooltips" _displayName="Editor tooltips" default ="_DEFAULT_SANS"/>
+ <Extension path="/MonoDevelop/Ide/Fonts">
+ <Font name="MessageBubbles" _displayName="Message bubbles" default="_DEFAULT_SANS" defaultMac="Lucida Grande 11" /><!-- TODO: VV: "_DEFAULT_SANS" => "Segoe UI Bold 8" -->
+ <Font name="MessageBubbleCounter" _displayName="Message bubbles error count" default="_DEFAULT_SANS" defaultMac="Lucida Grande Bold 11" /><!-- TODO: VV: "_DEFAULT_SANS" => "Segoe UI Bold 8" -->
+ <Font name="MessageBubbleTooltip" _displayName="Message bubbles tooltip" default="_DEFAULT_SANS" defaultMac="Lucida Grande Bold 11" /><!-- TODO: VV: "_DEFAULT_SANS" => "Segoe UI Bold 8" -->
+ <Font name="LanguageTooltips" _displayName="Editor tooltips" default="_DEFAULT_SANS" /><!-- TODO: VV: "_DEFAULT_SANS" => "Segoe UI Bold 8" -->
</Extension>
<Extension path = "/MonoDevelop/SourceEditor2/EditorFactory">
@@ -209,4 +212,14 @@
<!-- 2.6+ -->
<Migration sourceVersion="2.6+" kind="UserData" path="HighlightingSchemes" isDirectory="true" />
</Extension>
+
+ <Extension path = "/MonoDevelop/Core/StockIcons">
+ <StockIcon stockid="md-prefs-markers-rulers" resource="prefs-markers-rulers-light-16.png" size="Menu" />
+ <StockIcon stockid="md-prefs-syntax-highlighting" resource="prefs-syntax-highlighting-light-16.png" size="Menu" />
+ <StockIcon stockid="md-prefs-text-editor-general" resource="prefs-text-editor-general-light-16.png" size="Menu" />
+ <StockIcon stockid="md-prefs-text-editor-behavior" resource="prefs-text-editor-behavior-light-16.png" size="Menu" />
+ <StockIcon stockid="md-prefs-completion-appearance" resource="prefs-completion-appearance-light-16.png" size="Menu" />
+ <StockIcon stockid="md-prefs-completion-behavior" resource="prefs-completion-behavior-light-16.png" size="Menu" />
+ </Extension>
+
</ExtensionModel>
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj
index c1bb022051..d021a4265e 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj
@@ -240,6 +240,60 @@
<EmbeddedResource Include="icons\light\issues-warning-16%402x.png">
<LogicalName>issues-warning-light-16@2x.png</LogicalName>
</EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-bookmark-15.png">
+ <LogicalName>gutter-bookmark-light-15.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-bookmark-15%402x.png">
+ <LogicalName>gutter-bookmark-light-15@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-error-15.png">
+ <LogicalName>gutter-error-light-15.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-error-15%402x.png">
+ <LogicalName>gutter-error-light-15@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-warning-15.png">
+ <LogicalName>gutter-warning-light-15.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\gutter-warning-15%402x.png">
+ <LogicalName>gutter-warning-light-15@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-markers-rulers-16.png">
+ <LogicalName>prefs-markers-rulers-light-16.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-markers-rulers-16%402x.png">
+ <LogicalName>prefs-markers-rulers-light-16@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-syntax-highlighting-16.png">
+ <LogicalName>prefs-syntax-highlighting-light-16.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-syntax-highlighting-16%402x.png">
+ <LogicalName>prefs-syntax-highlighting-light-16@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-text-editor-general-16.png">
+ <LogicalName>prefs-text-editor-general-light-16.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-text-editor-general-16%402x.png">
+ <LogicalName>prefs-text-editor-general-light-16@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-text-editor-behavior-16.png">
+ <LogicalName>prefs-text-editor-behavior-light-16.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-text-editor-behavior-16%402x.png">
+ <LogicalName>prefs-text-editor-behavior-light-16@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-completion-appearance-16.png">
+ <LogicalName>prefs-completion-appearance-light-16.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-completion-appearance-16%402x.png">
+ <LogicalName>prefs-completion-appearance-light-16@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-completion-behavior-16.png">
+ <LogicalName>prefs-completion-behavior-light-16.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-completion-behavior-16%402x.png">
+ <LogicalName>prefs-completion-behavior-light-16@2x.png</LogicalName>
+ </EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AutoSave.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AutoSave.cs
index 893680a0eb..70b53bfe00 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AutoSave.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AutoSave.cs
@@ -67,7 +67,15 @@ namespace MonoDevelop.SourceEditor
if (!autoSaveEnabled)
return false;
try {
- return File.Exists (GetAutoSaveFileName (fileName));
+ var autoSaveFilename = GetAutoSaveFileName (fileName);
+ bool autoSaveExists = File.Exists (autoSaveFilename);
+ if (autoSaveExists) {
+ if (File.GetLastWriteTimeUtc (autoSaveFilename) < File.GetLastWriteTimeUtc (fileName)) {
+ File.Delete (autoSaveFilename);
+ return false;
+ }
+ }
+ return autoSaveExists;
} catch (Exception e) {
LoggingService.LogError ("Error in auto save - disableing.", e);
DisableAutoSave ();
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs
index 8a5f4e9372..33e9cb1971 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs
@@ -71,149 +71,13 @@ namespace MonoDevelop.SourceEditor
void TargetProcessExited (object sender, EventArgs e)
{
- if (tooltip != null)
- tooltip.Hide ();
- }
-
- #region ITooltipProvider implementation
-
- static string GetIdentifierName (TextEditor editor, Identifier id, out int startOffset)
- {
- startOffset = editor.LocationToOffset (id.StartLocation.Line, id.StartLocation.Column);
-
- return editor.GetTextBetween (id.StartLocation, id.EndLocation);
- }
-
- public static string ResolveExpression (TextEditor editor, ResolveResult result, AstNode node, out int startOffset)
- {
- //Console.WriteLine ("result is a {0}", result.GetType ().Name);
- startOffset = -1;
-
- if (result is NamespaceResolveResult ||
- result is ConversionResolveResult ||
- result is ConstantResolveResult ||
- result is ForEachResolveResult ||
- result is TypeIsResolveResult ||
- result is TypeOfResolveResult ||
- result is ErrorResolveResult)
- return null;
-
- if (result.IsCompileTimeConstant)
- return null;
-
- startOffset = editor.LocationToOffset (node.StartLocation.Line, node.StartLocation.Column);
-
- if (result is InvocationResolveResult) {
- var ir = (InvocationResolveResult) result;
- if (ir.Member.Name == ".ctor") {
- // if the user is hovering over something like "new Abc (...)", we want to show them type information for Abc
- return ir.Member.DeclaringType.FullName;
- }
-
- // do not support general method invocation for tooltips because it could cause side-effects
- return null;
- } else if (result is LocalResolveResult) {
- if (node is ParameterDeclaration) {
- // user is hovering over a method parameter, but we don't want to include the parameter type
- var param = (ParameterDeclaration) node;
-
- return GetIdentifierName (editor, param.NameToken, out startOffset);
- }
-
- if (node is VariableInitializer) {
- // user is hovering over something like "int fubar = 5;", but we don't want the expression to include the " = 5"
- var variable = (VariableInitializer) node;
-
- return GetIdentifierName (editor, variable.NameToken, out startOffset);
- }
- } else if (result is MemberResolveResult) {
- var mr = (MemberResolveResult) result;
-
- if (node is PropertyDeclaration) {
- var prop = (PropertyDeclaration) node;
- var name = GetIdentifierName (editor, prop.NameToken, out startOffset);
-
- // if the property is static, then we want to return "Full.TypeName.Property"
- if (prop.Modifiers.HasFlag (Modifiers.Static))
- return mr.Member.DeclaringType.FullName + "." + name;
-
- // otherwise we want to return "this.Property" so that it won't conflict with anything else in the local scope
- return "this." + name;
- }
-
- if (node is FieldDeclaration) {
- var field = (FieldDeclaration) node;
- var name = GetIdentifierName (editor, field.NameToken, out startOffset);
-
- // if the field is static, then we want to return "Full.TypeName.Field"
- if (field.Modifiers.HasFlag (Modifiers.Static))
- return mr.Member.DeclaringType.FullName + "." + name;
-
- // otherwise we want to return "this.Field" so that it won't conflict with anything else in the local scope
- return "this." + name;
- }
-
- if (node is VariableInitializer) {
- // user is hovering over a field declaration that includes initialization
- var variable = (VariableInitializer) node;
- var name = GetIdentifierName (editor, variable.NameToken, out startOffset);
-
- // walk up the AST to find the FieldDeclaration so that we can determine if it is static or not
- var field = variable.GetParent<FieldDeclaration> ();
-
- // if the field is static, then we want to return "Full.TypeName.Field"
- if (field.Modifiers.HasFlag (Modifiers.Static))
- return mr.Member.DeclaringType.FullName + "." + name;
-
- // otherwise we want to return "this.Field" so that it won't conflict with anything else in the local scope
- return "this." + name;
- }
-
- if (node is NamedExpression) {
- // user is hovering over 'Property' in an expression like: var fubar = new Fubar () { Property = baz };
- var variable = node.GetParent<VariableInitializer> ();
- if (variable != null) {
- var variableName = GetIdentifierName (editor, variable.NameToken, out startOffset);
- var name = GetIdentifierName (editor, ((NamedExpression) node).NameToken, out startOffset);
-
- return variableName + "." + name;
- }
- }
- } else if (result is TypeResolveResult) {
- return ((TypeResolveResult) result).Type.FullName;
+ if (tooltip != null) {
+ tooltip.Destroy ();
+ tooltip = null;
}
-
- return editor.GetTextBetween (node.StartLocation, node.EndLocation);
}
- static bool TryResolveAt (Document doc, DocumentLocation loc, out ResolveResult result, out AstNode node)
- {
- if (doc == null)
- throw new ArgumentNullException ("doc");
-
- result = null;
- node = null;
-
- var parsedDocument = doc.ParsedDocument;
- if (parsedDocument == null)
- return false;
-
- var unit = parsedDocument.GetAst<SyntaxTree> ();
- var parsedFile = parsedDocument.ParsedFile as CSharpUnresolvedFile;
-
- if (unit == null || parsedFile == null)
- return false;
-
- try {
- result = ResolveAtLocation.Resolve (new Lazy<ICompilation> (() => doc.Compilation), parsedFile, unit, loc, out node);
- if (result == null || node is Statement)
- return false;
- } catch {
- return false;
- }
-
- return true;
- }
+ #region ITooltipProvider implementation
public override TooltipItem GetItem (TextEditor editor, int offset)
{
@@ -241,14 +105,17 @@ namespace MonoDevelop.SourceEditor
if (doc == null || doc.ParsedDocument == null)
return null;
- ResolveResult result;
- AstNode node;
+ var resolver = doc.GetContent<IDebuggerExpressionResolver> ();
+ var data = editor.GetTextEditorData ();
- var loc = editor.OffsetToLocation (offset);
- if (!TryResolveAt (doc, loc, out result, out node))
- return null;
+ if (resolver != null) {
+ expression = resolver.ResolveExpression (data, doc, offset, out startOffset);
+ } else {
+ int endOffset = data.FindCurrentWordEnd (offset);
+ startOffset = data.FindCurrentWordStart (offset);
- expression = ResolveExpression (editor, result, node, out startOffset);
+ expression = data.GetTextAt (startOffset, endOffset - startOffset);
+ }
}
if (string.IsNullOrEmpty (expression))
@@ -256,7 +123,11 @@ namespace MonoDevelop.SourceEditor
ObjectValue val;
if (!cachedValues.TryGetValue (expression, out val)) {
- val = frame.GetExpressionValue (expression, true);
+ var options = DebuggingService.DebuggerSession.EvaluationOptions.Clone ();
+ options.AllowMethodEvaluation = true;
+ options.AllowTargetInvoke = true;
+
+ val = frame.GetExpressionValue (expression, options);
cachedValues [expression] = val;
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs
index ab489bf1d0..7fe9351672 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs
@@ -93,11 +93,34 @@ namespace MonoDevelop.SourceEditor
get { return (ISourceEditorOptions)base.Options; }
set { base.Options = value; }
}
+
+ static ExtensibleTextEditor ()
+ {
+ var icon = Xwt.Drawing.Image.FromResource ("gutter-bookmark-light-15.png");
+
+ BookmarkMarker.DrawBookmarkFunc = delegate(TextEditor editor, Cairo.Context cr, DocumentLine lineSegment, double x, double y, double width, double height) {
+ if (!lineSegment.IsBookmarked)
+ return;
+ cr.DrawImage (
+ editor,
+ icon,
+ Math.Floor (x + (width - icon.Width) / 2),
+ Math.Floor (y + (height - icon.Height) / 2)
+ );
+ };
+
+ }
public ExtensibleTextEditor (SourceEditorView view, ISourceEditorOptions options, Mono.TextEditor.TextDocument doc) : base(doc, options)
{
Initialize (view);
}
+
+ void HandleParseOperationFinished (object sender, EventArgs e)
+ {
+ resolveResult = null;
+ resolveRegion = DomRegion.Empty;
+ }
public ExtensibleTextEditor (SourceEditorView view)
{
@@ -114,7 +137,8 @@ namespace MonoDevelop.SourceEditor
this.view = view;
Document.TextReplaced += HandleSkipCharsOnReplace;
-
+ TypeSystemService.ParseOperationFinished += HandleParseOperationFinished;
+
UpdateEditMode ();
this.DoPopupMenu = ShowPopup;
}
@@ -158,8 +182,8 @@ namespace MonoDevelop.SourceEditor
} else {
// if (!(CurrentMode is SimpleEditMode)){
SimpleEditMode simpleMode = new SimpleEditMode ();
- simpleMode.KeyBindings [EditMode.GetKeyCode (Gdk.Key.Tab)] = new TabAction (this).Action;
- simpleMode.KeyBindings [EditMode.GetKeyCode (Gdk.Key.BackSpace)] = EditActions.AdvancedBackspace;
+ simpleMode.KeyBindings [EditMode.GetKeyCode (Gdk.Key.Tab)] = new TabAction (this).Action;
+ simpleMode.KeyBindings [EditMode.GetKeyCode (Gdk.Key.BackSpace)] = EditActions.AdvancedBackspace;
CurrentMode = simpleMode;
// }
}
@@ -177,6 +201,7 @@ namespace MonoDevelop.SourceEditor
protected override void OnDestroyed ()
{
+ TypeSystemService.ParseOperationFinished -= HandleParseOperationFinished;
UnregisterAdjustments ();
resolveResult = null;
EditorExtension = null;
@@ -312,6 +337,7 @@ namespace MonoDevelop.SourceEditor
return true;
bool inStringOrComment = false;
+ bool isString = false;
DocumentLine line = Document.GetLine (Caret.Line);
if (line == null)
return true;
@@ -320,12 +346,19 @@ namespace MonoDevelop.SourceEditor
var sm = Document.SyntaxMode as SyntaxMode;
if (sm != null)
Mono.TextEditor.Highlighting.SyntaxModeService.ScanSpans (Document, sm, sm, stack, line.Offset, Caret.Offset);
- string spanColor = null;
+
foreach (Span span in stack) {
if (string.IsNullOrEmpty (span.Color))
continue;
- if (span.Color.StartsWith ("String", StringComparison.Ordinal) || span.Color.StartsWith ("Comment", StringComparison.Ordinal)) {
- spanColor = span.Color;
+ if (span.Color.StartsWith ("String", StringComparison.Ordinal) ||
+ span.Color.StartsWith ("Comment", StringComparison.Ordinal) ||
+ span.Color.StartsWith ("Xml Attribute Value", StringComparison.Ordinal)) {
+ //Treat "Xml Attribute Value" as "String" so quotes in SkipChars works in Xml
+ if (span.Color.StartsWith ("Comment", StringComparison.Ordinal)) {
+ isString = false;
+ } else {
+ isString = true;
+ }
inStringOrComment = true;
break;
}
@@ -347,7 +380,7 @@ namespace MonoDevelop.SourceEditor
char charBefore = Document.GetCharAt (Caret.Offset - 1);
if (ch == '"') {
if (!inStringOrComment && charBefore == '"' ||
- inStringOrComment && spanColor == "String" && charBefore == '\\' ) {
+ isString && charBefore == '\\' ) {
skipChar = null;
braceIndex = -1;
}
@@ -566,21 +599,27 @@ namespace MonoDevelop.SourceEditor
ParameterInformationWindowManager.HideWindow (null, view);
HideTooltip ();
const string menuPath = "/MonoDevelop/SourceEditor2/ContextMenu/Editor";
- var ctx = view.WorkbenchWindow.ExtensionContext ?? AddinManager.AddinEngine;
+ var ctx = ExtensionContext ?? AddinManager.AddinEngine;
+
CommandEntrySet cset = IdeApp.CommandService.CreateCommandEntrySet (ctx, menuPath);
- Gtk.Menu menu = IdeApp.CommandService.CreateMenu (cset);
- var imMenu = CreateInputMethodMenuItem (GettextCatalog.GetString ("_Input Methods"));
- if (imMenu != null) {
- menu.Append (new SeparatorMenuItem ());
- menu.Append (imMenu);
- }
-
- menu.Hidden += HandleMenuHidden;
- if (evt != null) {
- GtkWorkarounds.ShowContextMenu (menu, this, evt);
+
+ if (Platform.IsMac) {
+ IdeApp.CommandService.ShowContextMenu (this, evt, cset, this);
} else {
- var pt = LocationToPoint (this.Caret.Location);
- GtkWorkarounds.ShowContextMenu (menu, this, new Gdk.Rectangle (pt.X, pt.Y, 1, (int)LineHeight));
+ Gtk.Menu menu = IdeApp.CommandService.CreateMenu (cset);
+ var imMenu = CreateInputMethodMenuItem (GettextCatalog.GetString ("_Input Methods"));
+ if (imMenu != null) {
+ menu.Append (new SeparatorMenuItem ());
+ menu.Append (imMenu);
+ }
+
+ menu.Hidden += HandleMenuHidden;
+ if (evt != null) {
+ GtkWorkarounds.ShowContextMenu (menu, this, evt);
+ } else {
+ var pt = LocationToPoint (this.Caret.Location);
+ GtkWorkarounds.ShowContextMenu (menu, this, new Gdk.Rectangle (pt.X, pt.Y, 1, (int)LineHeight));
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/HoverCloseButton.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/HoverCloseButton.cs
index 0f7b0f72b8..0284769bc6 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/HoverCloseButton.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/HoverCloseButton.cs
@@ -144,7 +144,7 @@ namespace MonoDevelop.SourceEditor
context.Arc (center.X, center.Y + 1, radius, 0, Math.PI * 2);
lg.AddColorStop (0, new Cairo.Color (0, 0, 0, 0.2 * opacity));
lg.AddColorStop (1, new Cairo.Color (0, 0, 0, 0));
- context.Pattern = lg;
+ context.SetSource (lg);
context.Stroke ();
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleCache.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleCache.cs
index dd80b5c282..ba46bb1a26 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleCache.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleCache.cs
@@ -54,8 +54,8 @@ namespace MonoDevelop.SourceEditor
public MessageBubbleCache (TextEditor editor)
{
this.editor = editor;
- errorPixbuf = ImageService.GetIcon ("md-bubble-error", Gtk.IconSize.Menu);
- warningPixbuf = ImageService.GetIcon ("md-bubble-warning", Gtk.IconSize.Menu);
+ errorPixbuf = Xwt.Drawing.Image.FromResource ("gutter-error-light-15.png");
+ warningPixbuf = Xwt.Drawing.Image.FromResource ("gutter-warning-light-15.png");
editor.EditorOptionsChanged += HandleEditorEditorOptionsChanged;
editor.TextArea.LeaveNotifyEvent += HandleLeaveNotifyEvent;
@@ -90,8 +90,6 @@ namespace MonoDevelop.SourceEditor
}
MessageBubblePopoverWindow popoverWindow;
- internal static readonly Cairo.Color ShadowColor = new Cairo.Color (0, 0, 0, MonoDevelop.Core.Platform.IsMac ? 0.12 : 0.2);
-
class MessageBubblePopoverWindow : PopoverWindow
{
readonly MessageBubbleCache cache;
@@ -102,7 +100,6 @@ namespace MonoDevelop.SourceEditor
this.cache = cache;
this.marker = marker;
ShowArrow = true;
- Opacity = 0.93;
Theme.ArrowLength = 7;
TransientFor = IdeApp.Workbench.RootWindow;
}
@@ -119,7 +116,7 @@ namespace MonoDevelop.SourceEditor
protected override void OnSizeRequested (ref Gtk.Requisition requisition)
{
base.OnSizeRequested (ref requisition);
- double y = verticalTextBorder * 2 - verticalTextSpace; // one space get's added too much
+ double y = verticalTextBorder * 2 - verticalTextSpace + (MonoDevelop.Core.Platform.IsWindows ? 10 : 2);
using (var drawingLayout = new Pango.Layout (this.PangoContext)) {
drawingLayout.FontDescription = cache.tooltipFontDescription;
@@ -157,49 +154,39 @@ namespace MonoDevelop.SourceEditor
using (var drawingLayout = new Pango.Layout (this.PangoContext)) {
drawingLayout.FontDescription = cache.tooltipFontDescription;
- double y = verticalTextBorder;
+ double y = verticalTextBorder;
var showBulletedList = marker.Errors.Count > 1;
- foreach (var msg in marker.Errors) {
+ foreach (var msg in marker.Errors) {
var icon = msg.IsError ? cache.errorPixbuf : cache.warningPixbuf;
+ int w, h;
if (!showBulletedList)
drawingLayout.Width = maxTextWidth;
+
drawingLayout.SetText (GetFirstLine (msg));
- int w;
- int h;
drawingLayout.GetPixelSize (out w, out h);
if (showBulletedList) {
g.Save ();
- g.Translate (
- textBorder,
- y + verticalTextSpace / 2 + 1 + Math.Max (0, (h - icon.Height) / 2)
- );
+ g.Translate (textBorder, y + verticalTextSpace / 2 + Math.Max (0, (h - icon.Height) / 2));
g.DrawImage (this, icon, 0, 0);
g.Restore ();
}
g.Save ();
- g.Translate (showBulletedList ? textBorder + iconTextSpacing + icon.Width: textBorder, y + verticalTextSpace / 2 + 1);
- g.SetSourceColor (ShadowColor);
- g.ShowLayout (drawingLayout);
-
- g.Translate (0, -1);
-
+ g.Translate (showBulletedList ? textBorder + iconTextSpacing + icon.Width: textBorder, y + verticalTextSpace / 2);
g.SetSourceColor (marker.TagColor.SecondColor);
g.ShowLayout (drawingLayout);
g.Restore ();
-
y += h + verticalTextSpace;
}
}
-
}
}
@@ -219,9 +206,11 @@ namespace MonoDevelop.SourceEditor
if (marker.Layouts == null || marker.Layouts.Count < 2 && !isReduced)
return false;
+
popoverWindow = new MessageBubblePopoverWindow (this, marker);
- popoverWindow.ShowWindowShadow = true;
- popoverWindow.ShowPopup (editor, new Gdk.Rectangle ((int)(bubbleX + editor.TextViewMargin.XOffset), (int)bubbleY, (int)bubbleWidth, (int)editor.LineHeight) ,PopupPosition.Top);
+ popoverWindow.ShowWindowShadow = false;
+ popoverWindow.ShowPopup (editor, new Gdk.Rectangle ((int)(bubbleX + editor.TextViewMargin.XOffset), (int)bubbleY, (int)bubbleWidth, (int)editor.LineHeight), PopupPosition.Top);
+
return false;
});
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleTextMarker.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleTextMarker.cs
index 5f4e594d89..17324e4d63 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleTextMarker.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MessageBubbleTextMarker.cs
@@ -393,7 +393,7 @@ namespace MonoDevelop.SourceEditor
showErrorCount = false;
// drawLayout.SetMarkup ("<span weight='heavy'>···</span>");
width = minWidth;
- roundingRadius = 10 * editor.Options.Zoom;
+ //roundingRadius = 10 * editor.Options.Zoom;
sx = Math.Min (sx, editor.Allocation.Width - width);
} else {
drawLayout.Ellipsize = Pango.EllipsizeMode.End;
@@ -401,42 +401,33 @@ namespace MonoDevelop.SourceEditor
drawLayout.SetText (text);
int w2, h2;
drawLayout.GetPixelSize (out w2, out h2);
- width = w2 + errorCounterWidth + editor.LineHeight;
+ width = w2 + errorCounterWidth + editor.LineHeight - 2;
}
}
+
bubbleDrawX = sx - editor.TextViewMargin.XOffset;
- bubbleDrawY = y;
+ bubbleDrawY = y + 2;
bubbleWidth = width;
+ var bubbleHeight = editor.LineHeight;
- var bubbleHeight = editor.LineHeight - 1;
- g.RoundedRectangle (sx, y + 1, width, bubbleHeight, roundingRadius);
+ g.RoundedRectangle (sx, y, width, bubbleHeight, roundingRadius);
g.SetSourceColor (TagColor.Color);
g.Fill ();
// Draw error count icon
if (showErrorCount) {
var errorCounterHeight = bubbleHeight - 2;
- var errorCounterX = sx + width - errorCounterWidth - 3;
- var errorCounterY = y + 1 + (bubbleHeight - errorCounterHeight) / 2;
-
- g.RoundedRectangle (
- errorCounterX - 1,
- errorCounterY - 1,
- errorCounterWidth + 2,
- errorCounterHeight + 2,
- editor.LineHeight / 2 - 3
- );
-
- g.SetSourceColor (new Cairo.Color (0, 0, 0, 0.081));
- g.Fill ();
+ var errorCounterX = sx + width - errorCounterWidth - 1;
+ var errorCounterY = Math.Round (y + (bubbleHeight - errorCounterHeight) / 2);
g.RoundedRectangle (
errorCounterX,
errorCounterY,
errorCounterWidth,
errorCounterHeight,
- editor.LineHeight / 2 - 3
+ editor.LineHeight / 2 - 2
);
+
using (var lg = new Cairo.LinearGradient (errorCounterX, errorCounterY, errorCounterX, errorCounterY + errorCounterHeight)) {
lg.AddColorStop (0, CounterColor.Color);
lg.AddColorStop (1, CounterColor.Color.AddLight (-0.1));
@@ -449,10 +440,10 @@ namespace MonoDevelop.SourceEditor
int ew;
errorCountLayout.GetPixelSize (out ew, out eh);
- g.Translate (
- errorCounterX + (2 + errorCounterWidth - ew) / 2,
- errorCounterY + (-1 + errorCounterHeight - eh) / 2
- );
+ var tx = Math.Round (errorCounterX + (2 + errorCounterWidth - ew) / 2);
+ var ty = Math.Round (errorCounterY + (-1 + errorCounterHeight - eh) / 2);
+
+ g.Translate (tx, ty);
g.SetSourceColor (CounterColor.SecondColor);
g.ShowLayout (errorCountLayout);
g.Restore ();
@@ -462,29 +453,22 @@ namespace MonoDevelop.SourceEditor
// Draw dots
double radius = 2 * editor.Options.Zoom;
double spacing = 1 * editor.Options.Zoom;
- double shadowOffset = 1 * editor.Options.Zoom;
sx += 1 * editor.Options.Zoom + Math.Ceiling((bubbleWidth - 3 * (radius * 2) - 2 * spacing) / 2);
- for (int i = 0; i < 3; i++) {
- g.Arc (sx, y + 1 + bubbleHeight / 2 + shadowOffset, radius, 0, Math.PI * 2);
- g.SetSourceColor (MessageBubbleCache.ShadowColor);
- g.Fill ();
- g.Arc (sx, y + 1 + bubbleHeight / 2, radius, 0, Math.PI * 2);
+ for (int i = 0; i < 3; i++) {
+ g.Arc (sx, y + bubbleHeight / 2, radius, 0, Math.PI * 2);
g.SetSourceColor (TagColor.SecondColor);
g.Fill ();
sx += radius * 2 + spacing;
}
-
} else {
// Draw label text
- g.Save ();
- g.Translate (sx + editor.LineHeight / 2, y + (editor.LineHeight - layouts [0].Height) / 2 + 1);
+ var tx = Math.Round (sx + editor.LineHeight / 2);
+ var ty = Math.Round (y + (editor.LineHeight - layouts [0].Height) / 2) - 1;
- // draw shadow
- g.SetSourceColor (MessageBubbleCache.ShadowColor);
- g.ShowLayout (drawLayout);
- g.Translate (0, -1);
+ g.Save ();
+ g.Translate (tx, ty);
g.SetSourceColor (TagColor.SecondColor);
g.ShowLayout (drawLayout);
@@ -493,7 +477,6 @@ namespace MonoDevelop.SourceEditor
if (customLayout)
drawLayout.Dispose ();
-
}
#region MarginMarker
@@ -530,14 +513,13 @@ namespace MonoDevelop.SourceEditor
public override void DrawForeground (TextEditor editor, Cairo.Context cr, MarginDrawMetrics metrics)
{
+ var tx = Math.Round (metrics.X + (metrics.Width - cache.errorPixbuf.Width) / 2) - 1;
+ var ty = Math.Floor (metrics.Y + (metrics.Height - cache.errorPixbuf.Height) / 2);
+
cr.Save ();
- cr.Translate (
- metrics.X + 0.5 + (metrics.Width - 2 - cache.errorPixbuf.Width) / 2,
- metrics.Y + 0.5 + (metrics.Height - cache.errorPixbuf.Height) / 2
- );
+ cr.Translate (tx, ty);
cr.DrawImage (editor, errors.Any (e => e.IsError) ? cache.errorPixbuf : cache.warningPixbuf, 0, 0);
cr.Restore ();
-
}
public override bool DrawBackground (TextEditor editor, Cairo.Context cr, MarginDrawMetrics metrics)
@@ -580,7 +562,9 @@ namespace MonoDevelop.SourceEditor
bool isCaretInLine = metrics.TextStartOffset <= editor.Caret.Offset && editor.Caret.Offset <= metrics.TextEndOffset;
int errorCounterWidth = GetErrorCountBounds (metrics).Item1;
- double x2 = System.Math.Max (right - LayoutWidth - border - (ShowIconsInBubble ? cache.errorPixbuf.Width : 0) - errorCounterWidth, editor.TextViewMargin.XOffset + editor.LineHeight / 2);
+ var min = right - LayoutWidth - border - (ShowIconsInBubble ? cache.errorPixbuf.Width : 0) - errorCounterWidth;
+ var max = Math.Round (editor.TextViewMargin.XOffset + editor.LineHeight / 2);
+ double x2 = Math.Max (min, max);
bool isEolSelected = editor.IsSomethingSelected && editor.SelectionMode != Mono.TextEditor.SelectionMode.Block ? editor.SelectionRange.Contains (lineSegment.Offset + lineSegment.Length) : false;
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
index d26d0cf261..8788c58b75 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
@@ -78,6 +78,7 @@ namespace MonoDevelop.SourceEditor
int lastDebugLine = -1;
BreakpointStore breakpoints;
EventHandler currentFrameChanged;
+ EventHandler executionLocationChanged;
EventHandler<BreakpointEventArgs> breakpointAdded;
EventHandler<BreakpointEventArgs> breakpointRemoved;
EventHandler<BreakpointEventArgs> breakpointStatusChanged;
@@ -193,6 +194,7 @@ namespace MonoDevelop.SourceEditor
{
Counters.LoadedEditors++;
currentFrameChanged = (EventHandler)DispatchService.GuiDispatch (new EventHandler (OnCurrentFrameChanged));
+ executionLocationChanged = (EventHandler)DispatchService.GuiDispatch (new EventHandler (OnExecutionLocationChanged));
breakpointAdded = (EventHandler<BreakpointEventArgs>)DispatchService.GuiDispatch (new EventHandler<BreakpointEventArgs> (OnBreakpointAdded));
breakpointRemoved = (EventHandler<BreakpointEventArgs>)DispatchService.GuiDispatch (new EventHandler<BreakpointEventArgs> (OnBreakpointRemoved));
breakpointStatusChanged = (EventHandler<BreakpointEventArgs>)DispatchService.GuiDispatch (new EventHandler<BreakpointEventArgs> (OnBreakpointStatusChanged));
@@ -245,6 +247,7 @@ namespace MonoDevelop.SourceEditor
breakpoints = DebuggingService.Breakpoints;
DebuggingService.DebugSessionStarted += OnDebugSessionStarted;
+ DebuggingService.ExecutionLocationChanged += executionLocationChanged;
DebuggingService.CurrentFrameChanged += currentFrameChanged;
DebuggingService.StoppedEvent += currentFrameChanged;
DebuggingService.ResumedEvent += currentFrameChanged;
@@ -1024,6 +1027,7 @@ namespace MonoDevelop.SourceEditor
TextEditorService.FileExtensionAdded -= HandleFileExtensionAdded;
TextEditorService.FileExtensionRemoved -= HandleFileExtensionRemoved;
+ DebuggingService.ExecutionLocationChanged -= executionLocationChanged;
DebuggingService.DebugSessionStarted -= OnDebugSessionStarted;
DebuggingService.CurrentFrameChanged -= currentFrameChanged;
DebuggingService.StoppedEvent -= currentFrameChanged;
@@ -1045,7 +1049,8 @@ namespace MonoDevelop.SourceEditor
debugStackLineMarker = null;
currentDebugLineMarker = null;
-
+
+ executionLocationChanged = null;
currentFrameChanged = null;
breakpointAdded = null;
breakpointRemoved = null;
@@ -1116,17 +1121,23 @@ namespace MonoDevelop.SourceEditor
if (!DebuggingService.IsDebugging)
UpdatePinnedWatches ();
}
+
+ void OnExecutionLocationChanged (object s, EventArgs args)
+ {
+ UpdateExecutionLocation ();
+ }
void UpdateExecutionLocation ()
{
- if (DebuggingService.IsDebugging && !DebuggingService.IsRunning) {
- var frame = CheckFrameIsInFile (DebuggingService.CurrentFrame)
+ if (DebuggingService.IsPaused) {
+ var location = CheckLocationIsInFile (DebuggingService.NextStatementLocation)
+ ?? CheckFrameIsInFile (DebuggingService.CurrentFrame)
?? CheckFrameIsInFile (DebuggingService.GetCurrentVisibleFrame ());
- if (frame != null) {
- if (lastDebugLine == frame.SourceLocation.Line)
+ if (location != null) {
+ if (lastDebugLine == location.Line)
return;
RemoveDebugMarkers ();
- lastDebugLine = frame.SourceLocation.Line;
+ lastDebugLine = location.Line;
var segment = widget.TextEditor.Document.GetLine (lastDebugLine);
if (segment != null) {
if (DebuggingService.CurrentFrameIndex == 0) {
@@ -1148,15 +1159,20 @@ namespace MonoDevelop.SourceEditor
widget.TextEditor.QueueDraw ();
}
}
-
- StackFrame CheckFrameIsInFile (StackFrame frame)
+
+ SourceLocation CheckLocationIsInFile (SourceLocation location)
{
- if (!string.IsNullOrEmpty (ContentName) && frame != null && !string.IsNullOrEmpty (frame.SourceLocation.FileName)
- && ((FilePath)frame.SourceLocation.FileName).FullPath == ((FilePath)ContentName).FullPath)
- return frame;
+ if (!string.IsNullOrEmpty (ContentName) && location != null && !string.IsNullOrEmpty (location.FileName)
+ && ((FilePath)location.FileName).FullPath == ((FilePath)ContentName).FullPath)
+ return location;
return null;
}
+ SourceLocation CheckFrameIsInFile (StackFrame frame)
+ {
+ return frame != null ? CheckLocationIsInFile (frame.SourceLocation) : null;
+ }
+
void RemoveDebugMarkers ()
{
if (currentLineSegment != null) {
@@ -1574,8 +1590,9 @@ namespace MonoDevelop.SourceEditor
return widget.TextEditor.Document.Text;
}
set {
- IsDirty = true;
- widget.TextEditor.Document.Text = value;
+ this.IsDirty = true;
+ var document = this.widget.TextEditor.Document;
+ document.Replace (0, document.TextLength, value);
}
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs
index 76481364a2..a96dd36d7f 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs
@@ -216,15 +216,30 @@ namespace MonoDevelop.SourceEditor
if (!QuickTaskStrip.MergeScrollBarAndQuickTasks)
return;
if (QuickTaskStrip.EnableFancyFeatures) {
- MonoDevelop.Components.GtkWorkarounds.SetOverlayScrollbarPolicy (scrolledWindow, PolicyType.Automatic, PolicyType.Never);
+ GtkWorkarounds.SetOverlayScrollbarPolicy (scrolledWindow, PolicyType.Automatic, PolicyType.Never);
+ SetSuppressScrollbar (true);
+ } else {
+ GtkWorkarounds.SetOverlayScrollbarPolicy (scrolledWindow, PolicyType.Automatic, PolicyType.Automatic);
+ SetSuppressScrollbar (false);
+ }
+ QueueResize ();
+ }
+
+ bool suppressScrollbar;
+
+ void SetSuppressScrollbar (bool value)
+ {
+ if (suppressScrollbar == value)
+ return;
+ suppressScrollbar = value;
+
+ if (suppressScrollbar) {
scrolledWindow.VScrollbar.SizeRequested += SuppressSize;
scrolledWindow.VScrollbar.ExposeEvent += SuppressExpose;
} else {
- MonoDevelop.Components.GtkWorkarounds.SetOverlayScrollbarPolicy (scrolledWindow, PolicyType.Automatic, PolicyType.Automatic);
scrolledWindow.VScrollbar.SizeRequested -= SuppressSize;
scrolledWindow.VScrollbar.ExposeEvent -= SuppressExpose;
}
- QueueResize ();
}
[GLib.ConnectBefore]
@@ -267,6 +282,7 @@ namespace MonoDevelop.SourceEditor
if (scrolledWindow.Child != null)
RemoveEvents ();
+ SetSuppressScrollbar (false);
QuickTaskStrip.EnableFancyFeatures.Changed -= FancyFeaturesChanged;
scrolledWindow.ButtonPressEvent -= PrepareEvent;
base.OnDestroyed ();
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/DebugTextMarker.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/DebugTextMarker.cs
index d1bdb6612a..2d1c491d8f 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/DebugTextMarker.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/DebugTextMarker.cs
@@ -31,8 +31,12 @@ using System.Linq;
using Mono.TextEditor;
using Mono.TextEditor.Highlighting;
using MonoDevelop.SourceEditor.Wrappers;
-
namespace MonoDevelop.SourceEditor
+using MonoDevelop.Components;
+
+using Xwt.Drawing;
+
+namespace MonoDevelop.Debugger
{
abstract class DebugTextMarker : MarginMarker
{
@@ -44,6 +48,17 @@ namespace MonoDevelop.SourceEditor
protected abstract Cairo.Color BackgroundColor {
get;
}
+
+ protected abstract Cairo.Color BorderColor {
+ get;
+ }
+
+ protected Cairo.Color GetBorderColor (AmbientColor color)
+ {
+ if (color.HasBorderColor)
+ return color.BorderColor;
+ return color.Color;
+ }
protected TextEditor Editor {
get; private set;
@@ -51,7 +66,7 @@ namespace MonoDevelop.SourceEditor
public override bool CanDrawBackground (Margin margin)
{
- return false;
+ return margin is TextViewMargin;
}
public override bool CanDrawForeground (Margin margin)
@@ -65,6 +80,19 @@ namespace MonoDevelop.SourceEditor
if (LineSegment != null && LineSegment.Markers.Any (m => m != this && (m is IExtendingTextLineMarker)))
return false;
+ var sidePadding = 4;
+ var rounding = editor.LineHeight / 2 - 1;
+
+ var d = metrics.TextRenderEndPosition - metrics.TextRenderStartPosition;
+ if (d > 0) {
+ cr.LineWidth = 1;
+ cr.RoundedRectangle (metrics.TextRenderStartPosition, Math.Floor (y) + 0.5, d + sidePadding, metrics.LineHeight - 1, rounding);
+ cr.SetSourceColor (BackgroundColor);
+ cr.FillPreserve ();
+ cr.SetSourceColor (BorderColor);
+ cr.Stroke ();
+ }
+
return base.DrawBackground (editor, cr, metrics);
}
@@ -89,79 +117,30 @@ namespace MonoDevelop.SourceEditor
return null;
var style = new ChunkStyle (baseStyle);
- style.Background = BackgroundColor;
+ // style.Background = BackgroundColor;
SetForegroundColor (style);
return style;
}
- protected virtual void DrawMarginIcon (Cairo.Context cr, double x, double y, double size)
- {
- }
-
- protected static void DrawCircle (Cairo.Context cr, double x, double y, double size)
+ protected void DrawImage (Cairo.Context cr, Image image, double x, double y, double size)
{
- x += 0.5; y += 0.5;
- cr.NewPath ();
- cr.Arc (x + size/2, y + size / 2, (size-4)/2, 0, 2 * Math.PI);
- cr.ClosePath ();
- }
+ var deltaX = size / 2 - image.Width / 2 + 0.5f;
+ var deltaY = size / 2 - image.Height / 2 + 0.5f;
- protected static void DrawDiamond (Cairo.Context cr, double x, double y, double size)
- {
- x += 0.5; y += 0.5;
- size -= 2;
- cr.NewPath ();
- cr.MoveTo (x + size/2, y);
- cr.LineTo (x + size, y + size/2);
- cr.LineTo (x + size/2, y + size);
- cr.LineTo (x, y + size/2);
- cr.LineTo (x + size/2, y);
- cr.ClosePath ();
- }
-
- protected static void DrawArrow (Cairo.Context cr, double x, double y, double size)
- {
- y += 2.5;
- x += 2.5;
- size -= 4;
- double awidth = 0.5;
- double aheight = 0.4;
- double pich = (size - (size * aheight)) / 2;
- cr.NewPath ();
- cr.MoveTo (x + size * awidth, y);
- cr.LineTo (x + size, y + size / 2);
- cr.LineTo (x + size * awidth, y + size);
- cr.RelLineTo (0, -pich);
- cr.RelLineTo (-size * awidth, 0);
- cr.RelLineTo (0, -size * aheight);
- cr.RelLineTo (size * awidth, 0);
- cr.RelLineTo (0, -pich);
- cr.ClosePath ();
- }
-
- protected static void FillGradient (Cairo.Context cr, Cairo.Color color1, Cairo.Color color2, double x, double y, double size)
- {
- using (var pat = new Cairo.LinearGradient (x + size / 4, y, x + size / 2, y + size - 4)) {
- pat.AddColorStop (0, color1);
- pat.AddColorStop (1, color2);
- cr.SetSource (pat);
- cr.FillPreserve ();
- }
+ cr.DrawImage (Editor, image, Math.Round (x + deltaX), Math.Round (y + deltaY));
}
- protected static void DrawBorder (Cairo.Context cr, Cairo.Color color, double x, double y, double size)
+ protected virtual void DrawMarginIcon (Cairo.Context cr, double x, double y, double size)
{
- using (var pat = new Cairo.LinearGradient (x, y + size, x + size, y)) {
- pat.AddColorStop (0, color);
- cr.SetSource (pat);
- cr.Stroke ();
- }
}
}
class BreakpointTextMarker : DebugTextMarker
{
+ static readonly Image breakpoint = Image.FromResource ("gutter-breakpoint-light-15.png");
+ static readonly Image tracepoint = Image.FromResource ("gutter-tracepoint-light-15.png");
+
public BreakpointTextMarker (TextEditor editor, bool tracepoint) : base (editor)
{
IsTracepoint = tracepoint;
@@ -172,7 +151,11 @@ namespace MonoDevelop.SourceEditor
}
protected override Cairo.Color BackgroundColor {
- get { return Editor.ColorStyle.BreakpointText.Background; }
+ get { return Editor.ColorStyle.BreakpointMarker.Color; }
+ }
+
+ protected override Cairo.Color BorderColor {
+ get { return GetBorderColor (Editor.ColorStyle.BreakpointMarker); }
}
protected override void SetForegroundColor (ChunkStyle style)
@@ -182,19 +165,15 @@ namespace MonoDevelop.SourceEditor
protected override void DrawMarginIcon (Cairo.Context cr, double x, double y, double size)
{
- Cairo.Color color1 = Editor.ColorStyle.BreakpointMarker.Color;
- Cairo.Color color2 = Editor.ColorStyle.BreakpointMarker.SecondColor;
- if (IsTracepoint)
- DrawDiamond (cr, x, y, size);
- else
- DrawCircle (cr, x, y, size);
- FillGradient (cr, color1, color2, x, y, size);
- DrawBorder (cr, color2, x, y, size);
+ DrawImage (cr, IsTracepoint ? tracepoint : breakpoint, x, y, size);
}
}
class DisabledBreakpointTextMarker : DebugTextMarker
{
+ static readonly Image breakpoint = Image.FromResource ("gutter-breakpoint-disabled-light-15.png");
+ static readonly Image tracepoint = Image.FromResource ("gutter-tracepoint-disabled-light-15.png");
+
public DisabledBreakpointTextMarker (TextEditor editor, bool tracepoint) : base (editor)
{
IsTracepoint = tracepoint;
@@ -207,21 +186,22 @@ namespace MonoDevelop.SourceEditor
protected override Cairo.Color BackgroundColor {
get { return Editor.ColorStyle.BreakpointMarkerDisabled.Color; }
}
+
+ protected override Cairo.Color BorderColor {
+ get { return GetBorderColor (Editor.ColorStyle.BreakpointMarkerDisabled); }
+ }
protected override void DrawMarginIcon (Cairo.Context cr, double x, double y, double size)
{
- Cairo.Color border = Editor.ColorStyle.BreakpointText.Background;
- if (IsTracepoint)
- DrawDiamond (cr, x, y, size);
- else
- DrawCircle (cr, x, y, size);
- //FillGradient (cr, new Cairo.Color (1,1,1), new Cairo.Color (1,0.8,0.8), x, y, size);
- DrawBorder (cr, border, x, y, size);
+ DrawImage (cr, IsTracepoint ? tracepoint : breakpoint, x, y, size);
}
}
class InvalidBreakpointTextMarker : DebugTextMarker
{
+ static readonly Image breakpoint = Image.FromResource ("gutter-breakpoint-invalid-light-15.png");
+ static readonly Image tracepoint = Image.FromResource ("gutter-tracepoint-invalid-light-15.png");
+
public InvalidBreakpointTextMarker (TextEditor editor, bool tracepoint) : base (editor)
{
IsTracepoint = tracepoint;
@@ -232,33 +212,33 @@ namespace MonoDevelop.SourceEditor
}
protected override Cairo.Color BackgroundColor {
- get { return Editor.ColorStyle.BreakpointTextInvalid.Background; }
+ get { return Editor.ColorStyle.BreakpointMarkerInvalid.Color; }
+ }
+
+ protected override Cairo.Color BorderColor {
+ get { return GetBorderColor (Editor.ColorStyle.BreakpointMarkerInvalid); }
}
protected override void DrawMarginIcon (Cairo.Context cr, double x, double y, double size)
{
- Cairo.Color color1 = Editor.ColorStyle.InvalidBreakpointMarker.Color;
- Cairo.Color color2 = color1;
- Cairo.Color border = Editor.ColorStyle.InvalidBreakpointMarker.SecondColor;
-
- if (IsTracepoint)
- DrawDiamond (cr, x, y, size);
- else
- DrawCircle (cr, x, y, size);
-
- FillGradient (cr, color1, color2, x, y, size);
- DrawBorder (cr, border, x, y, size);
+ DrawImage (cr, IsTracepoint ? tracepoint : breakpoint, x, y, size);
}
}
class CurrentDebugLineTextMarker : DebugTextMarker, MonoDevelop.Ide.Editor.ICurrentDebugLineTextMarker
{
+ static readonly Image currentLine = Image.FromResource ("gutter-execution-light-15.png");
+
public CurrentDebugLineTextMarker (TextEditor editor) : base (editor)
{
}
protected override Cairo.Color BackgroundColor {
- get { return Editor.ColorStyle.DebuggerCurrentLine.Background; }
+ get { return Editor.ColorStyle.DebuggerCurrentLineMarker.Color; }
+ }
+
+ protected override Cairo.Color BorderColor {
+ get { return GetBorderColor (Editor.ColorStyle.DebuggerCurrentLineMarker); }
}
protected override void SetForegroundColor (ChunkStyle style)
@@ -268,13 +248,7 @@ namespace MonoDevelop.SourceEditor
protected override void DrawMarginIcon (Cairo.Context cr, double x, double y, double size)
{
- Cairo.Color color1 = Editor.ColorStyle.DebuggerCurrentLineMarker.Color;
- Cairo.Color color2 = Editor.ColorStyle.DebuggerCurrentLineMarker.SecondColor;
- Cairo.Color border = Editor.ColorStyle.DebuggerCurrentLineMarker.BorderColor;
-
- DrawArrow (cr, x, y, size);
- FillGradient (cr, color1, color2, x, y, size);
- DrawBorder (cr, border, x, y, size);
+ DrawImage (cr, currentLine, x, y, size);
}
MonoDevelop.Ide.Editor.IDocumentLine MonoDevelop.Ide.Editor.ITextLineMarker.Line {
@@ -286,12 +260,18 @@ namespace MonoDevelop.SourceEditor
class DebugStackLineTextMarker : DebugTextMarker
{
+ static readonly Image stackLine = Image.FromResource ("gutter-stack-light-15.png");
+
public DebugStackLineTextMarker (TextEditor editor) : base (editor)
{
}
protected override Cairo.Color BackgroundColor {
- get { return Editor.ColorStyle.DebuggerStackLine.Background; }
+ get { return Editor.ColorStyle.DebuggerStackLineMarker.Color; }
+ }
+
+ protected override Cairo.Color BorderColor {
+ get { return GetBorderColor (Editor.ColorStyle.DebuggerStackLineMarker); }
}
protected override void SetForegroundColor (ChunkStyle style)
@@ -301,13 +281,7 @@ namespace MonoDevelop.SourceEditor
protected override void DrawMarginIcon (Cairo.Context cr, double x, double y, double size)
{
- Cairo.Color color1 = Editor.ColorStyle.DebuggerStackLineMarker.Color;
- Cairo.Color color2 = Editor.ColorStyle.DebuggerStackLineMarker.SecondColor;
- Cairo.Color border = Editor.ColorStyle.DebuggerStackLineMarker.BorderColor;
-
- DrawArrow (cr, x, y, size);
- FillGradient (cr, color1, color2, x, y, size);
- DrawBorder (cr, border, x, y, size);
+ DrawImage (cr, stackLine, x, y, size);
}
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-bookmark-15.png b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-bookmark-15.png
new file mode 100644
index 0000000000..50b75050d0
--- /dev/null
+++ b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-bookmark-15.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-bookmark-15@2x.png b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-bookmark-15@2x.png
new file mode 100644
index 0000000000..6e2df33c1b
--- /dev/null
+++ b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-bookmark-15@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-error-15.png b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-error-15.png
new file mode 100644
index 0000000000..7cfe2604d9
--- /dev/null
+++ b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-error-15.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-error-15@2x.png b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-error-15@2x.png
new file mode 100644
index 0000000000..b30b504b07
--- /dev/null
+++ b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-error-15@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-warning-15.png b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-warning-15.png
new file mode 100644
index 0000000000..9539699270
--- /dev/null
+++ b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-warning-15.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-warning-15@2x.png b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-warning-15@2x.png
new file mode 100644
index 0000000000..f72f42331c
--- /dev/null
+++ b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/gutter-warning-15@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-completion-appearance-16.png b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-completion-appearance-16.png
new file mode 100644
index 0000000000..536c7bdb27
--- /dev/null
+++ b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-completion-appearance-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-completion-appearance-16@2x.png b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-completion-appearance-16@2x.png
new file mode 100644
index 0000000000..8883b8b5ec
--- /dev/null
+++ b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-completion-appearance-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-completion-behavior-16.png b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-completion-behavior-16.png
new file mode 100644
index 0000000000..536c7bdb27
--- /dev/null
+++ b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-completion-behavior-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-completion-behavior-16@2x.png b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-completion-behavior-16@2x.png
new file mode 100644
index 0000000000..8883b8b5ec
--- /dev/null
+++ b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-completion-behavior-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-markers-rulers-16.png b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-markers-rulers-16.png
new file mode 100644
index 0000000000..2272d20f00
--- /dev/null
+++ b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-markers-rulers-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-markers-rulers-16@2x.png b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-markers-rulers-16@2x.png
new file mode 100644
index 0000000000..be480ee9b7
--- /dev/null
+++ b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-markers-rulers-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-syntax-highlighting-16.png b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-syntax-highlighting-16.png
new file mode 100644
index 0000000000..878fd038b1
--- /dev/null
+++ b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-syntax-highlighting-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-syntax-highlighting-16@2x.png b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-syntax-highlighting-16@2x.png
new file mode 100644
index 0000000000..f5e72e78dc
--- /dev/null
+++ b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-syntax-highlighting-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-text-editor-behavior-16.png b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-text-editor-behavior-16.png
new file mode 100644
index 0000000000..bf175ec49a
--- /dev/null
+++ b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-text-editor-behavior-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-text-editor-behavior-16@2x.png b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-text-editor-behavior-16@2x.png
new file mode 100644
index 0000000000..e4a86d4fd8
--- /dev/null
+++ b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-text-editor-behavior-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-text-editor-general-16.png b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-text-editor-general-16.png
new file mode 100644
index 0000000000..3dee46575c
--- /dev/null
+++ b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-text-editor-general-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-text-editor-general-16@2x.png b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-text-editor-general-16@2x.png
new file mode 100644
index 0000000000..e0e6d11f70
--- /dev/null
+++ b/main/src/addins/MonoDevelop.SourceEditor2/icons/light/prefs-text-editor-general-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.addin.xml b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.addin.xml
index d8e0dc3f1f..4db5d43fe3 100644
--- a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.addin.xml
+++ b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.addin.xml
@@ -21,11 +21,9 @@
_label = "Add Web Reference"
icon = "md-webreference-item" />
<Command id = "MonoDevelop.WebReferences.WebReferenceCommands.UpdateAll"
- _label = "Update Web References"
- icon = "gtk-reload" />
+ _label = "Update Web References" />
<Command id = "MonoDevelop.WebReferences.WebReferenceCommands.Update"
- _label = "Update Web Reference"
- icon = "gtk-reload" />
+ _label = "Update Web Reference" />
<Command id = "MonoDevelop.WebReferences.WebReferenceCommands.DeleteAll"
_label = "Delete All"
icon = "gtk-delete" />
diff --git a/main/src/addins/MonoDevelop.WebReferences/gtk-gui/generated.cs b/main/src/addins/MonoDevelop.WebReferences/gtk-gui/generated.cs
index 75935e2e55..3285e87c05 100644
--- a/main/src/addins/MonoDevelop.WebReferences/gtk-gui/generated.cs
+++ b/main/src/addins/MonoDevelop.WebReferences/gtk-gui/generated.cs
@@ -17,6 +17,7 @@ namespace Stetic
internal class BinContainer
{
private Gtk.Widget child;
+
private Gtk.UIManager uimanager;
public static BinContainer Attach (Gtk.Bin bin)
diff --git a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.Xml.StateEngine/Parser.cs b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.Xml.StateEngine/Parser.cs
index 6c6e481965..973040371e 100755
--- a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.Xml.StateEngine/Parser.cs
+++ b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.Xml.StateEngine/Parser.cs
@@ -127,15 +127,15 @@ namespace MonoDevelop.Xml.StateEngine
public void Push (char c)
{
try {
- //track line, column
+ //FIXME: position/location should be at current char, not after it
+ position++;
if (c == '\n') {
previousLineEnd = new TextLocation (location.Line, location.Column + 1);
location = new TextLocation (location.Line + 1, 1);
} else {
location = new TextLocation (location.Line, location.Column + 1);
}
-
- position++;
+
for (int loopLimit = 0; loopLimit < 10; loopLimit++) {
currentStateLength++;
string rollback = null;
@@ -161,15 +161,26 @@ namespace MonoDevelop.Xml.StateEngine
// only loop if the same char should be run through the new state
if (rollback == null)
return;
-
+
+ //simple rollback, just run same char through again
+ if (rollback.Length == 0)
+ continue;
+
//"complex" rollbacks require actually skipping backwards.
//Note the previous state is invalid for this operation.
- else if (rollback.Length > 0) {
- position -= (rollback.Length + 1);
- foreach (char rollChar in rollback)
- Push (rollChar);
- position++;
- }
+
+ //rollback position and location so they're valid
+ position -= (rollback.Length + 1);
+ location = new TextLocation (location.Line, location.Column - (rollback.Length + 1));
+ if (location.Column < 0)
+ throw new InvalidOperationException ("Can't roll back across line boundary");
+
+ foreach (char rollChar in rollback)
+ Push (rollChar);
+
+ //restore position and location
+ position++;
+ location = new TextLocation (location.Line, location.Column + 1);
}
throw new InvalidOperationException ("Too many state changes for char '" + c + "'. Current state is " + currentState.ToString () + ".");
} catch (Exception ex) {
@@ -292,13 +303,13 @@ namespace MonoDevelop.Xml.StateEngine
void IParseContext.LogWarning (string message)
{
if (errors != null || ErrorLogged != null)
- InternalLogError (new Error (ErrorType.Warning, message, Location));
+ InternalLogError (new Error (ErrorType.Warning, message, ((IParseContext)this).LocationMinus (1)));
}
void IParseContext.LogError (string message, TextLocation location)
{
if (errors != null || ErrorLogged != null)
- InternalLogError (new Error (ErrorType.Error, message, location));
+ InternalLogError (new Error (ErrorType.Error, message, ((IParseContext)this).LocationMinus (1)));
}
void IParseContext.LogWarning (string message, TextLocation location)
diff --git a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.Xml.StateEngine/XmlClosingTagState.cs b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.Xml.StateEngine/XmlClosingTagState.cs
index 3f7a035afe..7893d54365 100644
--- a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.Xml.StateEngine/XmlClosingTagState.cs
+++ b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.Xml.StateEngine/XmlClosingTagState.cs
@@ -54,7 +54,6 @@ namespace MonoDevelop.Xml.StateEngine
if (ct == null) {
Debug.Assert (context.CurrentStateLength == 1,
"IncompleteNode must not be an XClosingTag when CurrentStateLength is 1");
- Debug.Assert (context.Nodes.Peek () is XElement);
ct = new XClosingTag (context.LocationMinus (3)); //3 = </ and the current char
context.Nodes.Push (ct);
@@ -99,7 +98,9 @@ namespace MonoDevelop.Xml.StateEngine
context.Nodes.Pop ();
} else {
context.LogError (
- "Closing tag '" + ct.Name.FullName + "' does not match any currently open tag.");
+ "Closing tag '" + ct.Name.FullName + "' does not match any currently open tag.",
+ ct.Region
+ );
}
} else {
context.LogError ("Closing tag ended prematurely.");
diff --git a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Completion/XmlCompletionData.cs b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Completion/XmlCompletionData.cs
index 747290375f..f7d3dff4d3 100755
--- a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Completion/XmlCompletionData.cs
+++ b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Completion/XmlCompletionData.cs
@@ -29,6 +29,10 @@ using MonoDevelop.Ide.CodeCompletion;
using System;
using MonoDevelop.XmlEditor;
using MonoDevelop.Core;
+using Mono.TextEditor;
+using MonoDevelop.Ide.Gui.Content;
+using MonoDevelop.Ide;
+using MonoDevelop.Ide.Commands;
namespace MonoDevelop.XmlEditor.Completion
{
@@ -79,7 +83,7 @@ namespace MonoDevelop.XmlEditor.Completion
}
public override IconId Icon {
- get { return Gtk.Stock.GoForward; }
+ get { return base.Icon.IsNull ? (IconId)Gtk.Stock.GoForward : base.Icon; }
}
public override string DisplayText {
@@ -101,6 +105,21 @@ namespace MonoDevelop.XmlEditor.Completion
return String.Concat (text, "=\"|\"");
}
}
+
+ public override void InsertCompletionText (CompletionListWindow window, ref KeyActions ka, Gdk.Key closeChar, char keyChar, ModifierType modifier)
+ {
+ if (XmlEditorOptions.AutoInsertFragments && dataType == DataType.XmlAttribute) {
+ var textEditorDataProvier = window.CompletionWidget as ITextEditorDataProvider;
+ var textBuffer = window.CompletionWidget as ITextBuffer;
+ base.InsertCompletionText (window, ref ka, closeChar, keyChar, modifier);
+ if (textEditorDataProvier != null && textBuffer != null)
+ textEditorDataProvier.GetTextEditorData ().SetSkipChar (textBuffer.CursorPosition, '"');
+ IdeApp.CommandService.DispatchCommand (TextEditorCommands.ShowCompletionWindow);
+ ka &= ~KeyActions.CloseWindow;
+ } else {
+ base.InsertCompletionText (window, ref ka, closeChar, keyChar, modifier);
+ }
+ }
/// <summary>
/// Returns the xml item's documentation as retrieved from
diff --git a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Gui/BaseXmlEditorExtension.cs b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Gui/BaseXmlEditorExtension.cs
index c8c7490ee8..e4b77b8379 100644
--- a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Gui/BaseXmlEditorExtension.cs
+++ b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Gui/BaseXmlEditorExtension.cs
@@ -47,6 +47,7 @@ using MonoDevelop.Ide.TypeSystem;
using ICSharpCode.NRefactory;
using MonoDevelop.Ide.Editor;
using MonoDevelop.Ide.Editor.Extension;
+using MonoDevelop.Projects;
namespace MonoDevelop.XmlEditor.Gui
{
@@ -59,6 +60,7 @@ namespace MonoDevelop.XmlEditor.Gui
MonoDevelop.Ide.Gui.Components.PadTreeView outlineTreeView;
Gtk.TreeStore outlineTreeStore;
+ List<DotNetProject> ownerProjects;
#region Setup and teardown
@@ -76,6 +78,7 @@ namespace MonoDevelop.XmlEditor.Gui
protected override void Initialize ()
{
base.Initialize ();
+ UpdateOwnerProjects ();
Parser parser = new Parser (CreateRootState (), false);
tracker = new DocumentStateTracker<Parser> (parser, Editor);
Document.DocumentParsed += delegate {
@@ -87,7 +90,40 @@ namespace MonoDevelop.XmlEditor.Gui
lastCU = Document.ParsedDocument;
OnParsedDocumentUpdated ();
}
- }
+
+ if (IdeApp.Workspace != null) {
+ IdeApp.Workspace.FileAddedToProject += HandleProjectChanged;
+ IdeApp.Workspace.FileRemovedFromProject += HandleProjectChanged;
+ }
+ }
+
+ void HandleProjectChanged (object sender, ProjectFileEventArgs e)
+ {
+ UpdateOwnerProjects ();
+ }
+
+ void UpdateOwnerProjects ()
+ {
+ if (IdeApp.Workspace == null) {
+ ownerProjects = new List<DotNetProject> ();
+ return;
+ }
+ var projects = new HashSet<DotNetProject> (IdeApp.Workspace.GetAllSolutionItems<DotNetProject> ().Where (p => p.IsFileInProject (Document.FileName)));
+ if (ownerProjects == null || !projects.SetEquals (ownerProjects)) {
+ ownerProjects = projects.OrderBy (p => p.Name).ToList ();
+ var dnp = Document.Project as DotNetProject;
+ if (ownerProjects.Count > 0 && (dnp == null || !ownerProjects.Contains (dnp))) {
+ // If the project for the document is not a DotNetProject but there is a project containing this file
+ // in the current solution, then use that project
+ var pp = Document.Project != null ? ownerProjects.FirstOrDefault (p => p.ParentSolution == Document.Project.ParentSolution) : null;
+ if (pp != null)
+ Document.AttachToProject (pp);
+ }
+ }
+ if (Document.Project == null && ownerProjects.Count > 0)
+ Document.AttachToProject (ownerProjects[0]);
+ UpdatePath ();
+ }
public override void Dispose ()
{
@@ -97,6 +133,10 @@ namespace MonoDevelop.XmlEditor.Gui
tracker = null;
base.Dispose ();
}
+ if (IdeApp.Workspace != null) {
+ IdeApp.Workspace.FileAddedToProject -= HandleProjectChanged;
+ IdeApp.Workspace.FileRemovedFromProject -= HandleProjectChanged;
+ }
}
protected virtual void OnParsedDocumentUpdated ()
@@ -251,7 +291,7 @@ namespace MonoDevelop.XmlEditor.Gui
tracker.Engine.CurrentStateLength, previousChar, currentChar, forced);
//closing tag completion
- if (tracker.Engine.CurrentState is XmlFreeState && currentChar == '>')
+ if (tracker.Engine.CurrentState is XmlFreeState && currentChar == '>')
return ClosingTagCompletion (buf, currentLocation);
// Auto insert '>' when '/' is typed inside tag state (for quick tag closing)
@@ -261,14 +301,6 @@ namespace MonoDevelop.XmlEditor.Gui
return null;
}
- //element completion
- if (currentChar == '<' && tracker.Engine.CurrentState is XmlFreeState) {
- CompletionDataList list = new CompletionDataList ();
- GetElementCompletions (list);
- AddCloseTag (list, Tracker.Engine.Nodes);
- return list.Count > 0? list : null;
- }
-
//entity completion
if (currentChar == '&' && (tracker.Engine.CurrentState is XmlFreeState ||
tracker.Engine.CurrentState is XmlAttributeValueState))
@@ -303,13 +335,34 @@ namespace MonoDevelop.XmlEditor.Gui
}
return null;
}
+
+ //attribute value completion
+ //determine whether to trigger completion within attribute values quotes
+ if ((Tracker.Engine.CurrentState is XmlAttributeValueState)
+ //trigger on the opening quote
+ && ((Tracker.Engine.CurrentStateLength == 1 && (currentChar == '\'' || currentChar == '"'))
+ //or trigger on first letter of value, if unforced
+ || (forced || Tracker.Engine.CurrentStateLength == 2))) {
+ var att = (XAttribute)Tracker.Engine.Nodes.Peek ();
+
+ if (att.IsNamed) {
+ var attributedOb = Tracker.Engine.Nodes.Peek (1) as IAttributedXObject;
+ if (attributedOb == null)
+ return null;
+
+ //if triggered by first letter of value or forced, grab those letters
+ triggerWordLength = Tracker.Engine.CurrentStateLength - 1;
+
+ return GetAttributeValueCompletions (attributedOb, att);
+ }
+ }
//attribute name completion
if ((forced && Tracker.Engine.Nodes.Peek () is IAttributedXObject && !tracker.Engine.Nodes.Peek ().IsEnded)
- || (Tracker.Engine.CurrentState is XmlNameState
- && Tracker.Engine.CurrentState.Parent is XmlAttributeState
- && Tracker.Engine.CurrentStateLength == 1)
- ) {
+ || ((Tracker.Engine.CurrentState is XmlNameState
+ && Tracker.Engine.CurrentState.Parent is XmlAttributeState) ||
+ Tracker.Engine.CurrentState is XmlTagState)
+ && (Tracker.Engine.CurrentStateLength == 1 || forced)) {
IAttributedXObject attributedOb = (Tracker.Engine.Nodes.Peek () as IAttributedXObject) ??
Tracker.Engine.Nodes.Peek (1) as IAttributedXObject;
if (attributedOb == null)
@@ -333,46 +386,20 @@ namespace MonoDevelop.XmlEditor.Gui
}
}
- //attribute value completion
- //determine whether to trigger completion within attribute values quotes
- if ((Tracker.Engine.CurrentState is XmlAttributeValueState)
- //trigger on the opening quote
- && ((Tracker.Engine.CurrentStateLength == 1 && (currentChar == '\'' || currentChar == '"'))
- //or trigger on first letter of value, if unforced
- || (!forced && Tracker.Engine.CurrentStateLength == 1))
- )
- {
- var att = (XAttribute) Tracker.Engine.Nodes.Peek ();
-
- if (att.IsNamed) {
- var attributedOb = Tracker.Engine.Nodes.Peek (1) as IAttributedXObject;
- if (attributedOb == null)
- return null;
-
- char next = ' ';
- if (completionContext.TriggerOffset < buf.Length)
- next = buf.GetCharAt (completionContext.TriggerOffset);
-
- char compareChar = (Tracker.Engine.CurrentStateLength == 1)? currentChar : previousChar;
-
- if ((compareChar == '"' || compareChar == '\'')
- && (next == compareChar || char.IsWhiteSpace (next))
- ) {
- //if triggered by first letter of value, grab that letter
- if (Tracker.Engine.CurrentStateLength == 2)
- triggerWordLength = 1;
-
- return GetAttributeValueCompletions (attributedOb, att);
- }
- }
-
- }
-
// if (Tracker.Engine.CurrentState is XmlFreeState) {
// if (line < 3) {
// cp.Add ("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
// }
-
+
+ //element completion
+ if (currentChar == '<' && tracker.Engine.CurrentState is XmlFreeState ||
+ (tracker.Engine.CurrentState is XmlNameState && forced)) {
+ CompletionDataList list = new CompletionDataList ();
+ GetElementCompletions (list);
+ AddCloseTag (list, Tracker.Engine.Nodes);
+ return list.Count > 0? list : null;
+ }
+
if (forced && Tracker.Engine.CurrentState is XmlFreeState) {
CompletionDataList list = new CompletionDataList ();
MonoDevelop.Ide.CodeTemplates.CodeTemplateService.AddCompletionDataForFileName (Document.Name, list);
@@ -380,38 +407,38 @@ namespace MonoDevelop.XmlEditor.Gui
}
return null;
- }
-
- protected virtual ICompletionDataList ClosingTagCompletion (IEditableTextBuffer buf, TextLocation currentLocation)
- {
- //get name of current node in document that's being ended
- XElement el = tracker.Engine.Nodes.Peek () as XElement;
- if (el != null && el.Region.End >= currentLocation && !el.IsClosed && el.IsNamed) {
- string tag = String.Concat ("</", el.Name.FullName, ">");
- if (XmlEditorOptions.AutoCompleteElements) {
-
- // //make sure we have a clean atomic undo so the user can undo the tag insertion
- // //independently of the >
- // bool wasInAtomicUndo = this.Editor.Document.IsInAtomicUndo;
- // if (wasInAtomicUndo)
- // this.Editor.Document.EndAtomicUndo ();
-
- using (var undo = buf.OpenUndoGroup ()) {
- buf.InsertText (buf.CursorPosition, tag);
- buf.CursorPosition -= tag.Length;
- }
-
- // if (wasInAtomicUndo)
- // this.Editor.Document.BeginAtomicUndo ();
-
- return null;
- } else {
- CompletionDataList cp = new CompletionDataList ();
- cp.Add (new XmlTagCompletionData (tag, 0, true));
- return cp;
- }
- }
- return null;
+ }
+
+ protected virtual ICompletionDataList ClosingTagCompletion (IEditableTextBuffer buf, TextLocation currentLocation)
+ {
+ //get name of current node in document that's being ended
+ XElement el = tracker.Engine.Nodes.Peek () as XElement;
+ if (el != null && el.Region.End >= currentLocation && !el.IsClosed && el.IsNamed) {
+ string tag = String.Concat ("</", el.Name.FullName, ">");
+ if (XmlEditorOptions.AutoCompleteElements) {
+
+ // //make sure we have a clean atomic undo so the user can undo the tag insertion
+ // //independently of the >
+ // bool wasInAtomicUndo = this.Editor.Document.IsInAtomicUndo;
+ // if (wasInAtomicUndo)
+ // this.Editor.Document.EndAtomicUndo ();
+
+ using (var undo = buf.OpenUndoGroup ()) {
+ buf.InsertText (buf.CursorPosition, tag);
+ buf.CursorPosition -= tag.Length;
+ }
+
+ // if (wasInAtomicUndo)
+ // this.Editor.Document.BeginAtomicUndo ();
+
+ return null;
+ } else {
+ CompletionDataList cp = new CompletionDataList ();
+ cp.Add (new XmlTagCompletionData (tag, 0, true));
+ return cp;
+ }
+ }
+ return null;
}
protected virtual void GetElementCompletions (CompletionDataList list)
@@ -586,7 +613,6 @@ namespace MonoDevelop.XmlEditor.Gui
//locate the node
List<XObject> path = new List<XObject> (treeParser.Nodes);
-
//note: list is backwards, and we want ignore the root XDocument
XObject ob = path [path.Count - (depth + 2)];
XNode node = ob as XNode;
@@ -648,19 +674,77 @@ namespace MonoDevelop.XmlEditor.Gui
public Gtk.Widget CreatePathWidget (int index)
{
- Menu menu = new Menu ();
- MenuItem mi = new MenuItem (GettextCatalog.GetString ("Select"));
- mi.Activated += delegate {
- SelectPath (index);
- };
- menu.Add (mi);
- mi = new MenuItem (GettextCatalog.GetString ("Select contents"));
- mi.Activated += delegate {
- SelectPathContents (index);
- };
- menu.Add (mi);
- menu.ShowAll ();
- return menu;
+ if (ownerProjects.Count > 1 && index == 0) {
+ var window = new DropDownBoxListWindow (new DataProvider (this));
+ window.FixedRowHeight = 22;
+ window.MaxVisibleRows = 14;
+ window.SelectItem (currentPath [index].Tag);
+ return window;
+ } else {
+ if (ownerProjects.Count > 1)
+ index--;
+ Menu menu = new Menu ();
+ MenuItem mi = new MenuItem (GettextCatalog.GetString ("Select"));
+ mi.Activated += delegate {
+ SelectPath (index);
+ };
+ menu.Add (mi);
+ mi = new MenuItem (GettextCatalog.GetString ("Select contents"));
+ mi.Activated += delegate {
+ SelectPathContents (index);
+ };
+ menu.Add (mi);
+ menu.ShowAll ();
+ return menu;
+ }
+ }
+
+
+ class DataProvider : DropDownBoxListWindow.IListDataProvider
+ {
+
+ readonly BaseXmlEditorExtension ext;
+
+ public DataProvider (BaseXmlEditorExtension ext)
+ {
+ if (ext == null)
+ throw new ArgumentNullException ("ext");
+ this.ext = ext;
+ }
+
+ #region IListDataProvider implementation
+
+ public void Reset ()
+ {
+ }
+
+ public string GetMarkup (int n)
+ {
+ return GLib.Markup.EscapeText (ext.ownerProjects [n].Name);
+ }
+
+ public Xwt.Drawing.Image GetIcon (int n)
+ {
+ return ImageService.GetIcon (ext.ownerProjects [n].StockIcon, IconSize.Menu);
+ }
+
+ public object GetTag (int n)
+ {
+ return ext.ownerProjects [n];
+ }
+
+ public void ActivateItem (int n)
+ {
+ ext.Document.AttachToProject (ext.ownerProjects [n]);
+ }
+
+ public int IconCount {
+ get {
+ return ext.ownerProjects.Count;
+ }
+ }
+
+ #endregion
}
protected void OnPathChanged (PathEntry[] oldPath)
@@ -743,18 +827,21 @@ namespace MonoDevelop.XmlEditor.Gui
{
List<XObject> l = GetCurrentPath ();
- if (l == null)
- return;
//build the list
- PathEntry[] path = new PathEntry[l.Count];
- for (int i = 0; i < l.Count; i++) {
- if (l[i].FriendlyPathRepresentation == null) System.Console.WriteLine(l[i].GetType ());
- path[i] = new PathEntry (GLib.Markup.EscapeText (l[i].FriendlyPathRepresentation ?? "<>"));
+ var path = new List<PathEntry> ();
+ if (ownerProjects.Count > 1) {
+ // Current project if there is more than one
+ path.Add (new PathEntry (ImageService.GetIcon (Document.Project.StockIcon), GLib.Markup.EscapeText (Document.Project.Name)) { Tag = Document.Project });
+ }
+ if (l != null) {
+ for (int i = 0; i < l.Count; i++) {
+ path.Add (new PathEntry (GLib.Markup.EscapeText (l [i].FriendlyPathRepresentation ?? "<>")));
+ }
}
PathEntry[] oldPath = currentPath;
- currentPath = path;
+ currentPath = path.ToArray ();
OnPathChanged (oldPath);
}
diff --git a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Gui/XmlSchemasPanelWidget.cs b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Gui/XmlSchemasPanelWidget.cs
index ec702aaaf0..6808152048 100644
--- a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Gui/XmlSchemasPanelWidget.cs
+++ b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Gui/XmlSchemasPanelWidget.cs
@@ -121,7 +121,7 @@ namespace MonoDevelop.XmlEditor.Gui
//editing handlers
extensionTextRenderer.Edited += handleExtensionSet;
comboEditor.Edited += delegate (object sender, EditedArgs args) {
- setAssocValAndMarkChanged (args.Path, COL_NS, args.NewText);
+ setAssocValAndMarkChanged (args.Path, COL_NS, args.NewText ?? "");
};
prefixTextRenderer.Edited += delegate (object sender, EditedArgs args) {
foreach (char c in args.NewText)
diff --git a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.addin.xml b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.addin.xml
index 2fb83f2b38..73e7d2ba05 100644
--- a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.addin.xml
+++ b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.addin.xml
@@ -95,10 +95,10 @@
</Extension>
<Extension path = "/MonoDevelop/Ide/GlobalOptionsDialog/TextEditor/Behavior">
- <Section id = "XmlFormattingOptions" insertbefore="Formatting" _label = "XML" fill="true" class = "MonoDevelop.XmlEditor.Gui.XmlEditorOptionsPanel"/>
+ <Section id="XmlFormattingOptions" insertbefore="Formatting" _label="XML" fill="true" class="MonoDevelop.XmlEditor.Gui.XmlEditorOptionsPanel" icon="md-prefs-xml" />
</Extension>
<Extension path = "/MonoDevelop/Ide/GlobalOptionsDialog/TextEditor">
- <Section id = "XmlSchemas" _label = "XML Schemas" fill="true" class = "MonoDevelop.XmlEditor.Gui.XmlSchemasPanel"/>
+ <Section id="XmlSchemas" _label="XML Schemas" fill="true" class="MonoDevelop.XmlEditor.Gui.XmlSchemasPanel" icon="md-prefs-xml-schemas" />
</Extension>
<!-- XPath Query pad -->
@@ -145,4 +145,9 @@
<!-- 2.6+ -->
<Migration sourceVersion="2.6+" kind="UserData" path="XmlSchemas" isDirectory="true" />
</Extension>
+
+ <Extension path="/MonoDevelop/Core/StockIcons">
+ <StockIcon stockid="md-prefs-xml" resource="prefs-xml-light-16.png" size="Menu" />
+ <StockIcon stockid="md-prefs-xml-schemas" resource="prefs-xml-schemas-light-16.png" size="Menu" />
+ </Extension>
</ExtensionModel>
diff --git a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.csproj b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.csproj
index e58a8a9cee..2eeb711ac7 100644
--- a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.csproj
+++ b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.csproj
@@ -109,6 +109,20 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
+ <EmbeddedResource Include="icons\light\prefs-xml-16.png">
+ <LogicalName>prefs-xml-light-16.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-xml-16%402x.png">
+ <LogicalName>prefs-xml-light-16@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-xml-schemas-16.png">
+ <LogicalName>prefs-xml-schemas-light-16.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-xml-schemas-16%402x.png">
+ <LogicalName>prefs-xml-schemas-light-16@2x.png</LogicalName>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="MonoDevelop.XmlEditor\Commands.cs" />
<Compile Include="MonoDevelop.XmlEditor\EncodedStringWriter.cs" />
diff --git a/main/src/addins/MonoDevelop.XmlEditor/icons/light/prefs-xml-16.png b/main/src/addins/MonoDevelop.XmlEditor/icons/light/prefs-xml-16.png
new file mode 100644
index 0000000000..fc6082d1cb
--- /dev/null
+++ b/main/src/addins/MonoDevelop.XmlEditor/icons/light/prefs-xml-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.XmlEditor/icons/light/prefs-xml-16@2x.png b/main/src/addins/MonoDevelop.XmlEditor/icons/light/prefs-xml-16@2x.png
new file mode 100644
index 0000000000..0aef2fef5d
--- /dev/null
+++ b/main/src/addins/MonoDevelop.XmlEditor/icons/light/prefs-xml-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.XmlEditor/icons/light/prefs-xml-schemas-16.png b/main/src/addins/MonoDevelop.XmlEditor/icons/light/prefs-xml-schemas-16.png
new file mode 100644
index 0000000000..fc6082d1cb
--- /dev/null
+++ b/main/src/addins/MonoDevelop.XmlEditor/icons/light/prefs-xml-schemas-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.XmlEditor/icons/light/prefs-xml-schemas-16@2x.png b/main/src/addins/MonoDevelop.XmlEditor/icons/light/prefs-xml-schemas-16@2x.png
new file mode 100644
index 0000000000..0aef2fef5d
--- /dev/null
+++ b/main/src/addins/MonoDevelop.XmlEditor/icons/light/prefs-xml-schemas-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDeveloperExtensions/AddinInfo.cs b/main/src/addins/MonoDeveloperExtensions/AddinInfo.cs
index 99eb91a274..f96ed1a685 100644
--- a/main/src/addins/MonoDeveloperExtensions/AddinInfo.cs
+++ b/main/src/addins/MonoDeveloperExtensions/AddinInfo.cs
@@ -6,6 +6,7 @@ using Mono.Addins.Description;
[assembly:Addin ("MonoDeveloperExtensions",
Namespace = "MonoDevelop",
Version = MonoDevelop.BuildInfo.Version,
+ EnabledByDefault = false,
Category = "Project Import and Export")]
[assembly:AddinName ("IDE Extensions for developers of the Mono framework")]
diff --git a/main/src/addins/MonoDeveloperExtensions/MonoSolutionItemHandler.cs b/main/src/addins/MonoDeveloperExtensions/MonoSolutionItemHandler.cs
index 1a9cdc6262..d43e15eb86 100644
--- a/main/src/addins/MonoDeveloperExtensions/MonoSolutionItemHandler.cs
+++ b/main/src/addins/MonoDeveloperExtensions/MonoSolutionItemHandler.cs
@@ -179,23 +179,29 @@ namespace MonoDeveloper
target = "clean";
DotNetProjectConfiguration conf = (DotNetProjectConfiguration) project.GetConfiguration (configuration);
-
- StringWriter output = new StringWriter ();
- LogTextWriter tw = new LogTextWriter ();
- tw.ChainWriter (output);
- tw.ChainWriter (monitor.Log);
-
- ProcessWrapper proc = Runtime.ProcessService.StartProcess ("make", "PROFILE=" + conf.Id + " " + target, conf.OutputDirectory, monitor.Log, tw, null);
- proc.WaitForOutput ();
-
- CompilerResults cr = new CompilerResults (null);
- string[] lines = output.ToString().Split ('\n');
- foreach (string line in lines) {
- CompilerError err = CreateErrorFromString (line);
- if (err != null) cr.Errors.Add (err);
+
+ using (var output = new StringWriter ()) {
+ using (var tw = new LogTextWriter ()) {
+ tw.ChainWriter (output);
+ tw.ChainWriter (monitor.Log);
+
+ using (ProcessWrapper proc = Runtime.ProcessService.StartProcess ("make", "PROFILE=" + conf.Id + " " + target, conf.OutputDirectory, monitor.Log, tw, null))
+ proc.WaitForOutput ();
+
+ tw.UnchainWriter (output);
+ tw.UnchainWriter (monitor.Log);
+
+ CompilerResults cr = new CompilerResults (null);
+ string[] lines = output.ToString().Split ('\n');
+ foreach (string line in lines) {
+ CompilerError err = CreateErrorFromString (line);
+ if (err != null) cr.Errors.Add (err);
+ }
+
+ return new BuildResult (cr, output.ToString());
+ }
}
-
- return new BuildResult (cr, output.ToString());
+
}
private CompilerError CreateErrorFromString (string error_string)
@@ -351,5 +357,10 @@ namespace MonoDeveloper
get { return unitTest; }
set { unitTest = value; }
}
+
+ public object GetService (Type t)
+ {
+ return null;
+ }
}
}
diff --git a/main/src/addins/NUnit/Gui/AbstractUnitTestEditorExtension.cs b/main/src/addins/NUnit/Gui/AbstractUnitTestEditorExtension.cs
index fb8b9fc225..226b0a2f8a 100644
--- a/main/src/addins/NUnit/Gui/AbstractUnitTestEditorExtension.cs
+++ b/main/src/addins/NUnit/Gui/AbstractUnitTestEditorExtension.cs
@@ -139,6 +139,8 @@ namespace MonoDevelop.NUnit
public override void InformMouseHover (TextEditor editor, Margin margin, MarginMouseEventArgs args)
{
+ if (!(margin is ActionMargin))
+ return;
string toolTip;
if (unitTest.IsFixture) {
if (isFailed) {
@@ -178,6 +180,8 @@ namespace MonoDevelop.NUnit
public override void InformMousePress (TextEditor editor, Margin margin, MarginMouseEventArgs args)
{
+ if (!(margin is ActionMargin))
+ return;
if (menu != null) {
menu.Destroy ();
}
diff --git a/main/src/addins/NUnit/Gui/TestPad.cs b/main/src/addins/NUnit/Gui/TestPad.cs
index 1966f62101..eebf28737c 100644
--- a/main/src/addins/NUnit/Gui/TestPad.cs
+++ b/main/src/addins/NUnit/Gui/TestPad.cs
@@ -78,7 +78,7 @@ namespace MonoDevelop.NUnit
ArrayList testNavigationHistory = new ArrayList ();
- Button buttonRunAll, buttonRun, buttonStop;
+ Button buttonRunAll, buttonStop;
public override void Initialize (NodeBuilder[] builders, TreePadOption[] options, string menuPath)
{
@@ -480,7 +480,6 @@ namespace MonoDevelop.NUnit
return null;
NUnitService.ResetResult (test.RootTest);
- this.buttonRun.Sensitive = false;
this.buttonRunAll.Sensitive = false;
this.buttonStop.Sensitive = true;
@@ -506,7 +505,6 @@ namespace MonoDevelop.NUnit
if (op.Success)
RefreshDetails ();
runningTestOperation = null;
- this.buttonRun.Sensitive = true;
this.buttonRunAll.Sensitive = true;
this.buttonStop.Sensitive = false;
diff --git a/main/src/addins/NUnit/Gui/icons/light/unit-failed-16.png b/main/src/addins/NUnit/Gui/icons/light/unit-failed-16.png
index 9f63e50433..93e3f64b25 100644
--- a/main/src/addins/NUnit/Gui/icons/light/unit-failed-16.png
+++ b/main/src/addins/NUnit/Gui/icons/light/unit-failed-16.png
Binary files differ
diff --git a/main/src/addins/NUnit/Gui/icons/light/unit-failed-16@2x.png b/main/src/addins/NUnit/Gui/icons/light/unit-failed-16@2x.png
index b5d2da79da..adfed112c6 100644
--- a/main/src/addins/NUnit/Gui/icons/light/unit-failed-16@2x.png
+++ b/main/src/addins/NUnit/Gui/icons/light/unit-failed-16@2x.png
Binary files differ
diff --git a/main/src/addins/NUnit/Gui/icons/light/unit-mixed-results-16.png b/main/src/addins/NUnit/Gui/icons/light/unit-mixed-results-16.png
index d5bfbcec95..68eaabceb5 100644
--- a/main/src/addins/NUnit/Gui/icons/light/unit-mixed-results-16.png
+++ b/main/src/addins/NUnit/Gui/icons/light/unit-mixed-results-16.png
Binary files differ
diff --git a/main/src/addins/NUnit/Gui/icons/light/unit-mixed-results-16@2x.png b/main/src/addins/NUnit/Gui/icons/light/unit-mixed-results-16@2x.png
index ac1879bcec..eab0665fd4 100644
--- a/main/src/addins/NUnit/Gui/icons/light/unit-mixed-results-16@2x.png
+++ b/main/src/addins/NUnit/Gui/icons/light/unit-mixed-results-16@2x.png
Binary files differ
diff --git a/main/src/addins/NUnit/Gui/icons/light/unit-running-16.png b/main/src/addins/NUnit/Gui/icons/light/unit-running-16.png
index 027e9aafb9..587de48d85 100644
--- a/main/src/addins/NUnit/Gui/icons/light/unit-running-16.png
+++ b/main/src/addins/NUnit/Gui/icons/light/unit-running-16.png
Binary files differ
diff --git a/main/src/addins/NUnit/Gui/icons/light/unit-running-16@2x.png b/main/src/addins/NUnit/Gui/icons/light/unit-running-16@2x.png
index 4c652686b0..e61f579a0c 100644
--- a/main/src/addins/NUnit/Gui/icons/light/unit-running-16@2x.png
+++ b/main/src/addins/NUnit/Gui/icons/light/unit-running-16@2x.png
Binary files differ
diff --git a/main/src/addins/NUnit/Gui/icons/light/unit-success-16.png b/main/src/addins/NUnit/Gui/icons/light/unit-success-16.png
index 95400a22fe..88e9fdbb7e 100644
--- a/main/src/addins/NUnit/Gui/icons/light/unit-success-16.png
+++ b/main/src/addins/NUnit/Gui/icons/light/unit-success-16.png
Binary files differ
diff --git a/main/src/addins/NUnit/Gui/icons/light/unit-success-16@2x.png b/main/src/addins/NUnit/Gui/icons/light/unit-success-16@2x.png
index 47af0e3075..4ce7c0ad2c 100644
--- a/main/src/addins/NUnit/Gui/icons/light/unit-success-16@2x.png
+++ b/main/src/addins/NUnit/Gui/icons/light/unit-success-16@2x.png
Binary files differ
diff --git a/main/src/addins/NUnit/MonoDevelop.NUnit.csproj b/main/src/addins/NUnit/MonoDevelop.NUnit.csproj
index 1b016ba55b..575a1e39c9 100644
--- a/main/src/addins/NUnit/MonoDevelop.NUnit.csproj
+++ b/main/src/addins/NUnit/MonoDevelop.NUnit.csproj
@@ -225,7 +225,6 @@
<Compile Include="Services\NUnitOptions.cs" />
<Compile Include="Services\IResultsStore.cs" />
<Compile Include="Services\UnitTestResultsStore.cs" />
- <Compile Include="Services\XmlResultsStore.cs" />
<Compile Include="Services\WorkspaceTestGroup.cs" />
<Compile Include="gtk-gui\generated.cs" />
<Compile Include="Services\UnitTestResult.cs" />
@@ -237,6 +236,8 @@
<Compile Include="Gui\TestStatusIcon.cs" />
<Compile Include="AddinInfo.cs" />
<Compile Include="Gui\AbstractUnitTestEditorExtension.cs" />
+ <Compile Include="Services\AbstractResultsStore.cs" />
+ <Compile Include="Services\BinaryResultsStore.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Makefile.am" />
diff --git a/main/src/addins/NUnit/Project/NUnitAssemblyGroupProject.cs b/main/src/addins/NUnit/Project/NUnitAssemblyGroupProject.cs
index 51251e2f9a..0a67aac29d 100644
--- a/main/src/addins/NUnit/Project/NUnitAssemblyGroupProject.cs
+++ b/main/src/addins/NUnit/Project/NUnitAssemblyGroupProject.cs
@@ -168,7 +168,7 @@ namespace MonoDevelop.NUnit
{
this.project = project;
resultsPath = GetTestResultsDirectory (project.BaseDirectory);
- ResultsStore = new XmlResultsStore (resultsPath, Path.GetFileName (project.FileName));
+ ResultsStore = new BinaryResultsStore (resultsPath, Path.GetFileName (project.FileName));
lastConfig = (NUnitAssemblyGroupProjectConfiguration) project.DefaultConfiguration;
if (lastConfig != null)
diff --git a/main/src/addins/NUnit/Services/XmlResultsStore.cs b/main/src/addins/NUnit/Services/AbstractResultsStore.cs
index 63e9f56719..c90dfe4a31 100644
--- a/main/src/addins/NUnit/Services/XmlResultsStore.cs
+++ b/main/src/addins/NUnit/Services/AbstractResultsStore.cs
@@ -1,5 +1,5 @@
//
-// XmlResultsStore.cs
+// AbstractResultsStore.cs
//
// Author:
// Lluis Sanchez Gual
@@ -27,27 +27,28 @@
//
using System;
-using System.IO;
-using System.Linq;
using System.Collections;
-using System.Xml.Serialization;
+using System.Collections.Generic;
using System.Globalization;
+using System.IO;
+using System.Xml.Serialization;
using MonoDevelop.Core;
namespace MonoDevelop.NUnit
{
- public class XmlResultsStore: IResultsStore
+ public abstract class AbstractResultsStore: IResultsStore
{
Hashtable fileCache = new Hashtable ();
string basePath;
string storeId;
Hashtable cachedRootList = new Hashtable ();
-
- static XmlSerializer serializer = new XmlSerializer (typeof(TestRecord));
-
- public XmlResultsStore (string directory, string storeId)
+
+ IResultsStoreSerializer serializer;
+
+ public AbstractResultsStore (IResultsStoreSerializer serializer, string directory, string storeId)
{
- basePath = directory;
+ this.serializer = serializer;
+ this.basePath = directory;
this.storeId = storeId;
}
@@ -165,7 +166,7 @@ namespace MonoDevelop.NUnit
for (int n = dates.Length - 1; n >= 0 && list.Count < count; n--) {
if (dates [n] > endDate)
continue;
-
+
TestRecord root = GetRootRecord (configuration, dates [n]);
if (root == null) continue;
@@ -188,20 +189,19 @@ namespace MonoDevelop.NUnit
{
if (!Directory.Exists (basePath))
Directory.CreateDirectory (basePath);
-
+
foreach (DictionaryEntry entry in fileCache) {
TestRecord record = (TestRecord) entry.Value;
if (!record.Modified)
continue;
-
- string file = Path.Combine (basePath, (string)entry.Key);
- StreamWriter writer = new StreamWriter (file);
+
+ string filePath = Path.Combine (basePath, (string)entry.Key);
try {
- serializer.Serialize (writer, record);
- } finally {
- writer.Close ();
+ serializer.Serialize (filePath, record);
+ record.Modified = false;
+ } catch (Exception ex) {
+ LoggingService.LogError (ex.ToString ());
}
- record.Modified = false;
}
cachedRootList.Clear ();
}
@@ -223,7 +223,7 @@ namespace MonoDevelop.NUnit
return tr;
}
}
-
+
TestRecord GetRootRecord (string configuration, DateTime date)
{
string file = GetRootFileName (configuration, date);
@@ -236,19 +236,17 @@ namespace MonoDevelop.NUnit
} catch (Exception) {
return null;
}
- if (!File.Exists (filePath))
- return null;
-
- StreamReader s = new StreamReader (filePath);
+
try {
- res = (TestRecord) serializer.Deserialize (s);
+ res = (TestRecord) serializer.Deserialize (filePath);
} catch (Exception ex) {
LoggingService.LogError (ex.ToString ());
return null;
- } finally {
- s.Close ();
}
- fileCache [file] = res;
+
+ if (res != null) {
+ fileCache [file] = res;
+ }
return res;
}
@@ -276,11 +274,27 @@ namespace MonoDevelop.NUnit
}
return null;
}
+
+ // Filter out all invalid path characters in the file name
+ // Bug 3023 - Running NUnit tests throws ArgumentException: Illegal Characters in path
+ static string EscapeFilename (string str)
+ {
+ var pc = Path.GetInvalidPathChars ();
+ char[] specialCharacters = new char[pc.Length + 1];
+ pc.CopyTo (specialCharacters, 0);
+ specialCharacters [specialCharacters.Length - 1] = '%';
+
+ int i = str.IndexOfAny (specialCharacters);
+ while (i != -1) {
+ str = str.Substring (0, i) + '%' + ((int) str [i]).ToString ("X") + str.Substring (i + 1);
+ i = str.IndexOfAny (specialCharacters, i + 3);
+ }
+ return str;
+ }
string GetRootFileName (string configuration, DateTime date)
{
- // Filter out all invalid path characters in the file name (see: Bug 3023 - Running NUnit tests throws ArgumentException: Illegal Characters in path)
- var filteredConfiguration = new string (configuration.Where (c => !Path.GetInvalidPathChars ().Any (i => c == i)).ToArray ());
+ var filteredConfiguration = EscapeFilename (configuration);
return storeId + "-" + filteredConfiguration + "-" + date.ToString ("yyyy-MM-dd", CultureInfo.InvariantCulture) + ".xml";
}
@@ -299,20 +313,39 @@ namespace MonoDevelop.NUnit
DateTime[] res = (DateTime[]) cachedRootList [configuration];
if (res != null)
return res;
-
- ArrayList dates = new ArrayList ();
- foreach (string file in Directory.GetFiles (basePath, storeId + "-" + configuration + "-*")) {
+
+ var dates = new List<DateTime> ();
+ var escapedConfiguration = EscapeFilename (configuration);
+ foreach (string file in Directory.GetFiles (basePath, storeId + "-" + escapedConfiguration + "-*")) {
try {
- DateTime t = ParseFileNameDate (configuration, Path.GetFileName (file));
+ DateTime t = ParseFileNameDate (escapedConfiguration, Path.GetFileName (file));
dates.Add (t);
} catch { }
}
- res = (DateTime[]) dates.ToArray (typeof(DateTime));
+ res = dates.ToArray ();
cachedRootList [configuration] = res;
return res;
}
}
+ /// <summary>
+ /// Encapsulates serialization/deserialization logic
+ /// </summary>
+ public interface IResultsStoreSerializer
+ {
+ /// <summary>
+ /// Serialize the record into the specified path.
+ /// </summary>
+ void Serialize(string filePath, TestRecord testRecord);
+
+ /// <summary>
+ /// Deserialize the TestRecord from the sepcified path if possible.
+ /// Return null if deserialization is impossible.
+ /// </summary>
+ TestRecord Deserialize(string filePath);
+ }
+
+ [Serializable]
public class TestRecord
{
string name;
@@ -337,6 +370,7 @@ namespace MonoDevelop.NUnit
}
}
+ [Serializable]
public class TestRecordCollection: CollectionBase
{
public new TestRecord this [int n] {
@@ -358,6 +392,7 @@ namespace MonoDevelop.NUnit
}
}
+ [Serializable]
public class UnitTestResultCollection: CollectionBase
{
public new UnitTestResult this [int n] {
@@ -370,4 +405,3 @@ namespace MonoDevelop.NUnit
}
}
}
-
diff --git a/main/src/addins/NUnit/Services/BinaryResultsStore.cs b/main/src/addins/NUnit/Services/BinaryResultsStore.cs
new file mode 100644
index 0000000000..c6d0eca036
--- /dev/null
+++ b/main/src/addins/NUnit/Services/BinaryResultsStore.cs
@@ -0,0 +1,98 @@
+//
+// BinaryResultsStore.cs
+//
+// Author:
+// Sergey Khabibullin <sergey@khabibullin.com>
+//
+// Copyright (c) 2014 Sergey Khabibullin
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using ICSharpCode.NRefactory.Utils;
+using System.Xml.Serialization;
+using System.IO;
+
+namespace MonoDevelop.NUnit
+{
+ /// <summary>
+ /// ResultsStore implementation that uses binary serializer
+ /// </summary>
+ public class BinaryResultsStore : AbstractResultsStore
+ {
+ static BinaryResultsStoreSerializer serializer = new BinaryResultsStoreSerializer();
+
+ public BinaryResultsStore (string directory, string storeId)
+ : base(serializer, directory, storeId)
+ {
+ }
+ }
+
+ /// <summary>
+ /// Serializer implementation that uses ICSharpCode.NRefactory.Utils.FastSerializer
+ /// as it's main method to serialize test records. The serializer is backward compatible
+ /// with the old xml-based serialization and will deserialize test record from xml
+ /// if the binary form is not yet present.
+ /// </summary>
+ public class BinaryResultsStoreSerializer : IResultsStoreSerializer
+ {
+ const string binaryExtension = ".test-result";
+ const string xmlExtension = ".xml";
+
+ FastSerializer fastSerializer = new FastSerializer();
+ XmlSerializer xmlSerializer = new XmlSerializer(typeof(TestRecord));
+
+ public void Serialize (string xmlFilePath, TestRecord testRecord)
+ {
+ // no need for xml serialization because next time it will be
+ // deserialized from the binary format
+ string binaryFilePath = GetBinaryFilePath (xmlFilePath);
+ using (var stream = File.OpenWrite(binaryFilePath)) {
+ fastSerializer.Serialize (stream, testRecord);
+ }
+ }
+
+ public TestRecord Deserialize (string xmlFilePath)
+ {
+ string binaryFilePath = GetBinaryFilePath (xmlFilePath);
+
+ // deserialize from the binary format if the file exists
+ if (File.Exists(binaryFilePath)) {
+ using (var stream = File.OpenRead (binaryFilePath)) {
+ return (TestRecord) fastSerializer.Deserialize (stream);
+ }
+ }
+
+ // deserialize from xml if the file exists
+ if (File.Exists(xmlFilePath)) {
+ using (var reader = new StreamReader (xmlFilePath)) {
+ return (TestRecord) xmlSerializer.Deserialize (reader);
+ }
+ }
+
+ return null;
+ }
+
+ string GetBinaryFilePath(string xmlFilePath)
+ {
+ // filename with the binary extension
+ return xmlFilePath.Substring (0, xmlFilePath.Length - xmlExtension.Length) + binaryExtension;
+ }
+ }
+}
+
diff --git a/main/src/addins/NUnit/Services/NUnitProjectTestSuite.cs b/main/src/addins/NUnit/Services/NUnitProjectTestSuite.cs
index a81b574bc9..8f1e45b034 100644
--- a/main/src/addins/NUnit/Services/NUnitProjectTestSuite.cs
+++ b/main/src/addins/NUnit/Services/NUnitProjectTestSuite.cs
@@ -55,7 +55,7 @@ namespace MonoDevelop.NUnit
{
storeId = Path.GetFileName (project.FileName);
resultsPath = MonoDevelop.NUnit.RootTest.GetTestResultsDirectory (project.BaseDirectory);
- ResultsStore = new XmlResultsStore (resultsPath, storeId);
+ ResultsStore = new BinaryResultsStore (resultsPath, storeId);
this.project = project;
project.NameChanged += new SolutionItemRenamedEventHandler (OnProjectRenamed);
IdeApp.ProjectOperations.EndBuild += new BuildEventHandler (OnProjectBuilt);
@@ -67,7 +67,7 @@ namespace MonoDevelop.NUnit
return null;
foreach (var p in project.References)
- if (p.Reference.IndexOf ("GuiUnit", StringComparison.OrdinalIgnoreCase) != -1 || p.Reference.IndexOf ("nunit.framework") != -1 || p.Reference.IndexOf ("nunit.core") != -1)
+ if (p.Reference.IndexOf ("GuiUnit", StringComparison.OrdinalIgnoreCase) != -1 || p.Reference.IndexOf ("nunit.framework") != -1 || p.Reference.IndexOf ("nunit.core") != -1 || p.Reference.IndexOf ("nunitlite") != -1)
return new NUnitProjectTestSuite (project);
return null;
}
diff --git a/main/src/addins/NUnit/Services/SolutionFolderTestGroup.cs b/main/src/addins/NUnit/Services/SolutionFolderTestGroup.cs
index d70a5feb01..c961b9c7e8 100644
--- a/main/src/addins/NUnit/Services/SolutionFolderTestGroup.cs
+++ b/main/src/addins/NUnit/Services/SolutionFolderTestGroup.cs
@@ -45,7 +45,7 @@ namespace MonoDevelop.NUnit
{
string storeId = c.ItemId;
string resultsPath = MonoDevelop.NUnit.RootTest.GetTestResultsDirectory (c.BaseDirectory);
- ResultsStore = new XmlResultsStore (resultsPath, storeId);
+ ResultsStore = new BinaryResultsStore (resultsPath, storeId);
combine = c;
combine.ItemAdded += OnEntryChanged;
diff --git a/main/src/addins/NUnit/Services/WorkspaceTestGroup.cs b/main/src/addins/NUnit/Services/WorkspaceTestGroup.cs
index f004056425..adc4edac8a 100644
--- a/main/src/addins/NUnit/Services/WorkspaceTestGroup.cs
+++ b/main/src/addins/NUnit/Services/WorkspaceTestGroup.cs
@@ -45,7 +45,7 @@ namespace MonoDevelop.NUnit
{
string storeId = ws.Name;
string resultsPath = MonoDevelop.NUnit.RootTest.GetTestResultsDirectory (ws.BaseDirectory);
- ResultsStore = new XmlResultsStore (resultsPath, storeId);
+ ResultsStore = new BinaryResultsStore (resultsPath, storeId);
workspace = ws;
workspace.ItemAdded += OnEntryChanged;
diff --git a/main/src/addins/NUnit/templates/NUnitProject.xpt.xml b/main/src/addins/NUnit/templates/NUnitProject.xpt.xml
index 60df0cf613..9a83ac6b23 100644
--- a/main/src/addins/NUnit/templates/NUnitProject.xpt.xml
+++ b/main/src/addins/NUnit/templates/NUnitProject.xpt.xml
@@ -7,7 +7,7 @@
<_Category>NUnit</_Category>
<Icon>md-project|res:project-nunit-overlay-light-32.png</Icon>
<_Description>Creates an NUnit library</_Description>
- <LanguageName>*</LanguageName>
+ <LanguageName>C#,VBNet</LanguageName>
<DefaultFilename>NUnitProject</DefaultFilename>
</TemplateConfiguration>
diff --git a/main/src/addins/NUnit/templates/NUnitTestClass.xft.xml b/main/src/addins/NUnit/templates/NUnitTestClass.xft.xml
index d3a261dc16..aaebb07b4e 100644
--- a/main/src/addins/NUnit/templates/NUnitTestClass.xft.xml
+++ b/main/src/addins/NUnit/templates/NUnitTestClass.xft.xml
@@ -5,7 +5,7 @@
<_Name>Test Fixture</_Name>
<Icon>md-file-unit-test</Icon>
<_Category>NUnit</_Category>
- <LanguageName>*</LanguageName>
+ <LanguageName>C#,VBNet</LanguageName>
<_Description>Creates a Test Fixture.</_Description>
<DefaultFilename>NUnitTestClass</DefaultFilename>
</TemplateConfiguration>
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating.nuspec b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating.nuspec
new file mode 100644
index 0000000000..dc7ba85255
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating.nuspec
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
+ <metadata>
+ <id>Mono.TextTemplating</id>
+ <version>1.0.0</version>
+ <title>Mono.TextTemplating</title>
+ <authors>Michael Hutchinson</authors>
+ <licenseUrl>http://opensource.org/licenses/MIT</licenseUrl>
+ <projectUrl>https://github.com/mono/monodevelop/tree/master/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating</projectUrl>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <description>Open-source implementation of the T4 templating engine.</description>
+ <releaseNotes>Built from MonoDevelop git repository, commit 94b807b84f7e9d164e44a57fc594039738e4a920</releaseNotes>
+ <copyright>2009-2011 Novell, Inc. 2011-2014 Xamarin Inc.</copyright>
+ <tags>T4, templating</tags>
+ </metadata>
+ <files>
+ <file src="..\..\..\..\build\AddIns\MonoDevelop.TextTemplating\Mono.TextTemplating.dll" target="lib\Mono.TextTemplating.dll" />
+ </files>
+</package> \ No newline at end of file
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs
index 3d33e45185..24394ff826 100644
--- a/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs
@@ -416,10 +416,6 @@ namespace Mono.TextTemplating
foreach (var dt in settings.CustomDirectives) {
var processor = settings.DirectiveProcessors[dt.ProcessorName];
-
- if (processor is RequiresProvidesDirectiveProcessor)
- throw new NotImplementedException ("RequiresProvidesDirectiveProcessor");
-
processor.ProcessDirective (dt.Directive.Name, dt.Directive.Attributes);
}
diff --git a/main/src/addins/TextTemplating/TextTransform/Options.cs b/main/src/addins/TextTemplating/TextTransform/Options.cs
index a64ea4d4d0..663c804732 100644
--- a/main/src/addins/TextTemplating/TextTransform/Options.cs
+++ b/main/src/addins/TextTemplating/TextTransform/Options.cs
@@ -529,19 +529,6 @@ namespace Mono.Options
throw new InvalidOperationException ("Option has no names!");
}
- [Obsolete ("Use KeyedCollection.this[string]")]
- protected Option GetOptionForName (string option)
- {
- if (option == null)
- throw new ArgumentNullException ("option");
- try {
- return base [option];
- }
- catch (KeyNotFoundException) {
- return null;
- }
- }
-
protected override void InsertItem (int index, Option item)
{
base.InsertItem (index, item);
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseGitRepositoryTests.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseGitRepositoryTests.cs
index 65755bba1c..8841f269d3 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseGitRepositoryTests.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseGitRepositoryTests.cs
@@ -45,17 +45,17 @@ namespace MonoDevelop.VersionControl.Git.Tests
public override void Setup ()
{
// Generate directories and a svn util.
- RootUrl = new FilePath (FileService.CreateTempDirectory () + Path.DirectorySeparatorChar);
- RootCheckout = new FilePath (FileService.CreateTempDirectory () + Path.DirectorySeparatorChar);
- Directory.CreateDirectory (RootUrl.FullPath + "repo.git");
- RepoLocation = "file:///" + RootUrl.FullPath + "repo.git";
+ RemotePath = new FilePath (FileService.CreateTempDirectory () + Path.DirectorySeparatorChar);
+ LocalPath = new FilePath (FileService.CreateTempDirectory () + Path.DirectorySeparatorChar);
+ Directory.CreateDirectory (RemotePath.FullPath + "repo.git");
+ RemoteUrl = "file:///" + RemotePath.FullPath + "repo.git";
// Initialize the bare repo.
var ci = new InitCommand ();
- ci.SetDirectory (new Sharpen.FilePath (RootUrl.FullPath + "repo.git"));
+ ci.SetDirectory (new Sharpen.FilePath (RemotePath.FullPath + "repo.git"));
ci.SetBare (true);
ci.Call ();
- var bare = new FileRepository (new Sharpen.FilePath (RootUrl.FullPath + "repo.git"));
+ var bare = new FileRepository (new Sharpen.FilePath (RemotePath.FullPath + "repo.git"));
string branch = Constants.R_HEADS + "master";
RefUpdate head = bare.UpdateRef (Constants.HEAD);
@@ -63,9 +63,9 @@ namespace MonoDevelop.VersionControl.Git.Tests
head.Link (branch);
// Check out the repository.
- Checkout (RootCheckout, RepoLocation);
- Repo = GetRepo (RootCheckout, RepoLocation);
- DotDir= ".git";
+ Checkout (LocalPath, RemoteUrl);
+ Repo = GetRepo (LocalPath, RemoteUrl);
+ DotDir = ".git";
}
protected override NUnit.Framework.Constraints.IResolveConstraint IsCorrectType ()
@@ -86,7 +86,7 @@ namespace MonoDevelop.VersionControl.Git.Tests
string difftext = @"@@ -0,0 +1 @@
+text
";
- Assert.AreEqual (difftext, Repo.GenerateDiff (RootCheckout + "testfile", Repo.GetVersionInfo (RootCheckout + "testfile", VersionInfoQueryFlags.IgnoreCache)).Content.Replace ("\n", "\r\n"));
+ Assert.AreEqual (difftext, Repo.GenerateDiff (LocalPath + "testfile", Repo.GetVersionInfo (LocalPath + "testfile", VersionInfoQueryFlags.IgnoreCache)).Content.Replace ("\n", "\r\n"));
}
[Test]
@@ -177,10 +177,10 @@ namespace MonoDevelop.VersionControl.Git.Tests
AddFile ("file2", "nothing", true, true);
AddFile ("file1", "text", true, false);
repo2.GetStashes ().Create (new NullProgressMonitor ());
- Assert.IsTrue (!File.Exists (RootCheckout + "file1"), "Stash creation failure");
+ Assert.IsTrue (!File.Exists (LocalPath + "file1"), "Stash creation failure");
repo2.GetStashes ().Pop (new NullProgressMonitor ());
- VersionInfo vi = repo2.GetVersionInfo (RootCheckout + "file1", VersionInfoQueryFlags.IgnoreCache);
+ VersionInfo vi = repo2.GetVersionInfo (LocalPath + "file1", VersionInfoQueryFlags.IgnoreCache);
Assert.AreEqual (VersionStatus.ScheduledAdd, vi.Status & VersionStatus.ScheduledAdd, "Stash pop failure");
}
@@ -195,15 +195,15 @@ namespace MonoDevelop.VersionControl.Git.Tests
repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor (), "branch1");
Assert.AreEqual ("branch1", repo2.GetCurrentBranch ());
- Assert.IsTrue (File.Exists (RootCheckout + "file1"), "Branch not inheriting from current.");
+ Assert.IsTrue (File.Exists (LocalPath + "file1"), "Branch not inheriting from current.");
AddFile ("file2", "text", true, false);
repo2.CreateBranch ("branch2", null);
repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor (), "branch2");
- Assert.IsTrue (!File.Exists (RootCheckout + "file2"), "Uncommitted changes were not stashed");
+ Assert.IsTrue (!File.Exists (LocalPath + "file2"), "Uncommitted changes were not stashed");
repo2.GetStashes ().Pop (new NullProgressMonitor ());
- Assert.IsTrue (File.Exists (RootCheckout + "file2"), "Uncommitted changes were not stashed correctly");
+ Assert.IsTrue (File.Exists (LocalPath + "file2"), "Uncommitted changes were not stashed correctly");
repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor (), "master");
repo2.RemoveBranch ("branch1");
@@ -232,7 +232,7 @@ namespace MonoDevelop.VersionControl.Git.Tests
repo2.CreateBranch ("branch4", "origin/branch3");
repo2.SwitchToBranch (new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor (), "branch4");
- Assert.IsTrue (File.Exists (RootCheckout + "file2"), "Tracking remote is not grabbing correct commits");
+ Assert.IsTrue (File.Exists (LocalPath + "file2"), "Tracking remote is not grabbing correct commits");
}
[Test]
@@ -248,11 +248,11 @@ namespace MonoDevelop.VersionControl.Git.Tests
ChangeSet diff = repo2.GetPushChangeSet ("origin", "master");
Assert.AreEqual (2, diff.Items.Count ());
- ChangeSetItem item = diff.GetFileItem (RootCheckout + "file1");
+ ChangeSetItem item = diff.GetFileItem (LocalPath + "file1");
Assert.IsNotNull (item);
Assert.AreEqual (VersionStatus.ScheduledAdd, item.Status & VersionStatus.ScheduledAdd);
- item = diff.GetFileItem (RootCheckout + "file1");
+ item = diff.GetFileItem (LocalPath + "file1");
Assert.IsNotNull (item);
Assert.AreEqual (VersionStatus.ScheduledAdd, item.Status & VersionStatus.ScheduledAdd);
}
@@ -356,6 +356,35 @@ namespace MonoDevelop.VersionControl.Git.Tests
{
return new GitRepository (path, url);
}
+
+ // This test is for a memory usage improvement on status.
+ [Test]
+ public void TestSameGitRevision ()
+ {
+ // Test that we have the same Revision on subsequent calls when HEAD doesn't change.
+ AddFile ("file1", null, true, true);
+ var info1 = Repo.GetVersionInfo (LocalPath + "file1", VersionInfoQueryFlags.IgnoreCache);
+ var info2 = Repo.GetVersionInfo (LocalPath + "file1", VersionInfoQueryFlags.IgnoreCache);
+ Assert.IsTrue (object.ReferenceEquals (info1.Revision, info2.Revision));
+
+ // Test that we have the same Revision between two files on a HEAD bump.
+ AddFile ("file2", null, true, true);
+ var infos = Repo.GetVersionInfo (
+ new FilePath[] { LocalPath + "file1", LocalPath + "file2" },
+ VersionInfoQueryFlags.IgnoreCache
+ ).ToArray ();
+ Assert.IsTrue (object.ReferenceEquals (infos [0].Revision, infos [1].Revision));
+
+ // Test that the new Revision and the old one are different instances.
+ Assert.IsFalse (object.ReferenceEquals (info1.Revision, infos [0].Revision));
+
+ // Write the first test so it also covers directories.
+ AddDirectory ("meh", true, false);
+ AddFile ("meh/file3", null, true, true);
+ var info3 = Repo.GetVersionInfo (LocalPath + "meh", VersionInfoQueryFlags.IgnoreCache);
+ var info4 = Repo.GetVersionInfo (LocalPath + "meh", VersionInfoQueryFlags.IgnoreCache);
+ Assert.IsTrue (object.ReferenceEquals (info3.Revision, info4.Revision));
+ }
}
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseRepositoryTests.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseRepositoryTests.cs
index 3d04ebd517..acdaf3d5bf 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseRepositoryTests.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseRepositoryTests.cs
@@ -41,9 +41,9 @@ namespace MonoDevelop.VersionControl.Tests
protected const string Author = "author";
protected const string Email = "email@service.domain";
- protected string RepoLocation = "";
- protected FilePath RootUrl = "";
- protected FilePath RootCheckout;
+ protected string RemoteUrl = "";
+ protected FilePath RemotePath = "";
+ protected FilePath LocalPath;
protected Repository Repo;
protected Repository Repo2;
protected string DotDir;
@@ -56,8 +56,8 @@ namespace MonoDevelop.VersionControl.Tests
[TearDown]
public virtual void TearDown ()
{
- DeleteDirectory (RootUrl);
- DeleteDirectory (RootCheckout);
+ DeleteDirectory (RemotePath);
+ DeleteDirectory (LocalPath);
AddedItems.Clear ();
CommitNumber = 0;
}
@@ -84,7 +84,7 @@ namespace MonoDevelop.VersionControl.Tests
// Tests VersionControlService.GetRepositoryReference.
public void RightRepositoryDetection ()
{
- var path = ((string)RootCheckout).TrimEnd (Path.DirectorySeparatorChar);
+ var path = ((string)LocalPath).TrimEnd (Path.DirectorySeparatorChar);
var repo = VersionControlService.GetRepositoryReference (path, null);
Assert.That (repo, IsCorrectType (), "#1");
@@ -97,12 +97,12 @@ namespace MonoDevelop.VersionControl.Tests
// Versioned file
AddFile ("foo", "contents", true, true);
- path = Path.Combine (RootCheckout, "foo");
+ path = Path.Combine (LocalPath, "foo");
Assert.AreSame (VersionControlService.GetRepositoryReference (path, null), repo, "#2");
// Versioned directory
AddDirectory ("bar", true, true);
- path = Path.Combine (RootCheckout, "bar");
+ path = Path.Combine (LocalPath, "bar");
Assert.AreSame (VersionControlService.GetRepositoryReference (path, null), repo, "#3");
// Unversioned file
@@ -114,11 +114,11 @@ namespace MonoDevelop.VersionControl.Tests
Assert.AreSame (VersionControlService.GetRepositoryReference (path, null), repo, "#5");
// Nonexistent file
- path = Path.Combine (RootCheckout, "do_i_exist");
+ path = Path.Combine (LocalPath, "do_i_exist");
Assert.AreSame (VersionControlService.GetRepositoryReference (path, null), repo, "#6");
// Nonexistent directory
- path = Path.Combine (RootCheckout, "do", "i", "exist");
+ path = Path.Combine (LocalPath, "do", "i", "exist");
Assert.AreSame (VersionControlService.GetRepositoryReference (path, null), repo, "#6");
}
@@ -136,7 +136,7 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.Checkout.
public void CheckoutExists ()
{
- Assert.IsTrue (Directory.Exists (RootCheckout + DotDir));
+ Assert.IsTrue (Directory.Exists (LocalPath + DotDir));
}
// In main directory, ".git".
@@ -166,8 +166,8 @@ namespace MonoDevelop.VersionControl.Tests
AddFile ("testfile", null, true, false);
// Query two queries.
- VersionInfo vi = Repo.GetVersionInfo (RootCheckout + "testfile");
- VersionInfo[] vis = Repo.GetDirectoryVersionInfo (RootCheckout, false, false);
+ VersionInfo vi = Repo.GetVersionInfo (LocalPath + "testfile");
+ VersionInfo[] vis = Repo.GetDirectoryVersionInfo (LocalPath, false, false);
// No cache, query.
Assert.AreEqual (InitialValue, vi.Status);
@@ -175,28 +175,28 @@ namespace MonoDevelop.VersionControl.Tests
System.Threading.Thread.Sleep (QueryTimer);
// Cached.
- vi = Repo.GetVersionInfo (RootCheckout + "testfile");
+ vi = Repo.GetVersionInfo (LocalPath + "testfile");
Assert.AreEqual (VersionStatus.ScheduledAdd, vi.Status & VersionStatus.ScheduledAdd);
AddDirectory ("testdir", true, false);
AddFile (Path.Combine ("testdir", "testfile2"), null, true, false);
// Old cache.
- vis = Repo.GetDirectoryVersionInfo (RootCheckout, false, false);
+ vis = Repo.GetDirectoryVersionInfo (LocalPath, false, false);
Assert.AreEqual (1 + RepoItemsCount, vis.Length);
// Query.
- Repo.ClearCachedVersionInfo (RootCheckout);
- Repo.GetDirectoryVersionInfo (RootCheckout, false, false);
+ Repo.ClearCachedVersionInfo (LocalPath);
+ Repo.GetDirectoryVersionInfo (LocalPath, false, false);
System.Threading.Thread.Sleep (QueryTimer);
// Cached.
- vis = Repo.GetDirectoryVersionInfo (RootCheckout, false, false);
+ vis = Repo.GetDirectoryVersionInfo (LocalPath, false, false);
Assert.AreEqual (2 + RepoItemsCount, vis.Length);
// Wait for result.
AddFile ("testfile3", null, true, false);
- vis = Repo.GetDirectoryVersionInfo (RootCheckout, false, true);
+ vis = Repo.GetDirectoryVersionInfo (LocalPath, false, true);
Assert.AreEqual (4 + RepoItemsCountRecursive, vis.Length);
}
@@ -206,7 +206,7 @@ namespace MonoDevelop.VersionControl.Tests
{
AddFile ("testfile", null, true, false);
- VersionInfo vi = Repo.GetVersionInfo (RootCheckout + "testfile", VersionInfoQueryFlags.IgnoreCache);
+ VersionInfo vi = Repo.GetVersionInfo (LocalPath + "testfile", VersionInfoQueryFlags.IgnoreCache);
Assert.AreEqual (VersionStatus.Versioned, (VersionStatus.Versioned & vi.Status));
Assert.AreEqual (VersionStatus.ScheduledAdd, (VersionStatus.ScheduledAdd & vi.Status));
@@ -220,7 +220,7 @@ namespace MonoDevelop.VersionControl.Tests
AddFile ("testfile", null, true, true);
PostCommit (Repo);
- VersionInfo vi = Repo.GetVersionInfo (RootCheckout + "testfile", VersionInfoQueryFlags.IncludeRemoteStatus | VersionInfoQueryFlags.IgnoreCache);
+ VersionInfo vi = Repo.GetVersionInfo (LocalPath + "testfile", VersionInfoQueryFlags.IncludeRemoteStatus | VersionInfoQueryFlags.IgnoreCache);
// TODO: Fix Win32 Svn Remote status check.
Assert.AreEqual (VersionStatus.Versioned, (VersionStatus.Versioned & vi.Status));
}
@@ -238,8 +238,8 @@ namespace MonoDevelop.VersionControl.Tests
// Checkout a second repository.
FilePath second = new FilePath (FileService.CreateTempDirectory () + Path.DirectorySeparatorChar);
- Checkout (second, RepoLocation);
- Repo2 = GetRepo (second, RepoLocation);
+ Checkout (second, RemoteUrl);
+ Repo2 = GetRepo (second, RemoteUrl);
string added = second + "testfile2";
File.Create (added).Close ();
Repo2.Add (added, false, new NullProgressMonitor ());
@@ -251,7 +251,7 @@ namespace MonoDevelop.VersionControl.Tests
PostCommit (Repo2);
Repo.Update (Repo.RootPath, true, new NullProgressMonitor ());
- Assert.True (File.Exists (RootCheckout + "testfile2"));
+ Assert.True (File.Exists (LocalPath + "testfile2"));
DeleteDirectory (second);
}
@@ -263,7 +263,7 @@ namespace MonoDevelop.VersionControl.Tests
AddFile ("testfile", null, true, true);
AddFile ("testfile2", null, true, true);
int index = 0;
- foreach (Revision rev in Repo.GetHistory (RootCheckout + "testfile", null)) {
+ foreach (Revision rev in Repo.GetHistory (LocalPath + "testfile", null)) {
Assert.AreEqual (String.Format ("Commit #{0}", index++), rev.Message);
}
}
@@ -273,7 +273,7 @@ namespace MonoDevelop.VersionControl.Tests
public void DiffIsProper ()
{
AddFile ("testfile", null, true, true);
- File.AppendAllText (RootCheckout + "testfile", "text" + Environment.NewLine);
+ File.AppendAllText (LocalPath + "testfile", "text" + Environment.NewLine);
TestDiff ();
}
@@ -286,7 +286,7 @@ namespace MonoDevelop.VersionControl.Tests
{
string content = "text";
AddFile ("testfile", null, true, true);
- string added = RootCheckout + "testfile";
+ string added = LocalPath + "testfile";
// Revert to head.
File.WriteAllText (added, content);
@@ -311,7 +311,10 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.RevertRevision.
public virtual void RevertsRevision ()
{
- string added = RootCheckout + "testfile2";
+ if (!Repo.SupportsRevertRevision)
+ Assert.Ignore ("No support for reverting a specific revision.");
+
+ string added = LocalPath + "testfile2";
AddFile ("testfile", "text", true, true);
AddFile ("testfile2", "text2", true, true);
Repo.RevertRevision (added, GetHeadRevision (), new NullProgressMonitor ());
@@ -322,7 +325,7 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.MoveFile.
public virtual void MovesFile ()
{
- string src = RootCheckout + "testfile";
+ string src = LocalPath + "testfile";
string dst = src + "2";
AddFile ("testfile", null, true, true);
@@ -338,8 +341,8 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.MoveDirectory.
public virtual void MovesDirectory ()
{
- string srcDir = RootCheckout + "test";
- string dstDir = RootCheckout + "test2";
+ string srcDir = LocalPath + "test";
+ string dstDir = LocalPath + "test2";
string src = srcDir + Path.DirectorySeparatorChar + "testfile";
string dst = dstDir + Path.DirectorySeparatorChar + "testfile";
@@ -358,7 +361,7 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.DeleteFile.
public virtual void DeletesFile ()
{
- string added = RootCheckout + "testfile";
+ string added = LocalPath + "testfile";
AddFile ("testfile", null, true, true);
Repo.DeleteFile (added, true, new NullProgressMonitor ());
VersionInfo vi = Repo.GetVersionInfo (added, VersionInfoQueryFlags.IgnoreCache);
@@ -369,7 +372,7 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.DeleteDirectory.
public virtual void DeletesDirectory ()
{
- string addedDir = RootCheckout + "test";
+ string addedDir = LocalPath + "test";
string added = addedDir + Path.DirectorySeparatorChar + "testfile";
AddDirectory ("test", true, false);
AddFile ("testfile", null, true, true);
@@ -383,7 +386,7 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.Lock.
public virtual void LocksEntities ()
{
- string added = RootCheckout + "testfile";
+ string added = LocalPath + "testfile";
AddFile ("testfile", null, true, true);
Repo.Lock (new NullProgressMonitor (), added);
@@ -398,7 +401,7 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.Unlock.
public virtual void UnlocksEntities ()
{
- string added = RootCheckout + "testfile";
+ string added = LocalPath + "testfile";
AddFile ("testfile", null, true, true);
Repo.Lock (new NullProgressMonitor (), "testfile");
Repo.Unlock (new NullProgressMonitor (), added);
@@ -414,7 +417,7 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.Ignore
public virtual void IgnoresEntities ()
{
- string added = RootCheckout + "testfile";
+ string added = LocalPath + "testfile";
AddFile ("testfile", null, false, false);
Repo.Ignore (new FilePath[] { added });
VersionInfo vi = Repo.GetVersionInfo (added, VersionInfoQueryFlags.IgnoreCache);
@@ -425,7 +428,7 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.Unignore
public virtual void UnignoresEntities ()
{
- string added = RootCheckout + "testfile";
+ string added = LocalPath + "testfile";
AddFile ("testfile", null, false, false);
Repo.Ignore (new FilePath[] { added });
Repo.Unignore (new FilePath[] { added });
@@ -441,11 +444,11 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.GetTextAtRevision.
public void CorrectTextAtRevision ()
{
- string added = RootCheckout + "testfile";
+ string added = LocalPath + "testfile";
AddFile ("testfile", "text1", true, true);
File.AppendAllText (added, "text2");
CommitFile (added);
- string text = Repo.GetTextAtRevision (RootCheckout, GetHeadRevision ());
+ string text = Repo.GetTextAtRevision (LocalPath, GetHeadRevision ());
Assert.AreEqual ("text1text2", text);
}
@@ -453,7 +456,7 @@ namespace MonoDevelop.VersionControl.Tests
// Tests Repository.GetAnnotations.
public void BlameIsCorrect ()
{
- string added = RootCheckout + "testfile";
+ string added = LocalPath + "testfile";
// Initial commit.
AddFile ("testfile", "blah" + Environment.NewLine, true, true);
// Second commit.
@@ -529,7 +532,7 @@ namespace MonoDevelop.VersionControl.Tests
void AddToRepository (string relativePath, string contents, bool toVcs, bool commit)
{
- string added = Path.Combine (RootCheckout, relativePath);
+ string added = Path.Combine (LocalPath, relativePath);
if (contents == null)
Directory.CreateDirectory (added);
else
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/GitIntegrityTests.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/GitIntegrityTests.cs
index dda454879a..3c9e70fc9c 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/GitIntegrityTests.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/GitIntegrityTests.cs
@@ -227,7 +227,7 @@ namespace MonoDevelop.VersionControl.Git.Tests
public void GetCommitChangesAddedRemoved ()
{
var commit = "9ed729ee";
- var changes = GitUtil.CompareCommits (repo, repo.Resolve (commit), repo.Resolve (commit + "^")).ToArray ();
+ var changes = GitUtil.CompareCommits (repo, repo.Resolve (commit + "^"), repo.Resolve (commit)).ToArray ();
var add = changes.First (c => c.GetNewPath ().EndsWith ("DocumentLine.cs", StringComparison.Ordinal));
var remove = changes.First (c => c.GetOldPath ().EndsWith ("LineSegment.cs", StringComparison.Ordinal));
@@ -256,7 +256,7 @@ namespace MonoDevelop.VersionControl.Git.Tests
"TextViewMargin.cs",
};
- var changes = GitUtil.CompareCommits (repo, repo.Resolve (commit), repo.Resolve (commit + "^")).ToArray ();
+ var changes = GitUtil.CompareCommits (repo, repo.Resolve (commit + "^"), repo.Resolve (commit)).ToArray ();
Assert.AreEqual (11, changes.Length, "#1");
foreach (var file in changedFiles)
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/AssemblyInfo.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/AssemblyInfo.cs
index 7cc4b863f3..70b0a32308 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/AssemblyInfo.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/AssemblyInfo.cs
@@ -9,5 +9,4 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyVersion ("2.6")]
[assembly: AssemblyCopyright ("LGPL")]
-[assembly:InternalsVisibleTo ("UnitTests")]
[assembly:InternalsVisibleTo ("MonoDevelop.VersionControl.Git.Tests")]
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git.addin.xml b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git.addin.xml
index 1f7a269b96..90464f077d 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git.addin.xml
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git.addin.xml
@@ -11,7 +11,7 @@
<Extension path = "/MonoDevelop/Ide/Commands/VersionControl">
<Command id = "MonoDevelop.VersionControl.Git.Commands.Push"
_label = "Push Changes..."
- icon = "vcs-push"
+ icon = "vc-push"
defaultHandler = "MonoDevelop.VersionControl.Git.PushCommandHandler"
description = "Push changes to a remote repository."/>
<Command id = "MonoDevelop.VersionControl.Git.Commands.SwitchToBranch"
@@ -79,7 +79,7 @@
</Extension>
<Extension path = "/MonoDevelop/Ide/GlobalOptionsDialog/VersionControl">
- <Section id = "Git" _label = "Git" class = "MonoDevelop.VersionControl.Git.GitOptionsPanel" />
+ <Section id = "Git" _label = "Git" class = "MonoDevelop.VersionControl.Git.GitOptionsPanel" icon="md-prefs-git" />
</Extension>
<!-- <Extension path = "/MonoDevelop/Ide/ProjectFeatures">
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Commands.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Commands.cs
index 13b3fd9da2..b624b70f0e 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Commands.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/Commands.cs
@@ -132,24 +132,27 @@ namespace MonoDevelop.VersionControl.Git
{
var stashes = Repository.GetStashes ();
NewStashDialog dlg = new NewStashDialog ();
- if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
- string comment = dlg.Comment;
- MessageDialogProgressMonitor monitor = new MessageDialogProgressMonitor (true, false, false, true);
- var statusTracker = IdeApp.Workspace.GetFileStatusTracker ();
- ThreadPool.QueueUserWorkItem (delegate {
- try {
- using (var gm = new GitMonitor (monitor))
- stashes.Create (gm, comment);
- } catch (Exception ex) {
- MessageService.ShowException (ex);
- }
- finally {
- monitor.Dispose ();
- statusTracker.NotifyChanges ();
- }
- });
+ try {
+ if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
+ string comment = dlg.Comment;
+ MessageDialogProgressMonitor monitor = new MessageDialogProgressMonitor (true, false, false, true);
+ var statusTracker = IdeApp.Workspace.GetFileStatusTracker ();
+ ThreadPool.QueueUserWorkItem (delegate {
+ try {
+ using (var gm = new GitMonitor (monitor))
+ stashes.Create (gm, comment);
+ } catch (Exception ex) {
+ MessageService.ShowException (ex);
+ }
+ finally {
+ monitor.Dispose ();
+ statusTracker.NotifyChanges ();
+ }
+ });
+ }
+ } finally {
+ dlg.Destroy ();
}
- dlg.Destroy ();
}
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/EditBranchDialog.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/EditBranchDialog.cs
index b9d5b6b91d..ee9e6dfd39 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/EditBranchDialog.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/EditBranchDialog.cs
@@ -70,7 +70,7 @@ namespace MonoDevelop.VersionControl.Git
foreach (RemoteSource r in repo.GetRemotes ()) {
foreach (string b in repo.GetRemoteBranches (r.Name))
- AddValues (r.Name + "/" + b, ImageService.GetIcon ("md-web-search-icon", IconSize.Menu));
+ AddValues (r.Name + "/" + b, ImageService.GetIcon ("vc-repository", IconSize.Menu));
}
UpdateStatus ();
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs
index 61d4cb2f8a..144e81b7ce 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs
@@ -161,18 +161,32 @@ namespace MonoDevelop.VersionControl.Git
return new StashCollection (repository);
}
+ IEnumerable<string> GetSubmodulePaths ()
+ {
+ if (!File.Exists (RootPath.Combine (Constants.DOT_GIT_MODULES)))
+ return new List<string> ();
+
+ var lines = File.ReadAllLines (RootPath.Combine (Constants.DOT_GIT_MODULES));
+ // Parses .gitmodules to get all submodules paths.
+ var res = lines.Where (l => l.Contains ("path = ")).Select (l => l.Substring (l.LastIndexOf (" ", StringComparison.Ordinal) + 1));
+ return res;
+ }
+
DateTime cachedSubmoduleTime = DateTime.MinValue;
- Tuple<FilePath, NGit.Repository>[] cachedSubmodules = new Tuple<FilePath, NGit.Repository>[0];
- Tuple<FilePath, NGit.Repository>[] CachedSubmodules {
+ NGit.Repository[] cachedSubmodules = new NGit.Repository[0];
+ NGit.Repository[] CachedSubmodules {
get {
- var submoduleWriteTime = File.GetLastWriteTimeUtc(RootPath.Combine(".gitmodule"));
+ var submoduleWriteTime = File.GetLastWriteTimeUtc(RootPath.Combine(Constants.DOT_GIT_MODULES));
if (cachedSubmoduleTime != submoduleWriteTime) {
cachedSubmoduleTime = submoduleWriteTime;
- cachedSubmodules = new NGit.Api.Git (RootRepository)
- .SubmoduleStatus ()
- .Call ()
- .Select(s => Tuple.Create ((FilePath) s.Key, SubmoduleWalk.GetSubmoduleRepository (RootRepository, s.Key)))
- .ToArray ();
+ var submoduleStatus = new NGit.Api.Git (RootRepository).SubmoduleStatus ();
+ foreach (var submodule in GetSubmodulePaths ())
+ submoduleStatus.AddPath (submodule);
+
+ cachedSubmodules = submoduleStatus.Call ()
+ .Select(s => SubmoduleWalk.GetSubmoduleRepository (RootRepository, s.Key))
+ .Where(s => s != null) // TODO: Make this so we can tell user to clone them.
+ .ToArray ();
}
return cachedSubmodules;
}
@@ -186,16 +200,16 @@ namespace MonoDevelop.VersionControl.Git
IEnumerable<IGrouping<NGit.Repository, FilePath>> GroupByRepository (IEnumerable<FilePath> files)
{
var cache = CachedSubmodules;
- return files.GroupBy (f => cache.Where (s => {
- var fullPath = s.Item1.ToAbsolute (RootPath);
- return f.IsChildPathOf (fullPath) || f.CanonicalPath == fullPath.CanonicalPath;
- }).Select (s => s.Item2).FirstOrDefault () ?? RootRepository);
+ return files.GroupBy (f => cache.FirstOrDefault (s => {
+ var fullPath = s.WorkTree.ToString ();
+ return f.IsChildPathOf (fullPath) || f.FullPath == fullPath;
+ }) ?? RootRepository);
}
protected override Revision[] OnGetHistory (FilePath localFile, Revision since)
{
List<Revision> revs = new List<Revision> ();
-
+
var repository = GetRepository (localFile);
var hc = GetHeadCommit (repository);
if (hc == null)
@@ -249,8 +263,8 @@ namespace MonoDevelop.VersionControl.Git
// Used for checking if we will dupe data.
// This way we reduce the number of GitRevisions created and RevWalks done.
- NGit.Repository versionInfoCacheRepository;
- GitRevision versionInfoCacheRevision;
+ Dictionary<NGit.Repository, GitRevision> versionInfoCacheRevision = new Dictionary<NGit.Repository, GitRevision> ();
+ Dictionary<NGit.Repository, GitRevision> versionInfoCacheEmptyRevision = new Dictionary<NGit.Repository, GitRevision> ();
VersionInfo[] GetDirectoryVersionInfo (FilePath localDirectory, IEnumerable<FilePath> localFileNames, bool getRemoteStatus, bool recursive)
{
List<VersionInfo> versions = new List<VersionInfo> ();
@@ -261,7 +275,11 @@ namespace MonoDevelop.VersionControl.Git
var localFiles = new List<FilePath> ();
foreach (var group in GroupByRepository (localFileNames)) {
var repository = group.Key;
- var arev = new GitRevision (this, repository, "");
+ GitRevision arev;
+ if (!versionInfoCacheEmptyRevision.TryGetValue (repository, out arev)) {
+ arev = new GitRevision (this, repository, "");
+ versionInfoCacheEmptyRevision.Add (repository, arev);
+ }
foreach (var p in group) {
if (Directory.Exists (p)) {
if (recursive)
@@ -287,7 +305,11 @@ namespace MonoDevelop.VersionControl.Git
CollectFiles (existingFiles, directories, localDirectory, recursive);
foreach (var group in GroupByRepository (directories)) {
var repository = group.Key;
- var arev = new GitRevision (this, repository, "");
+ GitRevision arev;
+ if (!versionInfoCacheEmptyRevision.TryGetValue (repository, out arev)) {
+ arev = new GitRevision (this, repository, "");
+ versionInfoCacheEmptyRevision.Add (repository, arev);
+ }
foreach (var p in group)
versions.Add (new VersionInfo (p, "", true, VersionStatus.Versioned, arev, VersionStatus.Versioned, null));
}
@@ -311,15 +333,16 @@ namespace MonoDevelop.VersionControl.Git
var repository = group.Key;
GitRevision rev = null;
- if (versionInfoCacheRepository == null || versionInfoCacheRepository != repository) {
- versionInfoCacheRepository = repository;
- RevCommit headCommit = GetHeadCommit (repository);
- if (headCommit != null) {
+ RevCommit headCommit = GetHeadCommit (repository);
+ if (headCommit != null) {
+ if (!versionInfoCacheRevision.TryGetValue (repository, out rev)) {
rev = new GitRevision (this, repository, headCommit.Id.Name);
- versionInfoCacheRevision = rev;
+ versionInfoCacheRevision.Add (repository, rev);
+ } else if (rev.ToString () != headCommit.Id.Name) {
+ rev = new GitRevision (this, repository, headCommit.Id.Name);
+ versionInfoCacheRevision [repository] = rev;
}
- } else
- rev = versionInfoCacheRevision;
+ }
GetDirectoryVersionInfoCore (repository, rev, group, existingFiles, nonVersionedMissingFiles, versions);
@@ -378,14 +401,12 @@ namespace MonoDevelop.VersionControl.Git
{
if (!Directory.Exists (dir))
return;
- foreach (string file in Directory.GetFiles (dir))
- files.Add (new FilePath (file).CanonicalPath);
- foreach (string sub in Directory.GetDirectories (dir)) {
- directories.Add (new FilePath (sub));
- if (recursive)
- CollectFiles (files, directories, sub, true);
- }
+ directories.AddRange (Directory.GetDirectories (dir, "*", recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly)
+ .Select (f => new FilePath (f)));
+
+ files.UnionWith (Directory.GetFiles (dir, "*", recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly)
+ .Select (f => new FilePath (f).CanonicalPath));
}
protected override Repository OnPublish (string serverPath, FilePath localPath, FilePath[] files, string message, IProgressMonitor monitor)
@@ -480,14 +501,14 @@ namespace MonoDevelop.VersionControl.Git
// Iterate submodules and do status.
// SubmoduleStatus does not report changes for dirty submodules.
foreach (var submodule in CachedSubmodules) {
- var submoduleGit = new NGit.Api.Git (submodule.Item2);
+ var submoduleGit = new NGit.Api.Git (submodule);
var statusCommand = submoduleGit.Status ();
var status = statusCommand.Call ();
if (status.IsClean ())
- updateSubmodules.Add (submodule.Item1);
+ updateSubmodules.Add (RootRepository.ToGitPath (submodule.WorkTree.GetAbsolutePath ()));
else
- dirtySubmodules.Add (submodule.Item1);
+ dirtySubmodules.Add (RootRepository.ToGitPath (submodule.WorkTree.GetAbsolutePath ()));
}
if (dirtySubmodules.Count != 0) {
@@ -515,12 +536,6 @@ namespace MonoDevelop.VersionControl.Git
return true;
}
- [Obsolete ("Will be removed. Please use the one with GitUpdateOptions flags.")]
- public void Rebase (string upstreamRef, bool saveLocalChanges, IProgressMonitor monitor)
- {
- Rebase (upstreamRef, saveLocalChanges ? GitUpdateOptions.SaveLocalChanges : GitUpdateOptions.None, monitor);
- }
-
public void Rebase (string upstreamRef, GitUpdateOptions options, IProgressMonitor monitor)
{
StashCollection stashes = GitUtil.GetStashes (RootRepository);
@@ -645,12 +660,6 @@ namespace MonoDevelop.VersionControl.Git
}
}
- [Obsolete ("Will be removed. Please use the one with GitUpdateOptions flags.")]
- public void Merge (string upstreamRef, bool saveLocalChanges, IProgressMonitor monitor)
- {
- Merge (upstreamRef, saveLocalChanges ? GitUpdateOptions.SaveLocalChanges : GitUpdateOptions.None, monitor);
- }
-
public void Merge (string branch, GitUpdateOptions options, IProgressMonitor monitor)
{
IEnumerable<DiffEntry> statusList = null;
@@ -735,8 +744,8 @@ namespace MonoDevelop.VersionControl.Git
if ((options & GitUpdateOptions.UpdateSubmodules) == GitUpdateOptions.UpdateSubmodules) {
monitor.Log.WriteLine (GettextCatalog.GetString ("Updating repository submodules"));
var submoduleUpdate = git.SubmoduleUpdate ();
- foreach (var submodule in CachedSubmodules)
- submoduleUpdate.AddPath (submodule.Item1);
+ foreach (var submodule in UpdateSubmodules)
+ submoduleUpdate.AddPath (submodule);
submoduleUpdate.Call ();
monitor.Step (1);
@@ -766,7 +775,6 @@ namespace MonoDevelop.VersionControl.Git
ConflictResult res = ConflictResult.Abort;
DispatchService.GuiSyncDispatch (delegate {
ConflictResolutionDialog dlg = new ConflictResolutionDialog ();
- dlg.Load (file);
try {
dlg.Load (file);
var dres = (Gtk.ResponseType) MessageService.RunCustomDialog (dlg);
@@ -995,23 +1003,9 @@ namespace MonoDevelop.VersionControl.Git
protected override void OnRevertRevision (FilePath localPath, Revision revision, IProgressMonitor monitor)
{
- var git = new NGit.Api.Git (GetRepository (localPath));
- var gitRev = (GitRevision)revision;
- var revert = git.Revert ().Include (gitRev.Commit.ToObjectId ());
- revert.Call ();
-
- var revertResult = revert.GetFailingResult ();
- if (revertResult == null) {
- monitor.ReportSuccess (GettextCatalog.GetString ("Revision {0} successfully reverted", gitRev));
- } else {
- var errorMessage = GettextCatalog.GetString ("Could not revert commit {0}", gitRev);
- var description = GettextCatalog.GetString ("The following files had merge conflicts");
- description += Environment.NewLine + string.Join (Environment.NewLine, revertResult.GetFailingPaths ().Keys);
- monitor.ReportError (errorMessage, new UserException (errorMessage, description));
- }
+ throw new NotSupportedException ();
}
-
protected override void OnRevertToRevision (FilePath localPath, Revision revision, IProgressMonitor monitor)
{
NGit.Repository repo = GetRepository (localPath);
@@ -1019,9 +1013,8 @@ namespace MonoDevelop.VersionControl.Git
GitRevision gitRev = (GitRevision)revision;
// Rewrite file data from selected revision.
- foreach (var path in GetFilesInPaths (new FilePath[] { localPath })) {
- MonoDevelop.Projects.Text.TextFile.WriteFile (path, GetCommitTextContent (gitRev.Commit, path), null);
- }
+ foreach (var path in GetFilesInPaths (new [] { localPath }))
+ MonoDevelop.Projects.Text.TextFile.WriteFile (repo.FromGitPath (path), GetCommitTextContent (gitRev.Commit, path), null);
monitor.ReportSuccess (GettextCatalog.GetString ("Successfully reverted {0} to revision {1}", localPath, gitRev));
}
@@ -1041,11 +1034,6 @@ namespace MonoDevelop.VersionControl.Git
}
}
- [Obsolete ("Use the overload with keepLocal parameter")]
- protected override void OnDeleteFiles (FilePath[] localPaths, bool force, IProgressMonitor monitor)
- {
- }
-
protected override void OnDeleteFiles (FilePath[] localPaths, bool force, IProgressMonitor monitor, bool keepLocal)
{
DeleteCore (localPaths, force, monitor, keepLocal);
@@ -1066,11 +1054,6 @@ namespace MonoDevelop.VersionControl.Git
}
}
- [Obsolete ("Use the overload with keepLocal parameter")]
- protected override void OnDeleteDirectories (FilePath[] localPaths, bool force, IProgressMonitor monitor)
- {
- }
-
protected override void OnDeleteDirectories (FilePath[] localPaths, bool force, IProgressMonitor monitor, bool keepLocal)
{
DeleteCore (localPaths, force, monitor, keepLocal);
@@ -1150,14 +1133,14 @@ namespace MonoDevelop.VersionControl.Git
var repository = GetRepository (baseLocalPath);
if ((versionInfo.Status & VersionStatus.ScheduledAdd) != 0) {
var ctxt = GetFileContent (versionInfo.LocalPath);
- return new DiffInfo (baseLocalPath, versionInfo.LocalPath, GenerateDiff (EmptyContent, ctxt));
+ return new DiffInfo (baseLocalPath, versionInfo.LocalPath, GenerateDiff (EmptyContent, ctxt, repository));
} else if ((versionInfo.Status & VersionStatus.ScheduledDelete) != 0) {
var ctxt = GetCommitContent (GetHeadCommit (repository), versionInfo.LocalPath);
- return new DiffInfo (baseLocalPath, versionInfo.LocalPath, GenerateDiff (ctxt, EmptyContent));
+ return new DiffInfo (baseLocalPath, versionInfo.LocalPath, GenerateDiff (ctxt, EmptyContent, repository));
} else if ((versionInfo.Status & VersionStatus.Modified) != 0 || (versionInfo.Status & VersionStatus.Conflicted) != 0) {
var ctxt1 = GetCommitContent (GetHeadCommit (repository), versionInfo.LocalPath);
var ctxt2 = GetFileContent (versionInfo.LocalPath);
- return new DiffInfo (baseLocalPath, versionInfo.LocalPath, GenerateDiff (ctxt1, ctxt2));
+ return new DiffInfo (baseLocalPath, versionInfo.LocalPath, GenerateDiff (ctxt1, ctxt2, repository));
}
} catch (Exception ex) {
LoggingService.LogError ("Could not get diff for file '" + versionInfo.LocalPath + "'", ex);
@@ -1185,7 +1168,7 @@ namespace MonoDevelop.VersionControl.Git
byte[] GetCommitContent (RevCommit c, FilePath file)
{
var repository = GetRepository (file);
- TreeWalk tw = TreeWalk.ForPath (repository, repository.ToGitPath (file), c.Tree);
+ TreeWalk tw = TreeWalk.ForPath (repository, file.IsAbsolute ? repository.ToGitPath (file) : (string)file, c.Tree);
if (tw == null)
return EmptyContent;
ObjectId id = tw.GetObjectId (0);
@@ -1196,11 +1179,11 @@ namespace MonoDevelop.VersionControl.Git
{
var content = GetCommitContent (c, file);
if (RawText.IsBinary (content))
- return null;
+ return String.Empty;
return Mono.TextEditor.Utils.TextFileUtility.GetText (content);
}
- static string GenerateDiff (byte[] data1, byte[] data2)
+ static string GenerateDiff (byte[] data1, byte[] data2, NGit.Repository repo)
{
if (RawText.IsBinary (data1) || RawText.IsBinary (data2)) {
if (data1.Length != data2.Length)
@@ -1220,38 +1203,11 @@ namespace MonoDevelop.VersionControl.Git
.Diff (RawTextComparator.DEFAULT, text1, text2);
MemoryStream s = new MemoryStream ();
var formatter = new DiffFormatter (s);
+ formatter.SetRepository (repo);
formatter.Format (edits, text1, text2);
return Encoding.UTF8.GetString (s.ToArray ());
}
- DiffInfo[] GetUnifiedDiffInfo (string diffContent, FilePath basePath, FilePath[] localPaths)
- {
- basePath = basePath.FullPath;
- List<DiffInfo> list = new List<DiffInfo> ();
- using (StringReader sr = new StringReader (diffContent)) {
- string line;
- StringBuilder content = new StringBuilder ();
- string fileName = null;
-
- while ((line = sr.ReadLine ()) != null) {
- if (line.StartsWith ("+++ ", StringComparison.Ordinal) || line.StartsWith ("--- ", StringComparison.Ordinal)) {
- string newFile = RootPath.Combine (line.Substring (6));
- if (fileName != null && fileName != newFile) {
- list.Add (new DiffInfo (basePath, fileName, content.ToString ().Trim ('\n')));
- content = new StringBuilder ();
- }
- fileName = newFile;
- } else if (!line.StartsWith ("diff", StringComparison.Ordinal) && !line.StartsWith ("index", StringComparison.Ordinal)) {
- content.Append (line).Append ('\n');
- }
- }
- if (fileName != null) {
- list.Add (new DiffInfo (basePath, fileName, content.ToString ().Trim ('\n')));
- }
- }
- return list.ToArray ();
- }
-
public string GetCurrentRemote ()
{
List<string> remotes = new List<string> (GetRemotes ().Select (r => r.Name));
@@ -1572,7 +1528,7 @@ namespace MonoDevelop.VersionControl.Git
RevCommit c1 = rw.ParseCommit (cid1);
RevCommit c2 = rw.ParseCommit (cid2);
- foreach (var change in GitUtil.CompareCommits (RootRepository, c2, c1)) {
+ foreach (var change in GitUtil.CompareCommits (RootRepository, c1, c2)) {
VersionStatus status;
switch (change.GetChangeType ()) {
case DiffEntry.ChangeType.ADD:
@@ -1600,17 +1556,17 @@ namespace MonoDevelop.VersionControl.Git
RevCommit c2 = rw.ParseCommit (cid2);
List<DiffInfo> diffs = new List<DiffInfo> ();
- foreach (var change in GitUtil.CompareCommits (RootRepository, c2, c1)) {
+ foreach (var change in GitUtil.CompareCommits (RootRepository, c1, c2)) {
string diff;
switch (change.GetChangeType ()) {
case DiffEntry.ChangeType.DELETE:
- diff = GenerateDiff (EmptyContent, GetCommitContent (c2, change.GetOldPath ()));
+ diff = GenerateDiff (GetCommitContent (c2, change.GetOldPath ()), EmptyContent, RootRepository);
break;
case DiffEntry.ChangeType.ADD:
- diff = GenerateDiff (GetCommitContent (c1, change.GetNewPath ()), EmptyContent);
+ diff = GenerateDiff (EmptyContent, GetCommitContent (c1, change.GetNewPath ()), RootRepository);
break;
default:
- diff = GenerateDiff (GetCommitContent (c1, change.GetNewPath ()), GetCommitContent (c2, change.GetNewPath ()));
+ diff = GenerateDiff (GetCommitContent (c1, change.GetNewPath ()), GetCommitContent (c2, change.GetNewPath ()), RootRepository);
break;
}
DiffInfo di = new DiffInfo (RootPath, RootRepository.FromGitPath (change.GetNewPath ()), diff);
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs
index fa11bb6fd9..41ffac25fd 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs
@@ -112,8 +112,7 @@ namespace MonoDevelop.VersionControl.Git
public static void ShowStashManager (GitRepository repo)
{
StashManagerDialog dlg = new StashManagerDialog (repo);
- MessageService.RunCustomDialog (dlg);
- dlg.Destroy ();
+ MessageService.ShowCustomDialog (dlg);
}
public static void SwitchToBranch (GitRepository repo, string branch)
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitUtil.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitUtil.cs
index ba517fe035..2b56ef3e51 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitUtil.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitUtil.cs
@@ -97,24 +97,23 @@ namespace MonoDevelop.VersionControl.Git
{
var rev = commit.ToObjectId ();
var prev = repo.Resolve (commit.Name + "^") ?? ObjectId.ZeroId;
- return CompareCommits (repo, rev, prev);
+ return CompareCommits (repo, prev, rev);
}
public static IEnumerable<DiffEntry> CompareCommits (NGit.Repository repo, AnyObjectId reference, ObjectId compared)
{
var diff = new MyersDiff (repo);
- var firstTree = new CanonicalTreeParser ();
- firstTree.Reset (repo.NewObjectReader (), new RevWalk (repo).ParseTree (reference));
- diff.SetNewTree (firstTree);
-
- if (compared != ObjectId.ZeroId) {
- var secondTree = new CanonicalTreeParser ();
- secondTree.Reset (repo.NewObjectReader (), new RevWalk (repo).ParseTree (compared));
-
- if (compared != ObjectId.ZeroId)
- diff.SetOldTree (secondTree);
+ if (reference != ObjectId.ZeroId) {
+ var firstTree = new CanonicalTreeParser ();
+ firstTree.Reset (repo.NewObjectReader (), new RevWalk (repo).ParseTree (reference));
+ diff.SetOldTree (firstTree);
}
+
+ var secondTree = new CanonicalTreeParser ();
+ secondTree.Reset (repo.NewObjectReader (), new RevWalk (repo).ParseTree (compared));
+ diff.SetNewTree (secondTree);
+
return diff.Call ();
}
@@ -209,7 +208,7 @@ namespace MonoDevelop.VersionControl.Git
return null;
RevCommit headCommit = rw.ParseCommit (headId);
- return GitUtil.CompareCommits (repo, headCommit, remCommit);
+ return GitUtil.CompareCommits (repo, remCommit, headCommit);
}
public static string GetUpstreamSource (NGit.Repository repo, string branch)
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/MergeDialog.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/MergeDialog.cs
index 5b43f71389..15b18b1f74 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/MergeDialog.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/MergeDialog.cs
@@ -107,7 +107,7 @@ namespace MonoDevelop.VersionControl.Git
store.AppendValues (t, ImageService.GetIcon ("vc-tag", IconSize.Menu), t, "tag");
foreach (RemoteSource r in repo.GetRemotes ()) {
- TreeIter it = store.AppendValues (null, ImageService.GetIcon ("md-web-search-icon", IconSize.Menu), r.Name, null);
+ TreeIter it = store.AppendValues (null, ImageService.GetIcon ("vc-repository", IconSize.Menu), r.Name, null);
foreach (string b in repo.GetRemoteBranches (r.Name))
store.AppendValues (it, r.Name + "/" + b, ImageService.GetIcon ("vc-branch", IconSize.Menu), b, "remote");
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/UniqueIdentifier.targets b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/UniqueIdentifier.targets
new file mode 100644
index 0000000000..84d9be6fa1
--- /dev/null
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/UniqueIdentifier.targets
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
+ <!-- Import the version of CustomBuildTasks.dll that is dropped in the repository. -->
+ <UsingTask TaskName="GenerateUniqueIdentifierTask" AssemblyFile="..\Lib\CustomBuildTasks\CustomBuildTasks.dll" />
+
+ <!-- Set the path of the generated UniqueIdentifier.cs file. -->
+ <PropertyGroup>
+ <!-- To allow this target to be run from other directories besides the current one,
+ we use construct the relative path to output UniqueIdentifer.cs from this directory.
+ As not all versions of xbuild support the MSBuildThisFileDirectory property, we
+ we check and fall back to the current directory if the MSBuildThisFileDirectory property
+ is empty. -->
+ <LibGit2SharpPath Condition="'$(MSBuildThisFileDirectory)' == ''">.</LibGit2SharpPath>
+ <LibGit2SharpPath Condition="'$(MSBuildThisFileDirectory)' != ''">$(MSBuildThisFileDirectory)</LibGit2SharpPath>
+ <UniqueIdentifierPath>$(LibGit2SharpPath)\Core\UniqueIdentifier.cs</UniqueIdentifierPath>
+ <CoreCompileDependsOn>$(CoreCompileDependsOn);GenerateUniqueIdentifierCs</CoreCompileDependsOn>
+ <CoreCleanDependsOn>$(CoreCleanDependsOn);CleanUniqueIdentifierCs</CoreCleanDependsOn>
+ </PropertyGroup>
+
+ <!-- This target runs if any of the projects or .cs files for the project have changed since the last time
+ the UniqueIdentifier.cs file was generated. -->
+ <Target Name="GenerateUniqueIdentifierCs"
+ Inputs="$(MSBuildThisFileFullPath);$(MSBuildAllProjects);@(Compile)"
+ Outputs="$(UniqueIdentifierPath)">
+ <GenerateUniqueIdentifierTask OutputFile="$(UniqueIdentifierPath)" />
+ </Target>
+
+ <Target Name="CleanUniqueIdentifierCs">
+ <Delete Files="$(UniqueIdentifierPath)" />
+ </Target>
+</Project>
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/BaseSvnRepositoryTests.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/BaseSvnRepositoryTests.cs
index cf2bb0be44..3a13ada0ac 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/BaseSvnRepositoryTests.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/BaseSvnRepositoryTests.cs
@@ -44,13 +44,13 @@ namespace MonoDevelop.VersionControl.Subversion.Tests
ProcessStartInfo info;
// Generate directories and a svn util.
- RootCheckout = new FilePath (FileService.CreateTempDirectory () + Path.DirectorySeparatorChar);
+ LocalPath = new FilePath (FileService.CreateTempDirectory () + Path.DirectorySeparatorChar);
// Create repo in "repo".
svnAdmin = new Process ();
info = new ProcessStartInfo ();
info.FileName = "svnadmin";
- info.Arguments = "create " + RootUrl + Path.DirectorySeparatorChar + "repo";
+ info.Arguments = "create " + RemotePath + Path.DirectorySeparatorChar + "repo";
info.WindowStyle = ProcessWindowStyle.Hidden;
svnAdmin.StartInfo = info;
svnAdmin.Start ();
@@ -62,13 +62,13 @@ namespace MonoDevelop.VersionControl.Subversion.Tests
if (SvnServe != null) {
info = new ProcessStartInfo ();
info.FileName = "svnserve";
- info.Arguments = "-dr " + RootUrl;
+ info.Arguments = "-dr " + RemotePath;
info.WindowStyle = ProcessWindowStyle.Hidden;
SvnServe.StartInfo = info;
SvnServe.Start ();
// Create user to auth.
- using (var perm = File. CreateText (RootUrl + Path.DirectorySeparatorChar + "repo" +
+ using (var perm = File. CreateText (RemotePath + Path.DirectorySeparatorChar + "repo" +
Path.DirectorySeparatorChar + "conf" + Path.DirectorySeparatorChar + "svnserve.conf")) {
perm.WriteLine ("[general]");
perm.WriteLine ("anon-access = write");
@@ -77,8 +77,8 @@ namespace MonoDevelop.VersionControl.Subversion.Tests
}
// Check out the repository.
- Checkout (RootCheckout, RepoLocation);
- Repo = GetRepo (RootCheckout, RepoLocation);
+ Checkout (LocalPath, RemoteUrl);
+ Repo = GetRepo (LocalPath, RemoteUrl);
DotDir = ".svn";
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/RepositoryTests.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/RepositoryTests.cs
index 35373469e4..c3d6273c9d 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/RepositoryTests.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/RepositoryTests.cs
@@ -49,8 +49,8 @@ namespace VersionControl.Subversion.Unix.Tests
[SetUp]
public override void Setup ()
{
- RootUrl = new FilePath (FileService.CreateTempDirectory ());
- RepoLocation = "file://" + RootUrl + "/repo";
+ RemotePath = new FilePath (FileService.CreateTempDirectory ());
+ RemoteUrl = "file://" + RemotePath + "/repo";
base.Setup ();
}
@@ -72,7 +72,7 @@ namespace VersionControl.Subversion.Unix.Tests
@@ -0,0 +1 @@
+text
";
- Assert.AreEqual (difftext, Repo.GenerateDiff (RootCheckout + "testfile", Repo.GetVersionInfo (RootCheckout + "testfile", VersionInfoQueryFlags.IgnoreCache)).Content);
+ Assert.AreEqual (difftext, Repo.GenerateDiff (LocalPath + "testfile", Repo.GetVersionInfo (LocalPath + "testfile", VersionInfoQueryFlags.IgnoreCache)).Content);
}
// Tests that fail due to Subversion giving wrong data.
@@ -106,7 +106,7 @@ namespace VersionControl.Subversion.Unix.Tests
protected override void PostLock ()
{
- string added = RootCheckout + "testfile";
+ string added = LocalPath + "testfile";
Assert.Throws<Exception> (delegate {
File.WriteAllText (added, "text");
});
@@ -121,7 +121,7 @@ namespace VersionControl.Subversion.Unix.Tests
protected override void PostUnlock ()
{
- string added = RootCheckout + "testfile";
+ string added = LocalPath + "testfile";
Assert.DoesNotThrow (delegate {
File.WriteAllText (added, "text");
});
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix.dll.config b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix.dll.config
index 4a8ce0a63f..1e3a4be805 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix.dll.config
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix.dll.config
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<dllmap os="osx" dll="libsvn_client-1.so.0" target="libsvn_client-1.dylib" />
+ <dllmap os="osx" dll="libsvn_client-1.so.1" target="libsvn_client-1.dylib" />
<dllmap os="osx" dll="libapr-0.so.0" target="libapr-1.0.dylib" />
+ <dllmap os="osx" dll="libapr-1.so.0" target="libapr-1.0.dylib" />
<dllmap os="freebsd" dll="libapr-0.so.0" target="libapr-1.so" />
</configuration> \ No newline at end of file
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix/SvnClient.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix/SvnClient.cs
index 6b45a7539f..b94c055d25 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix/SvnClient.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix/SvnClient.cs
@@ -42,14 +42,14 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
CheckError (error, null);
}
- public static void CheckError (IntPtr error, int? allowedError)
+ public static SubversionException CheckErrorNoThrow (IntPtr error, int? allowedError)
{
string msg = null;
int errorCode = 0; // Innermost error-code.
while (error != IntPtr.Zero) {
- LibSvnClient.svn_error_t error_t = (LibSvnClient.svn_error_t) Marshal.PtrToStructure (error, typeof (LibSvnClient.svn_error_t));
+ LibSvnClient.svn_error_t error_t = (LibSvnClient.svn_error_t)Marshal.PtrToStructure (error, typeof(LibSvnClient.svn_error_t));
if (allowedError.HasValue && error_t.apr_err == allowedError.Value)
- return;
+ return null;
errorCode = error_t.apr_err;
if (msg != null)
@@ -61,8 +61,14 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
if (msg == null)
msg = GettextCatalog.GetString ("Unknown error");
}
- if (msg != null)
- throw new SubversionException (msg, errorCode);
+ return msg != null ? new SubversionException (msg, errorCode) : null;
+ }
+
+ public static void CheckError (IntPtr error, int? allowedError)
+ {
+ SubversionException ex = CheckErrorNoThrow (error, allowedError);
+ if (ex != null)
+ throw ex;
}
static string GetErrorMessage (LibSvnClient.svn_error_t error)
@@ -202,13 +208,13 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
sealed class UnixSvnBackend : SubversionBackend
{
- protected static LibApr apr {
+ static LibApr apr {
get {
return SvnClient.Apr;
}
}
- protected static LibSvnClient svn {
+ static LibSvnClient svn {
get {
return SvnClient.Svn;
}
@@ -224,6 +230,11 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
SvnClient.CheckError (error, allowedError);
}
+ static SubversionException CheckErrorNoThrow (IntPtr error, int? allowedError)
+ {
+ return SvnClient.CheckErrorNoThrow (error, allowedError);
+ }
+
static IntPtr newpool (IntPtr parent)
{
return SvnClient.newpool (parent);
@@ -390,7 +401,8 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
static readonly LibSvnClient.svn_auth_simple_prompt_func_t OnAuthSimplePromptCallback = OnAuthSimplePrompt;
static IntPtr OnAuthSimplePrompt (ref IntPtr cred, IntPtr baton, string realm, string user_name, bool may_save, IntPtr pool)
{
- LibSvnClient.svn_auth_cred_simple_t data = new LibSvnClient.svn_auth_cred_simple_t ();
+ LibSvnClient.svn_auth_cred_simple_t data = new LibSvnClient.svn_auth_cred_simple_t ();
+ data.username = user_name;
bool ms;
if (SimpleAuthenticationPrompt (realm, may_save, ref data.username, out data.password, out ms)) {
data.may_save = ms;
@@ -649,11 +661,6 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
return annotations;
}
- public override string GetTextAtRevision (string repositoryPath, Revision revision)
- {
- return null;
- }
-
public override string GetTextAtRevision (string repositoryPath, Revision revision, string rootPath)
{
MemoryStream memstream = new MemoryStream ();
@@ -1111,6 +1118,36 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
}
}
+ public override bool HasNeedLock (FilePath file)
+ {
+ IntPtr hash_item, hash_name, hash_val;
+ int length;
+ IntPtr result;
+ IntPtr props_ptr = IntPtr.Zero;
+ StringBuilder props = new StringBuilder ();
+ string new_path;
+ LibSvnClient.svn_string_t new_props;
+ LibSvnClient.Rev rev = LibSvnClient.Rev.Working;
+
+ var localpool = TryStartOperation (null);
+ try {
+ new_path = NormalizePath (file, localpool);
+ CheckError (svn.client_propget (out result, "svn:needs-lock", new_path,
+ ref rev, false, ctx, localpool));
+ hash_item = apr.hash_first (localpool, result);
+ while (hash_item != IntPtr.Zero) {
+ apr.hash_this (hash_item, out hash_name, out length, out hash_val);
+ new_props = (LibSvnClient.svn_string_t) Marshal.PtrToStructure (hash_val, typeof (LibSvnClient.svn_string_t));
+ props.Append (Marshal.PtrToStringAnsi (new_props.data));
+ hash_item = apr.hash_next (hash_item);
+ }
+ return props.Length != 0;
+ } finally {
+ apr.pool_destroy (localpool);
+ TryEndOperation ();
+ }
+ }
+
public override string GetTextBase (string sourcefile)
{
MemoryStream data = new MemoryStream ();
@@ -1492,9 +1529,8 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
var localpool = TryStartOperation (null);
try {
string new_path = NormalizePath (path.FullPath, localpool);
- try {
- CheckError (svn.client_get_wc_root (out result, new_path, ctx, localpool, scratch));
- } catch (SubversionException e) {
+ SubversionException e = CheckErrorNoThrow (svn.client_get_wc_root (out result, new_path, ctx, localpool, scratch), null);
+ if (e != null) {
// SVN_ERR_SVN_ERR_WC_UPGRADE_REQUIRED
Upgrading = e.ErrorCode == 155036;
@@ -1513,7 +1549,7 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
case 155036:
return String.Empty;
}
- throw;
+ throw e;
}
return Marshal.PtrToStringAnsi (result);
} finally {
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/SubversionRepository.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/SubversionRepository.cs
index fae6421fae..d2d5eac1d9 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/SubversionRepository.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/SubversionRepository.cs
@@ -30,12 +30,13 @@ namespace MonoDevelop.VersionControl.Subversion
}
}
-
+
+ // TODO: Handle externals.
public override bool HasChildRepositories {
- get { return true; }
+ get { return false; }
}
- public override IEnumerable<Repository> ChildRepositories {
+ /*public override IEnumerable<Repository> ChildRepositories {
get {
List<Repository> list = new List<Repository> ();
@@ -48,6 +49,14 @@ namespace MonoDevelop.VersionControl.Subversion
}
return list;
}
+ }*/
+
+ public override bool SupportsRemoteStatus {
+ get { return true; }
+ }
+
+ public override bool SupportsRevertRevision {
+ get { return true; }
}
new SubversionVersionControl VersionControlSystem {
@@ -55,7 +64,7 @@ namespace MonoDevelop.VersionControl.Subversion
}
SubversionBackend backend;
- protected internal SubversionBackend Svn {
+ internal SubversionBackend Svn {
get {
if (backend == null)
backend = VersionControlSystem.CreateBackend ();
@@ -106,22 +115,32 @@ namespace MonoDevelop.VersionControl.Subversion
return Svn.GetSupportedOperations (this, vinfo, base.GetSupportedOperations (vinfo));
}
- public override bool RequestFileWritePermission (FilePath path)
+ public override bool RequestFileWritePermission (params FilePath[] paths)
{
- if (!File.Exists (path))
- return true;
- if ((File.GetAttributes (path) & FileAttributes.ReadOnly) == 0)
+ var toLock = new List<FilePath>();
+
+ foreach (var path in paths) {
+ if (!File.Exists (path) || !Svn.HasNeedLock (path) || (File.GetAttributes (path) & FileAttributes.ReadOnly) == 0)
+ continue;
+ toLock.Add (path);
+ }
+
+ if (toLock.Count == 0)
return true;
+
AlertButton but = new AlertButton ("Lock File");
- if (!MessageService.Confirm (GettextCatalog.GetString ("File locking required"), GettextCatalog.GetString ("The file '{0}' must be locked before editing.", path), but))
+ if (!MessageService.Confirm (GettextCatalog.GetString ("The following files must be locked before editing."),
+ String.Join ("\n", toLock.Select (u => u.ToString ())), but))
return false;
+
try {
- Svn.Lock (null, "", false, path);
+ Svn.Lock (null, "", false, toLock.ToArray ());
} catch (SubversionException ex) {
- MessageService.ShowError (GettextCatalog.GetString ("The file '{0}' could not be unlocked", path), ex.Message);
+ MessageService.ShowError (GettextCatalog.GetString ("File could not be unlocked."), ex.Message);
return false;
}
- VersionControlService.NotifyFileStatusChanged (new FileUpdateEventArgs (this, path, false));
+
+ VersionControlService.NotifyFileStatusChanged (new FileUpdateEventArgs (this, toLock.ToArray ()));
return true;
}
@@ -440,11 +459,6 @@ namespace MonoDevelop.VersionControl.Subversion
collection.Add(f);
}
- [Obsolete ("Use the overload with keepLocal parameter")]
- protected override void OnDeleteFiles (FilePath[] localPaths, bool force, IProgressMonitor monitor)
- {
- }
-
protected override void OnDeleteFiles (FilePath[] localPaths, bool force, IProgressMonitor monitor, bool keepLocal)
{
foreach (string path in localPaths) {
@@ -473,11 +487,6 @@ namespace MonoDevelop.VersionControl.Subversion
}
}
- [Obsolete ("Use the overload with keepLocal parameter")]
- protected override void OnDeleteDirectories (FilePath[] localPaths, bool force, IProgressMonitor monitor)
- {
- }
-
protected override void OnDeleteDirectories (FilePath[] localPaths, bool force, IProgressMonitor monitor, bool keepLocal)
{
foreach (string path in localPaths) {
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/SubversionVersionControl.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/SubversionVersionControl.cs
index 69bff9c3c5..3e442578a9 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/SubversionVersionControl.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/SubversionVersionControl.cs
@@ -84,14 +84,8 @@ namespace MonoDevelop.VersionControl.Subversion
/// <param name='revision'>
/// Revision.
/// </param>
- [Obsolete ("Use the overload with rootPath parameter")]
- public abstract string GetTextAtRevision (string repositoryPath, Revision revision);
+ public abstract string GetTextAtRevision (string repositoryPath, Revision revision, string rootPath);
- public virtual string GetTextAtRevision (string repositoryPath, Revision revision, string rootPath)
- {
- return GetTextAtRevision (repositoryPath, revision);
- }
-
internal protected virtual VersionControlOperation GetSupportedOperations (Repository repo, VersionInfo vinfo, VersionControlOperation defaultValue)
{
if (vinfo.IsVersioned && File.Exists (vinfo.LocalPath) && !Directory.Exists (vinfo.LocalPath) && vinfo.HasLocalChange (VersionStatus.ScheduledDelete))
@@ -156,11 +150,6 @@ namespace MonoDevelop.VersionControl.Subversion
return list.ToArray ();
}
- public virtual IEnumerable<VersionInfo> Status (Repository repo, FilePath path, SvnRevision revision)
- {
- return Status (repo, path, revision, false, false, false);
- }
-
public abstract IEnumerable<VersionInfo> Status (Repository repo, FilePath path, SvnRevision revision, bool descendDirs, bool changedItemsOnly, bool remoteStatus);
public abstract void Update (FilePath path, bool recurse, IProgressMonitor monitor);
@@ -263,6 +252,8 @@ namespace MonoDevelop.VersionControl.Subversion
{
return new Annotation[0];
}
+
+ public abstract bool HasNeedLock (FilePath file);
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitDialog.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitDialog.cs
index 65fecab444..ae518e5428 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitDialog.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitDialog.cs
@@ -163,6 +163,16 @@ namespace MonoDevelop.VersionControl.Dialogs
base.OnResponse (type);
}
+ protected override void OnDestroyed ()
+ {
+ foreach (var ob in extensions) {
+ var ext = ob as CommitDialogExtension;
+ if (ext != null)
+ ext.Destroy ();
+ }
+ base.OnDestroyed ();
+ }
+
bool ButtonCommitClicked ()
{
// In case we have local unsaved files with changes, throw a dialog for the user.
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitMessageStylePanelWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitMessageStylePanelWidget.cs
index cc3873574b..ec28d6d478 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitMessageStylePanelWidget.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitMessageStylePanelWidget.cs
@@ -28,6 +28,7 @@
using System;
using MonoDevelop.Ide;
using MonoDevelop.Projects;
+using MonoDevelop.Ide.Fonts;
namespace MonoDevelop.VersionControl
{
@@ -44,12 +45,8 @@ namespace MonoDevelop.VersionControl
{
this.Build();
- Pango.FontDescription font = Pango.FontDescription.FromString (
- DesktopService.DefaultMonospaceFont);
- font.Size = Pango.Units.FromPixels (8);
- textview.ModifyFont (font);
+ textview.ModifyFont (FontService.MonospaceFont.CopyModified (0.8d));
textview.AcceptsTab = true;
- font.Dispose ();
}
public void Load (CommitMessageFormat format, AuthorInformation uinfo)
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs
index 68f19f6bac..f7220dc3dd 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs
@@ -68,7 +68,7 @@ namespace MonoDevelop.VersionControl.Views
public override ContainerChild this [Widget w] {
get {
- foreach (ContainerChild info in children.ToArray ()) {
+ foreach (ContainerChild info in children) {
if (info.Child == w)
return info;
}
@@ -496,7 +496,6 @@ namespace MonoDevelop.VersionControl.Views
{
if (highlightAnnotation == null)
return;
- int i = 1;
foreach (var view in widget.info.Document.ParentDocument.Views) {
DiffView diffView = view.GetContent<DiffView> ();
if (diffView != null) {
@@ -508,7 +507,6 @@ namespace MonoDevelop.VersionControl.Views
diffView.ComparisonWidget.SetRevision (diffView.ComparisonWidget.OriginalEditor, rev);
break;
}
- i++;
}
}
@@ -517,7 +515,6 @@ namespace MonoDevelop.VersionControl.Views
{
if (highlightAnnotation == null)
return;
- int i = 1;
foreach (var view in widget.info.Document.ParentDocument.Views) {
LogView logView = view.GetContent<LogView> ();
if (logView != null) {
@@ -528,7 +525,6 @@ namespace MonoDevelop.VersionControl.Views
logView.LogWidget.SelectedRevision = rev;
break;
}
- i++;
}
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CellRendererDiff.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CellRendererDiff.cs
index 9543398df7..6e2fcdc5ab 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CellRendererDiff.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CellRendererDiff.cs
@@ -7,13 +7,13 @@ using MonoDevelop.Ide;
using MonoDevelop.Components;
using System.Text;
using Mono.TextEditor;
+using MonoDevelop.Ide.Fonts;
namespace MonoDevelop.VersionControl.Views
{
class CellRendererDiff: Gtk.CellRendererText
{
Pango.Layout layout;
- Pango.FontDescription font;
bool diffMode;
int width, height, lineHeight;
string[] lines;
@@ -32,7 +32,6 @@ namespace MonoDevelop.VersionControl.Views
public CellRendererDiff()
{
- font = Pango.FontDescription.FromString (DesktopService.DefaultMonospaceFont);
}
void DisposeLayout ()
@@ -48,10 +47,6 @@ namespace MonoDevelop.VersionControl.Views
{
isDisposed = true;
DisposeLayout ();
- if (font != null) {
- font.Dispose ();
- font = null;
- }
base.OnDestroyed ();
}
@@ -103,7 +98,7 @@ namespace MonoDevelop.VersionControl.Views
Pango.Layout layout = new Pango.Layout (container.PangoContext);
layout.SingleParagraphMode = false;
if (diffMode) {
- layout.FontDescription = font;
+ layout.FontDescription = FontService.MonospaceFont;
layout.SetText (text);
}
else
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffWidget.cs
index 0c1883fdcc..e6b25f8193 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffWidget.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffWidget.cs
@@ -69,11 +69,7 @@ namespace MonoDevelop.VersionControl.Views
}
}
- public DiffWidget (VersionControlDocumentInfo info) : this (info, false)
- {
- }
-
- public DiffWidget (VersionControlDocumentInfo info, bool viewOnly)
+ public DiffWidget (VersionControlDocumentInfo info, bool viewOnly = false)
{
this.info = info;
this.Build ();
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.cs
index a578971cd8..2c177b54c7 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.cs
@@ -363,14 +363,14 @@ namespace MonoDevelop.VersionControl.Views
void AdjustmentChanged (object sender, EventArgs e)
{
vAdjustment.SetBounds (0, 1.0,
- attachedVAdjustments.Select (adj => adj.StepIncrement / (adj.Upper - adj.Lower)).Min (),
- attachedVAdjustments.Select (adj => adj.PageIncrement / (adj.Upper - adj.Lower)).Min (),
- attachedVAdjustments.Select (adj => adj.PageSize / (adj.Upper - adj.Lower)).Min ());
+ attachedVAdjustments.Min (adj => adj.StepIncrement / (adj.Upper - adj.Lower)),
+ attachedVAdjustments.Min (adj => adj.PageIncrement / (adj.Upper - adj.Lower)),
+ attachedVAdjustments.Min (adj => adj.PageSize / (adj.Upper - adj.Lower)));
hAdjustment.SetBounds (0, 1.0,
- attachedHAdjustments.Select (adj => adj.StepIncrement / (adj.Upper - adj.Lower)).Min (),
- attachedHAdjustments.Select (adj => adj.PageIncrement / (adj.Upper - adj.Lower)).Min (),
- attachedHAdjustments.Select (adj => adj.PageSize / (adj.Upper - adj.Lower)).Min ());
+ attachedHAdjustments.Min (adj => adj.StepIncrement / (adj.Upper - adj.Lower)),
+ attachedHAdjustments.Min (adj => adj.PageIncrement / (adj.Upper - adj.Lower)),
+ attachedHAdjustments.Min (adj => adj.PageSize / (adj.Upper - adj.Lower)));
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogView.cs
index 77f96a46f0..74270a1aa0 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogView.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogView.cs
@@ -25,37 +25,7 @@ namespace MonoDevelop.VersionControl.Views
return widget;
}
}
-
- class Worker : Task {
- Repository vc;
- string filepath;
- bool isDirectory;
- Revision since;
- Revision [] history;
-
- public Worker (Repository vc, string filepath, bool isDirectory, Revision since) {
- this.vc = vc;
- this.filepath = filepath;
- this.isDirectory = isDirectory;
- this.since = since;
- }
-
- protected override string GetDescription () {
- return GettextCatalog.GetString ("Retrieving history for {0}...", Path.GetFileName (filepath));
- }
-
- protected override void Run () {
- history = vc.GetHistory (filepath, since);
- }
-
- protected override void Finished() {
- if (history == null)
- return;
- LogView d = new LogView (filepath, isDirectory, history, vc);
- IdeApp.Workbench.OpenDocument (d, true);
- }
- }
-
+
public static bool CanShow (VersionControlItemList items, Revision since)
{
return items.All (i => i.VersionInfo.CanLog);
@@ -82,7 +52,8 @@ namespace MonoDevelop.VersionControl.Views
if (WorkbenchWindow != null)
widget.SetToolbar (WorkbenchWindow.GetToolbar (this));
}
-
+
+ [Obsolete]
public LogView (string filepath, bool isDirectory, Revision [] history, Repository vc)
: base (Path.GetFileName (filepath) + " Log")
{
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs
index 3c0f30c7cb..3c6c767628 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs
@@ -91,7 +91,7 @@ namespace MonoDevelop.VersionControl.Views
double center_x = cell_area.X + Math.Round ((double) (cell_area.Width / 2d));
double center_y = cell_area.Y + Math.Round ((double) (cell_area.Height / 2d));
cr.Arc (center_x, center_y, 5, 0, 2 * Math.PI);
- cr.Color = new Cairo.Color (0, 0, 0);
+ cr.SetSourceRGBA (0, 0, 0, 1);
cr.Stroke ();
if (!FirstNode) {
cr.MoveTo (center_x, cell_area.Y - 2);
@@ -253,7 +253,9 @@ namespace MonoDevelop.VersionControl.Views
internal void SetToolbar (DocumentToolbar toolbar)
{
- toolbar.Add (revertButton);
+ if (info.Repository.SupportsRevertRevision)
+ toolbar.Add (revertButton);
+
toolbar.Add (revertToButton);
toolbar.Add (refreshButton);
@@ -464,9 +466,9 @@ namespace MonoDevelop.VersionControl.Views
var rev = (Revision)model.GetValue (iter, 0);
string day;
var age = rev.Time - DateTime.Now;
- if (age.TotalDays == 0) {
+ if (age.Days == 0) {
day = GettextCatalog.GetString ("Today");
- } else if (age.TotalDays == 1) {
+ } else if (age.Days == 1) {
day = GettextCatalog.GetString ("Yesterday");
} else {
day = rev.Time.ToShortDateString ();
@@ -527,15 +529,13 @@ namespace MonoDevelop.VersionControl.Views
if (string.IsNullOrEmpty (rev.Email))
return;
ImageLoader img = ImageService.GetUserIcon (rev.Email, 16);
- if (img.LoadOperation.IsCompleted)
- renderer.Image = img.Image;
- else {
- renderer.Image = null;
- img.LoadOperation.Completed += delegate {
- Gtk.Application.Invoke (delegate {
- if (logstore.IterIsValid (iter))
- model.EmitRowChanged (model.GetPath (iter), iter);
- });
+
+ renderer.Image = img.Image;
+ if (img.Downloading) {
+ img.Completed += (sender, e) => {
+ renderer.Image = img.Image;
+ if (logstore.IterIsValid (iter))
+ model.EmitRowChanged (model.GetPath (iter), iter);
};
}
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeView.cs
index 609d6727cd..8cb107fa2d 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeView.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeView.cs
@@ -70,22 +70,6 @@ namespace MonoDevelop.VersionControl.Views
public void BaseContentChanged ()
{
}
-
- /* MergeWidget mergeWidget;
-
- public override Gtk.Widget Control {
- get {
- return mergeWidget;
- }
- }
-
-
- public override void Load (string fileName)
- {
-
-
- }*/
-
}
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeWidget.cs
index d71ca4efac..d4b2f04505 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeWidget.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeWidget.cs
@@ -116,19 +116,29 @@ namespace MonoDevelop.VersionControl.Views
}
// todo: move to version control backend
+ const string conflictStart = "<<<<<<<";
+ const string conflictDivider = "=======";
+ const string conflictEnd = ">>>>>>>";
+
static IEnumerable<Conflict> Conflicts (TextDocument doc)
{
- int mergeStart = 0;
- while ((mergeStart = doc.IndexOf ("<<<<<<<", mergeStart, doc.TextLength - mergeStart, StringComparison.Ordinal)) >= 0) {
- DocumentLine start = doc.GetLineByOffset (mergeStart);
- if (start.Offset != mergeStart)
- continue;
- int dividerOffset = doc.IndexOf ("=======", mergeStart, doc.TextLength - mergeStart, StringComparison.Ordinal);
- DocumentLine divider = doc.GetLineByOffset (dividerOffset);
-
- int endOffset = doc.IndexOf (">>>>>>>", dividerOffset, doc.TextLength - dividerOffset, StringComparison.Ordinal);
- DocumentLine end = doc.GetLineByOffset (endOffset);
- mergeStart = dividerOffset + 1;
+ var startLines = new List<DocumentLine> ();
+ var dividerLines = new List<DocumentLine> ();
+ var endLines = new List<DocumentLine> ();
+ foreach (var line in doc.Lines) {
+ int len = Math.Min (7, line.Length);
+ if (doc.IndexOf (conflictStart, line.Offset, len, StringComparison.Ordinal) >= 0)
+ startLines.Add (line);
+ else if (doc.IndexOf (conflictDivider, line.Offset, len, StringComparison.Ordinal) >= 0)
+ dividerLines.Add (line);
+ else if (doc.IndexOf (conflictEnd, line.Offset, len, StringComparison.Ordinal) >= 0)
+ endLines.Add (line);
+ }
+
+ for (int i = 0; i < startLines.Count; ++i) {
+ var start = startLines [i];
+ var divider = dividerLines [i];
+ var end = endLines [i];
yield return new Conflict (new TextSegment (start.EndOffsetIncludingDelimiter, divider.Offset - start.EndOffsetIncludingDelimiter),
new TextSegment (divider.EndOffsetIncludingDelimiter, end.Offset - divider.EndOffsetIncludingDelimiter),
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs
index 08f549ecde..b9496598a4 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs
@@ -33,10 +33,11 @@ namespace MonoDevelop.VersionControl.Views
Gtk.Button buttonRevert;
FileTreeView filelist;
- TreeViewColumn colCommit, colRemote;
+ TreeViewColumn colCommit, colRemote, colFile;
TreeStore filestore;
ScrolledWindow scroller;
CellRendererDiff diffRenderer;
+ CellRendererToggle cellToggle;
Box commitBox;
TextView commitText;
@@ -162,7 +163,7 @@ namespace MonoDevelop.VersionControl.Views
filelist.RowActivated += OnRowActivated;
filelist.DiffLineActivated += OnDiffLineActivated;
- CellRendererToggle cellToggle = new CellRendererToggle();
+ cellToggle = new CellRendererToggle();
cellToggle.Toggled += new ToggledHandler(OnCommitToggledHandler);
var crc = new CellRendererImage ();
crc.StockId = "vc-comment";
@@ -187,7 +188,7 @@ namespace MonoDevelop.VersionControl.Views
colStatus.AddAttribute (crt, "text", ColStatus);
colStatus.AddAttribute (crt, "foreground", ColStatusColor);
- TreeViewColumn colFile = new TreeViewColumn ();
+ colFile = new TreeViewColumn ();
colFile.Title = GettextCatalog.GetString ("File");
colFile.Spacing = 2;
crp = new CellRendererImage ();
@@ -311,7 +312,8 @@ namespace MonoDevelop.VersionControl.Views
toolbar.Add (buttonRevert);
showRemoteStatus.Clicked += new EventHandler(OnShowRemoteStatusClicked);
- toolbar.Add (showRemoteStatus);
+ if (vc.SupportsRemoteStatus)
+ toolbar.Add (showRemoteStatus);
var btnCreatePatch = new Gtk.Button () {
Image = new Xwt.ImageView (Xwt.Drawing.Image.FromResource ("diff-light-16.png")).ToGtkWidget (),
@@ -391,15 +393,32 @@ namespace MonoDevelop.VersionControl.Views
colCommit.Destroy ();
colCommit = null;
}
-
if (colRemote != null) {
colRemote.Destroy ();
colRemote = null;
}
+ if (colFile != null) {
+ colFile.Destroy ();
+ colFile = null;
+ }
if (filestore != null) {
filestore.Dispose ();
filestore = null;
}
+ if (filelist != null) {
+ filelist.DoPopupMenu = null;
+ filelist.RowActivated -= OnRowActivated;
+ filelist.DiffLineActivated -= OnDiffLineActivated;
+ filelist.TestExpandRow -= OnTestExpandRow;
+ filelist.Selection.Changed -= OnCursorChanged;
+ filelist.Destroy ();
+ filelist = null;
+ }
+ if (cellToggle != null) {
+ cellToggle.Toggled -= OnCommitToggledHandler;
+ cellToggle.Destroy ();
+ cellToggle = null;
+ }
if (this.diffRenderer != null) {
this.diffRenderer.Destroy ();
this.diffRenderer = null;
@@ -409,6 +428,8 @@ namespace MonoDevelop.VersionControl.Views
widget.Destroy ();
widget = null;
}
+ localDiff.Clear ();
+ remoteDiff.Clear ();
base.Dispose ();
}
@@ -500,8 +521,7 @@ namespace MonoDevelop.VersionControl.Views
colRemote.Visible = remoteStatus;
try {
- if (vc.GetVersionInfo (filepath).CanCommit)
- buttonCommit.Sensitive = true;
+ buttonCommit.Sensitive = statuses.Any (v => v.CanCommit);
} catch (Exception ex) {
LoggingService.LogError (ex.ToString ());
buttonCommit.Sensitive = true;
@@ -736,9 +756,7 @@ namespace MonoDevelop.VersionControl.Views
return;
}
- VersionControlService.FileStatusChanged -= OnFileStatusChanged;
CommitCommand.Commit (vc, changeSet.Clone ());
- VersionControlService.FileStatusChanged += OnFileStatusChanged;
}
@@ -750,8 +768,7 @@ namespace MonoDevelop.VersionControl.Views
TreeIter iter;
filestore.IterChildren (out iter, args.Iter);
string fileName = (string) filestore.GetValue (args.Iter, ColFullPath);
- bool remoteDiff = (bool) filestore.GetValue (args.Iter, ColStatusRemoteDiff);
- FillDiffInfo (iter, fileName, GetDiffData (remoteDiff));
+ FillDiffInfo (iter, fileName, GetDiffData (remoteStatus));
}
}
@@ -1028,7 +1045,7 @@ namespace MonoDevelop.VersionControl.Views
// the value. Do not capture the TreeIter as it may invalidate
// before the diff data has asyncronously loaded.
GC.KeepAlive (info.Diff.Value);
- Gtk.Application.Invoke (delegate { if (!disposed) FillDifs (GetDiffData (this.remoteStatus)); });
+ Gtk.Application.Invoke (delegate { if (!disposed) FillDifs (); });
});
} else if (info.Exception != null) {
text = new [] { GettextCatalog.GetString ("Could not get diff information. ") + info.Exception.Message };
@@ -1043,7 +1060,7 @@ namespace MonoDevelop.VersionControl.Views
filestore.SetValue (iter, ColPath, text);
}
- void FillDifs (List<DiffData> ddata)
+ void FillDifs ()
{
if (disposed)
return;
@@ -1057,10 +1074,9 @@ namespace MonoDevelop.VersionControl.Views
bool filled = (bool) filestore.GetValue (it, ColFilled);
if (filled) {
string fileName = (string) filestore.GetValue (it, ColFullPath);
- bool remoteDiff = (bool) filestore.GetValue (it, ColStatusRemoteDiff);
TreeIter citer;
filestore.IterChildren (out citer, it);
- FillDiffInfo (citer, fileName, GetDiffData (remoteDiff));
+ FillDiffInfo (citer, fileName, GetDiffData (remoteStatus));
}
}
while (filestore.IterNext (ref it));
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/SubviewAttachmentHandler.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/SubviewAttachmentHandler.cs
index e7aea9356a..9808922e3d 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/SubviewAttachmentHandler.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/SubviewAttachmentHandler.cs
@@ -41,7 +41,7 @@ namespace MonoDevelop.VersionControl.Views
Ide.IdeApp.Workbench.ActiveDocumentChanged += HandleDocumentChanged;
}
- void HandleDocumentChanged (object sender, EventArgs e)
+ static void HandleDocumentChanged (object sender, EventArgs e)
{
var document = Ide.IdeApp.Workbench.ActiveDocument;
try {
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/VersionControlDocumentInfo.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/VersionControlDocumentInfo.cs
index 3d4d448009..62faf89ddb 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/VersionControlDocumentInfo.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/VersionControlDocumentInfo.cs
@@ -50,7 +50,8 @@ namespace MonoDevelop.VersionControl.Views
get;
set;
}
-
+
+ [Obsolete ("Use Item.VersionInfo instead of this.")]
public VersionInfo VersionInfo {
get;
set;
@@ -89,23 +90,30 @@ namespace MonoDevelop.VersionControl.Views
DispatchService.GuiDispatch (delegate {
OnUpdated (EventArgs.Empty);
});
- isUpdated = true;
+ mre.Set ();
}
});
}
-
+
object updateLock = new object ();
- bool isUpdated = false;
-
+ ManualResetEvent mre = new ManualResetEvent (false);
+
+ // Runs an action in the GUI thread.
public void RunAfterUpdate (Action act)
{
- if (isUpdated) {
+ if (mre == null) {
act ();
return;
}
- while (!isUpdated)
- Thread.Sleep (10);
- act ();
+
+ ThreadPool.QueueUserWorkItem (delegate {
+ mre.WaitOne ();
+ mre.Dispose ();
+ mre = null;
+ DispatchService.GuiDispatch (delegate {
+ act ();
+ });
+ });
}
protected virtual void OnUpdated (EventArgs e)
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj
index b458e015b2..8a5f3f4e40 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj
@@ -194,8 +194,11 @@
<EmbeddedResource Include="icons\light\version-control-16%402x.png">
<LogicalName>version-control-light-16@2x.png</LogicalName>
</EmbeddedResource>
- <EmbeddedResource Include="icons\menu_log.png">
- <LogicalName>menu_log.png</LogicalName>
+ <EmbeddedResource Include="icons\light\log-16.png">
+ <LogicalName>log-light-16.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\log-16%402x.png">
+ <LogicalName>log-light-16@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\light\diff-16.png">
<LogicalName>diff-light-16.png</LogicalName>
@@ -221,8 +224,11 @@
<EmbeddedResource Include="icons\light\refresh-16%402x.png">
<LogicalName>refresh-light-16@2x.png</LogicalName>
</EmbeddedResource>
- <EmbeddedResource Include="icons\menu_status.png">
- <LogicalName>menu_status.png</LogicalName>
+ <EmbeddedResource Include="icons\light\local-status-16.png">
+ <LogicalName>local-status-light-16.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\local-status-16%402x.png">
+ <LogicalName>local-status-light-16@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\light\commit-16.png">
<LogicalName>commit-light-16.png</LogicalName>
@@ -284,6 +290,24 @@
<EmbeddedResource Include="icons\light\tag-16%402x.png">
<LogicalName>tag-light-16@2x.png</LogicalName>
</EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-git-16.png">
+ <LogicalName>prefs-git-light-16.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-git-16%402x.png">
+ <LogicalName>prefs-git-light-16@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-commit-message-style-16.png">
+ <LogicalName>prefs-commit-message-style-light-16.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-commit-message-style-16%402x.png">
+ <LogicalName>prefs-commit-message-style-light-16@2x.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-version-control-general-16.png">
+ <LogicalName>prefs-version-control-general-light-16.png</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="icons\light\prefs-version-control-general-16%402x.png">
+ <LogicalName>prefs-version-control-general-light-16@2x.png</LogicalName>
+ </EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Include="gtk-gui\generated.cs" />
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CommitCommand.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CommitCommand.cs
index 1acde498d9..f5257c5979 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CommitCommand.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/CommitCommand.cs
@@ -12,24 +12,20 @@ namespace MonoDevelop.VersionControl
public static void Commit (Repository vc, ChangeSet changeSet)
{
try {
- if (vc.GetVersionInfo (changeSet.BaseLocalPath).CanCommit) {
- if (!VersionControlService.NotifyPrepareCommit (vc, changeSet))
- return;
+ VersionControlService.NotifyPrepareCommit (vc, changeSet);
- CommitDialog dlg = new CommitDialog (changeSet);
- try {
- if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
- if (VersionControlService.NotifyBeforeCommit (vc, changeSet)) {
- new CommitWorker (vc, changeSet, dlg).Start();
- return;
- }
+ CommitDialog dlg = new CommitDialog (changeSet);
+ try {
+ if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
+ VersionControlService.NotifyBeforeCommit (vc, changeSet);
+ new CommitWorker (vc, changeSet, dlg).Start();
+ return;
}
- dlg.EndCommit (false);
- } finally {
- dlg.Destroy ();
- }
- VersionControlService.NotifyAfterCommit (vc, changeSet, false);
+ dlg.EndCommit (false);
+ } finally {
+ dlg.Destroy ();
}
+ VersionControlService.NotifyAfterCommit (vc, changeSet, false);
}
catch (Exception ex) {
MessageService.ShowException (ex, GettextCatalog.GetString ("Version control command failed."));
@@ -77,23 +73,15 @@ namespace MonoDevelop.VersionControl
protected override void Finished ()
{
dlg.EndCommit (success);
- dlg.Dispose ();
- VersionControlService.NotifyAfterCommit (vc, changeSet, success);
- ArrayList dirs = new ArrayList ();
- ArrayList files = new ArrayList ();
- foreach (ChangeSetItem it in changeSet.Items)
- if (it.IsDirectory) dirs.Add (it.LocalPath);
- else files.Add (it.LocalPath);
-
+ dlg.Destroy ();
FileUpdateEventArgs args = new FileUpdateEventArgs ();
-
- foreach (FilePath path in dirs)
- args.Add (new FileUpdateEventInfo (vc, path, true));
- foreach (FilePath path in files)
- args.Add (new FileUpdateEventInfo (vc, path, false));
-
+ foreach (ChangeSetItem it in changeSet.Items)
+ args.Add (new FileUpdateEventInfo (vc, it.LocalPath, it.IsDirectory));
+
if (args.Count > 0)
VersionControlService.NotifyFileStatusChanged (args);
+
+ VersionControlService.NotifyAfterCommit (vc, changeSet, success);
}
}
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/FileUpdateEventHandler.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/FileUpdateEventHandler.cs
index f8c3b7eef8..ac773c44e5 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/FileUpdateEventHandler.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/FileUpdateEventHandler.cs
@@ -12,6 +12,12 @@ namespace MonoDevelop.VersionControl
public FileUpdateEventArgs ()
{
}
+
+ public FileUpdateEventArgs (Repository repo, params FilePath[] filePaths)
+ {
+ foreach (var p in filePaths)
+ Add (new FileUpdateEventInfo (repo, p, false));
+ }
public FileUpdateEventArgs (Repository repo, FilePath filePath, bool isDirectory)
{
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Repository.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Repository.cs
index a9b0536fcc..aef5e0dd2d 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Repository.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Repository.cs
@@ -18,14 +18,14 @@ namespace MonoDevelop.VersionControl
VersionControlSystem vcs;
[ItemProperty ("VcsType")]
- string vcsName;
-
- int references;
-
- public FilePath RootPath
- {
- get;
- protected set;
+ string vcsName;
+
+ int references;
+
+ public FilePath RootPath
+ {
+ get;
+ protected set;
}
public event EventHandler NameChanged;
@@ -125,6 +125,14 @@ namespace MonoDevelop.VersionControl
public virtual bool AllowLocking {
get { return true; }
}
+
+ public virtual bool SupportsRemoteStatus {
+ get { return false; }
+ }
+
+ public virtual bool SupportsRevertRevision {
+ get { return false; }
+ }
internal protected virtual VersionControlOperation GetSupportedOperations (VersionInfo vinfo)
{
@@ -246,11 +254,6 @@ namespace MonoDevelop.VersionControl
}
}
- public void ClearCachedVersionInfo (FilePath rootPath)
- {
- infoCache.ClearCachedVersionInfo (rootPath);
- }
-
public void ClearCachedVersionInfo (params FilePath[] paths)
{
foreach (var p in paths)
@@ -568,84 +571,36 @@ namespace MonoDevelop.VersionControl
// Deletes a file or directory. This method may be called for versioned and unversioned
// files. The default implementetions performs a system file delete.
- public void DeleteFile (FilePath localPath, bool force, IProgressMonitor monitor)
- {
- DeleteFile (localPath, force, monitor, true);
- }
-
- public void DeleteFile (FilePath localPath, bool force, IProgressMonitor monitor, bool keepLocal)
+ public void DeleteFile (FilePath localPath, bool force, IProgressMonitor monitor, bool keepLocal = true)
{
DeleteFiles (new FilePath[] { localPath }, force, monitor, keepLocal);
}
- public void DeleteFiles (FilePath[] localPaths, bool force, IProgressMonitor monitor)
- {
- DeleteFiles (localPaths, force, monitor, true);
- }
-
- public void DeleteFiles (FilePath[] localPaths, bool force, IProgressMonitor monitor, bool keepLocal)
+ public void DeleteFiles (FilePath[] localPaths, bool force, IProgressMonitor monitor, bool keepLocal = true)
{
OnDeleteFiles (localPaths, force, monitor, keepLocal);
ClearCachedVersionInfo (localPaths);
}
- [Obsolete ("Use the overload with keepLocal parameter")]
- protected abstract void OnDeleteFiles (FilePath[] localPaths, bool force, IProgressMonitor monitor);
+ protected abstract void OnDeleteFiles (FilePath[] localPaths, bool force, IProgressMonitor monitor, bool keepLocal);
- protected virtual void OnDeleteFiles (FilePath[] localPaths, bool force, IProgressMonitor monitor, bool keepLocal)
- {
-#pragma warning disable 618
- OnDeleteFiles (localPaths, force, monitor);
-#pragma warning restore 618
- }
-
- public void DeleteDirectory (FilePath localPath, bool force, IProgressMonitor monitor)
- {
- DeleteDirectory (localPath, force, monitor, true);
- }
-
- public void DeleteDirectory (FilePath localPath, bool force, IProgressMonitor monitor, bool keepLocal)
+ public void DeleteDirectory (FilePath localPath, bool force, IProgressMonitor monitor, bool keepLocal = true)
{
DeleteDirectories (new FilePath[] { localPath }, force, monitor, keepLocal);
}
- public void DeleteDirectories (FilePath[] localPaths, bool force, IProgressMonitor monitor)
- {
- DeleteDirectories (localPaths, force, monitor, true);
- }
-
- public void DeleteDirectories (FilePath[] localPaths, bool force, IProgressMonitor monitor, bool keepLocal)
+ public void DeleteDirectories (FilePath[] localPaths, bool force, IProgressMonitor monitor, bool keepLocal = true)
{
OnDeleteDirectories (localPaths, force, monitor, keepLocal);
ClearCachedVersionInfo (localPaths);
}
- [Obsolete ("Use the overload with keepLocal parameter")]
- protected abstract void OnDeleteDirectories (FilePath[] localPaths, bool force, IProgressMonitor monitor);
-
- protected virtual void OnDeleteDirectories (FilePath[] localPaths, bool force, IProgressMonitor monitor, bool keepLocal)
- {
-#pragma warning disable 618
- OnDeleteDirectories (localPaths, force, monitor);
-#pragma warning restore 618
- }
-
- // Creates a local directory.
- public void CreateLocalDirectory (FilePath path)
- {
- ClearCachedVersionInfo (path);
- OnCreateLocalDirectory (path);
- }
-
- protected virtual void OnCreateLocalDirectory (FilePath path)
- {
- Directory.CreateDirectory (path);
- }
+ protected abstract void OnDeleteDirectories (FilePath[] localPaths, bool force, IProgressMonitor monitor, bool keepLocal);
// Called to request write permission for a file. The file may not yet exist.
// After the file is modified or created, NotifyFileChanged is called.
// This method is allways called for versioned and unversioned files.
- public virtual bool RequestFileWritePermission (FilePath path)
+ public virtual bool RequestFileWritePermission (params FilePath[] paths)
{
return true;
}
@@ -756,7 +711,6 @@ namespace MonoDevelop.VersionControl
} else {
if (fileName != null) {
list.Add (new DiffInfo (basePath, fileName, content.ToString ()));
- fileName = null;
}
fileName = line.Substring (6).Trim ();
fileName = fileName.Replace ('/', Path.DirectorySeparatorChar); // svn returns paths using unix separators
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UnknownRepository.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UnknownRepository.cs
index 21b6da6aa4..030583d3ce 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UnknownRepository.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UnknownRepository.cs
@@ -86,13 +86,11 @@ namespace MonoDevelop.VersionControl
{
}
- [Obsolete ("Use the overload with keepLocal parameter")]
- protected override void OnDeleteFiles (FilePath[] path, bool force, IProgressMonitor monitor)
+ protected override void OnDeleteFiles (FilePath[] path, bool force, IProgressMonitor monitor, bool keepLocal)
{
}
- [Obsolete ("Use the overload with keepLocal parameter")]
- protected override void OnDeleteDirectories (FilePath[] path, bool force, IProgressMonitor monitor)
+ protected override void OnDeleteDirectories (FilePath[] path, bool force, IProgressMonitor monitor, bool keepLocal)
{
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlCommandHandler.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlCommandHandler.cs
index 90a1a020a5..ba12420ea5 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlCommandHandler.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlCommandHandler.cs
@@ -28,6 +28,7 @@
using MonoDevelop.Projects;
using MonoDevelop.Ide.Gui.Components;
using MonoDevelop.Ide.Gui.Pads.ProjectPad;
+using System;
namespace MonoDevelop.VersionControl
{
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlFileSystemExtension.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlFileSystemExtension.cs
index c2eafe09c1..4f50281ce9 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlFileSystemExtension.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlFileSystemExtension.cs
@@ -43,12 +43,11 @@ namespace MonoDevelop.VersionControl
public override void CopyFile (FilePath source, FilePath dest, bool overwrite)
{
Repository repo = GetRepository (dest);
- if (repo.RequestFileWritePermission (dest)) {
- base.CopyFile (source, dest, overwrite);
- repo.NotifyFileChanged (dest);
- }
- else
- throw new System.IO.IOException ("Write permission denied");
+ if (!repo.RequestFileWritePermission (dest))
+ throw new System.IO.IOException ("Write permission denied.");
+
+ base.CopyFile (source, dest, overwrite);
+ repo.NotifyFileChanged (dest);
}
public override void MoveFile (FilePath source, FilePath dest)
@@ -85,7 +84,8 @@ namespace MonoDevelop.VersionControl
public override void CreateDirectory (FilePath path)
{
Repository repo = GetRepository (path);
- repo.CreateLocalDirectory (path);
+ repo.ClearCachedVersionInfo (path);
+ System.IO.Directory.CreateDirectory (path);
repo.Add (path, false, new NullProgressMonitor ());
}
@@ -110,11 +110,10 @@ namespace MonoDevelop.VersionControl
repo.DeleteDirectory (path, true, new NullProgressMonitor (), false);
}
- [Obsolete ("This will be removed. Override RequestFileEdit (IEnumerable<FilePath>) instead")]
- public override bool RequestFileEdit (FilePath file)
+ public override void RequestFileEdit (IEnumerable<FilePath> files)
{
- Repository repo = GetRepository (file);
- return repo.RequestFileWritePermission (file);
+ Repository repo = GetRepository (FilePath.GetCommonRootPath (files));
+ repo.RequestFileWritePermission (files.ToArray ());
}
public override void NotifyFilesChanged (IEnumerable<FilePath> files)
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlItemList.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlItemList.cs
index 955fa42070..f3803e6603 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlItemList.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlItemList.cs
@@ -25,7 +25,8 @@
//
//
-using System.Collections.Generic;
+using System.Collections.Generic;
+using System.Linq;
using MonoDevelop.Core;
namespace MonoDevelop.VersionControl
@@ -42,10 +43,9 @@ namespace MonoDevelop.VersionControl
t [it.Repository] = list;
}
list.Add (it);
- }
- VersionControlItemList[] arr = new VersionControlItemList [t.Count];
- t.Values.CopyTo (arr, 0);
- return arr;
+ }
+
+ return t.Values.ToArray ();
}
public VersionControlItemList GetFiles ()
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlNodeExtension.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlNodeExtension.cs
index 2b75cd7d24..848be5eba1 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlNodeExtension.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlNodeExtension.cs
@@ -109,7 +109,7 @@ namespace MonoDevelop.VersionControl
base.PrepareChildNodes (dataObject);
}
*/
- void AddFolderOverlay (Repository rep, string folder, NodeInfo nodeInfo, bool skipVersionedOverlay)
+ static void AddFolderOverlay (Repository rep, string folder, NodeInfo nodeInfo, bool skipVersionedOverlay)
{
Xwt.Drawing.Image overlay = null;
VersionInfo vinfo = rep.GetVersionInfo (folder);
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs
index 1c4af00cb8..9d204b4309 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs
@@ -114,6 +114,9 @@ namespace MonoDevelop.VersionControl
public static Xwt.Drawing.Image LoadOverlayIconForStatus(VersionStatus status)
{
+ if ((status & VersionStatus.Ignored) != 0)
+ return overlay_ignored;
+
if ((status & VersionStatus.Versioned) == 0)
return overlay_unversioned;
@@ -129,8 +132,6 @@ namespace MonoDevelop.VersionControl
case VersionStatus.Missing:
case VersionStatus.ScheduledDelete:
return overlay_removed;
- case VersionStatus.Ignored:
- return overlay_ignored;
}
if ((status & VersionStatus.LockOwned) != 0)
@@ -344,7 +345,7 @@ namespace MonoDevelop.VersionControl
return;
}
- FileService.EnsureDirectoryExists (file.ParentDirectory);
+ Directory.CreateDirectory (file.ParentDirectory);
stream = new FileStream (file, FileMode.Create, FileAccess.Write);
BinaryFormatter formatter = new BinaryFormatter ();
formatter.Serialize (stream, comments);
@@ -358,40 +359,57 @@ namespace MonoDevelop.VersionControl
}
}
- internal static bool NotifyPrepareCommit (Repository repo, ChangeSet changeSet)
+ internal static void NotifyPrepareCommit (Repository repo, ChangeSet changeSet)
{
+ if (!DispatchService.IsGuiThread) {
+ Gtk.Application.Invoke (delegate {
+ NotifyPrepareCommit (repo, changeSet);
+ });
+ return;
+ }
+
if (PrepareCommit != null) {
try {
PrepareCommit (null, new CommitEventArgs (repo, changeSet, false));
} catch (Exception ex) {
MessageService.ShowException (ex);
- return false;
}
}
- return true;
}
- internal static bool NotifyBeforeCommit (Repository repo, ChangeSet changeSet)
+ internal static void NotifyBeforeCommit (Repository repo, ChangeSet changeSet)
{
+ if (!DispatchService.IsGuiThread) {
+ Gtk.Application.Invoke (delegate {
+ NotifyBeforeCommit (repo, changeSet);
+ });
+ return;
+ }
+
if (BeginCommit != null) {
try {
BeginCommit (null, new CommitEventArgs (repo, changeSet, false));
} catch (Exception ex) {
MessageService.ShowException (ex);
- return false;
}
}
- return true;
}
- internal static bool NotifyAfterCommit (Repository repo, ChangeSet changeSet, bool success)
+ internal static void NotifyAfterCommit (Repository repo, ChangeSet changeSet, bool success)
{
+ if (!DispatchService.IsGuiThread) {
+ Gtk.Application.Invoke (delegate {
+ NotifyAfterCommit (repo, changeSet, success);
+ });
+ return;
+ }
+
if (EndCommit != null) {
try {
EndCommit (null, new CommitEventArgs (repo, changeSet, success));
} catch (Exception ex) {
MessageService.ShowException (ex);
- return false;
+ return;
}
}
if (success) {
@@ -399,7 +417,6 @@ namespace MonoDevelop.VersionControl
SetCommitComment (it.LocalPath, null, false);
SaveComments ();
}
- return true;
}
public static void NotifyFileStatusChanged (IEnumerable<VersionControlItem> items)
@@ -480,8 +497,8 @@ namespace MonoDevelop.VersionControl
static void SolutionItemAddFiles (string rootPath, SolutionItem entry, HashSet<string> files)
{
if (entry is SolutionEntityItem) {
- string file = ((SolutionEntityItem)entry).FileName;
- SolutionItemAddFile (rootPath, files, file);
+ foreach (var file in ((SolutionEntityItem)entry).GetItemFiles (false))
+ SolutionItemAddFile (rootPath, files, file);
}
if (entry is Project) {
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlSystem.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlSystem.cs
index aec5dff779..bd00b52bb1 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlSystem.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlSystem.cs
@@ -95,7 +95,5 @@ namespace MonoDevelop.VersionControl
{
VersionControlService.InternalStoreRepositoryReference (repo, path, id);
}
- }
-
- public delegate void UpdateCallback (FilePath path, string action);
+ }
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionInfoCache.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionInfoCache.cs
index c242c980bf..8228885a4c 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionInfoCache.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionInfoCache.cs
@@ -44,11 +44,11 @@ namespace MonoDevelop.VersionControl
{
rootPath = rootPath.CanonicalPath;
lock (fileStatus) {
- foreach (var p in fileStatus.Where (e => e.Key.IsChildPathOf (rootPath) || e.Key == rootPath).ToArray ())
+ foreach (var p in fileStatus.Where (e => e.Key.IsChildPathOf (rootPath) || e.Key == rootPath))
p.Value.RequiresRefresh = true;
}
lock (directoryStatus) {
- foreach (var p in directoryStatus.Where (e => e.Key.IsChildPathOf (rootPath) || e.Key == rootPath).ToArray ())
+ foreach (var p in directoryStatus.Where (e => e.Key.IsChildPathOf (rootPath) || e.Key == rootPath))
p.Value.RequiresRefresh = true;
}
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/VersionControl.addin.xml b/main/src/addins/VersionControl/MonoDevelop.VersionControl/VersionControl.addin.xml
index ebd35d24f2..848fcc2200 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/VersionControl.addin.xml
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/VersionControl.addin.xml
@@ -71,7 +71,7 @@
</Extension>
<Extension path = "/MonoDevelop/Ide/Pads/ProjectPad">
- <PadOption id = "ShowVersionControlOverlays" _label = "Show version control overlay icons" defaultValue = "True" />
+ <PadOption id = "ShowVersionControlOverlays" _label = "Show Version Control Overlay Icons" defaultValue = "True" />
<NodeBuilder id = "VersionControlNodeExtension" class = "MonoDevelop.VersionControl.VersionControlNodeExtension"/>
</Extension>
@@ -81,8 +81,8 @@
<StockIcon stockid = "vc-resolve-command" resource = "vcs-conflicted-16.png" size="Menu" />
<StockIcon stockid = "vc-revert-command" resource = "revert-light-16.png" size="Menu" />
<StockIcon stockid = "vc-diff" resource = "diff-light-16.png" size="Menu" />
- <StockIcon stockid = "vc-log" resource = "menu_log.png" size="Menu" />
- <StockIcon stockid = "vc-status" resource = "menu_status.png" size="Menu" />
+ <StockIcon stockid = "vc-log" resource = "log-light-16.png" size="Menu" />
+ <StockIcon stockid = "vc-status" resource = "local-status-light-16.png" size="Menu" />
<StockIcon stockid = "vc-update" resource = "pull-light-16.png" size="Menu" />
<StockIcon stockid = "vc-push" resource = "push-light-16.png" size="Menu" />
<StockIcon stockid = "vc-commit" resource = "commit-light-16.png" size="Menu" />
@@ -97,6 +97,9 @@
<StockIcon stockid = "vc-repository" resource = "repository-light-16.png" size="Menu" />
<StockIcon stockid = "vc-tag" resource = "tag-light-16.png" size="Menu" />
<StockIcon stockid = "vc-branch" resource = "branch-light-16.png" size="Menu" />
+ <StockIcon stockid = "md-prefs-git" resource="prefs-git-light-16.png" size="Menu" />
+ <StockIcon stockid = "md-prefs-commit-message-style" resource="prefs-commit-message-style-light-16.png" size="Menu" />
+ <StockIcon stockid = "md-prefs-version-control-general" resource="prefs-version-control-general-light-16.png" size="Menu" />
</Extension>
<Extension path = "/MonoDevelop/Ide/Commands">
@@ -197,7 +200,7 @@
</Extension>
<Extension path = "/MonoDevelop/Ide/MainMenu">
- <ItemSet id = "VersionControl" _label = "_Version Control" insertafter = "Run" >
+ <ItemSet id = "VersionControl" _label = "Versio_n Control" insertafter = "Run" >
<CommandItem id = "MonoDevelop.VersionControl.Commands.Checkout" />
<CommandItem id = "MonoDevelop.VersionControl.Commands.Publish"/>
<SeparatorItem/>
@@ -278,27 +281,27 @@
</Extension> -->
<Extension path = "/MonoDevelop/ProjectModel/Gui/ItemOptionPanels">
- <Section id="VersionControl" _label="Version Control">
+ <Section id="VersionControl" _label="Version Control" icon="md-prefs-version-control-general">
<Condition id="ItemType" value="Solution">
- <Section id = "VersionControlGeneral" _label = "General" fill="true" class="MonoDevelop.VersionControl.VersionControlSolutionOptionsPanel" />
+ <Section id="VersionControlGeneral" _label="General" fill="true" class="MonoDevelop.VersionControl.VersionControlSolutionOptionsPanel" icon="md-prefs-version-control-general" />
</Condition>
<ComplexCondition>
<Or>
<Condition id="ItemType" value="SolutionItem" />
<Condition id="ItemType" value="Solution" />
</Or>
- <Section id = "VersionControlGeneral" _label = "Commit Message Style" fill="true" class="MonoDevelop.VersionControl.VersionControlPolicyPanel" />
+ <Section id="VersionControlGeneral" _label="Commit Message Style" fill="true" class="MonoDevelop.VersionControl.VersionControlPolicyPanel" icon="md-prefs-commit-message-style" />
</ComplexCondition>
</Section>
</Extension>
<Extension path = "/MonoDevelop/ProjectModel/Gui/DefaultPolicyPanels/VersionControl">
- <Section id = "VersionControlGeneral" _label = "Commit Message Style" fill="true" class="MonoDevelop.VersionControl.VersionControlPolicyPanel" />
+ <Section id="VersionControlGeneral" _label = "Commit Message Style" fill="true" class="MonoDevelop.VersionControl.VersionControlPolicyPanel" icon="md-prefs-commit-message-style" />
</Extension>
<Extension path = "/MonoDevelop/Ide/GlobalOptionsDialog/VersionControl">
- <Section id = "VersionControlGeneral" _label = "General" fill="true" class="MonoDevelop.VersionControl.VersionControlGeneralOptionsPanel" />
- <Section id = "VersionControlGeneral" _label = "Commit Message Style" fill="true" class="MonoDevelop.VersionControl.VersionControlPolicyPanel" />
+ <Section id = "VersionControlGeneral" _label = "General" fill="true" class="MonoDevelop.VersionControl.VersionControlGeneralOptionsPanel" icon="md-prefs-version-control-general" />
+ <Section id = "VersionControlGeneral" _label = "Commit Message Style" fill="true" class="MonoDevelop.VersionControl.VersionControlPolicyPanel" icon="md-prefs-commit-message-style" />
</Extension>
<Extension path = "/MonoDevelop/ProjectModel/PolicySets/Mono" >
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/gtk-gui/MonoDevelop.VersionControl.Dialogs.CommitDialog.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/gtk-gui/MonoDevelop.VersionControl.Dialogs.CommitDialog.cs
index 6f0ebda48f..d97345f236 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/gtk-gui/MonoDevelop.VersionControl.Dialogs.CommitDialog.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/gtk-gui/MonoDevelop.VersionControl.Dialogs.CommitDialog.cs
@@ -145,7 +145,6 @@ namespace MonoDevelop.VersionControl.Dialogs
this.buttonCommit.UseUnderline = true;
this.buttonCommit.Label = global::Mono.Unix.Catalog.GetString ("C_ommit");
this.AddActionWidget (this.buttonCommit, -5);
- w12.Add (this.buttonCommit);
global::Gtk.ButtonBox.ButtonBoxChild w14 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w12 [this.buttonCommit]));
w14.Position = 1;
w14.Expand = false;
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/gtk-gui/gui.stetic b/main/src/addins/VersionControl/MonoDevelop.VersionControl/gtk-gui/gui.stetic
index 0e6079564a..998958b1e3 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/gtk-gui/gui.stetic
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/gtk-gui/gui.stetic
@@ -9,6 +9,7 @@
<widget-library name="../../../../../build/bin/Mono.TextEditor.dll" />
<widget-library name="../../../../../build/AddIns/DisplayBindings/SourceEditor/MonoDevelop.SourceEditor2.dll" />
<widget-library name="../../../../../build/AddIns/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.dll" />
+ <widget-library name="../../../../../build/AddIns/MonoDevelop.Debugger/MonoDevelop.Debugger.dll" />
<widget-library name="../../../../../build/AddIns/VersionControl/MonoDevelop.VersionControl.dll" internal="true" />
</import>
<widget class="Gtk.Dialog" id="MonoDevelop.VersionControl.Dialogs.SelectRepositoryDialog" design-size="617 438">
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/branch-16.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/branch-16.png
index 4095508d7a..a6a5b24cfe 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/branch-16.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/branch-16.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/branch-16@2x.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/branch-16@2x.png
index d576edd447..a2bff92231 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/branch-16@2x.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/branch-16@2x.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/commit-16.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/commit-16.png
index b3bd825f69..ea93ecbbf3 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/commit-16.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/commit-16.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/commit-16@2x.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/commit-16@2x.png
index c529f6a45c..596dc19eb9 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/commit-16@2x.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/commit-16@2x.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/local-status-16.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/local-status-16.png
new file mode 100644
index 0000000000..b50e6fc982
--- /dev/null
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/local-status-16.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/local-status-16@2x.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/local-status-16@2x.png
new file mode 100644
index 0000000000..bf9dd78174
--- /dev/null
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/local-status-16@2x.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/log-16.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/log-16.png
new file mode 100644
index 0000000000..72d172e2ab
--- /dev/null
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/log-16.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/log-16@2x.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/log-16@2x.png
new file mode 100644
index 0000000000..aaa76142ef
--- /dev/null
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/log-16@2x.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-commit-message-style-16.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-commit-message-style-16.png
new file mode 100644
index 0000000000..ea93ecbbf3
--- /dev/null
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-commit-message-style-16.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-commit-message-style-16@2x.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-commit-message-style-16@2x.png
new file mode 100644
index 0000000000..596dc19eb9
--- /dev/null
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-commit-message-style-16@2x.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-git-16.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-git-16.png
new file mode 100644
index 0000000000..ac46bb38b3
--- /dev/null
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-git-16.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-git-16@2x.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-git-16@2x.png
new file mode 100644
index 0000000000..d09e54f010
--- /dev/null
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-git-16@2x.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-version-control-general-16.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-version-control-general-16.png
new file mode 100644
index 0000000000..f50af22deb
--- /dev/null
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-version-control-general-16.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-version-control-general-16@2x.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-version-control-general-16@2x.png
new file mode 100644
index 0000000000..230d65e12d
--- /dev/null
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/prefs-version-control-general-16@2x.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/pull-16.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/pull-16.png
index d93cf80edc..7024886a2a 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/pull-16.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/pull-16.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/pull-16@2x.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/pull-16@2x.png
index a13c22d543..ad50947884 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/pull-16@2x.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/pull-16@2x.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/push-16.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/push-16.png
index a3f1d6be30..ac46bb38b3 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/push-16.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/push-16.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/push-16@2x.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/push-16@2x.png
index 046f45d7fb..d09e54f010 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/push-16@2x.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/push-16@2x.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/refresh-16.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/refresh-16.png
index e8e91364c2..d63fa2fad8 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/refresh-16.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/refresh-16.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/refresh-16@2x.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/refresh-16@2x.png
index 09e00ced0e..848a94e174 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/refresh-16@2x.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/refresh-16@2x.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/remote-status-16.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/remote-status-16.png
index 7cab4c355a..e362102a8c 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/remote-status-16.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/remote-status-16.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/remote-status-16@2x.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/remote-status-16@2x.png
index c177c3ef60..c270cd23a5 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/remote-status-16@2x.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/remote-status-16@2x.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/removed-overlay-16.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/removed-overlay-16.png
index d616c9cbd3..8f41659d22 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/removed-overlay-16.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/removed-overlay-16.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/removed-overlay-16@2x.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/removed-overlay-16@2x.png
index b0e192736b..953e8105a4 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/removed-overlay-16@2x.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/removed-overlay-16@2x.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/repository-16.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/repository-16.png
index 7de6c7d619..f50af22deb 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/repository-16.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/repository-16.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/repository-16@2x.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/repository-16@2x.png
index e0cdb60d82..230d65e12d 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/repository-16@2x.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/repository-16@2x.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/revert-16.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/revert-16.png
index 954665ba67..e08803d985 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/revert-16.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/revert-16.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/revert-16@2x.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/revert-16@2x.png
index 1c0899f381..d9155f2685 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/revert-16@2x.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/revert-16@2x.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/tag-16.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/tag-16.png
index acbcb7df19..5ed5e35bfb 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/tag-16.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/tag-16.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/tag-16@2x.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/tag-16@2x.png
index 5035c54468..4de708587a 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/tag-16@2x.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/tag-16@2x.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/unlocked-overlay-16.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/unlocked-overlay-16.png
index 9a5aa60080..3d2ff49956 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/unlocked-overlay-16.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/unlocked-overlay-16.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/unlocked-overlay-16@2x.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/unlocked-overlay-16@2x.png
index a26c3f532e..14fb4b8bc1 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/unlocked-overlay-16@2x.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/unlocked-overlay-16@2x.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/vcs-removed-16.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/vcs-removed-16.png
index 67ad8cdc7f..d33e4da129 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/vcs-removed-16.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/vcs-removed-16.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/vcs-removed-16@2x.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/vcs-removed-16@2x.png
index 4fc3ef4bc3..e29f3370cd 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/vcs-removed-16@2x.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/vcs-removed-16@2x.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/version-control-16.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/version-control-16.png
index 0187763b3a..b084d922fb 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/version-control-16.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/version-control-16.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/version-control-16@2x.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/version-control-16@2x.png
index 000942e590..2b5ba106e6 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/version-control-16@2x.png
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/light/version-control-16@2x.png
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/menu_log.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/menu_log.png
deleted file mode 100644
index 5d5f6351c5..0000000000
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/menu_log.png
+++ /dev/null
Binary files differ
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/menu_status.png b/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/menu_status.png
deleted file mode 100644
index 2bcb0f4050..0000000000
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/icons/menu_status.png
+++ /dev/null
Binary files differ
diff --git a/main/src/addins/VersionControl/Subversion.Win32.Tests/RepositoryTests.cs b/main/src/addins/VersionControl/Subversion.Win32.Tests/RepositoryTests.cs
index 7385ee64a7..c7cf1c8601 100644
--- a/main/src/addins/VersionControl/Subversion.Win32.Tests/RepositoryTests.cs
+++ b/main/src/addins/VersionControl/Subversion.Win32.Tests/RepositoryTests.cs
@@ -41,8 +41,8 @@ namespace MonoDevelop.VersionControl.Subversion.Tests
[SetUp]
public override void Setup ()
{
- RootUrl = new FilePath (FileService.CreateTempDirectory ());
- RepoLocation = "svn://localhost:3690/repo";
+ RemotePath = new FilePath (FileService.CreateTempDirectory ());
+ RemoteUrl = "svn://localhost:3690/repo";
SvnServe = new Process ();
base.Setup ();
}
@@ -62,7 +62,7 @@ namespace MonoDevelop.VersionControl.Subversion.Tests
@@ -0,0 +1 @@
+text
";
- Assert.AreEqual (difftext, Repo.GenerateDiff (RootCheckout + "testfile", Repo.GetVersionInfo (RootCheckout + "testfile", VersionInfoQueryFlags.IgnoreCache)).Content.Replace ("\n", "\r\n"));
+ Assert.AreEqual (difftext, Repo.GenerateDiff (LocalPath + "testfile", Repo.GetVersionInfo (LocalPath + "testfile", VersionInfoQueryFlags.IgnoreCache)).Content.Replace ("\n", "\r\n"));
}
// Tests that fail due to SvnSharp giving wrong data.
@@ -96,7 +96,7 @@ namespace MonoDevelop.VersionControl.Subversion.Tests
protected override void PostLock ()
{
- string added = RootCheckout + "testfile";
+ string added = LocalPath + "testfile";
Assert.Throws<Exception> (delegate {
File.WriteAllText (added, "text");
});
@@ -111,7 +111,7 @@ namespace MonoDevelop.VersionControl.Subversion.Tests
protected override void PostUnlock ()
{
- string added = RootCheckout + "testfile";
+ string added = LocalPath + "testfile";
Assert.DoesNotThrow (delegate {
File.WriteAllText (added, "text");
});
diff --git a/main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs b/main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs
index 7955d1de15..667308fa8f 100644
--- a/main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs
+++ b/main/src/addins/VersionControl/Subversion.Win32/SvnSharpClient.cs
@@ -16,17 +16,24 @@ namespace SubversionAddinWindows
sealed class SvnSharpClient: SubversionVersionControl
{
static bool errorShown;
- static readonly bool installError;
- static readonly SvnClient client;
+ static bool installError {
+ get { return client.Value == null; }
+ }
+ static readonly internal Lazy<SvnClient> client;
static SvnSharpClient ()
{
+ client = new Lazy<SvnClient> (CheckInstalled);
+ }
+
+ static SvnClient CheckInstalled ()
+ {
try {
- client = new SvnClient ();
+ return new SvnClient ();
} catch (Exception ex) {
LoggingService.LogError ("SVN client could not be initialized", ex);
- installError = true;
}
+ return null;
}
public override SubversionBackend CreateBackend ()
@@ -37,7 +44,7 @@ namespace SubversionAddinWindows
public override string GetPathUrl (FilePath path)
{
lock (client) {
- Uri u = client.GetUriFromWorkingCopy (path);
+ Uri u = client.Value.GetUriFromWorkingCopy (path);
return u != null ? u.ToString () : null;
}
}
@@ -62,7 +69,7 @@ namespace SubversionAddinWindows
{
string wc_path;
try {
- wc_path = client.GetWorkingCopyRoot (path.FullPath);
+ wc_path = client.Value.GetWorkingCopyRoot (path.FullPath);
return wc_path;
} catch (SvnException e) {
switch (e.SvnErrorCode) {
@@ -77,7 +84,10 @@ namespace SubversionAddinWindows
sealed class SvnSharpBackend: SubversionBackend
{
- SvnClient client;
+ static SvnClient client {
+ get { return SvnSharpClient.client.Value; }
+ }
+
IProgressMonitor updateMonitor;
NotifData notifyData;
ProgressData progressData;
@@ -107,7 +117,6 @@ namespace SubversionAddinWindows
void Init ()
{
- client = new SvnClient ();
client.Authentication.SslClientCertificateHandlers += AuthenticationSslClientCertificateHandlers;
client.Authentication.SslClientCertificatePasswordHandlers += AuthenticationSslClientCertificatePasswordHandlers;
client.Authentication.SslServerTrustHandlers += AuthenticationSslServerTrustHandlers;
@@ -238,12 +247,6 @@ namespace SubversionAddinWindows
client.Delete (path, args);
}
- [Obsolete ("")]
- public override string GetTextAtRevision (string repositoryPath, Revision revision)
- {
- return null;
- }
-
public override string GetTextAtRevision (string repositoryPath, Revision revision, string rootPath)
{
var ms = new MemoryStream ();
@@ -797,5 +800,11 @@ namespace SubversionAddinWindows
if (notifyChange && File.Exists (file))
FileService.NotifyFileChanged (file, true);
}
+
+ public override bool HasNeedLock (FilePath file)
+ {
+ string tmp;
+ return client.GetProperty (new SvnPathTarget (file), SvnPropertyNames.SvnNeedsLock, out tmp);
+ }
}
}
diff --git a/main/src/addins/WindowsPlatform/Dialogs/AddFileDialogHandler.cs b/main/src/addins/WindowsPlatform/Dialogs/AddFileDialogHandler.cs
deleted file mode 100644
index c450f488a1..0000000000
--- a/main/src/addins/WindowsPlatform/Dialogs/AddFileDialogHandler.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using MonoDevelop.Ide;
-using MonoDevelop.Ide.Extensions;
-using MonoDevelop.Platform;
-using System.Windows.Forms;
-using CustomControls.Controls;
-using MonoDevelop.Core;
-
-namespace MonoDevelop.Platform
-{
- class AddFileDialogHandler: IAddFileDialogHandler
- {
- volatile Form rootForm;
-
- public bool Run (AddFileDialogData data)
- {
- var parentWindow = data.TransientFor ?? MessageService.RootWindow;
- parentWindow.FocusInEvent += OnParentFocusIn;
-
- bool result = SelectFileDialogHandler.RunWinUIMethod (RunDialog, data);
-
- parentWindow.FocusInEvent -= OnParentFocusIn;
- parentWindow.Present ();
-
- return result;
- }
-
- void OnParentFocusIn (object o, EventArgs args)
- {
- if (rootForm != null)
- rootForm.BeginInvoke (new Action (() => rootForm.Activate ()));
- }
-
- bool RunDialog (AddFileDialogData data)
- {
- Application.EnableVisualStyles ();
-
- CustomAddFilesDialog adlg = new CustomAddFilesDialog();
- adlg.StartLocation = AddonWindowLocation.Bottom;
- adlg.BuildActions = data.BuildActions;
- bool result = false;
-
- SelectFileDialogHandler.SetCommonFormProperties (data, adlg.FileDialog);
-
- try
- {
- rootForm = new WinFormsRoot ();
- if (adlg.ShowDialog (rootForm) == DialogResult.Cancel)
- result = false;
- else
- {
- FilePath[] paths = new FilePath [adlg.FileDialog.FileNames.Length];
- for (int n=0; n<adlg.FileDialog.FileNames.Length; n++)
- paths [n] = adlg.FileDialog.FileNames [n];
- data.SelectedFiles = paths;
- data.OverrideAction = adlg.OverrideAction;
- result = true;
- }
- }
- finally
- {
- adlg.Dispose();
- }
-
- return result;
- }
- }
-}
diff --git a/main/src/addins/WindowsPlatform/Dialogs/CustomAddFilesDialog.Designer.cs b/main/src/addins/WindowsPlatform/Dialogs/CustomAddFilesDialog.Designer.cs
deleted file mode 100644
index b2d2727096..0000000000
--- a/main/src/addins/WindowsPlatform/Dialogs/CustomAddFilesDialog.Designer.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-namespace MonoDevelop.Platform
-{
- partial class CustomAddFilesDialog
- {
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.IContainer components = null;
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.checkOverride = new System.Windows.Forms.CheckBox();
- this.comboActions = new System.Windows.Forms.ComboBox();
- this.SuspendLayout();
- //
- // checkOverride
- //
- this.checkOverride.AutoSize = true;
- this.checkOverride.Location = new System.Drawing.Point(5, 13);
- this.checkOverride.Name = "checkOverride";
- this.checkOverride.Size = new System.Drawing.Size(158, 17);
- this.checkOverride.TabIndex = 0;
- this.checkOverride.Text = "Override default build action";
- this.checkOverride.UseVisualStyleBackColor = true;
- this.checkOverride.CheckedChanged += new System.EventHandler(this.checkOverride_CheckedChanged);
- //
- // comboActions
- //
- this.comboActions.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.comboActions.Enabled = false;
- this.comboActions.FormattingEnabled = true;
- this.comboActions.Location = new System.Drawing.Point(170, 11);
- this.comboActions.Name = "comboActions";
- this.comboActions.Size = new System.Drawing.Size(192, 21);
- this.comboActions.TabIndex = 1;
- //
- // CustomAddFilesDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.comboActions);
- this.Controls.Add(this.checkOverride);
- this.Name = "CustomAddFilesDialog";
- this.Padding = new System.Windows.Forms.Padding(7);
- this.Size = new System.Drawing.Size(384, 46);
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private System.Windows.Forms.CheckBox checkOverride;
- private System.Windows.Forms.ComboBox comboActions;
-
- }
-}
diff --git a/main/src/addins/WindowsPlatform/Dialogs/CustomAddFilesDialog.cs b/main/src/addins/WindowsPlatform/Dialogs/CustomAddFilesDialog.cs
deleted file mode 100644
index 8b53750b28..0000000000
--- a/main/src/addins/WindowsPlatform/Dialogs/CustomAddFilesDialog.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Drawing;
-using System.Data;
-using System.Text;
-using System.Windows.Forms;
-using CustomControls.Controls;
-
-namespace MonoDevelop.Platform
-{
- public partial class CustomAddFilesDialog : OpenFileDialogEx
- {
- public string[] BuildActions;
-
- public CustomAddFilesDialog()
- {
- InitializeComponent();
- Anchor = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right;
-
- // Use the classic dialogs, as the new ones (WPF based) can't handle child controls.
- FileDialog.AutoUpgradeEnabled = false;
- }
-
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
-
- foreach (string a in BuildActions)
- {
- if (a == "--") // Ignore separators for now
- continue;
- comboActions.Items.Add(a);
- }
- comboActions.SelectedIndex = 0;
- }
-
- // Need the dialog to be visible to access its controls coordinates.
- protected override void OnShow (EventArgs args)
- {
- base.OnShow (args);
- HorizontalLayout ();
- }
-
- void HorizontalLayout ()
- {
- var xOffset = FileNameLabelRect.X;
- checkOverride.Left += xOffset;
- comboActions.Left += xOffset;
- }
-
- private void checkOverride_CheckedChanged(object sender, EventArgs e)
- {
- comboActions.Enabled = checkOverride.Checked;
- }
-
- public string OverrideAction
- {
- get
- {
- if (checkOverride.Checked)
- return (string)comboActions.SelectedItem;
- else
- return null;
- }
- }
- }
-}
diff --git a/main/src/addins/WindowsPlatform/Dialogs/CustomAddFilesDialog.resx b/main/src/addins/WindowsPlatform/Dialogs/CustomAddFilesDialog.resx
deleted file mode 100644
index e57b641f21..0000000000
--- a/main/src/addins/WindowsPlatform/Dialogs/CustomAddFilesDialog.resx
+++ /dev/null
@@ -1,123 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <metadata name="dlgOpen.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
- <value>17, 17</value>
- </metadata>
-</root> \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/Dialogs/CustomOpenFileDialog.cs b/main/src/addins/WindowsPlatform/Dialogs/CustomOpenFileDialog.cs
deleted file mode 100644
index 0479fed992..0000000000
--- a/main/src/addins/WindowsPlatform/Dialogs/CustomOpenFileDialog.cs
+++ /dev/null
@@ -1,275 +0,0 @@
-//
-// CustomOpenFileDialog.cs
-//
-// Author:
-// Carlos Alberto Cortez <calberto.cortez@gmail.com>
-//
-// Copyright (c) 2011 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Drawing;
-using System.IO;
-using System.Text;
-using System.Windows.Forms;
-using CustomControls.Controls;
-using MonoDevelop.Ide;
-using MonoDevelop.Ide.Gui;
-using MonoDevelop.Ide.Extensions;
-using MonoDevelop.Platform;
-using MonoDevelop.Core;
-
-namespace MonoDevelop.Platform
-{
- public class CustomOpenFileDialog : OpenFileDialogEx
- {
- Label encodingLabel;
- Label viewerLabel;
- EncodingBox encodingBox;
- ComboBox viewerBox;
- CheckBox closeSolutionBox;
- int labelsWidth;
-
- const string EncodingText = "Encoding:";
- const string ViewerText = "Open with:";
-
- public CustomOpenFileDialog (FileDialog dialog, OpenFileDialogData data)
- : base (dialog)
- {
- Initialize (data);
-
- StartLocation = AddonWindowLocation.Bottom;
-
- // Use the classic dialogs, as the new ones (WPF based) can't handle child controls.
- if (data.ShowEncodingSelector || data.ShowViewerSelector) {
- dialog.AutoUpgradeEnabled = false;
- }
- }
-
-
- // We are required to compute the needed height to contain our controls
- // *before* the dialog is shown, thus we do it here as well as the vertical layout.
- // The X coords for our controls are set as soon as we get access to the native
- // dialog's controls, which happens to be when the OnShown event is fired.
- void Initialize (OpenFileDialogData data)
- {
- SuspendLayout ();
-
- int padding = 6;
- int y = padding;
-
- labelsWidth = GetMaxLabelWidth (data.ShowEncodingSelector, data.ShowViewerSelector);
-
- if (data.ShowEncodingSelector) {
- encodingLabel = new Label () {
- Text = GettextCatalog.GetString (EncodingText),
- Top = y,
- AutoSize = true
- };
-
- encodingBox = new EncodingBox (data.Action != Gtk.FileChooserAction.Save) {
- Top = y,
- SelectedEncodingId = data.Encoding != null ? data.Encoding.CodePage : 0,
- };
- encodingBox.Anchor = AnchorStyles.Left | AnchorStyles.Right;
-
- Controls.AddRange (new Control [] { encodingLabel, encodingBox });
-
- y += Math.Max (encodingLabel.Height, encodingBox.Height) + padding;
- }
-
- if (data.ShowViewerSelector && FileDialog is OpenFileDialog) {
- viewerLabel = new Label () {
- Text = GettextCatalog.GetString (ViewerText),
- Top = y,
- AutoSize = true
- };
-
- viewerBox = new ComboBox () {
- Top = y,
- DropDownStyle = ComboBoxStyle.DropDownList,
- Enabled = false
- };
- viewerBox.Anchor = AnchorStyles.Left | AnchorStyles.Right;
-
- y += Math.Max (viewerLabel.Height, viewerBox.Height) + padding;
-
- if (IdeApp.Workspace.IsOpen) {
- closeSolutionBox = new CheckBox () {
- Text = GettextCatalog.GetString ("Close current workspace"),
- Top = y,
- AutoSize = true,
- Checked = true,
- Enabled = false
- };
-
- y += closeSolutionBox.Height + padding;
- }
-
- if (encodingBox != null) {
- viewerBox.SelectedIndexChanged += delegate {
- int idx = viewerBox.SelectedIndex;
- encodingBox.Enabled = !(idx == 0 && currentViewers [0] == null);
- };
- }
-
- Controls.AddRange (new Control [] { viewerLabel, viewerBox });
- if (closeSolutionBox != null)
- Controls.Add (closeSolutionBox);
- }
-
- AutoScaleDimensions = new SizeF (6F, 13F);
- AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size (ClientSize.Width, y);
-
- ResumeLayout ();
- }
-
- public int SelectedEncodingId {
- get {
- return encodingBox == null ? 0 : encodingBox.SelectedEncodingId;
- }
- }
-
- public FileViewer SelectedViewer {
- get {
- if (viewerBox == null || currentViewers.Count == 0)
- return null;
-
- return currentViewers [viewerBox.SelectedIndex];
- }
- }
-
- public bool CloseCurrentWorkspace {
- get {
- return closeSolutionBox == null ? true : closeSolutionBox.Checked;
- }
- }
-
- List<FileViewer> currentViewers = new List<FileViewer> ();
-
- public override void OnFileNameChanged (string fileName)
- {
- base.OnFileNameChanged (fileName);
-
- bool slnViewerSelected = false; // whether the selected file is a project/solution file
-
- if (viewerBox != null) {
- FillViewers (currentViewers, viewerBox, fileName);
- if (currentViewers.Count > 0 && currentViewers [0] == null)
- slnViewerSelected = true;
-
- if (closeSolutionBox != null)
- closeSolutionBox.Enabled = slnViewerSelected;
- }
-
- if (encodingBox != null)
- encodingBox.Enabled = !slnViewerSelected;
- }
-
- protected override void OnShow (EventArgs args)
- {
- base.OnShow (args);
- HorizontalLayout ();
- }
-
- // Sort of ported from the MacSupport addin
- static void FillViewers (List<FileViewer> currentViewers, ComboBox viewerBox, string fileName)
- {
- currentViewers.Clear ();
- viewerBox.Items.Clear ();
-
- if (String.IsNullOrEmpty (fileName) || Directory.Exists (fileName)) {
- viewerBox.Enabled = false;
- return;
- }
-
- var projectService = IdeApp.Services.ProjectService;
- if (projectService.IsWorkspaceItemFile (fileName) || projectService.IsSolutionItemFile (fileName)) {
- viewerBox.Items.Add (GettextCatalog.GetString ("Solution Workbench"));
- currentViewers.Add (null);
- }
-
- foreach (var vw in DisplayBindingService.GetFileViewers (fileName, null)) {
- if (!vw.IsExternal) {
- viewerBox.Items.Add (vw.Title);
- currentViewers.Add (vw);
- }
- }
-
- viewerBox.Enabled = currentViewers.Count > 1;
- viewerBox.SelectedIndex = 0;
- }
-
- // Align our label/comobox/checkbox objects with respect to the native dialog ones.
- void HorizontalLayout ()
- {
- var labelRect = FileNameLabelRect; // Native dialog's label for filename
- int labelsX = labelRect.X;
-
- var comboRect = FileNameComboRect; // Native dialog's combobox for filename
- int boxesX = comboRect.X;
- int boxesWidth = comboRect.Width;
-
- int hPadding = 5;
-
- if (labelsWidth + hPadding > labelRect.Width) { // Adjust our comboBox objects if needed
- boxesX = labelsX + (labelsWidth + hPadding);
- boxesWidth = comboRect.Right - boxesX;
- }
-
- if (encodingLabel != null) {
- encodingLabel.Left = labelsX;
-
- encodingBox.Left = boxesX;
- encodingBox.Width = boxesWidth;
- }
-
- if (viewerLabel != null) {
- viewerLabel.Left = labelsX;
-
- viewerBox.Left = boxesX;
- viewerBox.Width = boxesWidth;
- }
-
- if (closeSolutionBox != null)
- closeSolutionBox.Left = boxesX;
- }
-
- int GetMaxLabelWidth (bool showEncoding, bool showViewer)
- {
- if (!showEncoding && !showViewer)
- return 0;
-
- Graphics g = CreateGraphics ();
- int encodingWidth = 0;
- int viewerWidth = 0;
-
- if (showEncoding)
- encodingWidth = (int)g.MeasureString (GettextCatalog.GetString (EncodingText), Font).Width;
-
- if (showViewer)
- viewerWidth = (int)g.MeasureString (GettextCatalog.GetString (ViewerText), Font).Width;
-
- return Math.Max (encodingWidth, viewerWidth);
- }
- }
-}
diff --git a/main/src/addins/WindowsPlatform/Dialogs/EncodingComboBox.cs b/main/src/addins/WindowsPlatform/Dialogs/EncodingComboBox.cs
deleted file mode 100644
index 886c3bc36a..0000000000
--- a/main/src/addins/WindowsPlatform/Dialogs/EncodingComboBox.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-//
-// EncodingComboBox.cs
-//
-// Author:
-// Carlos Alberto Cortez <calberto.cortez@gmail.com>
-//
-// Copyright (c) 2011 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Drawing;
-using System.Data;
-using System.Text;
-using System.Windows.Forms;
-using CustomControls.Controls;
-using MonoDevelop.Ide.Extensions;
-using MonoDevelop.Platform;
-using MonoDevelop.Core;
-using MonoDevelop.Projects.Text;
-using MonoDevelop.Ide;
-
-namespace MonoDevelop.Platform
-{
- public class EncodingBox : ComboBox
- {
- int [] encodings;
- bool showAutoDetected;
-
- public EncodingBox (bool showAutoDetected)
- {
- this.showAutoDetected = showAutoDetected;
-
- DropDownStyle = ComboBoxStyle.DropDownList;
-
- Populate (false);
- SelectedEncodingId = 0;
- }
-
- public int SelectedEncodingId {
- get {
- int selectedIndex = SelectedIndex;
- if (selectedIndex < 0 || (showAutoDetected && selectedIndex == 0))
- return 0;
-
- return encodings [showAutoDetected ? selectedIndex - 1 : selectedIndex];
- }
- set {
- if (value != 0)
- for (int i = 0; i < encodings.Length; i++)
- if (encodings [i] == value) {
- SelectedIndex = showAutoDetected ? i + 1 : i;
- return;
- }
-
- SelectedIndex = 0;
- }
- }
-
- void Populate (bool clear)
- {
- encodings = SeletedEncodings.ConversionEncodings;
- if (encodings == null || encodings.Length == 0)
- encodings = SeletedEncodings.DefaultEncodings;
-
- BeginUpdate ();
-
- if (clear)
- Items.Clear ();
-
- if (showAutoDetected)
- Items.Add (GettextCatalog.GetString ("Auto Detected"));
-
- foreach (var encoding in TextEncoding.ConversionEncodings)
- Items.Add (String.Format ("{0} ({1})", encoding.Name, encoding.Id));
-
- Items.Add (GettextCatalog.GetString ("Add or Remove..."));
-
- EndUpdate ();
- }
-
- protected override void OnSelectedIndexChanged (EventArgs e)
- {
- base.OnSelectedIndexChanged (e);
-
- // 'Add or Remove...' option
- if (Items.Count > 0 && SelectedIndex == Items.Count -1) {
- using (var encodingsForm = new EncodingSelectionForm ()) {
- if (encodingsForm.ShowDialog (Parent) == DialogResult.OK) {
- TextEncoding.ConversionEncodings = encodingsForm.SelectedEncodings;
- Populate (true);
- }
- }
-
- SelectedIndex = 0;
- }
- }
- }
-}
-
diff --git a/main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.Designer.cs b/main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.Designer.cs
deleted file mode 100644
index 0031bfc576..0000000000
--- a/main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.Designer.cs
+++ /dev/null
@@ -1,193 +0,0 @@
-namespace MonoDevelop.Platform
-{
- partial class EncodingSelectionForm
- {
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.IContainer components = null;
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
- protected override void Dispose (bool disposing)
- {
- if (disposing && (components != null)) {
- components.Dispose ();
- }
- base.Dispose (disposing);
- }
-
- #region Windows Form Designer generated code
-
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent ()
- {
- this.label1 = new System.Windows.Forms.Label ();
- this.addButton = new System.Windows.Forms.Button ();
- this.removeButton = new System.Windows.Forms.Button ();
- this.okButton = new System.Windows.Forms.Button ();
- this.cancelButton = new System.Windows.Forms.Button ();
- this.label2 = new System.Windows.Forms.Label ();
- this.shownListView = new MonoDevelop.Platform.EncodingListView ();
- this.availableListView = new MonoDevelop.Platform.EncodingListView ();
- this.upButton = new System.Windows.Forms.Button ();
- this.downButton = new System.Windows.Forms.Button ();
- this.SuspendLayout ();
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point (10, 12);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size (105, 15);
- this.label1.TabIndex = 0;
- this.label1.Text = "Available encodings:";
- //
- // addButton
- //
- this.addButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.addButton.Location = new System.Drawing.Point (291, 169);
- this.addButton.Name = "addButton";
- this.addButton.Size = new System.Drawing.Size (50, 30);
- this.addButton.TabIndex = 2;
- this.addButton.Text = ">";
- this.addButton.UseVisualStyleBackColor = true;
- this.addButton.Click += new System.EventHandler (this.addButtonClick);
- //
- // removeButton
- //
- this.removeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.removeButton.Location = new System.Drawing.Point (291, 205);
- this.removeButton.Name = "removeButton";
- this.removeButton.Size = new System.Drawing.Size (50, 30);
- this.removeButton.TabIndex = 3;
- this.removeButton.Text = "<";
- this.removeButton.UseVisualStyleBackColor = true;
- this.removeButton.Click += new System.EventHandler (this.removeButtonClick);
- //
- // okButton
- //
- this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.okButton.Location = new System.Drawing.Point (534, 395);
- this.okButton.Name = "okButton";
- this.okButton.Size = new System.Drawing.Size (75, 23);
- this.okButton.TabIndex = 5;
- this.okButton.Text = "OK";
- this.okButton.UseVisualStyleBackColor = true;
- this.okButton.Click += new System.EventHandler (this.okButtonClick);
- //
- // cancelButton
- //
- this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.cancelButton.Location = new System.Drawing.Point (615, 395);
- this.cancelButton.Name = "cancelButton";
- this.cancelButton.Size = new System.Drawing.Size (75, 23);
- this.cancelButton.TabIndex = 6;
- this.cancelButton.Text = "Cancel";
- this.cancelButton.UseVisualStyleBackColor = true;
- this.cancelButton.Click += new System.EventHandler (this.cancelButtonClick);
- //
- // label2
- //
- this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point (350, 12);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size (132, 15);
- this.label2.TabIndex = 7;
- this.label2.Text = "Encodings shown in menu:";
- //
- // shownListView
- //
- this.shownListView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.shownListView.FullRowSelect = true;
- this.shownListView.Location = new System.Drawing.Point (350, 39);
- this.shownListView.MultiSelect = false;
- this.shownListView.Name = "shownListView";
- this.shownListView.Size = new System.Drawing.Size (280, 343);
- this.shownListView.TabIndex = 4;
- this.shownListView.UseCompatibleStateImageBehavior = false;
- this.shownListView.View = System.Windows.Forms.View.Details;
- //
- // availableListView
- //
- this.availableListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.availableListView.FullRowSelect = true;
- this.availableListView.Location = new System.Drawing.Point (10, 40);
- this.availableListView.MultiSelect = false;
- this.availableListView.Name = "availableListView";
- this.availableListView.Size = new System.Drawing.Size (270, 342);
- this.availableListView.TabIndex = 1;
- this.availableListView.UseCompatibleStateImageBehavior = false;
- this.availableListView.View = System.Windows.Forms.View.Details;
- //
- // upButton
- //
- this.upButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.upButton.Location = new System.Drawing.Point (640, 169);
- this.upButton.Name = "upButton";
- this.upButton.Size = new System.Drawing.Size (50, 30);
- this.upButton.TabIndex = 8;
- this.upButton.Text = "Up";
- this.upButton.UseVisualStyleBackColor = true;
- this.upButton.Click += new System.EventHandler (this.upButtonClick);
- //
- // downButton
- //
- this.downButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.downButton.Location = new System.Drawing.Point (640, 205);
- this.downButton.Name = "downButton";
- this.downButton.Size = new System.Drawing.Size (50, 30);
- this.downButton.TabIndex = 9;
- this.downButton.Text = "Down";
- this.downButton.UseVisualStyleBackColor = true;
- this.downButton.Click += new System.EventHandler (this.downButtonClick);
- //
- // EncodingSelectionForm
- //
- this.AcceptButton = this.okButton;
- this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 15F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.CancelButton = this.cancelButton;
- this.ClientSize = new System.Drawing.Size (703, 431);
- this.Controls.Add (this.downButton);
- this.Controls.Add (this.upButton);
- this.Controls.Add (this.label2);
- this.Controls.Add (this.shownListView);
- this.Controls.Add (this.cancelButton);
- this.Controls.Add (this.okButton);
- this.Controls.Add (this.removeButton);
- this.Controls.Add (this.addButton);
- this.Controls.Add (this.availableListView);
- this.Controls.Add (this.label1);
- this.Name = "EncodingSelectionForm";
- this.ShowInTaskbar = false;
- this.Text = "Select Text Encodings";
- this.ResumeLayout (false);
- this.PerformLayout ();
-
- }
-
- #endregion
-
- private System.Windows.Forms.Label label1;
- private EncodingListView availableListView;
- private System.Windows.Forms.Button addButton;
- private System.Windows.Forms.Button removeButton;
- private System.Windows.Forms.Button okButton;
- private System.Windows.Forms.Button cancelButton;
- private EncodingListView shownListView;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Button upButton;
- private System.Windows.Forms.Button downButton;
- }
-} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.cs b/main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.cs
deleted file mode 100644
index 94b092248f..0000000000
--- a/main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.cs
+++ /dev/null
@@ -1,206 +0,0 @@
-//
-// EncodingSelectionForm.cs
-//
-// Author:
-// Carlos Alberto Cortez <calberto.cortez@gmail.com>
-//
-// Copyright (c) 2011 Carlos Alberto Cortez
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-
-using MonoDevelop.Core;
-using MonoDevelop.Projects.Text;
-using MonoDevelop.Components;
-
-using CustomControls.OS;
-
-namespace MonoDevelop.Platform
-{
- public partial class EncodingSelectionForm : Form
- {
- public EncodingSelectionForm ()
- {
- InitializeComponent ();
- LoadStockItems ();
- Populate ();
- }
-
- void Populate ()
- {
- var availableEncodings = new Dictionary<string,TextEncoding> ();
- foreach (var encoding in TextEncoding.SupportedEncodings)
- availableEncodings [encoding.Id] = encoding;
-
- var shownEncodings = TextEncoding.ConversionEncodings;
-
- shownListView.BeginUpdate ();
- foreach (var encoding in shownEncodings) {
- var item = new ListViewItem (new string [] { encoding.Id, encoding.Name }) {
- Tag = encoding
- };
- shownListView.Items.Add (item);
-
- // Don't show on the available list the encodings
- // that are already being shown
- availableEncodings.Remove (encoding.Id);
- }
- shownListView.AutoResizeColumns (ColumnHeaderAutoResizeStyle.HeaderSize);
- shownListView.EndUpdate ();
-
- availableListView.BeginUpdate ();
- foreach (var encoding in availableEncodings) {
- var item = new ListViewItem (new string [] { encoding.Value.Id, encoding.Value.Name }) {
- Tag = encoding.Value
- };
- availableListView.Items.Add (item);
- }
- availableListView.AutoResizeColumns (ColumnHeaderAutoResizeStyle.HeaderSize);
- availableListView.EndUpdate ();
- }
-
- void LoadStockItems ()
- {
- SetStockImage (addButton, Gtk.Stock.GoForward);
- SetStockImage (removeButton, Gtk.Stock.GoBack);
- SetStockImage (upButton, Gtk.Stock.GoUp);
- SetStockImage (downButton, Gtk.Stock.GoDown);
-
- Icon = WinFormsRoot.MonoDevelopIcon;
- }
-
- void SetStockImage (Button b, string stockId)
- {
- var pixbuf = MonoDevelop.Ide.ImageService.GetIcon (stockId, Gtk.IconSize.Button).ToPixbuf ();
- var stockImage = Image.FromStream (new System.IO.MemoryStream (pixbuf.SaveToBuffer ("png")));
-
- b.Image = stockImage;
- b.Text = String.Empty;
- }
-
- public TextEncoding [] SelectedEncodings {
- get {
- var encodings = shownListView.Items.Cast<ListViewItem> ().Select (item => (TextEncoding)item.Tag);
- return encodings.ToArray ();
- }
- }
-
- void MoveItem (ListView srcView, ListView destView)
- {
- if (srcView.SelectedIndices.Count == 0)
- return;
-
- int selectedIndex = srcView.SelectedIndices [0];
- var item = srcView.Items [selectedIndex];
-
- srcView.Items.RemoveAt (selectedIndex);
- destView.Items.Add (item);
- destView.AutoResizeColumns (ColumnHeaderAutoResizeStyle.HeaderSize);
- }
-
- private void addButtonClick (object sender, EventArgs e)
- {
- MoveItem (availableListView, shownListView);
- }
-
- private void removeButtonClick (object sender, EventArgs e)
- {
- MoveItem (shownListView, availableListView);
- }
-
- void ShiftItem (ListView listView, int shift)
- {
- if (listView.SelectedIndices.Count == 0)
- return;
-
- int selectedIndex = listView.SelectedIndices[0];
- int newIndex = selectedIndex + shift;
- if (newIndex < 0 || newIndex >= listView.Items.Count)
- return;
-
- listView.BeginUpdate ();
-
- var item = listView.Items[selectedIndex];
- listView.Items.RemoveAt (selectedIndex);
- listView.Items.Insert (newIndex, item);
- item.Selected = true;
-
- listView.EndUpdate ();
- }
-
- private void upButtonClick (object sender, EventArgs e)
- {
- ShiftItem (shownListView, -1);
- }
-
- private void downButtonClick (object sender, EventArgs e)
- {
- ShiftItem (shownListView, 1);
- }
-
- private void okButtonClick (object sender, EventArgs e)
- {
- DialogResult = DialogResult.OK;
- }
-
- private void cancelButtonClick (object sender, EventArgs e)
- {
- DialogResult = DialogResult.Cancel;
- }
-
- protected override void WndProc (ref Message m)
- {
- base.WndProc (ref m);
-
- switch (m.Msg) {
- // No need to take into account the idle event, as
- // we are handling it already from WinFormsRoot
- case (int) Msg.WM_WINDOWPOSCHANGED:
- MonoDevelop.Ide.DispatchService.RunPendingEvents ();
- break;
- }
- }
- }
-
- public class EncodingListView : ListView
- {
- public EncodingListView ()
- {
- SuspendLayout ();
-
- View = View.Details;
- MultiSelect = false;
- FullRowSelect = true;
- HideSelection = false;
-
- Columns.Add ("Name");
- Columns.Add ("Encoding");
-
- ResumeLayout ();
- }
- }
-}
diff --git a/main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.resx b/main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.resx
deleted file mode 100644
index 29dcb1b3a3..0000000000
--- a/main/src/addins/WindowsPlatform/Dialogs/EncodingSelectionForm.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
-</root> \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/Dialogs/OpenFileDialogEx.Designer.cs b/main/src/addins/WindowsPlatform/Dialogs/OpenFileDialogEx.Designer.cs
deleted file mode 100644
index c2ddc1c6e0..0000000000
--- a/main/src/addins/WindowsPlatform/Dialogs/OpenFileDialogEx.Designer.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-namespace CustomControls.Controls
-{
- partial class OpenFileDialogEx
- {
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.IContainer components = null;
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.SuspendLayout();
- //
- // OpenFileDialogEx
- //
- this.Name = "OpenFileDialogEx";
- this.Size = new System.Drawing.Size(255, 246);
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
-
- }
-} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/Dialogs/OpenFileDialogEx.cs b/main/src/addins/WindowsPlatform/Dialogs/OpenFileDialogEx.cs
deleted file mode 100644
index 6ca8fc0dda..0000000000
--- a/main/src/addins/WindowsPlatform/Dialogs/OpenFileDialogEx.cs
+++ /dev/null
@@ -1,672 +0,0 @@
-// Copyright (c) 2006, Gustavo Franco
-// Email: gustavo_franco@hotmail.com
-// All rights reserved.
-
-// Redistribution and use in source and binary forms, with or without modification,
-// are permitted provided that the following conditions are met:
-
-// Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-
-// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
-// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
-// PURPOSE. IT CAN BE DISTRIBUTED FREE OF CHARGE AS LONG AS THIS HEADER
-// REMAINS UNCHANGED.
-
-using System;
-using System.IO;
-using System.Text;
-using System.Data;
-using System.Drawing;
-using System.Threading;
-using System.Windows.Forms;
-using System.ComponentModel;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-
-using CustomControls.OS;
-
-namespace CustomControls.Controls
-{
- [Author("Franco, Gustavo")]
- public partial class OpenFileDialogEx : UserControl
- {
- #region delegates
- public delegate void FileNameChangedHandler(OpenFileDialogEx sender, string filePath);
- #endregion
-
- #region Events
- public event FileNameChangedHandler FileNameChanged;
- public event FileNameChangedHandler FolderNameChanged;
- public event EventHandler ClosingDialog;
- #endregion
-
- #region Constants Declaration
- internal const SetWindowPosFlags UFLAGSHIDE =
- SetWindowPosFlags.SWP_NOACTIVATE |
- SetWindowPosFlags.SWP_NOOWNERZORDER |
- SetWindowPosFlags.SWP_NOMOVE |
- SetWindowPosFlags.SWP_NOSIZE |
- SetWindowPosFlags.SWP_HIDEWINDOW;
- #endregion
-
- #region Variables Declaration
- private AddonWindowLocation mStartLocation = AddonWindowLocation.Right;
- private FolderViewMode mDefaultViewMode= FolderViewMode.Default;
- private FileDialog fileDialog;
- private DummyForm form;
- #endregion
-
- #region Constructors
- public OpenFileDialogEx () : this (new OpenFileDialog ())
- {
- }
-
- public OpenFileDialogEx (FileDialog fileDialog)
- {
- if (fileDialog == null)
- throw new ArgumentNullException ("fileDialog");
-
- InitializeComponent();
-// dlgOpen.AutoUpgradeEnabled = false;
- //SetStyle(ControlStyles.SupportsTransparentBackColor, true);
-
- this.fileDialog = fileDialog;
- }
- #endregion
-
- #region Properties
- public FileDialog FileDialog
- {
- get {return fileDialog;}
- }
-
- [DefaultValue(AddonWindowLocation.Right)]
- public AddonWindowLocation StartLocation
- {
- get {return mStartLocation;}
- set {mStartLocation = value;}
- }
-
- [DefaultValue(FolderViewMode.Default)]
- public FolderViewMode DefaultViewMode
- {
- get {return mDefaultViewMode;}
- set {mDefaultViewMode = value;}
- }
-
- protected Rectangle FileNameLabelRect
- {
- get {
- if (form == null || form.NativeDialog == null)
- return Rectangle.Empty;
-
- return form.NativeDialog.FileNameLabelRect;
- }
- }
-
- protected Rectangle FileNameComboRect
- {
- get {
- if (form == null || form.NativeDialog == null)
- return Rectangle.Empty;
-
- return form.NativeDialog.FileNameComboRect;
- }
- }
- #endregion
-
- #region Virtuals
- public virtual void OnFileNameChanged(string fileName)
- {
- if (FileNameChanged != null)
- FileNameChanged(this, fileName);
- }
-
- public virtual void OnFolderNameChanged(string folderName)
- {
- if (FolderNameChanged != null)
- FolderNameChanged(this, folderName);
- }
-
- public virtual void OnClosingDialog()
- {
- if (ClosingDialog != null)
- ClosingDialog(this, new EventArgs());
- }
-
- protected virtual void OnShow(EventArgs args)
- {
- }
- #endregion
-
- #region Methods
- public DialogResult ShowDialog()
- {
- return ShowDialog(null);
- }
-
- public DialogResult ShowDialog(IWin32Window owner)
- {
- form = new DummyForm(this);
- if (owner is Form)
- form.Icon = ((Form)owner).Icon; // Inherit the app/window icon
-
- form.Show(owner);
- Win32.SetWindowPos(form.Handle, IntPtr.Zero, 0, 0, 0, 0, UFLAGSHIDE);
- form.WatchForActivate = true;
- try
- {
- return fileDialog.ShowDialog(form);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- return DialogResult.Cancel;
- }
- finally
- {
- //form.Dispose();
- //form.Close();
- }
- }
- #endregion
-
- #region Helper Classes
- [Author("Franco, Gustavo")]
- private class OpenDialogNative : NativeWindow, IDisposable
- {
- #region Constants Declaration
- private SetWindowPosFlags UFLAGSSIZE =
- SetWindowPosFlags.SWP_NOACTIVATE |
- SetWindowPosFlags.SWP_NOOWNERZORDER |
- SetWindowPosFlags.SWP_NOMOVE;
- private SetWindowPosFlags UFLAGSHIDE =
- SetWindowPosFlags.SWP_NOACTIVATE |
- SetWindowPosFlags.SWP_NOOWNERZORDER |
- SetWindowPosFlags.SWP_NOMOVE |
- SetWindowPosFlags.SWP_NOSIZE |
- SetWindowPosFlags.SWP_HIDEWINDOW;
- private SetWindowPosFlags UFLAGSZORDER =
- SetWindowPosFlags.SWP_NOACTIVATE |
- SetWindowPosFlags.SWP_NOMOVE |
- SetWindowPosFlags.SWP_NOSIZE;
- #endregion
-
- #region Variables Declaration
- private Size mOriginalSize;
- private IntPtr mOpenDialogHandle;
- private IntPtr mListViewPtr;
- private WINDOWINFO mListViewInfo;
- private BaseDialogNative mBaseDialogNative;
- private IntPtr mComboFolders;
- private WINDOWINFO mComboFoldersInfo;
- private IntPtr mGroupButtons;
- private WINDOWINFO mGroupButtonsInfo;
- private IntPtr mComboFileName;
- private WINDOWINFO mComboFileNameInfo;
- private IntPtr mComboExtensions;
- private WINDOWINFO mComboExtensionsInfo;
- private IntPtr mOpenButton;
- private WINDOWINFO mOpenButtonInfo;
- private IntPtr mCancelButton;
- private WINDOWINFO mCancelButtonInfo;
- private IntPtr mHelpButton;
- private WINDOWINFO mHelpButtonInfo;
- private OpenFileDialogEx mSourceControl;
- private IntPtr mToolBarFolders;
- private WINDOWINFO mToolBarFoldersInfo;
- private IntPtr mLabelFileName;
- private WINDOWINFO mLabelFileNameInfo;
- private IntPtr mLabelFileType;
- private WINDOWINFO mLabelFileTypeInfo;
- private IntPtr mChkReadOnly;
- private WINDOWINFO mChkReadOnlyInfo;
- private bool mIsClosing = false;
- private bool mInitializated = false;
- private WINDOWINFO mOpenDialogWindowInfo;
- private RECT mOpenDialogWindowRect = new RECT();
- private RECT mOpenDialogClientRect = new RECT();
- #endregion
-
- #region Constructors
- public OpenDialogNative(IntPtr handle, OpenFileDialogEx sourceControl)
- {
- mOpenDialogHandle = handle;
- mSourceControl = sourceControl;
- AssignHandle(mOpenDialogHandle);
- }
- #endregion
-
- #region Events
- private void BaseDialogNative_FileNameChanged(BaseDialogNative sender, string filePath)
- {
- if (mSourceControl != null)
- mSourceControl.OnFileNameChanged(filePath);
- }
-
- private void BaseDialogNative_FolderNameChanged(BaseDialogNative sender, string folderName)
- {
- if (mSourceControl != null)
- mSourceControl.OnFolderNameChanged(folderName);
- }
- #endregion
-
- #region Properties
- public bool IsClosing
- {
- get {return mIsClosing;}
- set {mIsClosing = value;}
- }
-
- public Rectangle FileNameLabelRect
- {
- get {
- return RectToDialogClient(mLabelFileNameInfo.rcWindow);
- }
- }
-
- public Rectangle FileNameComboRect
- {
- get {
- return RectToDialogClient(mComboFileNameInfo.rcWindow);
- }
- }
- #endregion
-
- #region Methods
- public void Dispose()
- {
- ReleaseHandle();
- if (mBaseDialogNative != null)
- {
- mBaseDialogNative.FileNameChanged -= new BaseDialogNative.FileNameChangedHandler(BaseDialogNative_FileNameChanged);
- mBaseDialogNative.FolderNameChanged -= new BaseDialogNative.FileNameChangedHandler(BaseDialogNative_FolderNameChanged);
- mBaseDialogNative.Dispose();
- }
- }
- #endregion
-
- #region Private Methods
- private Rectangle RectToDialogClient(RECT rect)
- {
- uint locX = mOpenDialogWindowRect.left + mOpenDialogWindowInfo.cxWindowBorders;
- uint locY = mOpenDialogWindowRect.top + mOpenDialogWindowInfo.cyWindowBorders;
-
- rect.left -= locX;
- rect.right -= locX;
- rect.bottom -= locY;
- rect.top -= locY;
-
- return new Rectangle ((int)rect.left, (int)rect.top,
- (int)(rect.right - rect.left), (int)(rect.bottom - rect.top));
- }
-
- private void PopulateWindowsHandlers()
- {
- Win32.EnumChildWindows(mOpenDialogHandle, new Win32.EnumWindowsCallBack(OpenFileDialogEnumWindowCallBack), 0);
- }
-
- private bool OpenFileDialogEnumWindowCallBack(IntPtr hwnd, int lParam)
- {
- StringBuilder className = new StringBuilder(256);
- Win32.GetClassName(hwnd, className, className.Capacity);
- int controlID = Win32.GetDlgCtrlID(hwnd);
- WINDOWINFO windowInfo;
- Win32.GetWindowInfo(hwnd, out windowInfo);
-
- // Dialog Window
- if (className.ToString().StartsWith("#32770"))
- {
- mBaseDialogNative = new BaseDialogNative(hwnd);
- mBaseDialogNative.FileNameChanged += new BaseDialogNative.FileNameChangedHandler(BaseDialogNative_FileNameChanged);
- mBaseDialogNative.FolderNameChanged += new BaseDialogNative.FileNameChangedHandler(BaseDialogNative_FolderNameChanged);
- return true;
- }
-
- switch((ControlsID) controlID)
- {
- case ControlsID.DefaultView:
- mListViewPtr = hwnd;
- Win32.GetWindowInfo(hwnd, out mListViewInfo);
- if (mSourceControl.DefaultViewMode != FolderViewMode.Default)
- Win32.SendMessage(mListViewPtr, (int) Msg.WM_COMMAND, (int) mSourceControl.DefaultViewMode, 0);
- break;
- case ControlsID.ComboFolder:
- mComboFolders = hwnd;
- mComboFoldersInfo = windowInfo;
- break;
- case ControlsID.ComboFileType:
- mComboExtensions = hwnd;
- mComboExtensionsInfo = windowInfo;
- break;
- case ControlsID.ComboFileName:
- if (className.ToString().ToLower() == "comboboxex32")
- {
- mComboFileName = hwnd;
- mComboFileNameInfo = windowInfo;
- }
- break;
- case ControlsID.GroupFolder:
- mGroupButtons = hwnd;
- mGroupButtonsInfo = windowInfo;
- break;
- case ControlsID.LeftToolBar:
- mToolBarFolders = hwnd;
- mToolBarFoldersInfo = windowInfo;
- break;
- case ControlsID.ButtonOpen:
- mOpenButton = hwnd;
- mOpenButtonInfo = windowInfo;
- break;
- case ControlsID.ButtonCancel:
- mCancelButton = hwnd;
- mCancelButtonInfo = windowInfo;
- break;
- case ControlsID.ButtonHelp:
- mHelpButton = hwnd;
- mHelpButtonInfo = windowInfo;
- break;
- case ControlsID.CheckBoxReadOnly:
- mChkReadOnly = hwnd;
- mChkReadOnlyInfo = windowInfo;
- break;
- case ControlsID.LabelFileName:
- mLabelFileName = hwnd;
- mLabelFileNameInfo = windowInfo;
- break;
- case ControlsID.LabelFileType:
- mLabelFileType = hwnd;
- mLabelFileTypeInfo = windowInfo;
- break;
- }
-
- return true;
- }
-
- private void InitControls()
- {
- mInitializated = true;
-
- // Lets get information about the current open dialog
- Win32.GetClientRect(mOpenDialogHandle, ref mOpenDialogClientRect);
- Win32.GetWindowInfo(mOpenDialogHandle, out mOpenDialogWindowInfo);
- mOpenDialogWindowRect = mOpenDialogWindowInfo.rcWindow;
-
- // Lets borrow the Handles from the open dialog control
- PopulateWindowsHandlers();
-
- // Resize OpenDialog to make fit our extra form
- switch(mSourceControl.StartLocation)
- {
- case AddonWindowLocation.Right:
- // Now we transfer the control to the open dialog
- mSourceControl.Location = new Point((int) (mOpenDialogClientRect.Width - mSourceControl.Width), 0);
-
- // Everything is ready, now lets change the parent
- Win32.SetParent(mSourceControl.Handle, mOpenDialogHandle);
-
- // Send the control to the back
- Win32.SetWindowPos(mSourceControl.Handle, (IntPtr) ZOrderPos.HWND_BOTTOM, 0, 0, 0, 0, UFLAGSZORDER);
- break;
- case AddonWindowLocation.Bottom:
- // Now we transfer the control to the open dialog
- mSourceControl.Location = new Point(0, (int) (mOpenDialogClientRect.Height - mSourceControl.Height));
-
- // Everything is ready, now lets change the parent
- Win32.SetParent(mSourceControl.Handle, mOpenDialogHandle);
-
- // Send the control to the back
- Win32.SetWindowPos(mSourceControl.Handle, (IntPtr) ZOrderPos.HWND_BOTTOM, 0, 0, 0, 0, UFLAGSZORDER);
- break;
- case AddonWindowLocation.None:
- // We don't have to do too much in this case, but set parent must be the first call
- // because else ZOrder won't worl
- Win32.SetParent(mSourceControl.Handle, mOpenDialogHandle);
-
- // Send the control to the back
- Win32.SetWindowPos(mSourceControl.Handle, (IntPtr) ZOrderPos.HWND_BOTTOM, 0, 0, 0, 0, UFLAGSZORDER);
- break;
- }
- }
- #endregion
-
- #region Overrides
- protected override void WndProc(ref Message m)
- {
- switch(m.Msg)
- {
- case (int) Msg.WM_SHOWWINDOW:
- mInitializated = true;
- InitControls();
-
- mSourceControl.OnShow(EventArgs.Empty);
- break;
- case (int) Msg.WM_WINDOWPOSCHANGING:
- if (!mIsClosing)
- {
- if (!mInitializated)
- {
- WINDOWPOS pos = (WINDOWPOS) Marshal.PtrToStructure(m.LParam, typeof(WINDOWPOS));
- if (mSourceControl.StartLocation == AddonWindowLocation.Right)
- {
- if (pos.flags != 0 && ((pos.flags & (int) SWP_Flags.SWP_NOSIZE) != (int) SWP_Flags.SWP_NOSIZE))
- {
- mOriginalSize = new Size(pos.cx, pos.cy);
-
- pos.cx += mSourceControl.Width;
- Marshal.StructureToPtr(pos, m.LParam, true);
- }
- }
-
- if (mSourceControl.StartLocation == AddonWindowLocation.Bottom)
- {
- if (pos.flags != 0 && ((pos.flags & (int) SWP_Flags.SWP_NOSIZE) != (int) SWP_Flags.SWP_NOSIZE))
- {
- mOriginalSize = new Size(pos.cx, pos.cy);
-
- pos.cy += mSourceControl.Height;
- Marshal.StructureToPtr(pos, m.LParam, true);
- }
- }
- }
-
- RECT currentSize = new RECT();
- Win32.GetClientRect(mOpenDialogHandle, ref currentSize);
-
- switch(mSourceControl.StartLocation)
- {
- case AddonWindowLocation.Right: {
- var loc = new Point((int)(currentSize.Width - mSourceControl.Width), 0);
- if (mSourceControl.Location != loc)
- mSourceControl.Location = loc;
- if (mSourceControl.Height != (int) currentSize.Height)
- mSourceControl.Height = (int) currentSize.Height;
- break;
- }
- case AddonWindowLocation.Bottom: {
- var loc = new Point(0, (int)(currentSize.Height - mSourceControl.Height));
- if (mSourceControl.Location != loc)
- mSourceControl.Location = loc;
- if (mSourceControl.Width != (int) currentSize.Width)
- mSourceControl.Width = (int) currentSize.Width;
- break;
- }
- case AddonWindowLocation.None: {
- if (mSourceControl.Width != (int) currentSize.Width)
- mSourceControl.Width = (int) currentSize.Width;
- if (mSourceControl.Height != (int) currentSize.Height)
- mSourceControl.Height = (int) currentSize.Height;
- break;
- }
- }
- }
- break;
- case (int) Msg.WM_IME_NOTIFY:
- if (m.WParam == (IntPtr) ImeNotify.IMN_CLOSESTATUSWINDOW)
- {
- mIsClosing = true;
- mSourceControl.OnClosingDialog();
-
- Win32.SetWindowPos(mOpenDialogHandle, IntPtr.Zero, 0, 0, 0, 0, UFLAGSHIDE);
- Win32.GetWindowRect(mOpenDialogHandle, ref mOpenDialogWindowRect);
- Win32.SetWindowPos(mOpenDialogHandle, IntPtr.Zero,
- (int) (mOpenDialogWindowRect.left),
- (int) (mOpenDialogWindowRect.top),
- (int) (mOriginalSize.Width),
- (int) (mOriginalSize.Height),
- UFLAGSSIZE);
- }
- break;
- }
- base.WndProc(ref m);
- }
- #endregion
- }
-
- [Author("Franco, Gustavo")]
- private class BaseDialogNative : NativeWindow, IDisposable
- {
- #region delegates
- public delegate void FileNameChangedHandler(BaseDialogNative sender, string filePath);
- #endregion
-
- #region Events
- public event FileNameChangedHandler FileNameChanged;
- public event FileNameChangedHandler FolderNameChanged;
- #endregion
-
- #region Variables Declaration
- private IntPtr mhandle;
- #endregion
-
- #region Constructors
- public BaseDialogNative(IntPtr handle)
- {
- mhandle = handle;
- AssignHandle(handle);
- }
- #endregion
-
- #region Methods
- public void Dispose()
- {
- ReleaseHandle();
- }
- #endregion
-
- #region Overrides
- protected override void WndProc(ref Message m)
- {
- switch (m.Msg)
- {
- case (int) Msg.WM_NOTIFY:
- OFNOTIFY ofNotify = (OFNOTIFY) Marshal.PtrToStructure(m.LParam, typeof(OFNOTIFY));
- if (ofNotify.hdr.code == (uint) DialogChangeStatus.CDN_SELCHANGE)
- {
- StringBuilder filePath = new StringBuilder(256);
- Win32.SendMessage(Win32.GetParent(mhandle), (int) DialogChangeProperties.CDM_GETFILEPATH, (int) 256, filePath);
- if (FileNameChanged != null)
- FileNameChanged(this, filePath.ToString());
- }
- else if (ofNotify.hdr.code == (uint) DialogChangeStatus.CDN_FOLDERCHANGE)
- {
- StringBuilder folderPath = new StringBuilder(256);
- Win32.SendMessage(Win32.GetParent(mhandle), (int) DialogChangeProperties.CDM_GETFOLDERPATH, (int) 256, folderPath);
- if (FolderNameChanged != null)
- FolderNameChanged(this, folderPath.ToString());
- }
- break;
- }
- base.WndProc(ref m);
- }
- #endregion
- }
-
- [Author("Franco, Gustavo")]
- private class DummyForm : Form
- {
- #region Variables Declaration
- private OpenDialogNative mNativeDialog = null;
- private OpenFileDialogEx mFileDialogEx = null;
- private bool mWatchForActivate = false;
- private IntPtr mOpenDialogHandle = IntPtr.Zero;
- #endregion
-
- #region Constructors
- public DummyForm(OpenFileDialogEx fileDialogEx)
- {
- mFileDialogEx = fileDialogEx;
- this.Text = "";
- this.StartPosition = FormStartPosition.Manual;
- this.Location = new Point(-32000, -32000);
- this.ShowInTaskbar = false;
- }
- #endregion
-
- #region Properties
- public bool WatchForActivate
- {
- get {return mWatchForActivate;}
- set {mWatchForActivate = value;}
- }
-
- public OpenDialogNative NativeDialog
- {
- get {return mNativeDialog;}
- }
- #endregion
-
- #region Overrides
- protected override void OnClosing(CancelEventArgs e)
- {
- if (mNativeDialog != null)
- mNativeDialog.Dispose();
- base.OnClosing(e);
- }
-
- protected override void WndProc(ref Message m)
- {
- if (mWatchForActivate && m.Msg == (int) Msg.WM_ACTIVATE)
- {
- mWatchForActivate = false;
- mOpenDialogHandle = m.LParam;
- mNativeDialog = new OpenDialogNative(m.LParam, mFileDialogEx);
- }
- base.WndProc(ref m);
- }
- #endregion
- }
- #endregion
- }
-
- #region Enums
- public enum AddonWindowLocation
- {
- None = 0,
- Right = 1,
- Bottom = 2
- }
-
- public enum ControlsID
- {
- ButtonOpen = 0x1,
- ButtonCancel = 0x2,
- ButtonHelp = 0x40E,
- GroupFolder = 0x440,
- LabelFileType = 0x441,
- LabelFileName = 0x442,
- LabelLookIn = 0x443,
- DefaultView = 0x461,
- LeftToolBar = 0x4A0,
- ComboFileName = 0x47c,
- ComboFileType = 0x470,
- ComboFolder = 0x471,
- CheckBoxReadOnly= 0x410
- }
- #endregion
-}
diff --git a/main/src/addins/WindowsPlatform/Dialogs/OpenFileDialogEx.resx b/main/src/addins/WindowsPlatform/Dialogs/OpenFileDialogEx.resx
deleted file mode 100644
index e57b641f21..0000000000
--- a/main/src/addins/WindowsPlatform/Dialogs/OpenFileDialogEx.resx
+++ /dev/null
@@ -1,123 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <metadata name="dlgOpen.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
- <value>17, 17</value>
- </metadata>
-</root> \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/Dialogs/OpenFileDialogHandler.cs b/main/src/addins/WindowsPlatform/Dialogs/OpenFileDialogHandler.cs
deleted file mode 100644
index b94e317fd8..0000000000
--- a/main/src/addins/WindowsPlatform/Dialogs/OpenFileDialogHandler.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-//
-// OpenFileDialogHandler.cs
-//
-// Author:
-// Carlos Alberto Cortez <calberto.cortez@gmail.com>
-//
-// Copyright (c) 2011 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Text;
-using System.Windows.Forms;
-using CustomControls.Controls;
-using MonoDevelop.Core;
-using MonoDevelop.Ide;
-using MonoDevelop.Ide.Extensions;
-using MonoDevelop.Platform;
-
-namespace MonoDevelop.Platform
-{
- public class OpenFileDialogHandler : IOpenFileDialogHandler
- {
- volatile Form rootForm;
-
- public bool Run (OpenFileDialogData data)
- {
- var parentWindow = data.TransientFor ?? MessageService.RootWindow;
- parentWindow.FocusInEvent += OnParentFocusIn;
-
- bool result = SelectFileDialogHandler.RunWinUIMethod (RunDialog, data);
-
- parentWindow.FocusInEvent -= OnParentFocusIn;
- parentWindow.Present ();
-
- return result;
- }
-
- void OnParentFocusIn (object o, EventArgs args)
- {
- if (rootForm != null)
- rootForm.BeginInvoke (new Action (rootForm.Activate));
- }
-
- bool RunDialog (OpenFileDialogData data)
- {
- Application.EnableVisualStyles ();
-
- FileDialog fileDlg = null;
- if (data.Action == Gtk.FileChooserAction.Open)
- fileDlg = new OpenFileDialog ();
- else
- fileDlg = new SaveFileDialog ();
-
- var dlg = new CustomOpenFileDialog (fileDlg, data);
-
- SelectFileDialogHandler.SetCommonFormProperties (data, dlg.FileDialog);
-
- using (dlg) {
- rootForm = new WinFormsRoot ();
- if (dlg.ShowDialog (rootForm) == DialogResult.Cancel) {
- return false;
- }
-
- FilePath[] paths = new FilePath [fileDlg.FileNames.Length];
- for (int n = 0; n < fileDlg.FileNames.Length; n++)
- paths [n] = fileDlg.FileNames [n];
- data.SelectedFiles = paths;
-
- if (dlg.SelectedEncodingId != 0)
- data.Encoding = dlg.SelectedEncodingId > 0 ? Encoding.GetEncoding (dlg.SelectedEncodingId) : null;
- if (dlg.SelectedViewer != null)
- data.SelectedViewer = dlg.SelectedViewer;
-
- data.CloseCurrentWorkspace = dlg.CloseCurrentWorkspace;
- }
-
- return true;
- }
- }
-}
-
diff --git a/main/src/addins/WindowsPlatform/Dialogs/SelectFileDialogHandler.cs b/main/src/addins/WindowsPlatform/Dialogs/SelectFileDialogHandler.cs
deleted file mode 100644
index 92602fd556..0000000000
--- a/main/src/addins/WindowsPlatform/Dialogs/SelectFileDialogHandler.cs
+++ /dev/null
@@ -1,172 +0,0 @@
-using System;
-using System.IO;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading;
-using MonoDevelop.Components.Extensions;
-using System.Windows.Forms;
-using MonoDevelop.Core;
-using MonoDevelop.Ide;
-
-namespace MonoDevelop.Platform
-{
- class SelectFileDialogHandler : ISelectFileDialogHandler
- {
- volatile Form rootForm;
-
- public bool Run (SelectFileDialogData data)
- {
- var parentWindow = data.TransientFor ?? MessageService.RootWindow;
- parentWindow.FocusInEvent += OnParentFocusIn;
-
- bool result = RunWinUIMethod (RunDialog, data);
-
- parentWindow.FocusInEvent -= OnParentFocusIn;
- parentWindow.Present ();
-
- return result;
- }
-
- void OnParentFocusIn (object o, EventArgs args)
- {
- if (rootForm != null)
- rootForm.BeginInvoke (new Action (rootForm.Activate));
- }
-
- bool RunDialog (SelectFileDialogData data)
- {
- Application.EnableVisualStyles ();
-
- CommonDialog dlg = null;
- if (data.Action == Gtk.FileChooserAction.Open)
- dlg = new OpenFileDialog();
- else if (data.Action == Gtk.FileChooserAction.Save)
- dlg = new SaveFileDialog();
- else if (data.Action == Gtk.FileChooserAction.SelectFolder)
- dlg = new FolderBrowserDialog ();
-
- if (dlg is FileDialog)
- SetCommonFormProperties (data, (FileDialog)dlg);
- else
- SetFolderBrowserProperties (data, (FolderBrowserDialog)dlg);
-
- using (dlg) {
- rootForm = new WinFormsRoot ();
- if (dlg.ShowDialog (rootForm) == DialogResult.Cancel) {
- return false;
- }
-
- if (dlg is FileDialog) {
- var fileDlg = dlg as FileDialog;
- FilePath[] paths = new FilePath [fileDlg.FileNames.Length];
- for (int n=0; n < fileDlg.FileNames.Length; n++)
- paths [n] = fileDlg.FileNames [n];
- data.SelectedFiles = paths;
- } else {
- var folderDlg = dlg as FolderBrowserDialog;
- data.SelectedFiles = new [] { new FilePath (folderDlg.SelectedPath) };
- }
-
- return true;
- }
- }
-
- // Any native Winforms component needs to run on a thread marked as single-threaded apartment (STAThread).
- // Marking the MD's Main method with STAThread has historically shown to be a source of several problems,
- // thus we isolate the calls by creating a new thread for our calls.
- // More info here: http://blogs.msdn.com/b/jfoscoding/archive/2005/04/07/406341.aspx
- internal static bool RunWinUIMethod<T> (Func<T,bool> func, T data) where T : SelectFileDialogData
- {
- bool result = false;
- var t = new Thread (() => {
- try {
- result = func (data);
- } catch (Exception ex) {
- LoggingService.LogError ("Unhandled exception handling a native dialog", ex);
- }
- });
- t.Name = "Win32 Interop Thread";
- t.IsBackground = true;
- t.SetApartmentState (ApartmentState.STA);
-
- t.Start ();
- while (!t.Join (50))
- DispatchService.RunPendingEvents ();
-
- return result;
- }
-
- internal static void SetCommonFormProperties (SelectFileDialogData data, FileDialog dialog)
- {
- if (!string.IsNullOrEmpty (data.Title))
- dialog.Title = data.Title;
-
- dialog.AddExtension = true;
- dialog.Filter = GetFilterFromData (data.Filters);
- dialog.FilterIndex = data.DefaultFilter == null ? 1 : GetDefaultFilterIndex (data);
-
- dialog.InitialDirectory = data.CurrentFolder;
-
- // FileDialog.FileName expects anything but a directory name.
- if (!Directory.Exists (data.InitialFileName))
- dialog.FileName = data.InitialFileName;
-
- OpenFileDialog openDialog = dialog as OpenFileDialog;
- if (openDialog != null)
- openDialog.Multiselect = data.SelectMultiple;
- }
-
- static int GetDefaultFilterIndex (SelectFileDialogData data)
- {
- var defFilter = data.DefaultFilter;
- int idx = data.Filters.IndexOf (defFilter) + 1;
-
- // FileDialog doesn't show the file extension when saving a file,
- // so we try to look fo the precise filter if none was specified.
- if (data.Action == Gtk.FileChooserAction.Save && defFilter.Patterns.Contains ("*")) {
- string ext = Path.GetExtension (data.InitialFileName);
-
- if (!String.IsNullOrEmpty (ext))
- for (int i = 0; i < data.Filters.Count; i++) {
- var filter = data.Filters [i];
- foreach (string pattern in filter.Patterns)
- if (pattern.EndsWith (ext))
- return i + 1;
- }
- }
-
- return idx;
- }
-
- static void SetFolderBrowserProperties (SelectFileDialogData data, FolderBrowserDialog dialog)
- {
- if (!string.IsNullOrEmpty (data.Title))
- dialog.Description = data.Title;
-
- dialog.SelectedPath = data.CurrentFolder;
- }
-
- static string GetFilterFromData (IList<SelectFileDialogFilter> filters)
- {
- if (filters == null || filters.Count == 0)
- return null;
-
- var sb = new StringBuilder ();
- foreach (var f in filters) {
- if (sb.Length > 0)
- sb.Append ('|');
-
- sb.Append (f.Name);
- sb.Append ('|');
- for (int i = 0; i < f.Patterns.Count; i++) {
- if (i > 0)
- sb.Append (';');
-
- sb.Append (f.Patterns [i]);
- }
- }
-
- return sb.ToString ();
- }
- }
-}
diff --git a/main/src/addins/WindowsPlatform/Dialogs/WinFormsRoot.cs b/main/src/addins/WindowsPlatform/Dialogs/WinFormsRoot.cs
deleted file mode 100644
index 64dfcd55c1..0000000000
--- a/main/src/addins/WindowsPlatform/Dialogs/WinFormsRoot.cs
+++ /dev/null
@@ -1,122 +0,0 @@
-using System;
-using System.ComponentModel;
-using System.Collections.Generic;
-using System.Text;
-using System.Windows.Forms;
-using System.Drawing;
-using CustomControls.OS;
-using MonoDevelop.Components;
-
-namespace MonoDevelop.Platform
-{
- class WinFormsRoot : Form
- {
- // From OpenFileDialogEx.cs
- private SetWindowPosFlags UFLAGSHIDE =
- SetWindowPosFlags.SWP_NOACTIVATE |
- SetWindowPosFlags.SWP_NOOWNERZORDER |
- SetWindowPosFlags.SWP_NOMOVE |
- SetWindowPosFlags.SWP_NOSIZE |
- SetWindowPosFlags.SWP_HIDEWINDOW;
-
- IDisposable nativeDialogWindow;
- bool watchForActivate;
-
- public WinFormsRoot()
- {
- this.Text = "";
- this.StartPosition = FormStartPosition.Manual;
- this.Location = new Point(-32000, -32000);
- this.ShowInTaskbar = false;
- this.Icon = MonoDevelopIcon; // Icon is inherited to FileDialog objects
- Show();
- Win32.SetWindowPos(Handle, IntPtr.Zero, 0, 0, 0, 0, UFLAGSHIDE);
- watchForActivate = true;
- }
-
- public static readonly Icon MonoDevelopIcon = LoadMonoDevelopIcon ();
-
- static Icon LoadMonoDevelopIcon ()
- {
- // IconSize.Dnd seems to be the best match for Form.Icon
- var pixbuf = MonoDevelop.Ide.ImageService.GetIcon ("md-monodevelop", Gtk.IconSize.Dnd).ToPixbuf();
- return new Icon (new System.IO.MemoryStream (pixbuf.SaveToBuffer ("ico")));
- }
-
- protected override void OnClosing (CancelEventArgs args)
- {
- base.OnClosing (args);
- if (nativeDialogWindow != null)
- nativeDialogWindow.Dispose ();
- }
-
- protected override void WndProc(ref Message m)
- {
- if (m.Msg == (int)Msg.WM_ACTIVATE && watchForActivate) {
- watchForActivate = false;
- nativeDialogWindow = new NativeDialogWindow (m.LParam);
- }
-
- base.WndProc(ref m);
- }
-
- // The CommonDialog's Form Handle
- class NativeDialogWindow : NativeWindow, IDisposable
- {
- IntPtr handle;
-
- public NativeDialogWindow (IntPtr handle)
- {
- this.handle = handle;
- AssignHandle (handle);
- }
-
- public void Dispose ()
- {
- ReleaseHandle ();
- }
-
- protected override void WndProc (ref Message m)
- {
- /* Disable the handling of the pending events of the
- * MD's UI thread, as we are running them in a separated thread now,
- * but leave them here since we may need them when/if the MD's Main
- * method is marked with the STAThread attribute.
- switch (m.Msg) {
- case (int) Msg.WM_ENTERIDLE:
- case (int) Msg.WM_WINDOWPOSCHANGED:
- MonoDevelop.Ide.DispatchService.RunPendingEvents ();
- break;
- }
- */
-
- base.WndProc (ref m);
- }
- }
- }
-
- class WinFormsRunner
- {
- bool firstRun = true;
- EventHandler action;
-
- public void Run(EventHandler action)
- {
- this.action = action;
- Application.Idle += WinFormsIdle;
- Application.Run();
- Application.Idle -= WinFormsIdle;
- }
-
- void WinFormsIdle(object sender, EventArgs e)
- {
- if (firstRun)
- {
- firstRun = false;
- action(null, null);
- }
- else
- MonoDevelop.Ide.DispatchService.RunPendingEvents();
- }
- }
-}
diff --git a/main/src/addins/WindowsPlatform/Makefile.am b/main/src/addins/WindowsPlatform/Makefile.am
index 24e07e9bf5..afdf22dae4 100644
--- a/main/src/addins/WindowsPlatform/Makefile.am
+++ b/main/src/addins/WindowsPlatform/Makefile.am
@@ -1,5 +1,4 @@
-include $(top_srcdir)/xbuild.include
-if ! ENABLE_WINDOWSPLATFORM
-SKIP=y
-endif
+SUBDIRS = \
+ WindowsPlatform \
+ WindowsAPICodePack
diff --git a/main/src/addins/WindowsPlatform/Microsoft.WindowsAPICodePack.Shell.dll b/main/src/addins/WindowsPlatform/Microsoft.WindowsAPICodePack.Shell.dll
deleted file mode 100644
index 4542663e1e..0000000000
--- a/main/src/addins/WindowsPlatform/Microsoft.WindowsAPICodePack.Shell.dll
+++ /dev/null
Binary files differ
diff --git a/main/src/addins/WindowsPlatform/Microsoft.WindowsAPICodePack.dll b/main/src/addins/WindowsPlatform/Microsoft.WindowsAPICodePack.dll
deleted file mode 100644
index ac86949212..0000000000
--- a/main/src/addins/WindowsPlatform/Microsoft.WindowsAPICodePack.dll
+++ /dev/null
Binary files differ
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/ApplicationRecoveryException.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/ApplicationRecoveryException.cs
new file mode 100644
index 0000000000..14eb5bf166
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/ApplicationRecoveryException.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.WindowsAPICodePack.ApplicationServices
+{
+ /// <summary>
+ /// This exception is thrown when there are problems with registering, unregistering or updating
+ /// applications using Application Restart Recovery.
+ /// </summary>
+ [Serializable]
+ public class ApplicationRecoveryException : ExternalException
+ {
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ public ApplicationRecoveryException() { }
+
+ /// <summary>
+ /// Initializes an exception with a custom message.
+ /// </summary>
+ /// <param name="message">A custom message for the exception.</param>
+ public ApplicationRecoveryException(string message) : base(message) { }
+
+ /// <summary>
+ /// Initializes an exception with custom message and inner exception.
+ /// </summary>
+ /// <param name="message">A custom message for the exception.</param>
+ /// <param name="innerException">Inner exception.</param>
+ public ApplicationRecoveryException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ // Empty
+ }
+
+ /// <summary>
+ /// Initializes an exception with custom message and error code.
+ /// </summary>
+ /// <param name="message">A custom message for the exception.</param>
+ /// <param name="errorCode">An error code (hresult) from which to generate the exception.</param>
+ public ApplicationRecoveryException(string message, int errorCode) : base(message, errorCode) { }
+
+ /// <summary>
+ /// Initializes an exception from serialization info and a context.
+ /// </summary>
+ /// <param name="info">Serialization info from which to create exception.</param>
+ /// <param name="context">Streaming context from which to create exception.</param>
+ protected ApplicationRecoveryException(
+ System.Runtime.Serialization.SerializationInfo info,
+ System.Runtime.Serialization.StreamingContext context)
+ : base(info, context)
+ {
+ // Empty
+ }
+
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/ApplicationRestartRecoveryManager.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/ApplicationRestartRecoveryManager.cs
new file mode 100644
index 0000000000..b0d9e28c27
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/ApplicationRestartRecoveryManager.cs
@@ -0,0 +1,163 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Resources;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.ApplicationServices
+{
+ /// <summary>
+ /// Provides access to the Application Restart and Recovery
+ /// features available in Windows Vista or higher. Application Restart and Recovery lets an
+ /// application do some recovery work to save data before the process exits.
+ /// </summary>
+ public static class ApplicationRestartRecoveryManager
+ {
+ /// <summary>
+ /// Registers an application for recovery by Application Restart and Recovery.
+ /// </summary>
+ /// <param name="settings">An object that specifies
+ /// the callback method, an optional parameter to pass to the callback
+ /// method and a time interval.</param>
+ /// <exception cref="System.ArgumentException">
+ /// The registration failed due to an invalid parameter.
+ /// </exception>
+ /// <exception cref="System.ComponentModel.Win32Exception">
+ /// The registration failed.</exception>
+ /// <remarks>The time interval is the period of time within
+ /// which the recovery callback method
+ /// calls the <see cref="ApplicationRecoveryInProgress"/> method to indicate
+ /// that it is still performing recovery work.</remarks>
+ public static void RegisterForApplicationRecovery(RecoverySettings settings)
+ {
+ CoreHelpers.ThrowIfNotVista();
+
+ if (settings == null) { throw new ArgumentNullException("settings"); }
+
+ GCHandle handle = GCHandle.Alloc(settings.RecoveryData);
+
+ HResult hr = AppRestartRecoveryNativeMethods.RegisterApplicationRecoveryCallback(
+ AppRestartRecoveryNativeMethods.InternalCallback, (IntPtr)handle, settings.PingInterval, (uint)0);
+
+ if (!CoreErrorHelper.Succeeded(hr))
+ {
+ if (hr == HResult.InvalidArguments)
+ {
+ throw new ArgumentException(LocalizedMessages.ApplicationRecoveryBadParameters, "settings");
+ }
+
+ throw new ApplicationRecoveryException(LocalizedMessages.ApplicationRecoveryFailedToRegister);
+ }
+ }
+
+ /// <summary>
+ /// Removes an application's recovery registration.
+ /// </summary>
+ /// <exception cref="Microsoft.WindowsAPICodePack.ApplicationServices.ApplicationRecoveryException">
+ /// The attempt to unregister for recovery failed.</exception>
+ public static void UnregisterApplicationRecovery()
+ {
+ CoreHelpers.ThrowIfNotVista();
+
+ HResult hr = AppRestartRecoveryNativeMethods.UnregisterApplicationRecoveryCallback();
+
+ if (!CoreErrorHelper.Succeeded(hr))
+ {
+ throw new ApplicationRecoveryException(LocalizedMessages.ApplicationRecoveryFailedToUnregister);
+ }
+ }
+
+ /// <summary>
+ /// Removes an application's restart registration.
+ /// </summary>
+ /// <exception cref="Microsoft.WindowsAPICodePack.ApplicationServices.ApplicationRecoveryException">
+ /// The attempt to unregister for restart failed.</exception>
+ public static void UnregisterApplicationRestart()
+ {
+ CoreHelpers.ThrowIfNotVista();
+
+ HResult hr = AppRestartRecoveryNativeMethods.UnregisterApplicationRestart();
+
+ if (!CoreErrorHelper.Succeeded(hr))
+ {
+ throw new ApplicationRecoveryException(LocalizedMessages.ApplicationRecoveryFailedToUnregisterForRestart);
+ }
+ }
+
+ /// <summary>
+ /// Called by an application's <see cref="RecoveryCallback"/> method
+ /// to indicate that it is still performing recovery work.
+ /// </summary>
+ /// <returns>A <see cref="System.Boolean"/> value indicating whether the user
+ /// canceled the recovery.</returns>
+ /// <exception cref="Microsoft.WindowsAPICodePack.ApplicationServices.ApplicationRecoveryException">
+ /// This method must be called from a registered callback method.</exception>
+ public static bool ApplicationRecoveryInProgress()
+ {
+ CoreHelpers.ThrowIfNotVista();
+
+ bool canceled = false;
+ HResult hr = AppRestartRecoveryNativeMethods.ApplicationRecoveryInProgress(out canceled);
+
+ if (!CoreErrorHelper.Succeeded(hr))
+ {
+ throw new InvalidOperationException(LocalizedMessages.ApplicationRecoveryMustBeCalledFromCallback);
+ }
+
+ return canceled;
+ }
+
+ /// <summary>
+ /// Called by an application's <see cref="RecoveryCallback"/> method to
+ /// indicate that the recovery work is complete.
+ /// </summary>
+ /// <remarks>
+ /// This should
+ /// be the last call made by the <see cref="RecoveryCallback"/> method because
+ /// Windows Error Reporting will terminate the application
+ /// after this method is invoked.
+ /// </remarks>
+ /// <param name="success"><b>true</b> to indicate the the program was able to complete its recovery
+ /// work before terminating; otherwise <b>false</b>.</param>
+ public static void ApplicationRecoveryFinished(bool success)
+ {
+ CoreHelpers.ThrowIfNotVista();
+
+ AppRestartRecoveryNativeMethods.ApplicationRecoveryFinished(success);
+ }
+
+ /// <summary>
+ /// Registers an application for automatic restart if
+ /// the application
+ /// is terminated by Windows Error Reporting.
+ /// </summary>
+ /// <param name="settings">An object that specifies
+ /// the command line arguments used to restart the
+ /// application, and
+ /// the conditions under which the application should not be
+ /// restarted.</param>
+ /// <exception cref="System.ArgumentException">Registration failed due to an invalid parameter.</exception>
+ /// <exception cref="System.InvalidOperationException">The attempt to register failed.</exception>
+ /// <remarks>A registered application will not be restarted if it executed for less than 60 seconds before terminating.</remarks>
+ public static void RegisterForApplicationRestart(RestartSettings settings)
+ {
+ // Throw PlatformNotSupportedException if the user is not running Vista or beyond
+ CoreHelpers.ThrowIfNotVista();
+ if (settings == null) { throw new ArgumentNullException("settings"); }
+
+ HResult hr = AppRestartRecoveryNativeMethods.RegisterApplicationRestart(settings.Command, settings.Restrictions);
+
+ if (hr == HResult.Fail)
+ {
+ throw new InvalidOperationException(LocalizedMessages.ApplicationRecoveryFailedToRegisterForRestart);
+ }
+ else if (hr == HResult.InvalidArguments)
+ {
+ throw new ArgumentException(LocalizedMessages.ApplicationRecoverFailedToRegisterForRestartBadParameters);
+ }
+ }
+
+ }
+}
+
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/RecoveryData.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/RecoveryData.cs
new file mode 100644
index 0000000000..0989c0dcc5
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/RecoveryData.cs
@@ -0,0 +1,54 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.ApplicationServices
+{
+ /// <summary>
+ /// The <see cref="System.Delegate"/> that represents the callback method invoked
+ /// by the system when an application has registered for
+ /// application recovery.
+ /// </summary>
+ /// <param name="state">An application-defined state object that is passed to the callback method.</param>
+ /// <remarks>The callback method will be invoked
+ /// prior to the application being terminated by Windows Error Reporting (WER). To keep WER from terminating the application before
+ /// the callback method completes, the callback method must
+ /// periodically call the <see cref="ApplicationRestartRecoveryManager.ApplicationRecoveryInProgress"/> method. </remarks>
+ /// <seealso cref="ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(RecoverySettings)"/>
+ public delegate int RecoveryCallback(object state);
+
+ /// <summary>
+ /// Defines a class that contains a callback delegate and properties of the application
+ /// as defined by the user.
+ /// </summary>
+ public class RecoveryData
+ {
+ /// <summary>
+ /// Initializes a recovery data wrapper with a callback method and the current
+ /// state of the application.
+ /// </summary>
+ /// <param name="callback">The callback delegate.</param>
+ /// <param name="state">The current state of the application.</param>
+ public RecoveryData(RecoveryCallback callback, object state)
+ {
+ Callback = callback;
+ State = state;
+ }
+
+ /// <summary>
+ /// Gets or sets a value that determines the recovery callback function.
+ /// </summary>
+ public RecoveryCallback Callback { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value that determines the application state.
+ /// </summary>
+ public object State { get; set; }
+
+ /// <summary>
+ /// Invokes the recovery callback function.
+ /// </summary>
+ public void Invoke()
+ {
+ if (Callback != null) { Callback(State); }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/RecoverySettings.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/RecoverySettings.cs
new file mode 100644
index 0000000000..95a3f2725e
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/RecoverySettings.cs
@@ -0,0 +1,74 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using Microsoft.WindowsAPICodePack.Resources;
+
+namespace Microsoft.WindowsAPICodePack.ApplicationServices
+{
+ /// <summary>
+ /// Defines methods and properties for recovery settings, and specifies options for an application that attempts
+ /// to perform final actions after a fatal event, such as an
+ /// unhandled exception.
+ /// </summary>
+ /// <remarks>This class is used to register for application recovery.
+ /// See the <see cref="ApplicationRestartRecoveryManager"/> class.
+ /// </remarks>
+ public class RecoverySettings
+ {
+ private RecoveryData recoveryData;
+ private uint pingInterval;
+
+ /// <summary>
+ /// Initializes a new instance of the <b>RecoverySettings</b> class.
+ /// </summary>
+ /// <param name="data">A recovery data object that contains the callback method (invoked by the system
+ /// before Windows Error Reporting terminates the application) and an optional state object.</param>
+ /// <param name="interval">The time interval within which the
+ /// callback method must invoke <see cref="ApplicationRestartRecoveryManager.ApplicationRecoveryInProgress"/> to
+ /// prevent WER from terminating the application.</param>
+ /// <seealso cref="ApplicationRestartRecoveryManager"/>
+ public RecoverySettings(RecoveryData data, uint interval)
+ {
+ this.recoveryData = data;
+ this.pingInterval = interval;
+ }
+
+ /// <summary>
+ /// Gets the recovery data object that contains the callback method and an optional
+ /// parameter (usually the state of the application) to be passed to the
+ /// callback method.
+ /// </summary>
+ /// <value>A <see cref="RecoveryData"/> object.</value>
+ public RecoveryData RecoveryData
+ {
+ get { return recoveryData; }
+ }
+
+ /// <summary>
+ /// Gets the time interval for notifying Windows Error Reporting.
+ /// The <see cref="RecoveryCallback"/> method must invoke <see cref="ApplicationRestartRecoveryManager.ApplicationRecoveryInProgress"/>
+ /// within this interval to prevent WER from terminating the application.
+ /// </summary>
+ /// <remarks>
+ /// The recovery ping interval is specified in milliseconds.
+ /// By default, the interval is 5 seconds.
+ /// If you specify zero, the default interval is used.
+ /// </remarks>
+ public uint PingInterval { get { return pingInterval; } }
+
+ /// <summary>
+ /// Returns a string representation of the current state
+ /// of this object.
+ /// </summary>
+ /// <returns>A <see cref="System.String"/> object.</returns>
+ public override string ToString()
+ {
+ return string.Format(System.Globalization.CultureInfo.InvariantCulture,
+ LocalizedMessages.RecoverySettingsFormatString,
+ this.recoveryData.Callback.Method.ToString(),
+ this.recoveryData.State.ToString(),
+ this.PingInterval);
+ }
+ }
+}
+
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/RestartRestrictions.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/RestartRestrictions.cs
new file mode 100644
index 0000000000..7ea35b13a2
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/RestartRestrictions.cs
@@ -0,0 +1,38 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+
+namespace Microsoft.WindowsAPICodePack.ApplicationServices
+{
+ /// <summary>
+ /// Specifies the conditions when Windows Error Reporting
+ /// should not restart an application that has registered
+ /// for automatic restart.
+ /// </summary>
+ [Flags]
+ public enum RestartRestrictions
+ {
+ /// <summary>
+ /// Always restart the application.
+ /// </summary>
+ None = 0,
+ /// <summary>
+ /// Do not restart when the application has crashed.
+ /// </summary>
+ NotOnCrash = 1,
+ /// <summary>
+ /// Do not restart when the application is hung.
+ /// </summary>
+ NotOnHang = 2,
+ /// <summary>
+ /// Do not restart when the application is terminated
+ /// due to a system update.
+ /// </summary>
+ NotOnPatch = 4,
+ /// <summary>
+ /// Do not restart when the application is terminated
+ /// because of a system reboot.
+ /// </summary>
+ NotOnReboot = 8
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/RestartSettings.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/RestartSettings.cs
new file mode 100644
index 0000000000..2162806c5d
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/AppRestartRecovery/RestartSettings.cs
@@ -0,0 +1,70 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using Microsoft.WindowsAPICodePack.Resources;
+
+namespace Microsoft.WindowsAPICodePack.ApplicationServices
+{
+ /// <summary>
+ /// Specifies the options for an application to be automatically
+ /// restarted by Windows Error Reporting.
+ /// </summary>
+ /// <remarks>Regardless of these
+ /// settings, the application
+ /// will not be restarted if it executed for less than 60 seconds before
+ /// terminating.</remarks>
+ public class RestartSettings
+ {
+ private string command;
+ private RestartRestrictions restrictions;
+
+ /// <summary>
+ /// Creates a new instance of the RestartSettings class.
+ /// </summary>
+ /// <param name="command">The command line arguments
+ /// used to restart the application.</param>
+ /// <param name="restrictions">A bitwise combination of the RestartRestrictions
+ /// values that specify
+ /// when the application should not be restarted.
+ /// </param>
+ public RestartSettings(string command, RestartRestrictions restrictions)
+ {
+ this.command = command;
+ this.restrictions = restrictions;
+ }
+
+ /// <summary>
+ /// Gets the command line arguments used to restart the application.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string Command
+ {
+ get { return command; }
+ }
+
+ /// <summary>
+ /// Gets the set of conditions when the application
+ /// should not be restarted.
+ /// </summary>
+ /// <value>A set of <see cref="RestartRestrictions"/> values.</value>
+ public RestartRestrictions Restrictions
+ {
+ get { return restrictions; }
+ }
+
+ /// <summary>
+ /// Returns a string representation of the current state
+ /// of this object.
+ /// </summary>
+ /// <returns>A <see cref="System.String"/> that displays
+ /// the command line arguments
+ /// and restrictions for restarting the application.</returns>
+ public override string ToString()
+ {
+ return string.Format(System.Globalization.CultureInfo.InvariantCulture,
+ LocalizedMessages.RestartSettingsFormatString,
+ command, restrictions.ToString());
+ }
+ }
+}
+
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Core.csproj b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Core.csproj
new file mode 100644
index 0000000000..7862b272b6
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Core.csproj
@@ -0,0 +1,214 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{2E1FB0DF-F9BB-4909-9F32-2D9D022A8E57}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Microsoft.WindowsAPICodePack</RootNamespace>
+ <AssemblyName>Microsoft.WindowsAPICodePack</AssemblyName>
+ <FileAlignment>512</FileAlignment>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>3.5</OldToolsVersion>
+ <UpgradeBackupLocation />
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\..\..\..\..\build\AddIns\WindowsPlatform</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <DocumentationFile>..\..\..\..\..\build\AddIns\WindowsPlatform\Microsoft.WindowsAPICodePack.xml</DocumentationFile>
+ <CodeAnalysisRules>
+ </CodeAnalysisRules>
+ <RunCodeAnalysis>false</RunCodeAnalysis>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>..\..\..\..\..\build\AddIns\WindowsPlatform</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\x64\Debug\</OutputPath>
+ <DefineConstants>CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
+ <DocumentationFile>bin\Debug\Microsoft.WindowsAPICodePack.XML</DocumentationFile>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <CodeAnalysisLogFile>bin\Debug\Microsoft.WindowsAPICodePack.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
+ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+ <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSetDirectories>;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
+ <CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
+ <CodeAnalysisRuleDirectories>;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
+ <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
+ <RunCodeAnalysis>false</RunCodeAnalysis>
+ <WarningLevel>4</WarningLevel>
+ <Optimize>false</Optimize>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+ <OutputPath>bin\x64\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <CodeAnalysisLogFile>bin\Release\Microsoft.WindowsAPICodePack.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
+ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+ <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSetDirectories>;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
+ <CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
+ <CodeAnalysisRuleDirectories>;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
+ <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AppRestartRecovery\ApplicationRestartRecoveryManager.cs" />
+ <Compile Include="AppRestartRecovery\ApplicationRecoveryException.cs" />
+ <Compile Include="AppRestartRecovery\RecoveryData.cs" />
+ <Compile Include="AppRestartRecovery\RecoverySettings.cs" />
+ <Compile Include="AppRestartRecovery\RestartRestrictions.cs" />
+ <Compile Include="AppRestartRecovery\RestartSettings.cs" />
+ <Compile Include="Interop\WindowMessage.cs" />
+ <Compile Include="PowerManagement\PowerManagerException.cs" />
+ <Compile Include="Dialogs\Common\DialogControl.cs" />
+ <Compile Include="Dialogs\Common\DialogControlCollection.cs" />
+ <Compile Include="Dialogs\Common\DialogsDefaults.cs" />
+ <Compile Include="Dialogs\Common\IDialogControlHost.cs" />
+ <Compile Include="GlobalSuppressions.cs" />
+ <Compile Include="Interop\AppRestartRecovery\AppRestartRecoveryNativeMethods.cs" />
+ <Compile Include="Interop\CoreErrorHelper.cs" />
+ <Compile Include="Interop\CoreHelpers.cs" />
+ <Compile Include="Interop\CoreNativeMethods.cs" />
+ <Compile Include="Interop\Dialogs\DialogShowState.cs" />
+ <Compile Include="Interop\NetworkList\INetwork.cs" />
+ <Compile Include="Interop\NetworkList\INetworkConnection.cs" />
+ <Compile Include="Interop\NetworkList\INetworkListManager.cs" />
+ <Compile Include="Interop\NetworkList\NetworkListManagerClass.cs" />
+ <Compile Include="Interop\PowerManagement\PowerManagementNativeMethods.cs" />
+ <Compile Include="Interop\TaskDialogs\NativeTaskDialog.cs" />
+ <Compile Include="Interop\TaskDialogs\NativeTaskDialogSettings.cs" />
+ <Compile Include="Interop\TaskDialogs\TaskDialogNativeMethods.cs" />
+ <Compile Include="NetworkList\Network.cs" />
+ <Compile Include="NetworkList\NetworkCollection.cs" />
+ <Compile Include="NetworkList\NetworkConnection.cs" />
+ <Compile Include="NetworkList\NetworkConnectionCollection.cs" />
+ <Compile Include="NetworkList\NetworkListEnums.cs" />
+ <Compile Include="NetworkList\NetworkListManager.cs" />
+ <Compile Include="PowerManagement\BatteryState.cs" />
+ <Compile Include="PowerManagement\EventManager.cs" />
+ <Compile Include="PowerManagement\ExecutionState.cs" />
+ <Compile Include="PowerManagement\MessageManager.cs">
+ </Compile>
+ <Compile Include="PowerManagement\PersonalityGuids.cs" />
+ <Compile Include="PowerManagement\Power.cs" />
+ <Compile Include="PowerManagement\PowerManager.cs" />
+ <Compile Include="PowerManagement\PowerPersonality.cs" />
+ <Compile Include="PowerManagement\PowerSource.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="PropertySystem\PropertyKey.cs" />
+ <Compile Include="PropertySystem\PropVariant.cs" />
+ <Compile Include="PropertySystem\PropVariantNativeMethods.cs" />
+ <Compile Include="Resources\LocalizedMessages.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>LocalizedMessages.resx</DependentUpon>
+ </Compile>
+ <Compile Include="SafeHandles\ZeroInvalidHandle.cs" />
+ <Compile Include="SafeHandles\SafeIconHandle.cs" />
+ <Compile Include="SafeHandles\SafeRegionHandle.cs" />
+ <Compile Include="SafeHandles\SafeWindowHandle.cs" />
+ <Compile Include="Dialogs\TaskDialogs\TaskDialog.cs" />
+ <Compile Include="Dialogs\TaskDialogs\TaskDialogBar.cs" />
+ <Compile Include="Dialogs\TaskDialogs\TaskDialogButton.cs" />
+ <Compile Include="Dialogs\TaskDialogs\TaskDialogButtonBase.cs" />
+ <Compile Include="Dialogs\TaskDialogs\TaskDialogClosingEventArgs.cs" />
+ <Compile Include="Dialogs\TaskDialogs\TaskDialogCommandLink.cs" />
+ <Compile Include="Dialogs\TaskDialogs\TaskDialogControl.cs" />
+ <Compile Include="Dialogs\TaskDialogs\TaskDialogDefaults.cs" />
+ <Compile Include="Dialogs\TaskDialogs\TaskDialogExpandedInfoMode.cs" />
+ <Compile Include="Dialogs\TaskDialogs\TaskDialogHyperlinkClickedEventArgs.cs" />
+ <Compile Include="Dialogs\TaskDialogs\TaskDialogProgressBar.cs" />
+ <Compile Include="Dialogs\TaskDialogs\TaskDialogProgressBarState.cs" />
+ <Compile Include="Dialogs\TaskDialogs\TaskDialogRadioButton.cs" />
+ <Compile Include="Dialogs\TaskDialogs\TaskDialogResult.cs" />
+ <Compile Include="Dialogs\TaskDialogs\TaskDialogStandardButton.cs" />
+ <Compile Include="Dialogs\TaskDialogs\TaskDialogStandardIcon.cs" />
+ <Compile Include="Dialogs\TaskDialogs\TaskDialogStartupLocation.cs" />
+ <Compile Include="Dialogs\TaskDialogs\TaskDialogTickEventArgs.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+ <Visible>False</Visible>
+ <ProductName>Windows Installer 3.1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Resources\LocalizedMessages.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>LocalizedMessages.Designer.cs</LastGenOutput>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <CodeAnalysisDictionary Include="CustomDictionary.xml">
+ <SubType>Designer</SubType>
+ </CodeAnalysisDictionary>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/CustomDictionary.xml b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/CustomDictionary.xml
new file mode 100644
index 0000000000..5f690102c1
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/CustomDictionary.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<Dictionary>
+ <Words>
+ <Recognized>
+ <Word>IPv4</Word>
+ <Word>IPv6</Word>
+ <Word>comctl</Word>
+ <Word>Wh</Word>
+ </Recognized>
+ </Words>
+ <Acronyms>
+ <CasingExceptions>
+ <Acronym>API</Acronym>
+ </CasingExceptions>
+ </Acronyms>
+</Dictionary> \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/Common/DialogControl.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/Common/DialogControl.cs
new file mode 100644
index 0000000000..be0049f75d
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/Common/DialogControl.cs
@@ -0,0 +1,147 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Diagnostics;
+using Microsoft.WindowsAPICodePack.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Abstract base class for all dialog controls
+ /// </summary>
+ public abstract class DialogControl
+ {
+ private static int nextId = DialogsDefaults.MinimumDialogControlId;
+
+ /// <summary>
+ /// Creates a new instance of a dialog control
+ /// </summary>
+ protected DialogControl()
+ {
+ Id = nextId;
+
+ // Support wrapping of control IDs in case you create a lot of custom controls
+ if (nextId == Int32.MaxValue) { nextId = DialogsDefaults.MinimumDialogControlId; }
+ else { nextId++; }
+ }
+
+ /// <summary>
+ /// Creates a new instance of a dialog control with the specified name.
+ /// </summary>
+ /// <param name="name">The name for this dialog.</param>
+ protected DialogControl(string name)
+ : this()
+ {
+ Name = name;
+ }
+
+ /// <summary>
+ /// The native dialog that is hosting this control. This property is null is
+ /// there is not associated dialog
+ /// </summary>
+ public IDialogControlHost HostingDialog { get; set; }
+
+ private string name;
+ /// <summary>
+ /// Gets the name for this control.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> value.</value>
+ public string Name
+ {
+ get { return name; }
+ set
+ {
+ // Names for controls need to be quite stable,
+ // as we are going to maintain a mapping between
+ // the names and the underlying Win32/COM control IDs.
+ if (string.IsNullOrEmpty(value))
+ {
+ throw new ArgumentException(LocalizedMessages.DialogControlNameCannotBeEmpty);
+ }
+
+ if (!string.IsNullOrEmpty(name))
+ {
+ throw new InvalidOperationException(LocalizedMessages.DialogControlsCannotBeRenamed);
+ }
+
+ // Note that we don't notify the hosting dialog of
+ // the change, as the initial set of name is (must be)
+ // always legal, and renames are always illegal.
+ this.name = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets the identifier for this control.
+ /// </summary>
+ /// <value>An <see cref="System.Int32"/> value.</value>
+ public int Id { get; private set; }
+
+ ///<summary>
+ /// Calls the hosting dialog, if it exists, to check whether the
+ /// property can be set in the dialog's current state.
+ /// The host should throw an exception if the change is not supported.
+ /// Note that if the dialog isn't set yet,
+ /// there are no restrictions on setting the property.
+ /// </summary>
+ /// <param name="propName">The name of the property that is changing</param>
+ protected void CheckPropertyChangeAllowed(string propName)
+ {
+ Debug.Assert(!string.IsNullOrEmpty(propName), "Property to change was not specified");
+
+ if (HostingDialog != null)
+ {
+ // This will throw if the property change is not allowed.
+ HostingDialog.IsControlPropertyChangeAllowed(propName, this);
+ }
+ }
+
+ ///<summary>
+ /// Calls the hosting dialog, if it exists, to
+ /// to indicate that a property has changed, and that
+ /// the dialog should do whatever is necessary
+ /// to propagate the change to the native control.
+ /// Note that if the dialog isn't set yet,
+ /// there are no restrictions on setting the property.
+ /// </summary>
+ /// <param name="propName">The name of the property that is changing.</param>
+ protected void ApplyPropertyChange(string propName)
+ {
+ Debug.Assert(!string.IsNullOrEmpty(propName), "Property changed was not specified");
+
+ if (HostingDialog != null)
+ {
+ HostingDialog.ApplyControlPropertyChange(propName, this);
+ }
+ }
+
+ /// <summary>
+ /// Compares two objects to determine whether they are equal
+ /// </summary>
+ /// <param name="obj">The object to compare against.</param>
+ /// <returns>A <see cref="System.Boolean"/> value.</returns>
+ public override bool Equals(object obj)
+ {
+ DialogControl control = obj as DialogControl;
+
+ if (control != null)
+ return (this.Id == control.Id);
+
+ return false;
+ }
+
+ /// <summary>
+ /// Serves as a hash function for a particular type.
+ /// </summary>
+ /// <returns>An <see cref="System.Int32"/> hash code for this control.</returns>
+ public override int GetHashCode()
+ {
+ if (Name == null)
+ {
+ return this.ToString().GetHashCode();
+ }
+
+ return Name.GetHashCode();
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/Common/DialogControlCollection.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/Common/DialogControlCollection.cs
new file mode 100644
index 0000000000..7323d665f5
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/Common/DialogControlCollection.cs
@@ -0,0 +1,120 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.ObjectModel;
+using System.Linq;
+using Microsoft.WindowsAPICodePack.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Strongly typed collection for dialog controls.
+ /// </summary>
+ /// <typeparam name="T">DialogControl</typeparam>
+ public sealed class DialogControlCollection<T> : Collection<T> where T : DialogControl
+ {
+ private IDialogControlHost hostingDialog;
+
+ internal DialogControlCollection(IDialogControlHost host)
+ {
+ hostingDialog = host;
+ }
+
+ /// <summary>
+ /// Inserts an dialog control at the specified index.
+ /// </summary>
+ /// <param name="index">The location to insert the control.</param>
+ /// <param name="control">The item to insert.</param>
+ /// <permission cref="System.InvalidOperationException">A control with
+ /// the same name already exists in this collection -or-
+ /// the control is being hosted by another dialog -or- the associated dialog is
+ /// showing and cannot be modified.</permission>
+ protected override void InsertItem(int index, T control)
+ {
+ // Check for duplicates, lack of host,
+ // and during-show adds.
+ if (Items.Contains(control))
+ {
+ throw new InvalidOperationException(LocalizedMessages.DialogCollectionCannotHaveDuplicateNames);
+ }
+ if (control.HostingDialog != null)
+ {
+ throw new InvalidOperationException(LocalizedMessages.DialogCollectionControlAlreadyHosted);
+ }
+ if (!hostingDialog.IsCollectionChangeAllowed())
+ {
+ throw new InvalidOperationException(LocalizedMessages.DialogCollectionModifyShowingDialog);
+ }
+
+ // Reparent, add control.
+ control.HostingDialog = hostingDialog;
+ base.InsertItem(index, control);
+
+ // Notify that we've added a control.
+ hostingDialog.ApplyCollectionChanged();
+ }
+
+ /// <summary>
+ /// Removes the control at the specified index.
+ /// </summary>
+ /// <param name="index">The location of the control to remove.</param>
+ /// <permission cref="System.InvalidOperationException">
+ /// The associated dialog is
+ /// showing and cannot be modified.</permission>
+ protected override void RemoveItem(int index)
+ {
+ // Notify that we're about to remove a control.
+ // Throw if dialog showing.
+ if (!hostingDialog.IsCollectionChangeAllowed())
+ {
+ throw new InvalidOperationException(LocalizedMessages.DialogCollectionModifyShowingDialog);
+ }
+
+ DialogControl control = (DialogControl)Items[index];
+
+ // Unparent and remove.
+ control.HostingDialog = null;
+ base.RemoveItem(index);
+
+ hostingDialog.ApplyCollectionChanged();
+ }
+
+ /// <summary>
+ /// Defines the indexer that supports accessing controls by name.
+ /// </summary>
+ /// <remarks>
+ /// <para>Control names are case sensitive.</para>
+ /// <para>This indexer is useful when the dialog is created in XAML
+ /// rather than constructed in code.</para></remarks>
+ ///<exception cref="System.ArgumentException">
+ /// The name cannot be null or a zero-length string.</exception>
+ /// <remarks>If there is more than one control with the same name, only the <B>first control</B> will be returned.</remarks>
+ public T this[string name]
+ {
+ get
+ {
+ if (string.IsNullOrEmpty(name))
+ {
+ throw new ArgumentException(LocalizedMessages.DialogCollectionControlNameNull, "name");
+ }
+
+ return Items.FirstOrDefault(x => x.Name == name);
+ }
+ }
+
+ /// <summary>
+ /// Searches for the control who's id matches the value
+ /// passed in the <paramref name="id"/> parameter.
+ /// </summary>
+ ///
+ /// <param name="id">An integer containing the identifier of the
+ /// control being searched for.</param>
+ ///
+ /// <returns>A DialogControl who's id matches the value of the
+ /// <paramref name="id"/> parameter.</returns>
+ internal DialogControl GetControlbyId(int id)
+ {
+ return Items.FirstOrDefault(x => x.Id == id);
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/Common/DialogsDefaults.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/Common/DialogsDefaults.cs
new file mode 100644
index 0000000000..999f1cbe46
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/Common/DialogsDefaults.cs
@@ -0,0 +1,23 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using Microsoft.WindowsAPICodePack.Resources;
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ internal static class DialogsDefaults
+ {
+ internal static string Caption { get { return LocalizedMessages.DialogDefaultCaption; } }
+ internal static string MainInstruction { get { return LocalizedMessages.DialogDefaultMainInstruction; } }
+ internal static string Content { get { return LocalizedMessages.DialogDefaultContent; } }
+
+ internal const int ProgressBarStartingValue = 0;
+ internal const int ProgressBarMinimumValue = 0;
+ internal const int ProgressBarMaximumValue = 100;
+
+ internal const int IdealWidth = 0;
+
+ // For generating control ID numbers that won't
+ // collide with the standard button return IDs.
+ internal const int MinimumDialogControlId =
+ (int)TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Close + 1;
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/Common/IDialogControlHost.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/Common/IDialogControlHost.cs
new file mode 100644
index 0000000000..9516952453
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/Common/IDialogControlHost.cs
@@ -0,0 +1,43 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Indicates that the implementing class is a dialog that can host
+ /// customizable dialog controls (subclasses of DialogControl).
+ /// </summary>
+ public interface IDialogControlHost
+ {
+ /// <summary>
+ /// Returns if changes to the collection are allowed.
+ /// </summary>
+ /// <returns>true if collection change is allowed.</returns>
+ bool IsCollectionChangeAllowed();
+
+ /// <summary>
+ /// Applies changes to the collection.
+ /// </summary>
+ void ApplyCollectionChanged();
+
+ /// <summary>
+ /// Handle notifications of individual child
+ /// pseudo-controls' properties changing..
+ /// Prefilter should throw if the property
+ /// cannot be set in the dialog's current state.
+ /// PostProcess should pass on changes to native control,
+ /// if appropriate.
+ /// </summary>
+ /// <param name="propertyName">The name of the property.</param>
+ /// <param name="control">The control propertyName applies to.</param>
+ /// <returns>true if the property change is allowed.</returns>
+ bool IsControlPropertyChangeAllowed(string propertyName, DialogControl control);
+
+ /// <summary>
+ /// Called when a control currently in the collection
+ /// has a property changed.
+ /// </summary>
+ /// <param name="propertyName">The name of the property changed.</param>
+ /// <param name="control">The control whose property has changed.</param>
+ void ApplyControlPropertyChange(string propertyName, DialogControl control);
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialog.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialog.cs
new file mode 100644
index 0000000000..962d1a3c66
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialog.cs
@@ -0,0 +1,1253 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using Microsoft.WindowsAPICodePack.Resources;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Encapsulates a new-to-Vista Win32 TaskDialog window
+ /// - a powerful successor to the MessageBox available
+ /// in previous versions of Windows.
+ /// </summary>
+ public sealed class TaskDialog : IDialogControlHost, IDisposable
+ {
+ // Global instance of TaskDialog, to be used by static Show() method.
+ // As most parameters of a dialog created via static Show() will have
+ // identical parameters, we'll create one TaskDialog and treat it
+ // as a NativeTaskDialog generator for all static Show() calls.
+ private static TaskDialog staticDialog;
+
+ // Main current native dialog.
+ private NativeTaskDialog nativeDialog;
+
+ private List<TaskDialogButtonBase> buttons = new List<TaskDialogButtonBase>();
+ private List<TaskDialogButtonBase> radioButtons = new List<TaskDialogButtonBase>();
+ private List<TaskDialogButtonBase> commandLinks = new List<TaskDialogButtonBase>();
+ private IntPtr ownerWindow;
+
+ #region Public Properties
+ /// <summary>
+ /// Occurs when a progress bar changes.
+ /// </summary>
+ public event EventHandler<TaskDialogTickEventArgs> Tick;
+
+ /// <summary>
+ /// Occurs when a user clicks a hyperlink.
+ /// </summary>
+ public event EventHandler<TaskDialogHyperlinkClickedEventArgs> HyperlinkClick;
+
+ /// <summary>
+ /// Occurs when the TaskDialog is closing.
+ /// </summary>
+ public event EventHandler<TaskDialogClosingEventArgs> Closing;
+
+ /// <summary>
+ /// Occurs when a user clicks on Help.
+ /// </summary>
+ public event EventHandler HelpInvoked;
+
+ /// <summary>
+ /// Occurs when the TaskDialog is opened.
+ /// </summary>
+ public event EventHandler Opened;
+
+ /// <summary>
+ /// Gets or sets a value that contains the owner window's handle.
+ /// </summary>
+ public IntPtr OwnerWindowHandle
+ {
+ get { return ownerWindow; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.OwnerCannotBeChanged);
+ ownerWindow = value;
+ }
+ }
+
+ // Main content (maps to MessageBox's "message").
+ private string text;
+ /// <summary>
+ /// Gets or sets a value that contains the message text.
+ /// </summary>
+ public string Text
+ {
+ get { return text; }
+ set
+ {
+ // Set local value, then update native dialog if showing.
+ text = value;
+ if (NativeDialogShowing) { nativeDialog.UpdateText(text); }
+ }
+ }
+
+ private string instructionText;
+ /// <summary>
+ /// Gets or sets a value that contains the instruction text.
+ /// </summary>
+ public string InstructionText
+ {
+ get { return instructionText; }
+ set
+ {
+ // Set local value, then update native dialog if showing.
+ instructionText = value;
+ if (NativeDialogShowing) { nativeDialog.UpdateInstruction(instructionText); }
+ }
+ }
+
+ private string caption;
+ /// <summary>
+ /// Gets or sets a value that contains the caption text.
+ /// </summary>
+ public string Caption
+ {
+ get { return caption; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.CaptionCannotBeChanged);
+ caption = value;
+ }
+ }
+
+ private string footerText;
+ /// <summary>
+ /// Gets or sets a value that contains the footer text.
+ /// </summary>
+ public string FooterText
+ {
+ get { return footerText; }
+ set
+ {
+ // Set local value, then update native dialog if showing.
+ footerText = value;
+ if (NativeDialogShowing) { nativeDialog.UpdateFooterText(footerText); }
+ }
+ }
+
+ private string checkBoxText;
+ /// <summary>
+ /// Gets or sets a value that contains the footer check box text.
+ /// </summary>
+ public string FooterCheckBoxText
+ {
+ get { return checkBoxText; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.CheckBoxCannotBeChanged);
+ checkBoxText = value;
+ }
+ }
+
+ private string detailsExpandedText;
+ /// <summary>
+ /// Gets or sets a value that contains the expanded text in the details section.
+ /// </summary>
+ public string DetailsExpandedText
+ {
+ get { return detailsExpandedText; }
+ set
+ {
+ // Set local value, then update native dialog if showing.
+ detailsExpandedText = value;
+ if (NativeDialogShowing) { nativeDialog.UpdateExpandedText(detailsExpandedText); }
+ }
+ }
+
+ private bool detailsExpanded;
+ /// <summary>
+ /// Gets or sets a value that determines if the details section is expanded.
+ /// </summary>
+ public bool DetailsExpanded
+ {
+ get { return detailsExpanded; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.ExpandingStateCannotBeChanged);
+ detailsExpanded = value;
+ }
+ }
+
+ private string detailsExpandedLabel;
+ /// <summary>
+ /// Gets or sets a value that contains the expanded control text.
+ /// </summary>
+ public string DetailsExpandedLabel
+ {
+ get { return detailsExpandedLabel; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.ExpandedLabelCannotBeChanged);
+ detailsExpandedLabel = value;
+ }
+ }
+
+ private string detailsCollapsedLabel;
+ /// <summary>
+ /// Gets or sets a value that contains the collapsed control text.
+ /// </summary>
+ public string DetailsCollapsedLabel
+ {
+ get { return detailsCollapsedLabel; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.CollapsedTextCannotBeChanged);
+ detailsCollapsedLabel = value;
+ }
+ }
+
+ private bool cancelable;
+ /// <summary>
+ /// Gets or sets a value that determines if Cancelable is set.
+ /// </summary>
+ public bool Cancelable
+ {
+ get { return cancelable; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.CancelableCannotBeChanged);
+ cancelable = value;
+ }
+ }
+
+ private TaskDialogStandardIcon icon;
+ /// <summary>
+ /// Gets or sets a value that contains the TaskDialog main icon.
+ /// </summary>
+ public TaskDialogStandardIcon Icon
+ {
+ get { return icon; }
+ set
+ {
+ // Set local value, then update native dialog if showing.
+ icon = value;
+ if (NativeDialogShowing) { nativeDialog.UpdateMainIcon(icon); }
+ }
+ }
+
+ private TaskDialogStandardIcon footerIcon;
+ /// <summary>
+ /// Gets or sets a value that contains the footer icon.
+ /// </summary>
+ public TaskDialogStandardIcon FooterIcon
+ {
+ get { return footerIcon; }
+ set
+ {
+ // Set local value, then update native dialog if showing.
+ footerIcon = value;
+ if (NativeDialogShowing) { nativeDialog.UpdateFooterIcon(footerIcon); }
+ }
+ }
+
+ private TaskDialogStandardButtons standardButtons = TaskDialogStandardButtons.None;
+ /// <summary>
+ /// Gets or sets a value that contains the standard buttons.
+ /// </summary>
+ public TaskDialogStandardButtons StandardButtons
+ {
+ get { return standardButtons; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.StandardButtonsCannotBeChanged);
+ standardButtons = value;
+ }
+ }
+
+ private DialogControlCollection<TaskDialogControl> controls;
+ /// <summary>
+ /// Gets a value that contains the TaskDialog controls.
+ /// </summary>
+ public DialogControlCollection<TaskDialogControl> Controls
+ {
+ // "Show protection" provided by collection itself,
+ // as well as individual controls.
+ get { return controls; }
+ }
+
+ private bool hyperlinksEnabled;
+ /// <summary>
+ /// Gets or sets a value that determines if hyperlinks are enabled.
+ /// </summary>
+ public bool HyperlinksEnabled
+ {
+ get { return hyperlinksEnabled; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.HyperlinksCannotBetSet);
+ hyperlinksEnabled = value;
+ }
+ }
+
+ private bool? footerCheckBoxChecked = null;
+ /// <summary>
+ /// Gets or sets a value that indicates if the footer checkbox is checked.
+ /// </summary>
+ public bool? FooterCheckBoxChecked
+ {
+ get { return footerCheckBoxChecked.GetValueOrDefault(false); }
+ set
+ {
+ // Set local value, then update native dialog if showing.
+ footerCheckBoxChecked = value;
+ if (NativeDialogShowing) { nativeDialog.UpdateCheckBoxChecked(footerCheckBoxChecked.Value); }
+ }
+ }
+
+ private TaskDialogExpandedDetailsLocation expansionMode;
+ /// <summary>
+ /// Gets or sets a value that contains the expansion mode for this dialog.
+ /// </summary>
+ public TaskDialogExpandedDetailsLocation ExpansionMode
+ {
+ get { return expansionMode; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.ExpandedDetailsCannotBeChanged);
+ expansionMode = value;
+ }
+ }
+
+ private TaskDialogStartupLocation startupLocation;
+ /// <summary>
+ /// Gets or sets a value that contains the startup location.
+ /// </summary>
+ public TaskDialogStartupLocation StartupLocation
+ {
+ get { return startupLocation; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.StartupLocationCannotBeChanged);
+ startupLocation = value;
+ }
+ }
+
+ private TaskDialogProgressBar progressBar;
+ /// <summary>
+ /// Gets or sets the progress bar on the taskdialog. ProgressBar a visual representation
+ /// of the progress of a long running operation.
+ /// </summary>
+ public TaskDialogProgressBar ProgressBar
+ {
+ get { return progressBar; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.ProgressBarCannotBeChanged);
+ if (value != null)
+ {
+ if (value.HostingDialog != null)
+ {
+ throw new InvalidOperationException(LocalizedMessages.ProgressBarCannotBeHostedInMultipleDialogs);
+ }
+
+ value.HostingDialog = this;
+ }
+ progressBar = value;
+ }
+ }
+
+ #endregion
+
+ #region Constructors
+
+ /// <summary>
+ /// Creates a basic TaskDialog window
+ /// </summary>
+ public TaskDialog()
+ {
+ CoreHelpers.ThrowIfNotVista();
+
+ // Initialize various data structs.
+ controls = new DialogControlCollection<TaskDialogControl>(this);
+ }
+
+ #endregion
+
+ #region Static Show Methods
+
+ /// <summary>
+ /// Creates and shows a task dialog with the specified message text.
+ /// </summary>
+ /// <param name="text">The text to display.</param>
+ /// <returns>The dialog result.</returns>
+ public static TaskDialogResult Show(string text)
+ {
+ return ShowCoreStatic(
+ text,
+ TaskDialogDefaults.MainInstruction,
+ TaskDialogDefaults.Caption);
+ }
+
+ /// <summary>
+ /// Creates and shows a task dialog with the specified supporting text and main instruction.
+ /// </summary>
+ /// <param name="text">The supporting text to display.</param>
+ /// <param name="instructionText">The main instruction text to display.</param>
+ /// <returns>The dialog result.</returns>
+ public static TaskDialogResult Show(string text, string instructionText)
+ {
+ return ShowCoreStatic(
+ text,
+ instructionText,
+ TaskDialogDefaults.Caption);
+ }
+
+ /// <summary>
+ /// Creates and shows a task dialog with the specified supporting text, main instruction, and dialog caption.
+ /// </summary>
+ /// <param name="text">The supporting text to display.</param>
+ /// <param name="instructionText">The main instruction text to display.</param>
+ /// <param name="caption">The caption for the dialog.</param>
+ /// <returns>The dialog result.</returns>
+ public static TaskDialogResult Show(string text, string instructionText, string caption)
+ {
+ return ShowCoreStatic(text, instructionText, caption);
+ }
+ #endregion
+
+ #region Instance Show Methods
+
+ /// <summary>
+ /// Creates and shows a task dialog.
+ /// </summary>
+ /// <returns>The dialog result.</returns>
+ public TaskDialogResult Show()
+ {
+ return ShowCore();
+ }
+ #endregion
+
+ #region Core Show Logic
+
+ // CORE SHOW METHODS:
+ // All static Show() calls forward here -
+ // it is responsible for retrieving
+ // or creating our cached TaskDialog instance, getting it configured,
+ // and in turn calling the appropriate instance Show.
+
+ private static TaskDialogResult ShowCoreStatic(
+ string text,
+ string instructionText,
+ string caption)
+ {
+ CoreHelpers.ThrowIfNotVista();
+
+ // If no instance cached yet, create it.
+ if (staticDialog == null)
+ {
+ // New TaskDialog will automatically pick up defaults when
+ // a new config structure is created as part of ShowCore().
+ staticDialog = new TaskDialog();
+ }
+
+ // Set the few relevant properties,
+ // and go with the defaults for the others.
+ staticDialog.text = text;
+ staticDialog.instructionText = instructionText;
+ staticDialog.caption = caption;
+
+ return staticDialog.Show();
+ }
+
+ private TaskDialogResult ShowCore()
+ {
+ TaskDialogResult result;
+
+ try
+ {
+ // Populate control lists, based on current
+ // contents - note we are somewhat late-bound
+ // on our control lists, to support XAML scenarios.
+ SortDialogControls();
+
+ // First, let's make sure it even makes
+ // sense to try a show.
+ ValidateCurrentDialogSettings();
+
+ // Create settings object for new dialog,
+ // based on current state.
+ NativeTaskDialogSettings settings = new NativeTaskDialogSettings();
+ ApplyCoreSettings(settings);
+ ApplySupplementalSettings(settings);
+
+ // Show the dialog.
+ // NOTE: this is a BLOCKING call; the dialog proc callbacks
+ // will be executed by the same thread as the
+ // Show() call before the thread of execution
+ // contines to the end of this method.
+ nativeDialog = new NativeTaskDialog(settings, this);
+ nativeDialog.NativeShow();
+
+ // Build and return dialog result to public API - leaving it
+ // null after an exception is thrown is fine in this case
+ result = ConstructDialogResult(nativeDialog);
+ footerCheckBoxChecked = nativeDialog.CheckBoxChecked;
+ }
+ finally
+ {
+ CleanUp();
+ nativeDialog = null;
+ }
+
+ return result;
+ }
+
+ // Helper that looks at the current state of the TaskDialog and verifies
+ // that there aren't any abberant combinations of properties.
+ // NOTE that this method is designed to throw
+ // rather than return a bool.
+ private void ValidateCurrentDialogSettings()
+ {
+ if (footerCheckBoxChecked.HasValue &&
+ footerCheckBoxChecked.Value == true &&
+ string.IsNullOrEmpty(checkBoxText))
+ {
+ throw new InvalidOperationException(LocalizedMessages.TaskDialogCheckBoxTextRequiredToEnableCheckBox);
+ }
+
+ // Progress bar validation.
+ // Make sure the progress bar values are valid.
+ // the Win32 API will valiantly try to rationalize
+ // bizarre min/max/value combinations, but we'll save
+ // it the trouble by validating.
+ if (progressBar != null && !progressBar.HasValidValues)
+ {
+ throw new InvalidOperationException(LocalizedMessages.TaskDialogProgressBarValueInRange);
+ }
+
+ // Validate Buttons collection.
+ // Make sure we don't have buttons AND
+ // command-links - the Win32 API treats them as different
+ // flavors of a single button struct.
+ if (buttons.Count > 0 && commandLinks.Count > 0)
+ {
+ throw new NotSupportedException(LocalizedMessages.TaskDialogSupportedButtonsAndLinks);
+ }
+ if (buttons.Count > 0 && standardButtons != TaskDialogStandardButtons.None)
+ {
+ throw new NotSupportedException(LocalizedMessages.TaskDialogSupportedButtonsAndButtons);
+ }
+ }
+
+ // Analyzes the final state of the NativeTaskDialog instance and creates the
+ // final TaskDialogResult that will be returned from the public API
+ private static TaskDialogResult ConstructDialogResult(NativeTaskDialog native)
+ {
+ Debug.Assert(native.ShowState == DialogShowState.Closed, "dialog result being constructed for unshown dialog.");
+
+ TaskDialogResult result = TaskDialogResult.Cancel;
+
+ TaskDialogStandardButtons standardButton = MapButtonIdToStandardButton(native.SelectedButtonId);
+
+ // If returned ID isn't a standard button, let's fetch
+ if (standardButton == TaskDialogStandardButtons.None)
+ {
+ result = TaskDialogResult.CustomButtonClicked;
+ }
+ else { result = (TaskDialogResult)standardButton; }
+
+ return result;
+ }
+
+ /// <summary>
+ /// Close TaskDialog
+ /// </summary>
+ /// <exception cref="InvalidOperationException">if TaskDialog is not showing.</exception>
+ public void Close()
+ {
+ if (!NativeDialogShowing)
+ {
+ throw new InvalidOperationException(LocalizedMessages.TaskDialogCloseNonShowing);
+ }
+
+ nativeDialog.NativeClose(TaskDialogResult.Cancel);
+ // TaskDialog's own cleanup code -
+ // which runs post show - will handle disposal of native dialog.
+ }
+
+ /// <summary>
+ /// Close TaskDialog with a given TaskDialogResult
+ /// </summary>
+ /// <param name="closingResult">TaskDialogResult to return from the TaskDialog.Show() method</param>
+ /// <exception cref="InvalidOperationException">if TaskDialog is not showing.</exception>
+ public void Close(TaskDialogResult closingResult)
+ {
+ if (!NativeDialogShowing)
+ {
+ throw new InvalidOperationException(LocalizedMessages.TaskDialogCloseNonShowing);
+ }
+
+ nativeDialog.NativeClose(closingResult);
+ // TaskDialog's own cleanup code -
+ // which runs post show - will handle disposal of native dialog.
+ }
+
+ #endregion
+
+ #region Configuration Construction
+
+ private void ApplyCoreSettings(NativeTaskDialogSettings settings)
+ {
+ ApplyGeneralNativeConfiguration(settings.NativeConfiguration);
+ ApplyTextConfiguration(settings.NativeConfiguration);
+ ApplyOptionConfiguration(settings.NativeConfiguration);
+ ApplyControlConfiguration(settings);
+ }
+
+ private void ApplyGeneralNativeConfiguration(TaskDialogNativeMethods.TaskDialogConfiguration dialogConfig)
+ {
+ // If an owner wasn't specifically specified,
+ // we'll use the app's main window.
+ if (ownerWindow != IntPtr.Zero)
+ {
+ dialogConfig.parentHandle = ownerWindow;
+ }
+
+ // Other miscellaneous sets.
+ dialogConfig.mainIcon = new TaskDialogNativeMethods.IconUnion((int)icon);
+ dialogConfig.footerIcon = new TaskDialogNativeMethods.IconUnion((int)footerIcon);
+ dialogConfig.commonButtons = (TaskDialogNativeMethods.TaskDialogCommonButtons)standardButtons;
+ }
+
+ /// <summary>
+ /// Sets important text properties.
+ /// </summary>
+ /// <param name="dialogConfig">An instance of a <see cref="TaskDialogNativeMethods.TaskDialogConfiguration"/> object.</param>
+ private void ApplyTextConfiguration(TaskDialogNativeMethods.TaskDialogConfiguration dialogConfig)
+ {
+ // note that nulls or empty strings are fine here.
+ dialogConfig.content = text;
+ dialogConfig.windowTitle = caption;
+ dialogConfig.mainInstruction = instructionText;
+ dialogConfig.expandedInformation = detailsExpandedText;
+ dialogConfig.expandedControlText = detailsExpandedLabel;
+ dialogConfig.collapsedControlText = detailsCollapsedLabel;
+ dialogConfig.footerText = footerText;
+ dialogConfig.verificationText = checkBoxText;
+ }
+
+ private void ApplyOptionConfiguration(TaskDialogNativeMethods.TaskDialogConfiguration dialogConfig)
+ {
+ // Handle options - start with no options set.
+ TaskDialogNativeMethods.TaskDialogOptions options = TaskDialogNativeMethods.TaskDialogOptions.None;
+ if (cancelable)
+ {
+ options |= TaskDialogNativeMethods.TaskDialogOptions.AllowCancel;
+ }
+ if (footerCheckBoxChecked.HasValue && footerCheckBoxChecked.Value)
+ {
+ options |= TaskDialogNativeMethods.TaskDialogOptions.CheckVerificationFlag;
+ }
+ if (hyperlinksEnabled)
+ {
+ options |= TaskDialogNativeMethods.TaskDialogOptions.EnableHyperlinks;
+ }
+ if (detailsExpanded)
+ {
+ options |= TaskDialogNativeMethods.TaskDialogOptions.ExpandedByDefault;
+ }
+ if (Tick != null)
+ {
+ options |= TaskDialogNativeMethods.TaskDialogOptions.UseCallbackTimer;
+ }
+ if (startupLocation == TaskDialogStartupLocation.CenterOwner)
+ {
+ options |= TaskDialogNativeMethods.TaskDialogOptions.PositionRelativeToWindow;
+ }
+
+ // Note: no validation required, as we allow this to
+ // be set even if there is no expanded information
+ // text because that could be added later.
+ // Default for Win32 API is to expand into (and after)
+ // the content area.
+ if (expansionMode == TaskDialogExpandedDetailsLocation.ExpandFooter)
+ {
+ options |= TaskDialogNativeMethods.TaskDialogOptions.ExpandFooterArea;
+ }
+
+ // Finally, apply options to config.
+ dialogConfig.taskDialogFlags = options;
+ }
+
+ // Builds the actual configuration
+ // that the NativeTaskDialog (and underlying Win32 API)
+ // expects, by parsing the various control
+ // lists, marshalling to the unmanaged heap, etc.
+
+ private void ApplyControlConfiguration(NativeTaskDialogSettings settings)
+ {
+ // Deal with progress bars/marquees.
+ if (progressBar != null)
+ {
+ if (progressBar.State == TaskDialogProgressBarState.Marquee)
+ {
+ settings.NativeConfiguration.taskDialogFlags |= TaskDialogNativeMethods.TaskDialogOptions.ShowMarqueeProgressBar;
+ }
+ else
+ {
+ settings.NativeConfiguration.taskDialogFlags |= TaskDialogNativeMethods.TaskDialogOptions.ShowProgressBar;
+ }
+ }
+
+ // Build the native struct arrays that NativeTaskDialog
+ // needs - though NTD will handle
+ // the heavy lifting marshalling to make sure
+ // all the cleanup is centralized there.
+ if (buttons.Count > 0 || commandLinks.Count > 0)
+ {
+ // These are the actual arrays/lists of
+ // the structs that we'll copy to the
+ // unmanaged heap.
+ List<TaskDialogButtonBase> sourceList = (buttons.Count > 0 ? buttons : commandLinks);
+ settings.Buttons = BuildButtonStructArray(sourceList);
+
+ // Apply option flag that forces all
+ // custom buttons to render as command links.
+ if (commandLinks.Count > 0)
+ {
+ settings.NativeConfiguration.taskDialogFlags |= TaskDialogNativeMethods.TaskDialogOptions.UseCommandLinks;
+ }
+
+ // Set default button and add elevation icons
+ // to appropriate buttons.
+ settings.NativeConfiguration.defaultButtonIndex = FindDefaultButtonId(sourceList);
+
+ ApplyElevatedIcons(settings, sourceList);
+ }
+
+ if (radioButtons.Count > 0)
+ {
+ settings.RadioButtons = BuildButtonStructArray(radioButtons);
+
+ // Set default radio button - radio buttons don't support.
+ int defaultRadioButton = FindDefaultButtonId(radioButtons);
+ settings.NativeConfiguration.defaultRadioButtonIndex = defaultRadioButton;
+
+ if (defaultRadioButton == TaskDialogNativeMethods.NoDefaultButtonSpecified)
+ {
+ settings.NativeConfiguration.taskDialogFlags |= TaskDialogNativeMethods.TaskDialogOptions.NoDefaultRadioButton;
+ }
+ }
+ }
+
+ private static TaskDialogNativeMethods.TaskDialogButton[] BuildButtonStructArray(List<TaskDialogButtonBase> controls)
+ {
+ TaskDialogNativeMethods.TaskDialogButton[] buttonStructs;
+ TaskDialogButtonBase button;
+
+ int totalButtons = controls.Count;
+ buttonStructs = new TaskDialogNativeMethods.TaskDialogButton[totalButtons];
+ for (int i = 0; i < totalButtons; i++)
+ {
+ button = controls[i];
+ buttonStructs[i] = new TaskDialogNativeMethods.TaskDialogButton(button.Id, button.ToString());
+ }
+ return buttonStructs;
+ }
+
+ // Searches list of controls and returns the ID of
+ // the default control, or 0 if no default was specified.
+ private static int FindDefaultButtonId(List<TaskDialogButtonBase> controls)
+ {
+ var defaults = controls.FindAll(control => control.Default);
+
+ if (defaults.Count == 1) { return defaults[0].Id; }
+ else if (defaults.Count > 1)
+ {
+ throw new InvalidOperationException(LocalizedMessages.TaskDialogOnlyOneDefaultControl);
+ }
+
+ return TaskDialogNativeMethods.NoDefaultButtonSpecified;
+ }
+
+ private static void ApplyElevatedIcons(NativeTaskDialogSettings settings, List<TaskDialogButtonBase> controls)
+ {
+ foreach (TaskDialogButton control in controls)
+ {
+ if (control.UseElevationIcon)
+ {
+ if (settings.ElevatedButtons == null) { settings.ElevatedButtons = new List<int>(); }
+ settings.ElevatedButtons.Add(control.Id);
+ }
+ }
+ }
+
+ private void ApplySupplementalSettings(NativeTaskDialogSettings settings)
+ {
+ if (progressBar != null)
+ {
+ if (progressBar.State != TaskDialogProgressBarState.Marquee)
+ {
+ settings.ProgressBarMinimum = progressBar.Minimum;
+ settings.ProgressBarMaximum = progressBar.Maximum;
+ settings.ProgressBarValue = progressBar.Value;
+ settings.ProgressBarState = progressBar.State;
+ }
+ }
+
+ if (HelpInvoked != null) { settings.InvokeHelp = true; }
+ }
+
+ // Here we walk our controls collection and
+ // sort the various controls by type.
+ private void SortDialogControls()
+ {
+ foreach (TaskDialogControl control in controls)
+ {
+ TaskDialogButtonBase buttonBase = control as TaskDialogButtonBase;
+ TaskDialogCommandLink commandLink = control as TaskDialogCommandLink;
+
+ if (buttonBase != null && string.IsNullOrEmpty(buttonBase.Text) &&
+ commandLink != null && string.IsNullOrEmpty(commandLink.Instruction))
+ {
+ throw new InvalidOperationException(LocalizedMessages.TaskDialogButtonTextEmpty);
+ }
+
+ TaskDialogRadioButton radButton;
+ TaskDialogProgressBar progBar;
+
+ // Loop through child controls
+ // and sort the controls based on type.
+ if (commandLink != null)
+ {
+ commandLinks.Add(commandLink);
+ }
+ else if ((radButton = control as TaskDialogRadioButton) != null)
+ {
+ if (radioButtons == null) { radioButtons = new List<TaskDialogButtonBase>(); }
+ radioButtons.Add(radButton);
+ }
+ else if (buttonBase != null)
+ {
+ if (buttons == null) { buttons = new List<TaskDialogButtonBase>(); }
+ buttons.Add(buttonBase);
+ }
+ else if ((progBar = control as TaskDialogProgressBar) != null)
+ {
+ progressBar = progBar;
+ }
+ else
+ {
+ throw new InvalidOperationException(LocalizedMessages.TaskDialogUnkownControl);
+ }
+ }
+ }
+
+ #endregion
+
+ #region Helpers
+
+ // Helper to map the standard button IDs returned by
+ // TaskDialogIndirect to the standard button ID enum -
+ // note that we can't just cast, as the Win32
+ // typedefs differ incoming and outgoing.
+
+ private static TaskDialogStandardButtons MapButtonIdToStandardButton(int id)
+ {
+ switch ((TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds)id)
+ {
+ case TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Ok:
+ return TaskDialogStandardButtons.Ok;
+ case TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Cancel:
+ return TaskDialogStandardButtons.Cancel;
+ case TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Abort:
+ // Included for completeness in API -
+ // we can't pass in an Abort standard button.
+ return TaskDialogStandardButtons.None;
+ case TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Retry:
+ return TaskDialogStandardButtons.Retry;
+ case TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Ignore:
+ // Included for completeness in API -
+ // we can't pass in an Ignore standard button.
+ return TaskDialogStandardButtons.None;
+ case TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Yes:
+ return TaskDialogStandardButtons.Yes;
+ case TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.No:
+ return TaskDialogStandardButtons.No;
+ case TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Close:
+ return TaskDialogStandardButtons.Close;
+ default:
+ return TaskDialogStandardButtons.None;
+ }
+ }
+
+ private void ThrowIfDialogShowing(string message)
+ {
+ if (NativeDialogShowing) { throw new NotSupportedException(message); }
+ }
+
+ private bool NativeDialogShowing
+ {
+ get
+ {
+ return (nativeDialog != null)
+ && (nativeDialog.ShowState == DialogShowState.Showing
+ || nativeDialog.ShowState == DialogShowState.Closing);
+ }
+ }
+
+ // NOTE: we are going to require names be unique
+ // across both buttons and radio buttons,
+ // even though the Win32 API allows them to be separate.
+ private TaskDialogButtonBase GetButtonForId(int id)
+ {
+ return (TaskDialogButtonBase)controls.GetControlbyId(id);
+ }
+
+ #endregion
+
+ #region IDialogControlHost Members
+
+ // We're explicitly implementing this interface
+ // as the user will never need to know about it
+ // or use it directly - it is only for the internal
+ // implementation of "pseudo controls" within
+ // the dialogs.
+
+ // Called whenever controls are being added
+ // to or removed from the dialog control collection.
+ bool IDialogControlHost.IsCollectionChangeAllowed()
+ {
+ // Only allow additions to collection if dialog is NOT showing.
+ return !NativeDialogShowing;
+ }
+
+ // Called whenever controls have been added or removed.
+ void IDialogControlHost.ApplyCollectionChanged()
+ {
+ // If we're showing, we should never get here -
+ // the changing notification would have thrown and the
+ // property would not have been changed.
+ Debug.Assert(!NativeDialogShowing,
+ "Collection changed notification received despite show state of dialog");
+ }
+
+ // Called when a control currently in the collection
+ // has a property changing - this is
+ // basically to screen out property changes that
+ // cannot occur while the dialog is showing
+ // because the Win32 API has no way for us to
+ // propagate the changes until we re-invoke the Win32 call.
+ bool IDialogControlHost.IsControlPropertyChangeAllowed(string propertyName, DialogControl control)
+ {
+ Debug.Assert(control is TaskDialogControl,
+ "Property changing for a control that is not a TaskDialogControl-derived type");
+ Debug.Assert(propertyName != "Name",
+ "Name changes at any time are not supported - public API should have blocked this");
+
+ bool canChange = false;
+
+ if (!NativeDialogShowing)
+ {
+ // Certain properties can't be changed if the dialog is not showing
+ // we need a handle created before we can set these...
+ switch (propertyName)
+ {
+ case "Enabled":
+ canChange = false;
+ break;
+ default:
+ canChange = true;
+ break;
+ }
+ }
+ else
+ {
+ // If the dialog is showing, we can only
+ // allow some properties to change.
+ switch (propertyName)
+ {
+ // Properties that CAN'T be changed while dialog is showing.
+ case "Text":
+ case "Default":
+ canChange = false;
+ break;
+
+ // Properties that CAN be changed while dialog is showing.
+ case "ShowElevationIcon":
+ case "Enabled":
+ canChange = true;
+ break;
+ default:
+ Debug.Assert(true, "Unknown property name coming through property changing handler");
+ break;
+ }
+ }
+ return canChange;
+ }
+
+ // Called when a control currently in the collection
+ // has a property changed - this handles propagating
+ // the new property values to the Win32 API.
+ // If there isn't a way to change the Win32 value, then we
+ // should have already screened out the property set
+ // in NotifyControlPropertyChanging.
+ void IDialogControlHost.ApplyControlPropertyChange(string propertyName, DialogControl control)
+ {
+ // We only need to apply changes to the
+ // native dialog when it actually exists.
+ if (NativeDialogShowing)
+ {
+ TaskDialogButton button;
+ TaskDialogRadioButton radioButton;
+ if (control is TaskDialogProgressBar)
+ {
+ if (!progressBar.HasValidValues)
+ {
+ throw new ArgumentException(LocalizedMessages.TaskDialogProgressBarValueInRange);
+ }
+
+ switch (propertyName)
+ {
+ case "State":
+ nativeDialog.UpdateProgressBarState(progressBar.State);
+ break;
+ case "Value":
+ nativeDialog.UpdateProgressBarValue(progressBar.Value);
+ break;
+ case "Minimum":
+ case "Maximum":
+ nativeDialog.UpdateProgressBarRange();
+ break;
+ default:
+ Debug.Assert(true, "Unknown property being set");
+ break;
+ }
+ }
+ else if ((button = control as TaskDialogButton) != null)
+ {
+ switch (propertyName)
+ {
+ case "ShowElevationIcon":
+ nativeDialog.UpdateElevationIcon(button.Id, button.UseElevationIcon);
+ break;
+ case "Enabled":
+ nativeDialog.UpdateButtonEnabled(button.Id, button.Enabled);
+ break;
+ default:
+ Debug.Assert(true, "Unknown property being set");
+ break;
+ }
+ }
+ else if ((radioButton = control as TaskDialogRadioButton) != null)
+ {
+ switch (propertyName)
+ {
+ case "Enabled":
+ nativeDialog.UpdateRadioButtonEnabled(radioButton.Id, radioButton.Enabled);
+ break;
+ default:
+ Debug.Assert(true, "Unknown property being set");
+ break;
+ }
+ }
+ else
+ {
+ // Do nothing with property change -
+ // note that this shouldn't ever happen, we should have
+ // either thrown on the changing event, or we handle above.
+ Debug.Assert(true, "Control property changed notification not handled properly - being ignored");
+ }
+ }
+ }
+
+ #endregion
+
+ #region Event Percolation Methods
+
+ // All Raise*() methods are called by the
+ // NativeTaskDialog when various pseudo-controls
+ // are triggered.
+ internal void RaiseButtonClickEvent(int id)
+ {
+ // First check to see if the ID matches a custom button.
+ TaskDialogButtonBase button = GetButtonForId(id);
+
+ // If a custom button was found,
+ // raise the event - if not, it's a standard button, and
+ // we don't support custom event handling for the standard buttons
+ if (button != null) { button.RaiseClickEvent(); }
+ }
+
+ internal void RaiseHyperlinkClickEvent(string link)
+ {
+ EventHandler<TaskDialogHyperlinkClickedEventArgs> handler = HyperlinkClick;
+ if (handler != null)
+ {
+ handler(this, new TaskDialogHyperlinkClickedEventArgs(link));
+ }
+ }
+
+ // Gives event subscriber a chance to prevent
+ // the dialog from closing, based on
+ // the current state of the app and the button
+ // used to commit. Note that we don't
+ // have full access at this stage to
+ // the full dialog state.
+ internal int RaiseClosingEvent(int id)
+ {
+ EventHandler<TaskDialogClosingEventArgs> handler = Closing;
+ if (handler != null)
+ {
+ TaskDialogButtonBase customButton = null;
+ TaskDialogClosingEventArgs e = new TaskDialogClosingEventArgs();
+
+ // Try to identify the button - is it a standard one?
+ TaskDialogStandardButtons buttonClicked = MapButtonIdToStandardButton(id);
+
+ // If not, it had better be a custom button...
+ if (buttonClicked == TaskDialogStandardButtons.None)
+ {
+ customButton = GetButtonForId(id);
+
+ // ... or we have a problem.
+ if (customButton == null)
+ {
+ throw new InvalidOperationException(LocalizedMessages.TaskDialogBadButtonId);
+ }
+
+ e.CustomButton = customButton.Name;
+ e.TaskDialogResult = TaskDialogResult.CustomButtonClicked;
+ }
+ else
+ {
+ e.TaskDialogResult = (TaskDialogResult)buttonClicked;
+ }
+
+ // Raise the event and determine how to proceed.
+ handler(this, e);
+ if (e.Cancel) { return (int)HResult.False; }
+ }
+
+ // It's okay to let the dialog close.
+ return (int)HResult.Ok;
+ }
+
+ internal void RaiseHelpInvokedEvent()
+ {
+ if (HelpInvoked != null) { HelpInvoked(this, EventArgs.Empty); }
+ }
+
+ internal void RaiseOpenedEvent()
+ {
+ if (Opened != null) { Opened(this, EventArgs.Empty); }
+ }
+
+ internal void RaiseTickEvent(int ticks)
+ {
+ if (Tick != null) { Tick(this, new TaskDialogTickEventArgs(ticks)); }
+ }
+
+ #endregion
+
+ #region Cleanup Code
+
+ // Cleans up data and structs from a single
+ // native dialog Show() invocation.
+ private void CleanUp()
+ {
+ // Reset values that would be considered
+ // 'volatile' in a given instance.
+ if (progressBar != null)
+ {
+ progressBar.Reset();
+ }
+
+ // Clean out sorted control lists -
+ // though we don't of course clear the main controls collection,
+ // so the controls are still around; we'll
+ // resort on next show, since the collection may have changed.
+ if (buttons != null) { buttons.Clear(); }
+ if (commandLinks != null) { commandLinks.Clear(); }
+ if (radioButtons != null) { radioButtons.Clear(); }
+ progressBar = null;
+
+ // Have the native dialog clean up the rest.
+ if (nativeDialog != null)
+ {
+ nativeDialog.Dispose();
+ }
+ }
+
+
+ // Dispose pattern - cleans up data and structs for
+ // a) any native dialog currently showing, and
+ // b) anything else that the outer TaskDialog has.
+ private bool disposed;
+
+ /// <summary>
+ /// Dispose TaskDialog Resources
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// TaskDialog Finalizer
+ /// </summary>
+ ~TaskDialog()
+ {
+ Dispose(false);
+ }
+
+ /// <summary>
+ /// Dispose TaskDialog Resources
+ /// </summary>
+ /// <param name="disposing">If true, indicates that this is being called via Dispose rather than via the finalizer.</param>
+ public void Dispose(bool disposing)
+ {
+ if (!disposed)
+ {
+ disposed = true;
+
+ if (disposing)
+ {
+ // Clean up managed resources.
+ if (nativeDialog != null && nativeDialog.ShowState == DialogShowState.Showing)
+ {
+ nativeDialog.NativeClose(TaskDialogResult.Cancel);
+ }
+
+ buttons = null;
+ radioButtons = null;
+ commandLinks = null;
+ }
+
+ // Clean up unmanaged resources SECOND, NTD counts on
+ // being closed before being disposed.
+ if (nativeDialog != null)
+ {
+ nativeDialog.Dispose();
+ nativeDialog = null;
+ }
+
+ if (staticDialog != null)
+ {
+ staticDialog.Dispose();
+ staticDialog = null;
+ }
+
+
+ }
+ }
+
+ #endregion
+
+ /// <summary>
+ /// Indicates whether this feature is supported on the current platform.
+ /// </summary>
+ public static bool IsPlatformSupported
+ {
+ get
+ {
+ // We need Windows Vista onwards ...
+ return CoreHelpers.RunningOnVista;
+ }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogBar.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogBar.cs
new file mode 100644
index 0000000000..f812d8dd55
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogBar.cs
@@ -0,0 +1,43 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Defines a common class for all task dialog bar controls, such as the progress and marquee bars.
+ /// </summary>
+ public class TaskDialogBar : TaskDialogControl
+ {
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ public TaskDialogBar() { }
+ /// <summary>
+ /// Creates a new instance of this class with the specified name.
+ /// </summary>
+ /// <param name="name">The name for this control.</param>
+ protected TaskDialogBar(string name) : base(name) { }
+
+ private TaskDialogProgressBarState state;
+ /// <summary>
+ /// Gets or sets the state of the progress bar.
+ /// </summary>
+ public TaskDialogProgressBarState State
+ {
+ get { return state; }
+ set
+ {
+ CheckPropertyChangeAllowed("State");
+ state = value;
+ ApplyPropertyChange("State");
+ }
+ }
+ /// <summary>
+ /// Resets the state of the control to normal.
+ /// </summary>
+ protected internal virtual void Reset()
+ {
+ state = TaskDialogProgressBarState.Normal;
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogButton.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogButton.cs
new file mode 100644
index 0000000000..5a3070ea19
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogButton.cs
@@ -0,0 +1,37 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Implements a button that can be hosted in a task dialog.
+ /// </summary>
+ public class TaskDialogButton : TaskDialogButtonBase
+ {
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ public TaskDialogButton() { }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified property settings.
+ /// </summary>
+ /// <param name="name">The name of the button.</param>
+ /// <param name="text">The button label.</param>
+ public TaskDialogButton(string name, string text) : base(name, text) { }
+
+ private bool useElevationIcon;
+ /// <summary>
+ /// Gets or sets a value that controls whether the elevation icon is displayed.
+ /// </summary>
+ public bool UseElevationIcon
+ {
+ get { return useElevationIcon; }
+ set
+ {
+ CheckPropertyChangeAllowed("ShowElevationIcon");
+ useElevationIcon = value;
+ ApplyPropertyChange("ShowElevationIcon");
+ }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogButtonBase.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogButtonBase.cs
new file mode 100644
index 0000000000..bc0fe8942b
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogButtonBase.cs
@@ -0,0 +1,112 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ // ContentProperty allows us to specify the text
+ // of the button as the child text of
+ // a button element in XAML, as well as explicitly
+ // set with 'Text="<text>"'
+ // Note that this attribute is inherited, so it
+ // applies to command-links and radio buttons as well.
+ /// <summary>
+ /// Defines the abstract base class for task dialog buttons.
+ /// Classes that inherit from this class will inherit
+ /// the Text property defined in this class.
+ /// </summary>
+ public abstract class TaskDialogButtonBase : TaskDialogControl
+ {
+
+ /// <summary>
+ /// Creates a new instance on a task dialog button.
+ /// </summary>
+ protected TaskDialogButtonBase() { }
+ /// <summary>
+ /// Creates a new instance on a task dialog button with
+ /// the specified name and text.
+ /// </summary>
+ /// <param name="name">The name for this button.</param>
+ /// <param name="text">The label for this button.</param>
+ protected TaskDialogButtonBase(string name, string text) : base(name)
+ {
+ this.text = text;
+ }
+
+ // Note that we don't need to explicitly
+ // implement the add/remove delegate for the Click event;
+ // the hosting dialog only needs the delegate
+ // information when the Click event is
+ // raised (indirectly) by NativeTaskDialog,
+ // so the latest delegate is always available.
+ /// <summary>
+ /// Raised when the task dialog button is clicked.
+ /// </summary>
+ public event EventHandler Click;
+
+ internal void RaiseClickEvent()
+ {
+ // Only perform click if the button is enabled.
+ if (!enabled) { return; }
+
+ if (Click != null) { Click(this, EventArgs.Empty); }
+ }
+
+ private string text;
+ /// <summary>
+ /// Gets or sets the button text.
+ /// </summary>
+ public string Text
+ {
+ get { return text; }
+ set
+ {
+ CheckPropertyChangeAllowed("Text");
+ text = value;
+ ApplyPropertyChange("Text");
+ }
+ }
+
+ private bool enabled = true;
+ /// <summary>
+ /// Gets or sets a value that determines whether the
+ /// button is enabled. The enabled state can cannot be changed
+ /// before the dialog is shown.
+ /// </summary>
+ public bool Enabled
+ {
+ get { return enabled; }
+ set
+ {
+ CheckPropertyChangeAllowed("Enabled");
+ enabled = value;
+ ApplyPropertyChange("Enabled");
+ }
+ }
+
+ private bool defaultControl;
+ /// <summary>
+ /// Gets or sets a value that indicates whether
+ /// this button is the default button.
+ /// </summary>
+ public bool Default
+ {
+ get { return defaultControl; }
+ set
+ {
+ CheckPropertyChangeAllowed("Default");
+ defaultControl = value;
+ ApplyPropertyChange("Default");
+ }
+ }
+
+ /// <summary>
+ /// Returns the Text property value for this button.
+ /// </summary>
+ /// <returns>A <see cref="System.String"/>.</returns>
+ public override string ToString()
+ {
+ return text ?? string.Empty;
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogClosingEventArgs.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogClosingEventArgs.cs
new file mode 100644
index 0000000000..5c3aa7614b
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogClosingEventArgs.cs
@@ -0,0 +1,34 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System.ComponentModel;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Data associated with <see cref="TaskDialog.Closing"/> event.
+ /// </summary>
+ public class TaskDialogClosingEventArgs : CancelEventArgs
+ {
+ private TaskDialogResult taskDialogResult;
+ /// <summary>
+ /// Gets or sets the standard button that was clicked.
+ /// </summary>
+ public TaskDialogResult TaskDialogResult
+ {
+ get { return taskDialogResult; }
+ set { taskDialogResult = value; }
+ }
+
+ private string customButton;
+ /// <summary>
+ /// Gets or sets the text of the custom button that was clicked.
+ /// </summary>
+ public string CustomButton
+ {
+ get { return customButton; }
+ set { customButton = value; }
+ }
+
+
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogCommandLink.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogCommandLink.cs
new file mode 100644
index 0000000000..7e757306e2
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogCommandLink.cs
@@ -0,0 +1,59 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Globalization;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Represents a command-link.
+ /// </summary>
+ public class TaskDialogCommandLink : TaskDialogButton
+ {
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ public TaskDialogCommandLink() { }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified name and label.
+ /// </summary>
+ /// <param name="name">The name for this button.</param>
+ /// <param name="text">The label for this button.</param>
+ public TaskDialogCommandLink(string name, string text) : base(name, text) { }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified name,label, and instruction.
+ /// </summary>
+ /// <param name="name">The name for this button.</param>
+ /// <param name="text">The label for this button.</param>
+ /// <param name="instruction">The instruction for this command link.</param>
+ public TaskDialogCommandLink(string name, string text, string instruction)
+ : base(name, text)
+ {
+ this.instruction = instruction;
+ }
+
+ private string instruction;
+ /// <summary>
+ /// Gets or sets the instruction associated with this command link button.
+ /// </summary>
+ public string Instruction
+ {
+ get { return instruction; }
+ set { instruction = value; }
+ }
+
+ /// <summary>
+ /// Returns a string representation of this object.
+ /// </summary>
+ /// <returns>A <see cref="System.String"/></returns>
+ public override string ToString()
+ {
+ return string.Format(CultureInfo.CurrentCulture, "{0}{1}{2}",
+ Text ?? string.Empty,
+ (!string.IsNullOrEmpty(Text) && !string.IsNullOrEmpty(instruction)) ? Environment.NewLine : string.Empty,
+ instruction ?? string.Empty);
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogControl.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogControl.cs
new file mode 100644
index 0000000000..3f0ed35ed0
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogControl.cs
@@ -0,0 +1,20 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Declares the abstract base class for all custom task dialog controls.
+ /// </summary>
+ public abstract class TaskDialogControl : DialogControl
+ {
+ /// <summary>
+ /// Creates a new instance of a task dialog control.
+ /// </summary>
+ protected TaskDialogControl() { }
+ /// <summary>
+ /// Creates a new instance of a task dialog control with the specified name.
+ /// </summary>
+ /// <param name="name">The name for this control.</param>
+ protected TaskDialogControl(string name) : base(name) { }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogDefaults.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogDefaults.cs
new file mode 100644
index 0000000000..e9018e526b
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogDefaults.cs
@@ -0,0 +1,23 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using Microsoft.WindowsAPICodePack.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ internal static class TaskDialogDefaults
+ {
+ public static string Caption { get { return LocalizedMessages.TaskDialogDefaultCaption; } }
+ public static string MainInstruction { get { return LocalizedMessages.TaskDialogDefaultMainInstruction; } }
+ public static string Content { get { return LocalizedMessages.TaskDialogDefaultContent; } }
+
+ public const int ProgressBarMinimumValue = 0;
+ public const int ProgressBarMaximumValue = 100;
+
+ public const int IdealWidth = 0;
+
+ // For generating control ID numbers that won't
+ // collide with the standard button return IDs.
+ public const int MinimumDialogControlId =
+ (int)TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Close + 1;
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogExpandedInfoMode.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogExpandedInfoMode.cs
new file mode 100644
index 0000000000..d2ac518837
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogExpandedInfoMode.cs
@@ -0,0 +1,25 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Specifies the options for expand/collapse sections in dialogs.
+ /// </summary>
+ public enum TaskDialogExpandedDetailsLocation
+ {
+ /// <summary>
+ /// Do not show the content.
+ /// </summary>
+ Hide,
+
+ /// <summary>
+ /// Show the content.
+ /// </summary>
+ ExpandContent,
+
+ /// <summary>
+ /// Expand the footer content.
+ /// </summary>
+ ExpandFooter
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogHyperlinkClickedEventArgs.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogHyperlinkClickedEventArgs.cs
new file mode 100644
index 0000000000..b1e72af4c2
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogHyperlinkClickedEventArgs.cs
@@ -0,0 +1,26 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Defines event data associated with a HyperlinkClick event.
+ /// </summary>
+ public class TaskDialogHyperlinkClickedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Creates a new instance of this class with the specified link text.
+ /// </summary>
+ /// <param name="linkText">The text of the hyperlink that was clicked.</param>
+ public TaskDialogHyperlinkClickedEventArgs(string linkText)
+ {
+ LinkText = linkText;
+ }
+
+ /// <summary>
+ /// Gets or sets the text of the hyperlink that was clicked.
+ /// </summary>
+ public string LinkText { get; set; }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogProgressBar.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogProgressBar.cs
new file mode 100644
index 0000000000..e63236521d
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogProgressBar.cs
@@ -0,0 +1,123 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using Microsoft.WindowsAPICodePack.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Provides a visual representation of the progress of a long running operation.
+ /// </summary>
+ public class TaskDialogProgressBar : TaskDialogBar
+ {
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ public TaskDialogProgressBar() { }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified name.
+ /// And using the default values: Min = 0, Max = 100, Current = 0
+ /// </summary>
+ /// <param name="name">The name of the control.</param>
+ public TaskDialogProgressBar(string name) : base(name) { }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified
+ /// minimum, maximum and current values.
+ /// </summary>
+ /// <param name="minimum">The minimum value for this control.</param>
+ /// <param name="maximum">The maximum value for this control.</param>
+ /// <param name="value">The current value for this control.</param>
+ public TaskDialogProgressBar(int minimum, int maximum, int value)
+ {
+ Minimum = minimum;
+ Maximum = maximum;
+ Value = value;
+ }
+
+ private int _minimum;
+ private int _value;
+ private int _maximum = TaskDialogDefaults.ProgressBarMaximumValue;
+
+ /// <summary>
+ /// Gets or sets the minimum value for the control.
+ /// </summary>
+ public int Minimum
+ {
+ get { return _minimum; }
+ set
+ {
+ CheckPropertyChangeAllowed("Minimum");
+
+ // Check for positive numbers
+ if (value < 0)
+ {
+ throw new System.ArgumentException(LocalizedMessages.TaskDialogProgressBarMinValueGreaterThanZero, "value");
+ }
+
+ // Check if min / max differ
+ if (value >= Maximum)
+ {
+ throw new System.ArgumentException(LocalizedMessages.TaskDialogProgressBarMinValueLessThanMax, "value");
+ }
+
+ _minimum = value;
+ ApplyPropertyChange("Minimum");
+ }
+ }
+ /// <summary>
+ /// Gets or sets the maximum value for the control.
+ /// </summary>
+ public int Maximum
+ {
+ get { return _maximum; }
+ set
+ {
+ CheckPropertyChangeAllowed("Maximum");
+
+ // Check if min / max differ
+ if (value < Minimum)
+ {
+ throw new System.ArgumentException(LocalizedMessages.TaskDialogProgressBarMaxValueGreaterThanMin, "value");
+ }
+ _maximum = value;
+ ApplyPropertyChange("Maximum");
+ }
+ }
+ /// <summary>
+ /// Gets or sets the current value for the control.
+ /// </summary>
+ public int Value
+ {
+ get { return this._value; }
+ set
+ {
+ CheckPropertyChangeAllowed("Value");
+ // Check for positive numbers
+ if (value < Minimum || value > Maximum)
+ {
+ throw new System.ArgumentException(LocalizedMessages.TaskDialogProgressBarValueInRange, "value");
+ }
+ this._value = value;
+ ApplyPropertyChange("Value");
+ }
+ }
+
+ /// <summary>
+ /// Verifies that the progress bar's value is between its minimum and maximum.
+ /// </summary>
+ internal bool HasValidValues
+ {
+ get { return _minimum <= _value && _value <= _maximum; }
+ }
+
+ /// <summary>
+ /// Resets the control to its minimum value.
+ /// </summary>
+ protected internal override void Reset()
+ {
+ base.Reset();
+ _value = _minimum;
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogProgressBarState.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogProgressBarState.cs
new file mode 100644
index 0000000000..6f86451820
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogProgressBarState.cs
@@ -0,0 +1,35 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Sets the state of a task dialog progress bar.
+ /// </summary>
+ public enum TaskDialogProgressBarState
+ {
+ /// <summary>
+ /// Uninitialized state, this should never occur.
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// Normal state.
+ /// </summary>
+ Normal = TaskDialogNativeMethods.ProgressBarState.Normal,
+
+ /// <summary>
+ /// An error occurred.
+ /// </summary>
+ Error = TaskDialogNativeMethods.ProgressBarState.Error,
+
+ /// <summary>
+ /// The progress is paused.
+ /// </summary>
+ Paused = TaskDialogNativeMethods.ProgressBarState.Paused,
+
+ /// <summary>
+ /// Displays marquee (indeterminate) style progress
+ /// </summary>
+ Marquee
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogRadioButton.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogRadioButton.cs
new file mode 100644
index 0000000000..93333d3077
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogRadioButton.cs
@@ -0,0 +1,25 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Defines a radio button that can be hosted in by a
+ /// <see cref="TaskDialog"/> object.
+ /// </summary>
+ public class TaskDialogRadioButton : TaskDialogButtonBase
+ {
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ public TaskDialogRadioButton() { }
+
+ /// <summary>
+ /// Creates a new instance of this class with
+ /// the specified name and text.
+ /// </summary>
+ /// <param name="name">The name for this control.</param>
+ /// <param name="text">The value for this controls
+ /// <see cref="P:Microsoft.WindowsAPICodePack.Dialogs.TaskDialogButtonBase.Text"/> property.</param>
+ public TaskDialogRadioButton(string name, string text) : base(name, text) { }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogResult.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogResult.cs
new file mode 100644
index 0000000000..fc1a81653d
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogResult.cs
@@ -0,0 +1,50 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Indicates the various buttons and options clicked by the user on the task dialog.
+ /// </summary>
+ public enum TaskDialogResult
+ {
+ /// <summary>
+ /// No button was selected.
+ /// </summary>
+ None = 0x0000,
+
+ /// <summary>
+ /// "OK" button was clicked
+ /// </summary>
+ Ok = 0x0001,
+
+ /// <summary>
+ /// "Yes" button was clicked
+ /// </summary>
+ Yes = 0x0002,
+
+ /// <summary>
+ /// "No" button was clicked
+ /// </summary>
+ No = 0x0004,
+
+ /// <summary>
+ /// "Cancel" button was clicked
+ /// </summary>
+ Cancel = 0x0008,
+
+ /// <summary>
+ /// "Retry" button was clicked
+ /// </summary>
+ Retry = 0x0010,
+
+ /// <summary>
+ /// "Close" button was clicked
+ /// </summary>
+ Close = 0x0020,
+
+ /// <summary>
+ /// A custom button was clicked.
+ /// </summary>
+ CustomButtonClicked = 0x0100,
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogStandardButton.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogStandardButton.cs
new file mode 100644
index 0000000000..f371db8a20
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogStandardButton.cs
@@ -0,0 +1,49 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Identifies one of the standard buttons that
+ /// can be displayed via TaskDialog.
+ /// </summary>
+ [Flags]
+ public enum TaskDialogStandardButtons
+ {
+ /// <summary>
+ /// No buttons on the dialog.
+ /// </summary>
+ None = 0x0000,
+
+ /// <summary>
+ /// An "OK" button.
+ /// </summary>
+ Ok = 0x0001,
+
+ /// <summary>
+ /// A "Yes" button.
+ /// </summary>
+ Yes = 0x0002,
+
+ /// <summary>
+ /// A "No" button.
+ /// </summary>
+ No = 0x0004,
+
+ /// <summary>
+ /// A "Cancel" button.
+ /// </summary>
+ Cancel = 0x0008,
+
+ /// <summary>
+ /// A "Retry" button.
+ /// </summary>
+ Retry = 0x0010,
+
+ /// <summary>
+ /// A "Close" button.
+ /// </summary>
+ Close = 0x0020
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogStandardIcon.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogStandardIcon.cs
new file mode 100644
index 0000000000..bb8b2f3f50
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogStandardIcon.cs
@@ -0,0 +1,35 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Specifies the icon displayed in a task dialog.
+ /// </summary>
+ public enum TaskDialogStandardIcon
+ {
+ /// <summary>
+ /// Displays no icons (default).
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// Displays the warning icon.
+ /// </summary>
+ Warning = 65535,
+
+ /// <summary>
+ /// Displays the error icon.
+ /// </summary>
+ Error = 65534,
+
+ /// <summary>
+ /// Displays the Information icon.
+ /// </summary>
+ Information = 65533,
+
+ /// <summary>
+ /// Displays the User Account Control shield.
+ /// </summary>
+ Shield = 65532
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogStartupLocation.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogStartupLocation.cs
new file mode 100644
index 0000000000..592283a982
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogStartupLocation.cs
@@ -0,0 +1,20 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Specifies the initial display location for a task dialog.
+ /// </summary>
+ public enum TaskDialogStartupLocation
+ {
+ /// <summary>
+ /// The window placed in the center of the screen.
+ /// </summary>
+ CenterScreen,
+
+ /// <summary>
+ /// The window centered relative to the window that launched the dialog.
+ /// </summary>
+ CenterOwner
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogTickEventArgs.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogTickEventArgs.cs
new file mode 100644
index 0000000000..ab0cbbe04f
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Dialogs/TaskDialogs/TaskDialogTickEventArgs.cs
@@ -0,0 +1,26 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// The event data for a TaskDialogTick event.
+ /// </summary>
+ public class TaskDialogTickEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Initializes the data associated with the TaskDialog tick event.
+ /// </summary>
+ /// <param name="ticks">The total number of ticks since the control was activated.</param>
+ public TaskDialogTickEventArgs(int ticks)
+ {
+ Ticks = ticks;
+ }
+
+ /// <summary>
+ /// Gets a value that determines the current number of ticks.
+ /// </summary>
+ public int Ticks { get; private set; }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/GlobalSuppressions.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/GlobalSuppressions.cs
new file mode 100644
index 0000000000..f4e4a58576
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/GlobalSuppressions.cs
@@ -0,0 +1,100 @@
+// This file is used by Code Analysis to maintain SuppressMessage
+// attributes that are applied to this project.
+// Project-level suppressions either have no target or are given
+// a specific target and scoped to a namespace, type, member, etc.
+//
+// To add a suppression to this file, right-click the message in the
+// Error List, point to "Suppress Message(s)", and click
+// "In Project Suppression File".
+// You do not need to add suppressions to this file manually.
+
+
+#region CA1709 Identifers should use proper casing - "API" acronym chosen for clarity
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "API")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.ApplicationServices", MessageId = "API")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Net", MessageId = "API")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem", MessageId = "API")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Dialogs", MessageId = "API")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "MS.WindowsAPICodePack.Internal", MessageId = "API")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem", MessageId = "API")]
+#endregion
+
+
+#region CA1709 - Identifiers should use proper casing - "v" for "Version" chosen for clarity
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Net.ConnectivityStates.#IPv6Internet", MessageId = "Pv")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Net.ConnectivityStates.#IPv6NoTraffic", MessageId = "Pv")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Net.ConnectivityStates.#IPv4Subnet", MessageId = "Pv")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Net.ConnectivityStates.#IPv4NoTraffic", MessageId = "Pv")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Net.ConnectivityStates.#IPv4Internet", MessageId = "Pv")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Net.ConnectivityStates.#IPv4LocalNetwork", MessageId = "Pv")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Net.ConnectivityStates.#IPv6Subnet", MessageId = "Pv")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Net.ConnectivityStates.#IPv6LocalNetwork", MessageId = "Pv")]
+#endregion
+
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Scope = "member", Target = "Microsoft.WindowsAPICodePack.ApplicationServices.PowerPersonalityGuids.#All")]
+
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1805:DoNotInitializeUnnecessarily", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.PropVariant.#.cctor()")]
+
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "Microsoft.WindowsAPICodePack.Resources.LocalizedMessages.resources", MessageId = "comctl")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "Microsoft.WindowsAPICodePack.Resources.LocalizedMessages.resources", MessageId = "Wh")]
+
+#region CA1811 - Potentially uncalled code
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropVariantNativeMethods.#InitPropVariantFromPropVariantVectorElem(MS.WindowsAPICodePack.Internal.PropVariant,System.UInt32,MS.WindowsAPICodePack.Internal.PropVariant)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.DialogsDefaults.#get_Caption()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.DialogsDefaults.#get_Content()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreErrorHelper.#HResultFromWin32(System.Int32)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreErrorHelper.#Failed(System.Int32)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods+Size.#get_Height()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods+Size.#set_Height(System.Int32)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods+Size.#set_Width(System.Int32)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods+Size.#get_Width()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.DialogsDefaults.#get_MainInstruction()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialogSettings.#get_InvokeHelp()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialog.#get_SelectedRadioButtonId()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.TaskDialogNativeMethods+IconUnion.#get_MainIcon()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods.#SendMessage(System.IntPtr,MS.WindowsAPICodePack.Internal.WindowMessage,System.IntPtr,System.IntPtr)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods.#SendMessage(System.IntPtr,System.UInt32,System.IntPtr,System.String)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods.#SendMessage(System.IntPtr,System.UInt32,System.Int32,System.String)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods.#GetLoWord(System.Int64)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods.#GetHiWord(System.Int64,System.Int32)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods.#PostMessage(System.IntPtr,MS.WindowsAPICodePack.Internal.WindowMessage,System.IntPtr,System.IntPtr)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreNativeMethods.#SendMessage(System.IntPtr,System.UInt32,System.Int32&,System.Text.StringBuilder)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.CoreErrorHelper.#Matches(System.Int32,System.Int32)")]
+#endregion
+
+
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1014:MarkAssembliesWithClsCompliant", Justification = "There are places where unsigned values are used, which is considered not Cls compliant.")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames")]
+
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem", Justification = "Uses nested classes to organize the namespce, there is a workitem to resolve this.")]
+
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1027:MarkEnumsWithFlags", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Dialogs.TaskDialogResult", Justification = "Does not represent flags.")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.PropVariant.#Value", Justification = "Uses a switch statement.")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Scope = "member", Justification = "These return snapshots of a state, which are likely to change between calls.", Target = "Microsoft.WindowsAPICodePack.ApplicationServices.PowerManager.#GetCurrentBatteryState()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Scope = "member", Justification = "These return snapshots of a state, which are likely to change between calls.", Target = "Microsoft.WindowsAPICodePack.Net.NetworkListManager.#GetNetworkConnections()")]
+
+#region CA2122, CA2123 - LinkDemand related
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.PropVariant.#.ctor(System.Single[])")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.PropVariant.#.ctor(System.Decimal[])")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.ApplicationServices.ApplicationRestartRecoveryManager.#RegisterForApplicationRecovery(Microsoft.WindowsAPICodePack.ApplicationServices.RecoverySettings)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialog.#AllocateAndMarshalButtons(Microsoft.WindowsAPICodePack.Dialogs.TaskDialogNativeMethods+TaskDialogButton[])")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialog.#Dispose(System.Boolean)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialog.#FreeOldString(Microsoft.WindowsAPICodePack.Dialogs.TaskDialogNativeMethods+TaskDialogElements)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialog.#MakeNewString(System.String,Microsoft.WindowsAPICodePack.Dialogs.TaskDialogNativeMethods+TaskDialogElements)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialog.#NativeShow()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialogSettings.#.ctor()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.PropVariant.#GetBlobData()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.PropVariant.#.ctor(System.String)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.PropVariant.#Value")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.SafeWindowHandle.#ReleaseHandle()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.ApplicationServices.Power.#GetSystemBatteryState()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.ApplicationServices.Power.#GetSystemPowerCapabilities()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.ZeroInvalidHandle.#.ctor()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.SafeIconHandle.#ReleaseHandle()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.SafeRegionHandle.#ReleaseHandle()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.SafeWindowHandle.#ReleaseHandle()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.ZeroInvalidHandle.#IsInvalid")]
+#endregion
+
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.TaskDialogNativeMethods.#TaskDialogIndirect(Microsoft.WindowsAPICodePack.Dialogs.TaskDialogNativeMethods+TaskDialogConfiguration,System.Int32&,System.Int32&,System.Boolean&)", Justification="This does exist, I believe it is caused by FxCop using the wrong version of the DLL.")]
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/AppRestartRecovery/AppRestartRecoveryNativeMethods.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/AppRestartRecovery/AppRestartRecoveryNativeMethods.cs
new file mode 100644
index 0000000000..a86c71224e
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/AppRestartRecovery/AppRestartRecoveryNativeMethods.cs
@@ -0,0 +1,65 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.ApplicationServices
+{
+ internal static class AppRestartRecoveryNativeMethods
+ {
+ #region Application Restart and Recovery Definitions
+
+ internal delegate UInt32 InternalRecoveryCallback(IntPtr state);
+
+ private static InternalRecoveryCallback internalCallback = new InternalRecoveryCallback(InternalRecoveryHandler);
+ internal static InternalRecoveryCallback InternalCallback { get { return internalCallback; } }
+
+ private static UInt32 InternalRecoveryHandler(IntPtr parameter)
+ {
+ bool cancelled = false;
+ ApplicationRecoveryInProgress(out cancelled);
+
+ GCHandle handle = GCHandle.FromIntPtr(parameter);
+ RecoveryData data = handle.Target as RecoveryData;
+ data.Invoke();
+ handle.Free();
+
+ return (0);
+ }
+
+
+
+ [DllImport("kernel32.dll")]
+ internal static extern void ApplicationRecoveryFinished(
+ [MarshalAs(UnmanagedType.Bool)] bool success);
+
+ [DllImport("kernel32.dll")]
+ [PreserveSig]
+ internal static extern HResult ApplicationRecoveryInProgress(
+ [Out, MarshalAs(UnmanagedType.Bool)] out bool canceled);
+
+ [DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
+ [PreserveSig]
+ internal static extern HResult RegisterApplicationRecoveryCallback(
+ InternalRecoveryCallback callback, IntPtr param,
+ uint pingInterval,
+ uint flags); // Unused.
+
+ [DllImport("kernel32.dll")]
+ [PreserveSig]
+ internal static extern HResult RegisterApplicationRestart(
+ [MarshalAs(UnmanagedType.BStr)] string commandLineArgs,
+ RestartRestrictions flags);
+
+ [DllImport("kernel32.dll")]
+ [PreserveSig]
+ internal static extern HResult UnregisterApplicationRecoveryCallback();
+
+ [DllImport("kernel32.dll")]
+ [PreserveSig]
+ internal static extern HResult UnregisterApplicationRestart();
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/CoreErrorHelper.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/CoreErrorHelper.cs
new file mode 100644
index 0000000000..ba51a70465
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/CoreErrorHelper.cs
@@ -0,0 +1,161 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace MS.WindowsAPICodePack.Internal
+{
+ /// <summary>
+ /// HRESULT Wrapper
+ /// </summary>
+ public enum HResult
+ {
+ /// <summary>
+ /// S_OK
+ /// </summary>
+ Ok = 0x0000,
+
+ /// <summary>
+ /// S_FALSE
+ /// </summary>
+ False = 0x0001,
+
+ /// <summary>
+ /// E_INVALIDARG
+ /// </summary>
+ InvalidArguments = unchecked((int)0x80070057),
+
+ /// <summary>
+ /// E_OUTOFMEMORY
+ /// </summary>
+ OutOfMemory = unchecked((int)0x8007000E),
+
+ /// <summary>
+ /// E_NOINTERFACE
+ /// </summary>
+ NoInterface = unchecked((int)0x80004002),
+
+ /// <summary>
+ /// E_FAIL
+ /// </summary>
+ Fail = unchecked((int)0x80004005),
+
+ /// <summary>
+ /// E_ELEMENTNOTFOUND
+ /// </summary>
+ ElementNotFound = unchecked((int)0x80070490),
+
+ /// <summary>
+ /// TYPE_E_ELEMENTNOTFOUND
+ /// </summary>
+ TypeElementNotFound = unchecked((int)0x8002802B),
+
+ /// <summary>
+ /// NO_OBJECT
+ /// </summary>
+ NoObject = unchecked((int)0x800401E5),
+
+ /// <summary>
+ /// Win32 Error code: ERROR_CANCELLED
+ /// </summary>
+ Win32ErrorCanceled = 1223,
+
+ /// <summary>
+ /// ERROR_CANCELLED
+ /// </summary>
+ Canceled = unchecked((int)0x800704C7),
+
+ /// <summary>
+ /// The requested resource is in use
+ /// </summary>
+ ResourceInUse = unchecked((int)0x800700AA),
+
+ /// <summary>
+ /// The requested resources is read-only.
+ /// </summary>
+ AccessDenied = unchecked((int)0x80030005)
+ }
+
+ /// <summary>
+ /// Provide Error Message Helper Methods.
+ /// This is intended for Library Internal use only.
+ /// </summary>
+ internal static class CoreErrorHelper
+ {
+ /// <summary>
+ /// This is intended for Library Internal use only.
+ /// </summary>
+ private const int FacilityWin32 = 7;
+
+ /// <summary>
+ /// This is intended for Library Internal use only.
+ /// </summary>
+ public const int Ignored = (int)HResult.Ok;
+
+ /// <summary>
+ /// This is intended for Library Internal use only.
+ /// </summary>
+ /// <param name="win32ErrorCode">The Windows API error code.</param>
+ /// <returns>The equivalent HRESULT.</returns>
+ public static int HResultFromWin32(int win32ErrorCode)
+ {
+ if (win32ErrorCode > 0)
+ {
+ win32ErrorCode =
+ (int)(((uint)win32ErrorCode & 0x0000FFFF) | (FacilityWin32 << 16) | 0x80000000);
+ }
+ return win32ErrorCode;
+
+ }
+
+ /// <summary>
+ /// This is intended for Library Internal use only.
+ /// </summary>
+ /// <param name="result">The error code.</param>
+ /// <returns>True if the error code indicates success.</returns>
+ public static bool Succeeded(int result)
+ {
+ return result >= 0;
+ }
+
+ /// <summary>
+ /// This is intended for Library Internal use only.
+ /// </summary>
+ /// <param name="result">The error code.</param>
+ /// <returns>True if the error code indicates success.</returns>
+ public static bool Succeeded(HResult result)
+ {
+ return Succeeded((int)result);
+ }
+
+ /// <summary>
+ /// This is intended for Library Internal use only.
+ /// </summary>
+ /// <param name="result">The error code.</param>
+ /// <returns>True if the error code indicates failure.</returns>
+ public static bool Failed(HResult result)
+ {
+ return !Succeeded(result);
+ }
+
+ /// <summary>
+ /// This is intended for Library Internal use only.
+ /// </summary>
+ /// <param name="result">The error code.</param>
+ /// <returns>True if the error code indicates failure.</returns>
+ public static bool Failed(int result)
+ {
+ return !Succeeded(result);
+ }
+
+ /// <summary>
+ /// This is intended for Library Internal use only.
+ /// </summary>
+ /// <param name="result">The COM error code.</param>
+ /// <param name="win32ErrorCode">The Win32 error code.</param>
+ /// <returns>Inticates that the Win32 error code corresponds to the COM error code.</returns>
+ public static bool Matches(int result, int win32ErrorCode)
+ {
+ return (result == HResultFromWin32(win32ErrorCode));
+ }
+
+
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/CoreHelpers.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/CoreHelpers.cs
new file mode 100644
index 0000000000..878803cd64
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/CoreHelpers.cs
@@ -0,0 +1,118 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Globalization;
+using System.Text;
+using Microsoft.WindowsAPICodePack.Resources;
+
+namespace MS.WindowsAPICodePack.Internal
+{
+ /// <summary>
+ /// Common Helper methods
+ /// </summary>
+ public static class CoreHelpers
+ {
+ /// <summary>
+ /// Determines if the application is running on XP
+ /// </summary>
+ public static bool RunningOnXP
+ {
+ get
+ {
+ return Environment.OSVersion.Platform == PlatformID.Win32NT &&
+ Environment.OSVersion.Version.Major >= 5;
+ }
+ }
+
+ /// <summary>
+ /// Throws PlatformNotSupportedException if the application is not running on Windows XP
+ /// </summary>
+ public static void ThrowIfNotXP()
+ {
+ if (!CoreHelpers.RunningOnXP)
+ {
+ throw new PlatformNotSupportedException(LocalizedMessages.CoreHelpersRunningOnXp);
+ }
+ }
+
+ /// <summary>
+ /// Determines if the application is running on Vista
+ /// </summary>
+ public static bool RunningOnVista
+ {
+ get
+ {
+ return Environment.OSVersion.Version.Major >= 6;
+ }
+ }
+
+ /// <summary>
+ /// Throws PlatformNotSupportedException if the application is not running on Windows Vista
+ /// </summary>
+ public static void ThrowIfNotVista()
+ {
+ if (!CoreHelpers.RunningOnVista)
+ {
+ throw new PlatformNotSupportedException(LocalizedMessages.CoreHelpersRunningOnVista);
+ }
+ }
+
+ /// <summary>
+ /// Determines if the application is running on Windows 7
+ /// </summary>
+ public static bool RunningOnWin7
+ {
+ get
+ {
+ // Verifies that OS version is 6.1 or greater, and the Platform is WinNT.
+ return Environment.OSVersion.Platform == PlatformID.Win32NT &&
+ Environment.OSVersion.Version.CompareTo(new Version(6, 1)) >= 0;
+ }
+ }
+
+ /// <summary>
+ /// Throws PlatformNotSupportedException if the application is not running on Windows 7
+ /// </summary>
+ public static void ThrowIfNotWin7()
+ {
+ if (!CoreHelpers.RunningOnWin7)
+ {
+ throw new PlatformNotSupportedException(LocalizedMessages.CoreHelpersRunningOn7);
+ }
+ }
+
+ /// <summary>
+ /// Get a string resource given a resource Id
+ /// </summary>
+ /// <param name="resourceId">The resource Id</param>
+ /// <returns>The string resource corresponding to the given resource Id. Returns null if the resource id
+ /// is invalid or the string cannot be retrieved for any other reason.</returns>
+ public static string GetStringResource(string resourceId)
+ {
+ string[] parts;
+ string library;
+ int index;
+
+ if (string.IsNullOrEmpty(resourceId)) { return string.Empty; }
+
+ // Known folder "Recent" has a malformed resource id
+ // for its tooltip. This causes the resource id to
+ // parse into 3 parts instead of 2 parts if we don't fix.
+ resourceId = resourceId.Replace("shell32,dll", "shell32.dll");
+ parts = resourceId.Split(new char[] { ',' });
+
+ library = parts[0];
+ library = library.Replace(@"@", string.Empty);
+ library = Environment.ExpandEnvironmentVariables(library);
+ IntPtr handle = CoreNativeMethods.LoadLibrary(library);
+
+ parts[1] = parts[1].Replace("-", string.Empty);
+ index = int.Parse(parts[1], CultureInfo.InvariantCulture);
+
+ StringBuilder stringValue = new StringBuilder(255);
+ int retval = CoreNativeMethods.LoadString(handle, index, stringValue, 255);
+
+ return retval != 0 ? stringValue.ToString() : null;
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/CoreNativeMethods.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/CoreNativeMethods.cs
new file mode 100644
index 0000000000..4a645fb75f
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/CoreNativeMethods.cs
@@ -0,0 +1,280 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace MS.WindowsAPICodePack.Internal
+{
+ /// <summary>
+ /// Wrappers for Native Methods and Structs.
+ /// This type is intended for internal use only
+ /// </summary>
+ internal static class CoreNativeMethods
+ {
+ #region General Definitions
+
+ /// <summary>
+ /// Places (posts) a message in the message queue associated with the thread that created
+ /// the specified window and returns without waiting for the thread to process the message.
+ /// </summary>
+ /// <param name="windowHandle">Handle to the window whose window procedure will receive the message.
+ /// If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system,
+ /// including disabled or invisible unowned windows, overlapped windows, and pop-up windows;
+ /// but the message is not sent to child windows.
+ /// </param>
+ /// <param name="message">Specifies the message to be sent.</param>
+ /// <param name="wparam">Specifies additional message-specific information.</param>
+ /// <param name="lparam">Specifies additional message-specific information.</param>
+ /// <returns>A return code specific to the message being sent.</returns>
+ [DllImport("user32.dll", CharSet = CharSet.Auto, PreserveSig=false, SetLastError = true)]
+ public static extern void PostMessage(
+ IntPtr windowHandle,
+ WindowMessage message,
+ IntPtr wparam,
+ IntPtr lparam
+ );
+
+ /// <summary>
+ /// Sends the specified message to a window or windows. The SendMessage function calls
+ /// the window procedure for the specified window and does not return until the window
+ /// procedure has processed the message.
+ /// </summary>
+ /// <param name="windowHandle">Handle to the window whose window procedure will receive the message.
+ /// If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system,
+ /// including disabled or invisible unowned windows, overlapped windows, and pop-up windows;
+ /// but the message is not sent to child windows.
+ /// </param>
+ /// <param name="message">Specifies the message to be sent.</param>
+ /// <param name="wparam">Specifies additional message-specific information.</param>
+ /// <param name="lparam">Specifies additional message-specific information.</param>
+ /// <returns>A return code specific to the message being sent.</returns>
+ [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
+ public static extern IntPtr SendMessage(
+ IntPtr windowHandle,
+ WindowMessage message,
+ IntPtr wparam,
+ IntPtr lparam
+ );
+
+ /// <summary>
+ /// Sends the specified message to a window or windows. The SendMessage function calls
+ /// the window procedure for the specified window and does not return until the window
+ /// procedure has processed the message.
+ /// </summary>
+ /// <param name="windowHandle">Handle to the window whose window procedure will receive the message.
+ /// If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system,
+ /// including disabled or invisible unowned windows, overlapped windows, and pop-up windows;
+ /// but the message is not sent to child windows.
+ /// </param>
+ /// <param name="message">Specifies the message to be sent.</param>
+ /// <param name="wparam">Specifies additional message-specific information.</param>
+ /// <param name="lparam">Specifies additional message-specific information.</param>
+ /// <returns>A return code specific to the message being sent.</returns>
+ [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
+ public static extern IntPtr SendMessage(
+ IntPtr windowHandle,
+ uint message,
+ IntPtr wparam,
+ IntPtr lparam
+ );
+
+ /// <summary>
+ /// Sends the specified message to a window or windows. The SendMessage function calls
+ /// the window procedure for the specified window and does not return until the window
+ /// procedure has processed the message.
+ /// </summary>
+ /// <param name="windowHandle">Handle to the window whose window procedure will receive the message.
+ /// If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system,
+ /// including disabled or invisible unowned windows, overlapped windows, and pop-up windows;
+ /// but the message is not sent to child windows.
+ /// </param>
+ /// <param name="message">Specifies the message to be sent.</param>
+ /// <param name="wparam">Specifies additional message-specific information.</param>
+ /// <param name="lparam">Specifies additional message-specific information.</param>
+ /// <returns>A return code specific to the message being sent.</returns>
+ [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
+ public static extern IntPtr SendMessage(
+ IntPtr windowHandle,
+ uint message,
+ IntPtr wparam,
+ [MarshalAs(UnmanagedType.LPWStr)] string lparam);
+
+ /// <summary>
+ /// Sends the specified message to a window or windows. The SendMessage function calls
+ /// the window procedure for the specified window and does not return until the window
+ /// procedure has processed the message.
+ /// </summary>
+ /// <param name="windowHandle">Handle to the window whose window procedure will receive the message.
+ /// If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system,
+ /// including disabled or invisible unowned windows, overlapped windows, and pop-up windows;
+ /// but the message is not sent to child windows.
+ /// </param>
+ /// <param name="message">Specifies the message to be sent.</param>
+ /// <param name="wparam">Specifies additional message-specific information.</param>
+ /// <param name="lparam">Specifies additional message-specific information.</param>
+ /// <returns>A return code specific to the message being sent.</returns>
+ public static IntPtr SendMessage(
+ IntPtr windowHandle,
+ uint message,
+ int wparam,
+ string lparam)
+ {
+ return SendMessage(windowHandle, message, (IntPtr)wparam, lparam);
+ }
+
+ /// <summary>
+ /// Sends the specified message to a window or windows. The SendMessage function calls
+ /// the window procedure for the specified window and does not return until the window
+ /// procedure has processed the message.
+ /// </summary>
+ /// <param name="windowHandle">Handle to the window whose window procedure will receive the message.
+ /// If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system,
+ /// including disabled or invisible unowned windows, overlapped windows, and pop-up windows;
+ /// but the message is not sent to child windows.
+ /// </param>
+ /// <param name="message">Specifies the message to be sent.</param>
+ /// <param name="wparam">Specifies additional message-specific information.</param>
+ /// <param name="lparam">Specifies additional message-specific information.</param>
+ /// <returns>A return code specific to the message being sent.</returns>
+
+ [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
+ public static extern IntPtr SendMessage(
+ IntPtr windowHandle,
+ uint message,
+ ref int wparam,
+ [MarshalAs(UnmanagedType.LPWStr)] StringBuilder lparam);
+
+ // Various helpers for forcing binding to proper
+ // version of Comctl32 (v6).
+ [DllImport("kernel32.dll", SetLastError = true, ThrowOnUnmappableChar = true, BestFitMapping = false)]
+ internal static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)] string fileName);
+
+ [DllImport("gdi32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool DeleteObject(IntPtr graphicsObjectHandle);
+
+ [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
+ internal static extern int LoadString(
+ IntPtr instanceHandle,
+ int id,
+ StringBuilder buffer,
+ int bufferSize);
+
+ [DllImport("Kernel32.dll", EntryPoint = "LocalFree")]
+ internal static extern IntPtr LocalFree(ref Guid guid);
+
+ /// <summary>
+ /// Destroys an icon and frees any memory the icon occupied.
+ /// </summary>
+ /// <param name="hIcon">Handle to the icon to be destroyed. The icon must not be in use. </param>
+ /// <returns>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError. </returns>
+ [DllImport("user32.dll", SetLastError = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool DestroyIcon(IntPtr hIcon);
+
+ #endregion
+
+ #region Window Handling
+
+ [DllImport("user32.dll", SetLastError = true, EntryPoint = "DestroyWindow", CallingConvention = CallingConvention.StdCall)]
+ internal static extern int DestroyWindow(IntPtr handle);
+
+ #endregion
+
+ #region General Declarations
+
+ // Various important window messages
+ internal const int UserMessage = 0x0400;
+ internal const int EnterIdleMessage = 0x0121;
+
+ // FormatMessage constants and structs.
+ internal const int FormatMessageFromSystem = 0x00001000;
+
+ // App recovery and restart return codes
+ internal const uint ResultFailed = 0x80004005;
+ internal const uint ResultInvalidArgument = 0x80070057;
+ internal const uint ResultFalse = 1;
+ internal const uint ResultNotFound = 0x80070490;
+
+ /// <summary>
+ /// Gets the HiWord
+ /// </summary>
+ /// <param name="value">The value to get the hi word from.</param>
+ /// <param name="size">Size</param>
+ /// <returns>The upper half of the dword.</returns>
+ public static int GetHiWord(long value, int size)
+ {
+ return (short)(value >> size);
+ }
+
+ /// <summary>
+ /// Gets the LoWord
+ /// </summary>
+ /// <param name="value">The value to get the low word from.</param>
+ /// <returns>The lower half of the dword.</returns>
+ public static int GetLoWord(long value)
+ {
+ return (short)(value & 0xFFFF);
+ }
+
+ #endregion
+
+ #region GDI and DWM Declarations
+
+ /// <summary>
+ /// A Wrapper for a SIZE struct
+ /// </summary>
+ [StructLayout(LayoutKind.Sequential)]
+ public struct Size
+ {
+ private int width;
+ private int height;
+
+ /// <summary>
+ /// Width
+ /// </summary>
+ public int Width { get { return width; } set { width = value; } }
+
+ /// <summary>
+ /// Height
+ /// </summary>
+ public int Height { get { return height; } set { height = value; } }
+ };
+
+ // Enable/disable non-client rendering based on window style.
+ internal const int DWMNCRP_USEWINDOWSTYLE = 0;
+
+ // Disabled non-client rendering; window style is ignored.
+ internal const int DWMNCRP_DISABLED = 1;
+
+ // Enabled non-client rendering; window style is ignored.
+ internal const int DWMNCRP_ENABLED = 2;
+
+ // Enable/disable non-client rendering Use DWMNCRP_* values.
+ internal const int DWMWA_NCRENDERING_ENABLED = 1;
+
+ // Non-client rendering policy.
+ internal const int DWMWA_NCRENDERING_POLICY = 2;
+
+ // Potentially enable/forcibly disable transitions 0 or 1.
+ internal const int DWMWA_TRANSITIONS_FORCEDISABLED = 3;
+
+ #endregion
+
+ #region Windows OS structs and consts
+
+ internal const uint StatusAccessDenied = 0xC0000022;
+
+
+
+ public delegate int WNDPROC(IntPtr hWnd,
+ uint uMessage,
+ IntPtr wParam,
+ IntPtr lParam);
+
+ #endregion
+ }
+
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/Dialogs/DialogShowState.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/Dialogs/DialogShowState.cs
new file mode 100644
index 0000000000..a285747f8c
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/Dialogs/DialogShowState.cs
@@ -0,0 +1,30 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Dialog Show State
+ /// </summary>
+ public enum DialogShowState
+ {
+ /// <summary>
+ /// Pre Show
+ /// </summary>
+ PreShow,
+
+ /// <summary>
+ /// Currently Showing
+ /// </summary>
+ Showing,
+
+ /// <summary>
+ /// Currently Closing
+ /// </summary>
+ Closing,
+
+ /// <summary>
+ /// Closed
+ /// </summary>
+ Closed
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/NetworkList/INetwork.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/NetworkList/INetwork.cs
new file mode 100644
index 0000000000..de81e31299
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/NetworkList/INetwork.cs
@@ -0,0 +1,67 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.WindowsAPICodePack.Net
+{
+ [ComImport]
+ [TypeLibType((short)0x1040)]
+ [Guid("DCB00002-570F-4A9B-8D69-199FDBA5723B")]
+ internal interface INetwork
+ {
+ [return: MarshalAs(UnmanagedType.BStr)]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ string GetName();
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetName([In, MarshalAs(UnmanagedType.BStr)] string szNetworkNewName);
+
+ [return: MarshalAs(UnmanagedType.BStr)]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ string GetDescription();
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetDescription([In, MarshalAs(UnmanagedType.BStr)] string szDescription);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ Guid GetNetworkId();
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ DomainType GetDomainType();
+
+ [return: MarshalAs(UnmanagedType.Interface)]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ IEnumerable GetNetworkConnections();
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetTimeCreatedAndConnected(
+ out uint pdwLowDateTimeCreated,
+ out uint pdwHighDateTimeCreated,
+ out uint pdwLowDateTimeConnected,
+ out uint pdwHighDateTimeConnected);
+
+ bool IsConnectedToInternet
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ get;
+ }
+
+ bool IsConnected
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ get;
+ }
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ ConnectivityStates GetConnectivity();
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ NetworkCategory GetCategory();
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetCategory([In] NetworkCategory NewCategory);
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/NetworkList/INetworkConnection.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/NetworkList/INetworkConnection.cs
new file mode 100644
index 0000000000..05cab734f4
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/NetworkList/INetworkConnection.cs
@@ -0,0 +1,43 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.WindowsAPICodePack.Net
+{
+ [ComImport]
+ [TypeLibType((short)0x1040)]
+ [Guid("DCB00005-570F-4A9B-8D69-199FDBA5723B")]
+ internal interface INetworkConnection
+ {
+ [return: MarshalAs(UnmanagedType.Interface)]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ INetwork GetNetwork();
+
+ bool IsConnectedToInternet
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ get;
+ }
+
+ bool IsConnected
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ get;
+ }
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ ConnectivityStates GetConnectivity();
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ Guid GetConnectionId();
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ Guid GetAdapterId();
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ DomainType GetDomainType();
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/NetworkList/INetworkListManager.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/NetworkList/INetworkListManager.cs
new file mode 100644
index 0000000000..5a7bb476bd
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/NetworkList/INetworkListManager.cs
@@ -0,0 +1,46 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.WindowsAPICodePack.Net
+{
+ [ComImport]
+ [Guid("DCB00000-570F-4A9B-8D69-199FDBA5723B")]
+ [TypeLibType((short)0x1040)]
+ internal interface INetworkListManager
+ {
+ [return: MarshalAs(UnmanagedType.Interface)]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ IEnumerable GetNetworks([In] NetworkConnectivityLevels Flags);
+
+ [return: MarshalAs(UnmanagedType.Interface)]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ INetwork GetNetwork([In] Guid gdNetworkId);
+
+ [return: MarshalAs(UnmanagedType.Interface)]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ IEnumerable GetNetworkConnections();
+
+ [return: MarshalAs(UnmanagedType.Interface)]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ INetworkConnection GetNetworkConnection([In] Guid gdNetworkConnectionId);
+
+ bool IsConnectedToInternet
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ get;
+ }
+
+ bool IsConnected
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ get;
+ }
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ ConnectivityStates GetConnectivity();
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/NetworkList/NetworkListManagerClass.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/NetworkList/NetworkListManagerClass.cs
new file mode 100644
index 0000000000..d5b808c566
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/NetworkList/NetworkListManagerClass.cs
@@ -0,0 +1,47 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.WindowsAPICodePack.Net
+{
+ [ComImport, ClassInterface((short)0), Guid("DCB00C01-570F-4A9B-8D69-199FDBA5723B")]
+ [ComSourceInterfaces("Microsoft.Windows.NetworkList.Internal.INetworkEvents\0Microsoft.Windows.NetworkList.Internal.INetworkConnectionEvents\0Microsoft.Windows.NetworkList.Internal.INetworkListManagerEvents\0"), TypeLibType((short)2)]
+ internal class NetworkListManagerClass : INetworkListManager
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(7)]
+ public virtual extern ConnectivityStates GetConnectivity();
+
+ [return: MarshalAs(UnmanagedType.Interface)]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(2)]
+ public virtual extern INetwork GetNetwork([In] Guid gdNetworkId);
+
+ [return: MarshalAs(UnmanagedType.Interface)]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)]
+ public virtual extern INetworkConnection GetNetworkConnection([In] Guid gdNetworkConnectionId);
+
+ [return: MarshalAs(UnmanagedType.Interface)]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(3)]
+ public virtual extern IEnumerable GetNetworkConnections();
+
+ [return: MarshalAs(UnmanagedType.Interface)]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)]
+ public virtual extern IEnumerable GetNetworks([In] NetworkConnectivityLevels Flags);
+
+ [DispId(6)]
+ public virtual extern bool IsConnected
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)]
+ get;
+ }
+
+ [DispId(5)]
+ public virtual extern bool IsConnectedToInternet
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)]
+ get;
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/PowerManagement/PowerManagementNativeMethods.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/PowerManagement/PowerManagementNativeMethods.cs
new file mode 100644
index 0000000000..98fff9f33e
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/PowerManagement/PowerManagementNativeMethods.cs
@@ -0,0 +1,227 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.WindowsAPICodePack.ApplicationServices
+{
+ internal static class PowerManagementNativeMethods
+ {
+ #region Power Management
+
+ internal const uint PowerBroadcastMessage = 536;
+ internal const uint PowerSettingChangeMessage = 32787;
+ internal const uint ScreenSaverSetActive = 0x0011;
+ internal const uint UpdateInFile = 0x0001;
+ internal const uint SendChange = 0x0002;
+
+ // This structure is sent when the PBT_POWERSETTINGSCHANGE message is sent.
+ // It describes the power setting that has changed and
+ // contains data about the change.
+ [StructLayout(LayoutKind.Sequential, Pack = 4)]
+ public struct PowerBroadcastSetting
+ {
+ public Guid PowerSetting;
+ public Int32 DataLength;
+ }
+
+ // This structure is used when calling CallNtPowerInformation
+ // to retrieve SystemPowerCapabilities
+ [StructLayout(LayoutKind.Sequential)]
+ public struct SystemPowerCapabilities
+ {
+ [MarshalAs(UnmanagedType.I1)]
+ public bool PowerButtonPresent;
+ [MarshalAs(UnmanagedType.I1)]
+ public bool SleepButtonPresent;
+ [MarshalAs(UnmanagedType.I1)]
+ public bool LidPresent;
+ [MarshalAs(UnmanagedType.I1)]
+ public bool SystemS1;
+ [MarshalAs(UnmanagedType.I1)]
+ public bool SystemS2;
+ [MarshalAs(UnmanagedType.I1)]
+ public bool SystemS3;
+ [MarshalAs(UnmanagedType.I1)]
+ public bool SystemS4;
+ [MarshalAs(UnmanagedType.I1)]
+ public bool SystemS5;
+ [MarshalAs(UnmanagedType.I1)]
+ public bool HiberFilePresent;
+ [MarshalAs(UnmanagedType.I1)]
+ public bool FullWake;
+ [MarshalAs(UnmanagedType.I1)]
+ public bool VideoDimPresent;
+ [MarshalAs(UnmanagedType.I1)]
+ public bool ApmPresent;
+ [MarshalAs(UnmanagedType.I1)]
+ public bool UpsPresent;
+ [MarshalAs(UnmanagedType.I1)]
+ public bool ThermalControl;
+ [MarshalAs(UnmanagedType.I1)]
+ public bool ProcessorThrottle;
+ public byte ProcessorMinimumThrottle;
+ public byte ProcessorMaximumThrottle;
+ [MarshalAs(UnmanagedType.I1)]
+ public bool FastSystemS4;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
+ public byte[] spare2;
+ [MarshalAs(UnmanagedType.I1)]
+ public bool DiskSpinDown;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
+ public byte[] spare3;
+ [MarshalAs(UnmanagedType.I1)]
+ public bool SystemBatteriesPresent;
+ [MarshalAs(UnmanagedType.I1)]
+ public bool BatteriesAreShortTerm;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
+ public BatteryReportingScale[] BatteryScale;
+ public SystemPowerState AcOnlineWake;
+ public SystemPowerState SoftLidWake;
+ public SystemPowerState RtcWake;
+ public SystemPowerState MinimumDeviceWakeState;
+ public SystemPowerState DefaultLowLatencyWake;
+ }
+
+ public enum PowerInformationLevel
+ {
+ SystemPowerPolicyAc,
+ SystemPowerPolicyDc,
+ VerifySystemPolicyAc,
+ VerifySystemPolicyDc,
+ SystemPowerCapabilities,
+ SystemBatteryState,
+ SystemPowerStateHandler,
+ ProcessorStateHandler,
+ SystemPowerPolicyCurrent,
+ AdministratorPowerPolicy,
+ SystemReserveHiberFile,
+ ProcessorInformation,
+ SystemPowerInformation,
+ ProcessorStateHandler2,
+ LastWakeTime,
+ LastSleepTime,
+ SystemExecutionState,
+ SystemPowerStateNotifyHandler,
+ ProcessorPowerPolicyAc,
+ ProcessorPowerPolicyDc,
+ VerifyProcessorPowerPolicyAc,
+ VerifyProcessorPowerPolicyDc,
+ ProcessorPowerPolicyCurrent,
+ SystemPowerStateLogging,
+ SystemPowerLoggingEntry,
+ SetPowerSettingValue,
+ NotifyUserPowerSetting,
+ PowerInformationLevelUnused0,
+ PowerInformationLevelUnused1,
+ SystemVideoState,
+ TraceApplicationPowerMessage,
+ TraceApplicationPowerMessageEnd,
+ ProcessorPerfStates,
+ ProcessorIdleStates,
+ ProcessorCap,
+ SystemWakeSource,
+ SystemHiberFileInformation,
+ TraceServicePowerMessage,
+ ProcessorLoad,
+ PowerShutdownNotification,
+ MonitorCapabilities,
+ SessionPowerInit,
+ SessionDisplayState,
+ PowerRequestCreate,
+ PowerRequestAction,
+ GetPowerRequestList,
+ ProcessorInformationEx,
+ NotifyUserModeLegacyPowerEvent,
+ GroupPark,
+ ProcessorIdleDomains,
+ WakeTimerList,
+ SystemHiberFileSize,
+ PowerInformationLevelMaximum
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct BatteryReportingScale
+ {
+ public UInt32 Granularity;
+ public UInt32 Capacity;
+ }
+
+ public enum SystemPowerState
+ {
+ Unspecified = 0,
+ Working = 1,
+ Sleeping1 = 2,
+ Sleeping2 = 3,
+ Sleeping3 = 4,
+ Hibernate = 5,
+ Shutdown = 6,
+ Maximum = 7
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct SystemBatteryState
+ {
+ [MarshalAs(UnmanagedType.I1)]
+ public bool AcOnLine;
+ [MarshalAs(UnmanagedType.I1)]
+ public bool BatteryPresent;
+ [MarshalAs(UnmanagedType.I1)]
+ public bool Charging;
+ [MarshalAs(UnmanagedType.I1)]
+ public bool Discharging;
+ public byte Spare1;
+ public byte Spare2;
+ public byte Spare3;
+ public byte Spare4;
+ public uint MaxCapacity;
+ public uint RemainingCapacity;
+ public uint Rate;
+ public uint EstimatedTime;
+ public uint DefaultAlert1;
+ public uint DefaultAlert2;
+ }
+
+ [DllImport("powrprof.dll")]
+ internal static extern UInt32 CallNtPowerInformation(
+ PowerInformationLevel informationLevel,
+ IntPtr inputBuffer,
+ UInt32 inputBufferSize,
+ out SystemPowerCapabilities outputBuffer,
+ UInt32 outputBufferSize
+ );
+
+ [DllImport("powrprof.dll")]
+ internal static extern UInt32 CallNtPowerInformation(
+ PowerInformationLevel informationLevel,
+ IntPtr inputBuffer,
+ UInt32 inputBufferSize,
+ out SystemBatteryState outputBuffer,
+ UInt32 outputBufferSize
+ );
+
+ /// <summary>
+ /// Gets the Guid relating to the currently active power scheme.
+ /// </summary>
+ /// <param name="rootPowerKey">Reserved for future use, this must be set to IntPtr.Zero</param>
+ /// <param name="activePolicy">Returns a Guid referring to the currently active power scheme.</param>
+ [DllImport("powrprof.dll")]
+ internal static extern void PowerGetActiveScheme(
+ IntPtr rootPowerKey,
+ [MarshalAs(UnmanagedType.LPStruct)]
+ out Guid activePolicy);
+
+ [DllImport("User32", SetLastError = true,
+ EntryPoint = "RegisterPowerSettingNotification",
+ CallingConvention = CallingConvention.StdCall)]
+ internal static extern int RegisterPowerSettingNotification(
+ IntPtr hRecipient,
+ ref Guid PowerSettingGuid,
+ Int32 Flags);
+
+ [DllImport("kernel32.dll", SetLastError = true)]
+ internal static extern ExecutionStates SetThreadExecutionState(ExecutionStates esFlags);
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/TaskDialogs/NativeTaskDialog.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/TaskDialogs/NativeTaskDialog.cs
new file mode 100644
index 0000000000..5a685ede5a
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/TaskDialogs/NativeTaskDialog.cs
@@ -0,0 +1,612 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Resources;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Encapsulates the native logic required to create,
+ /// configure, and show a TaskDialog,
+ /// via the TaskDialogIndirect() Win32 function.
+ /// </summary>
+ /// <remarks>A new instance of this class should
+ /// be created for each messagebox show, as
+ /// the HWNDs for TaskDialogs do not remain constant
+ /// across calls to TaskDialogIndirect.
+ /// </remarks>
+ internal class NativeTaskDialog : IDisposable
+ {
+ private TaskDialogNativeMethods.TaskDialogConfiguration nativeDialogConfig;
+ private NativeTaskDialogSettings settings;
+ private IntPtr hWndDialog;
+ private TaskDialog outerDialog;
+
+ private IntPtr[] updatedStrings = new IntPtr[Enum.GetNames(typeof(TaskDialogNativeMethods.TaskDialogElements)).Length];
+ private IntPtr buttonArray, radioButtonArray;
+
+ // Flag tracks whether our first radio
+ // button click event has come through.
+ private bool firstRadioButtonClicked = true;
+
+ #region Constructors
+
+ // Configuration is applied at dialog creation time.
+ internal NativeTaskDialog(NativeTaskDialogSettings settings, TaskDialog outerDialog)
+ {
+ nativeDialogConfig = settings.NativeConfiguration;
+ this.settings = settings;
+
+ // Wireup dialog proc message loop for this instance.
+ nativeDialogConfig.callback = new TaskDialogNativeMethods.TaskDialogCallback(DialogProc);
+
+ ShowState = DialogShowState.PreShow;
+
+ // Keep a reference to the outer shell, so we can notify.
+ this.outerDialog = outerDialog;
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ public DialogShowState ShowState { get; private set; }
+
+ public int SelectedButtonId { get; private set; }
+
+ public int SelectedRadioButtonId { get; private set; }
+
+ public bool CheckBoxChecked { get; private set; }
+
+ #endregion
+
+ internal void NativeShow()
+ {
+ // Applies config struct and other settings, then
+ // calls main Win32 function.
+ if (settings == null)
+ {
+ throw new InvalidOperationException(LocalizedMessages.NativeTaskDialogConfigurationError);
+ }
+
+ // Do a last-minute parse of the various dialog control lists,
+ // and only allocate the memory at the last minute.
+
+ MarshalDialogControlStructs();
+
+ // Make the call and show the dialog.
+ // NOTE: this call is BLOCKING, though the thread
+ // WILL re-enter via the DialogProc.
+ try
+ {
+ ShowState = DialogShowState.Showing;
+
+ int selectedButtonId;
+ int selectedRadioButtonId;
+ bool checkBoxChecked;
+
+ // Here is the way we use "vanilla" P/Invoke to call TaskDialogIndirect().
+ HResult hresult = TaskDialogNativeMethods.TaskDialogIndirect(
+ nativeDialogConfig,
+ out selectedButtonId,
+ out selectedRadioButtonId,
+ out checkBoxChecked);
+
+ if (CoreErrorHelper.Failed(hresult))
+ {
+ string msg;
+ switch (hresult)
+ {
+ case HResult.InvalidArguments:
+ msg = LocalizedMessages.NativeTaskDialogInternalErrorArgs;
+ break;
+ case HResult.OutOfMemory:
+ msg = LocalizedMessages.NativeTaskDialogInternalErrorComplex;
+ break;
+ default:
+ msg = string.Format(System.Globalization.CultureInfo.InvariantCulture,
+ LocalizedMessages.NativeTaskDialogInternalErrorUnexpected,
+ hresult);
+ break;
+ }
+ Exception e = Marshal.GetExceptionForHR((int)hresult);
+ throw new Win32Exception(msg, e);
+ }
+
+ SelectedButtonId = selectedButtonId;
+ SelectedRadioButtonId = selectedRadioButtonId;
+ CheckBoxChecked = checkBoxChecked;
+ }
+ catch (EntryPointNotFoundException exc)
+ {
+ throw new NotSupportedException(LocalizedMessages.NativeTaskDialogVersionError, exc);
+ }
+ finally
+ {
+ ShowState = DialogShowState.Closed;
+ }
+ }
+
+ // The new task dialog does not support the existing
+ // Win32 functions for closing (e.g. EndDialog()); instead,
+ // a "click button" message is sent. In this case, we're
+ // abstracting out to say that the TaskDialog consumer can
+ // simply call "Close" and we'll "click" the cancel button.
+ // Note that the cancel button doesn't actually
+ // have to exist for this to work.
+ internal void NativeClose(TaskDialogResult result)
+ {
+ ShowState = DialogShowState.Closing;
+
+ int id;
+ switch (result)
+ {
+ case TaskDialogResult.Close:
+ id = (int)TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Close;
+ break;
+ case TaskDialogResult.CustomButtonClicked:
+ id = DialogsDefaults.MinimumDialogControlId; // custom buttons
+ break;
+ case TaskDialogResult.No:
+ id = (int)TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.No;
+ break;
+ case TaskDialogResult.Ok:
+ id = (int)TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Ok;
+ break;
+ case TaskDialogResult.Retry:
+ id = (int)TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Retry;
+ break;
+ case TaskDialogResult.Yes:
+ id = (int)TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Yes;
+ break;
+ default:
+ id = (int)TaskDialogNativeMethods.TaskDialogCommonButtonReturnIds.Cancel;
+ break;
+ }
+
+ SendMessageHelper(TaskDialogNativeMethods.TaskDialogMessages.ClickButton, id, 0);
+ }
+
+ #region Main Dialog Proc
+
+ private int DialogProc(
+ IntPtr windowHandle,
+ uint message,
+ IntPtr wparam,
+ IntPtr lparam,
+ IntPtr referenceData)
+ {
+ // Fetch the HWND - it may be the first time we're getting it.
+ hWndDialog = windowHandle;
+
+ // Big switch on the various notifications the
+ // dialog proc can get.
+ switch ((TaskDialogNativeMethods.TaskDialogNotifications)message)
+ {
+ case TaskDialogNativeMethods.TaskDialogNotifications.Created:
+ int result = PerformDialogInitialization();
+ outerDialog.RaiseOpenedEvent();
+ return result;
+ case TaskDialogNativeMethods.TaskDialogNotifications.ButtonClicked:
+ return HandleButtonClick((int)wparam);
+ case TaskDialogNativeMethods.TaskDialogNotifications.RadioButtonClicked:
+ return HandleRadioButtonClick((int)wparam);
+ case TaskDialogNativeMethods.TaskDialogNotifications.HyperlinkClicked:
+ return HandleHyperlinkClick(lparam);
+ case TaskDialogNativeMethods.TaskDialogNotifications.Help:
+ return HandleHelpInvocation();
+ case TaskDialogNativeMethods.TaskDialogNotifications.Timer:
+ return HandleTick((int)wparam);
+ case TaskDialogNativeMethods.TaskDialogNotifications.Destroyed:
+ return PerformDialogCleanup();
+ default:
+ break;
+ }
+ return (int)HResult.Ok;
+ }
+
+ // Once the task dialog HWND is open, we need to send
+ // additional messages to configure it.
+ private int PerformDialogInitialization()
+ {
+ // Initialize Progress or Marquee Bar.
+ if (IsOptionSet(TaskDialogNativeMethods.TaskDialogOptions.ShowProgressBar))
+ {
+ UpdateProgressBarRange();
+
+ // The order of the following is important -
+ // state is more important than value,
+ // and non-normal states turn off the bar value change
+ // animation, which is likely the intended
+ // and preferable behavior.
+ UpdateProgressBarState(settings.ProgressBarState);
+ UpdateProgressBarValue(settings.ProgressBarValue);
+
+ // Due to a bug that wasn't fixed in time for RTM of Vista,
+ // second SendMessage is required if the state is non-Normal.
+ UpdateProgressBarValue(settings.ProgressBarValue);
+ }
+ else if (IsOptionSet(TaskDialogNativeMethods.TaskDialogOptions.ShowMarqueeProgressBar))
+ {
+ // TDM_SET_PROGRESS_BAR_MARQUEE is necessary
+ // to cause the marquee to start animating.
+ // Note that this internal task dialog setting is
+ // round-tripped when the marquee is
+ // is set to different states, so it never has to
+ // be touched/sent again.
+ SendMessageHelper(TaskDialogNativeMethods.TaskDialogMessages.SetProgressBarMarquee, 1, 0);
+ UpdateProgressBarState(settings.ProgressBarState);
+ }
+
+ if (settings.ElevatedButtons != null && settings.ElevatedButtons.Count > 0)
+ {
+ foreach (int id in settings.ElevatedButtons)
+ {
+ UpdateElevationIcon(id, true);
+ }
+ }
+
+ return CoreErrorHelper.Ignored;
+ }
+
+ private int HandleButtonClick(int id)
+ {
+ // First we raise a Click event, if there is a custom button
+ // However, we implement Close() by sending a cancel button, so
+ // we don't want to raise a click event in response to that.
+ if (ShowState != DialogShowState.Closing)
+ {
+ outerDialog.RaiseButtonClickEvent(id);
+ }
+
+ // Once that returns, we raise a Closing event for the dialog
+ // The Win32 API handles button clicking-and-closing
+ // as an atomic action,
+ // but it is more .NET friendly to split them up.
+ // Unfortunately, we do NOT have the return values at this stage.
+ if (id < DialogsDefaults.MinimumDialogControlId)
+ {
+ return outerDialog.RaiseClosingEvent(id);
+ }
+
+ return (int)HResult.False;
+ }
+
+ private int HandleRadioButtonClick(int id)
+ {
+ // When the dialog sets the radio button to default,
+ // it (somewhat confusingly)issues a radio button clicked event
+ // - we mask that out - though ONLY if
+ // we do have a default radio button
+ if (firstRadioButtonClicked
+ && !IsOptionSet(TaskDialogNativeMethods.TaskDialogOptions.NoDefaultRadioButton))
+ {
+ firstRadioButtonClicked = false;
+ }
+ else
+ {
+ outerDialog.RaiseButtonClickEvent(id);
+ }
+
+ // Note: we don't raise Closing, as radio
+ // buttons are non-committing buttons
+ return CoreErrorHelper.Ignored;
+ }
+
+ private int HandleHyperlinkClick(IntPtr href)
+ {
+ string link = Marshal.PtrToStringUni(href);
+ outerDialog.RaiseHyperlinkClickEvent(link);
+
+ return CoreErrorHelper.Ignored;
+ }
+
+
+ private int HandleTick(int ticks)
+ {
+ outerDialog.RaiseTickEvent(ticks);
+ return CoreErrorHelper.Ignored;
+ }
+
+ private int HandleHelpInvocation()
+ {
+ outerDialog.RaiseHelpInvokedEvent();
+ return CoreErrorHelper.Ignored;
+ }
+
+ // There should be little we need to do here,
+ // as the use of the NativeTaskDialog is
+ // that it is instantiated for a single show, then disposed of.
+ private int PerformDialogCleanup()
+ {
+ firstRadioButtonClicked = true;
+
+ return CoreErrorHelper.Ignored;
+ }
+
+ #endregion
+
+ #region Update members
+
+ internal void UpdateProgressBarValue(int i)
+ {
+ AssertCurrentlyShowing();
+ SendMessageHelper(TaskDialogNativeMethods.TaskDialogMessages.SetProgressBarPosition, i, 0);
+ }
+
+ internal void UpdateProgressBarRange()
+ {
+ AssertCurrentlyShowing();
+
+ // Build range LPARAM - note it is in REVERSE intuitive order.
+ long range = NativeTaskDialog.MakeLongLParam(
+ settings.ProgressBarMaximum,
+ settings.ProgressBarMinimum);
+
+ SendMessageHelper(TaskDialogNativeMethods.TaskDialogMessages.SetProgressBarRange, 0, range);
+ }
+
+ internal void UpdateProgressBarState(TaskDialogProgressBarState state)
+ {
+ AssertCurrentlyShowing();
+ SendMessageHelper(TaskDialogNativeMethods.TaskDialogMessages.SetProgressBarState, (int)state, 0);
+ }
+
+ internal void UpdateText(string text)
+ {
+ UpdateTextCore(text, TaskDialogNativeMethods.TaskDialogElements.Content);
+ }
+
+ internal void UpdateInstruction(string instruction)
+ {
+ UpdateTextCore(instruction, TaskDialogNativeMethods.TaskDialogElements.MainInstruction);
+ }
+
+ internal void UpdateFooterText(string footerText)
+ {
+ UpdateTextCore(footerText, TaskDialogNativeMethods.TaskDialogElements.Footer);
+ }
+
+ internal void UpdateExpandedText(string expandedText)
+ {
+ UpdateTextCore(expandedText, TaskDialogNativeMethods.TaskDialogElements.ExpandedInformation);
+ }
+
+ private void UpdateTextCore(string s, TaskDialogNativeMethods.TaskDialogElements element)
+ {
+ AssertCurrentlyShowing();
+
+ FreeOldString(element);
+ SendMessageHelper(
+ TaskDialogNativeMethods.TaskDialogMessages.SetElementText,
+ (int)element,
+ (long)MakeNewString(s, element));
+ }
+
+ internal void UpdateMainIcon(TaskDialogStandardIcon mainIcon)
+ {
+ UpdateIconCore(mainIcon, TaskDialogNativeMethods.TaskDialogIconElement.Main);
+ }
+
+ internal void UpdateFooterIcon(TaskDialogStandardIcon footerIcon)
+ {
+ UpdateIconCore(footerIcon, TaskDialogNativeMethods.TaskDialogIconElement.Footer);
+ }
+
+ private void UpdateIconCore(TaskDialogStandardIcon icon, TaskDialogNativeMethods.TaskDialogIconElement element)
+ {
+ AssertCurrentlyShowing();
+ SendMessageHelper(
+ TaskDialogNativeMethods.TaskDialogMessages.UpdateIcon,
+ (int)element,
+ (long)icon);
+ }
+
+ internal void UpdateCheckBoxChecked(bool cbc)
+ {
+ AssertCurrentlyShowing();
+ SendMessageHelper(
+ TaskDialogNativeMethods.TaskDialogMessages.ClickVerification,
+ (cbc ? 1 : 0),
+ 1);
+ }
+
+ internal void UpdateElevationIcon(int buttonId, bool showIcon)
+ {
+ AssertCurrentlyShowing();
+ SendMessageHelper(
+ TaskDialogNativeMethods.TaskDialogMessages.SetButtonElevationRequiredState,
+ buttonId,
+ Convert.ToInt32(showIcon));
+ }
+
+ internal void UpdateButtonEnabled(int buttonID, bool enabled)
+ {
+ AssertCurrentlyShowing();
+ SendMessageHelper(
+ TaskDialogNativeMethods.TaskDialogMessages.EnableButton, buttonID, enabled == true ? 1 : 0);
+ }
+
+ internal void UpdateRadioButtonEnabled(int buttonID, bool enabled)
+ {
+ AssertCurrentlyShowing();
+ SendMessageHelper(TaskDialogNativeMethods.TaskDialogMessages.EnableRadioButton,
+ buttonID, enabled == true ? 1 : 0);
+ }
+
+ internal void AssertCurrentlyShowing()
+ {
+ Debug.Assert(ShowState == DialogShowState.Showing,
+ "Update*() methods should only be called while native dialog is showing");
+ }
+
+ #endregion
+
+ #region Helpers
+
+ private int SendMessageHelper(TaskDialogNativeMethods.TaskDialogMessages message, int wparam, long lparam)
+ {
+ // Be sure to at least assert here -
+ // messages to invalid handles often just disappear silently
+ Debug.Assert(hWndDialog != null, "HWND for dialog is null during SendMessage");
+
+ return (int)CoreNativeMethods.SendMessage(
+ hWndDialog,
+ (uint)message,
+ (IntPtr)wparam,
+ new IntPtr(lparam));
+ }
+
+ private bool IsOptionSet(TaskDialogNativeMethods.TaskDialogOptions flag)
+ {
+ return ((nativeDialogConfig.taskDialogFlags & flag) == flag);
+ }
+
+ // Allocates a new string on the unmanaged heap,
+ // and stores the pointer so we can free it later.
+
+ private IntPtr MakeNewString(string text, TaskDialogNativeMethods.TaskDialogElements element)
+ {
+ IntPtr newStringPtr = Marshal.StringToHGlobalUni(text);
+ updatedStrings[(int)element] = newStringPtr;
+ return newStringPtr;
+ }
+
+ // Checks to see if the given element already has an
+ // updated string, and if so,
+ // frees it. This is done in preparation for a call to
+ // MakeNewString(), to prevent
+ // leaks from multiple updates calls on the same element
+ // within a single native dialog lifetime.
+ private void FreeOldString(TaskDialogNativeMethods.TaskDialogElements element)
+ {
+ int elementIndex = (int)element;
+ if (updatedStrings[elementIndex] != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(updatedStrings[elementIndex]);
+ updatedStrings[elementIndex] = IntPtr.Zero;
+ }
+ }
+
+ // Based on the following defines in WinDef.h and WinUser.h:
+ // #define MAKELPARAM(l, h) ((LPARAM)(DWORD)MAKELONG(l, h))
+ // #define MAKELONG(a, b) ((LONG)(((WORD)(((DWORD_PTR)(a)) & 0xffff)) | ((DWORD)((WORD)(((DWORD_PTR)(b)) & 0xffff))) << 16))
+ private static long MakeLongLParam(int a, int b)
+ {
+ return (a << 16) + b;
+ }
+
+ // Builds the actual configuration that the
+ // NativeTaskDialog (and underlying Win32 API)
+ // expects, by parsing the various control lists,
+ // marshaling to the unmanaged heap, etc.
+ private void MarshalDialogControlStructs()
+ {
+ if (settings.Buttons != null && settings.Buttons.Length > 0)
+ {
+ buttonArray = AllocateAndMarshalButtons(settings.Buttons);
+ settings.NativeConfiguration.buttons = buttonArray;
+ settings.NativeConfiguration.buttonCount = (uint)settings.Buttons.Length;
+ }
+
+ if (settings.RadioButtons != null && settings.RadioButtons.Length > 0)
+ {
+ radioButtonArray = AllocateAndMarshalButtons(settings.RadioButtons);
+ settings.NativeConfiguration.radioButtons = radioButtonArray;
+ settings.NativeConfiguration.radioButtonCount = (uint)settings.RadioButtons.Length;
+ }
+ }
+
+ private static IntPtr AllocateAndMarshalButtons(TaskDialogNativeMethods.TaskDialogButton[] structs)
+ {
+ IntPtr initialPtr = Marshal.AllocHGlobal(
+ Marshal.SizeOf(typeof(TaskDialogNativeMethods.TaskDialogButton)) * structs.Length);
+
+ IntPtr currentPtr = initialPtr;
+ foreach (TaskDialogNativeMethods.TaskDialogButton button in structs)
+ {
+ Marshal.StructureToPtr(button, currentPtr, false);
+ currentPtr = (IntPtr)((int)currentPtr + Marshal.SizeOf(button));
+ }
+
+ return initialPtr;
+ }
+
+ #endregion
+
+ #region IDispose Pattern
+
+ private bool disposed;
+
+ // Finalizer and IDisposable implementation.
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ ~NativeTaskDialog()
+ {
+ Dispose(false);
+ }
+
+ // Core disposing logic.
+ protected void Dispose(bool disposing)
+ {
+ if (!disposed)
+ {
+ disposed = true;
+
+ // Single biggest resource - make sure the dialog
+ // itself has been instructed to close.
+
+ if (ShowState == DialogShowState.Showing)
+ {
+ NativeClose(TaskDialogResult.Cancel);
+ }
+
+ // Clean up custom allocated strings that were updated
+ // while the dialog was showing. Note that the strings
+ // passed in the initial TaskDialogIndirect call will
+ // be cleaned up automagically by the default
+ // marshalling logic.
+
+ if (updatedStrings != null)
+ {
+ for (int i = 0; i < updatedStrings.Length; i++)
+ {
+ if (updatedStrings[i] != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(updatedStrings[i]);
+ updatedStrings[i] = IntPtr.Zero;
+ }
+ }
+ }
+
+ // Clean up the button and radio button arrays, if any.
+ if (buttonArray != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(buttonArray);
+ buttonArray = IntPtr.Zero;
+ }
+ if (radioButtonArray != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(radioButtonArray);
+ radioButtonArray = IntPtr.Zero;
+ }
+
+ if (disposing)
+ {
+ // Clean up managed resources - currently there are none
+ // that are interesting.
+ }
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/TaskDialogs/NativeTaskDialogSettings.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/TaskDialogs/NativeTaskDialogSettings.cs
new file mode 100644
index 0000000000..ab7b883236
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/TaskDialogs/NativeTaskDialogSettings.cs
@@ -0,0 +1,58 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ ///<summary>
+ /// Encapsulates additional configuration needed by NativeTaskDialog
+ /// that it can't get from the TASKDIALOGCONFIG struct.
+ ///</summary>
+ internal class NativeTaskDialogSettings
+ {
+ internal NativeTaskDialogSettings()
+ {
+ NativeConfiguration = new TaskDialogNativeMethods.TaskDialogConfiguration();
+
+ // Apply standard settings.
+ NativeConfiguration.size = (uint)Marshal.SizeOf(NativeConfiguration);
+ NativeConfiguration.parentHandle = IntPtr.Zero;
+ NativeConfiguration.instance = IntPtr.Zero;
+ NativeConfiguration.taskDialogFlags = TaskDialogNativeMethods.TaskDialogOptions.AllowCancel;
+ NativeConfiguration.commonButtons = TaskDialogNativeMethods.TaskDialogCommonButtons.Ok;
+ NativeConfiguration.mainIcon = new TaskDialogNativeMethods.IconUnion(0);
+ NativeConfiguration.footerIcon = new TaskDialogNativeMethods.IconUnion(0);
+ NativeConfiguration.width = TaskDialogDefaults.IdealWidth;
+
+ // Zero out all the custom button fields.
+ NativeConfiguration.buttonCount = 0;
+ NativeConfiguration.radioButtonCount = 0;
+ NativeConfiguration.buttons = IntPtr.Zero;
+ NativeConfiguration.radioButtons = IntPtr.Zero;
+ NativeConfiguration.defaultButtonIndex = 0;
+ NativeConfiguration.defaultRadioButtonIndex = 0;
+
+ // Various text defaults.
+ NativeConfiguration.windowTitle = TaskDialogDefaults.Caption;
+ NativeConfiguration.mainInstruction = TaskDialogDefaults.MainInstruction;
+ NativeConfiguration.content = TaskDialogDefaults.Content;
+ NativeConfiguration.verificationText = null;
+ NativeConfiguration.expandedInformation = null;
+ NativeConfiguration.expandedControlText = null;
+ NativeConfiguration.collapsedControlText = null;
+ NativeConfiguration.footerText = null;
+ }
+
+ public int ProgressBarMinimum { get; set; }
+ public int ProgressBarMaximum { get; set; }
+ public int ProgressBarValue { get; set; }
+ public TaskDialogProgressBarState ProgressBarState { get; set; }
+ public bool InvokeHelp { get; set; }
+ public TaskDialogNativeMethods.TaskDialogConfiguration NativeConfiguration { get; private set; }
+ public TaskDialogNativeMethods.TaskDialogButton[] Buttons { get; set; }
+ public TaskDialogNativeMethods.TaskDialogButton[] RadioButtons { get; set; }
+ public List<int> ElevatedButtons { get; set; }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/TaskDialogs/TaskDialogNativeMethods.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/TaskDialogs/TaskDialogNativeMethods.cs
new file mode 100644
index 0000000000..48ac3522f2
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/TaskDialogs/TaskDialogNativeMethods.cs
@@ -0,0 +1,233 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+
+ /// <summary>
+ /// Internal class containing most native interop declarations used
+ /// throughout the library.
+ /// Functions that are not performance intensive belong in this class.
+ /// </summary>
+
+ internal static class TaskDialogNativeMethods
+ {
+ #region TaskDialog Definitions
+
+ [DllImport("Comctl32.dll", SetLastError = true)]
+ internal static extern HResult TaskDialogIndirect(
+ [In] TaskDialogNativeMethods.TaskDialogConfiguration taskConfig,
+ [Out] out int button,
+ [Out] out int radioButton,
+ [MarshalAs(UnmanagedType.Bool), Out] out bool verificationFlagChecked);
+
+ // Main task dialog configuration struct.
+ // NOTE: Packing must be set to 4 to make this work on 64-bit platforms.
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 4)]
+ internal class TaskDialogConfiguration
+ {
+ internal uint size;
+ internal IntPtr parentHandle;
+ internal IntPtr instance;
+ internal TaskDialogOptions taskDialogFlags;
+ internal TaskDialogCommonButtons commonButtons;
+ [MarshalAs(UnmanagedType.LPWStr)]
+ internal string windowTitle;
+ internal IconUnion mainIcon; // NOTE: 32-bit union field, holds pszMainIcon as well
+ [MarshalAs(UnmanagedType.LPWStr)]
+ internal string mainInstruction;
+ [MarshalAs(UnmanagedType.LPWStr)]
+ internal string content;
+ internal uint buttonCount;
+ internal IntPtr buttons; // Ptr to TASKDIALOG_BUTTON structs
+ internal int defaultButtonIndex;
+ internal uint radioButtonCount;
+ internal IntPtr radioButtons; // Ptr to TASKDIALOG_BUTTON structs
+ internal int defaultRadioButtonIndex;
+ [MarshalAs(UnmanagedType.LPWStr)]
+ internal string verificationText;
+ [MarshalAs(UnmanagedType.LPWStr)]
+ internal string expandedInformation;
+ [MarshalAs(UnmanagedType.LPWStr)]
+ internal string expandedControlText;
+ [MarshalAs(UnmanagedType.LPWStr)]
+ internal string collapsedControlText;
+ internal IconUnion footerIcon; // NOTE: 32-bit union field, holds pszFooterIcon as well
+ [MarshalAs(UnmanagedType.LPWStr)]
+ internal string footerText;
+ internal TaskDialogCallback callback;
+ internal IntPtr callbackData;
+ internal uint width;
+ }
+
+ internal const int TaskDialogIdealWidth = 0; // Value for TASKDIALOGCONFIG.cxWidth
+ internal const int TaskDialogButtonShieldIcon = 1;
+
+ // NOTE: We include a "spacer" so that the struct size varies on
+ // 64-bit architectures.
+ [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Auto)]
+ internal struct IconUnion
+ {
+ internal IconUnion(int i)
+ {
+ mainIcon = i;
+ spacer = IntPtr.Zero;
+ }
+
+ [FieldOffset(0)]
+ private int mainIcon;
+
+ // This field is used to adjust the length of the structure on 32/64bit OS.
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+ [FieldOffset(0)]
+ private IntPtr spacer;
+
+ /// <summary>
+ /// Gets the handle to the Icon
+ /// </summary>
+ public int MainIcon { get { return mainIcon; } }
+ }
+
+ // NOTE: Packing must be set to 4 to make this work on 64-bit platforms.
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 4)]
+ internal struct TaskDialogButton
+ {
+ public TaskDialogButton(int buttonId, string text)
+ {
+ this.buttonId = buttonId;
+ buttonText = text;
+ }
+
+ internal int buttonId;
+ [MarshalAs(UnmanagedType.LPWStr)]
+ internal string buttonText;
+ }
+
+ // Task Dialog - identifies common buttons.
+ [Flags]
+ internal enum TaskDialogCommonButtons
+ {
+ Ok = 0x0001, // selected control return value IDOK
+ Yes = 0x0002, // selected control return value IDYES
+ No = 0x0004, // selected control return value IDNO
+ Cancel = 0x0008, // selected control return value IDCANCEL
+ Retry = 0x0010, // selected control return value IDRETRY
+ Close = 0x0020 // selected control return value IDCLOSE
+ }
+
+ // Identify button *return values* - note that, unfortunately, these are different
+ // from the inbound button values.
+ internal enum TaskDialogCommonButtonReturnIds
+ {
+ Ok = 1,
+ Cancel = 2,
+ Abort = 3,
+ Retry = 4,
+ Ignore = 5,
+ Yes = 6,
+ No = 7,
+ Close = 8
+ }
+
+ internal enum TaskDialogElements
+ {
+ Content,
+ ExpandedInformation,
+ Footer,
+ MainInstruction
+ }
+
+ internal enum TaskDialogIconElement
+ {
+ Main,
+ Footer
+ }
+
+ // Task Dialog - flags
+ [Flags]
+ internal enum TaskDialogOptions
+ {
+ None = 0,
+ EnableHyperlinks = 0x0001,
+ UseMainIcon = 0x0002,
+ UseFooterIcon = 0x0004,
+ AllowCancel = 0x0008,
+ UseCommandLinks = 0x0010,
+ UseNoIconCommandLinks = 0x0020,
+ ExpandFooterArea = 0x0040,
+ ExpandedByDefault = 0x0080,
+ CheckVerificationFlag = 0x0100,
+ ShowProgressBar = 0x0200,
+ ShowMarqueeProgressBar = 0x0400,
+ UseCallbackTimer = 0x0800,
+ PositionRelativeToWindow = 0x1000,
+ RightToLeftLayout = 0x2000,
+ NoDefaultRadioButton = 0x4000
+ }
+
+ internal enum TaskDialogMessages
+ {
+ NavigatePage = CoreNativeMethods.UserMessage + 101,
+ ClickButton = CoreNativeMethods.UserMessage + 102, // wParam = Button ID
+ SetMarqueeProgressBar = CoreNativeMethods.UserMessage + 103, // wParam = 0 (nonMarque) wParam != 0 (Marquee)
+ SetProgressBarState = CoreNativeMethods.UserMessage + 104, // wParam = new progress state
+ SetProgressBarRange = CoreNativeMethods.UserMessage + 105, // lParam = MAKELPARAM(nMinRange, nMaxRange)
+ SetProgressBarPosition = CoreNativeMethods.UserMessage + 106, // wParam = new position
+ SetProgressBarMarquee = CoreNativeMethods.UserMessage + 107, // wParam = 0 (stop marquee), wParam != 0 (start marquee), lparam = speed (milliseconds between repaints)
+ SetElementText = CoreNativeMethods.UserMessage + 108, // wParam = element (TASKDIALOG_ELEMENTS), lParam = new element text (LPCWSTR)
+ ClickRadioButton = CoreNativeMethods.UserMessage + 110, // wParam = Radio Button ID
+ EnableButton = CoreNativeMethods.UserMessage + 111, // lParam = 0 (disable), lParam != 0 (enable), wParam = Button ID
+ EnableRadioButton = CoreNativeMethods.UserMessage + 112, // lParam = 0 (disable), lParam != 0 (enable), wParam = Radio Button ID
+ ClickVerification = CoreNativeMethods.UserMessage + 113, // wParam = 0 (unchecked), 1 (checked), lParam = 1 (set key focus)
+ UpdateElementText = CoreNativeMethods.UserMessage + 114, // wParam = element (TASKDIALOG_ELEMENTS), lParam = new element text (LPCWSTR)
+ SetButtonElevationRequiredState = CoreNativeMethods.UserMessage + 115, // wParam = Button ID, lParam = 0 (elevation not required), lParam != 0 (elevation required)
+ UpdateIcon = CoreNativeMethods.UserMessage + 116 // wParam = icon element (TASKDIALOG_ICON_ELEMENTS), lParam = new icon (hIcon if TDF_USE_HICON_* was set, PCWSTR otherwise)
+ }
+
+ internal enum TaskDialogNotifications
+ {
+ Created = 0,
+ Navigated = 1,
+ ButtonClicked = 2, // wParam = Button ID
+ HyperlinkClicked = 3, // lParam = (LPCWSTR)pszHREF
+ Timer = 4, // wParam = Milliseconds since dialog created or timer reset
+ Destroyed = 5,
+ RadioButtonClicked = 6, // wParam = Radio Button ID
+ Constructed = 7,
+ VerificationClicked = 8, // wParam = 1 if checkbox checked, 0 if not, lParam is unused and always 0
+ Help = 9,
+ ExpandButtonClicked = 10 // wParam = 0 (dialog is now collapsed), wParam != 0 (dialog is now expanded)
+ }
+
+ // Used in the various SET_DEFAULT* TaskDialog messages
+ internal const int NoDefaultButtonSpecified = 0;
+
+ // Task Dialog config and related structs (for TaskDialogIndirect())
+ internal delegate int TaskDialogCallback(
+ IntPtr hwnd,
+ uint message,
+ IntPtr wparam,
+ IntPtr lparam,
+ IntPtr referenceData);
+
+ internal enum ProgressBarState
+ {
+ Normal = 0x0001,
+ Error = 0x0002,
+ Paused = 0x0003
+ }
+
+ internal enum TaskDialogIcons
+ {
+ Warning = 65535,
+ Error = 65534,
+ Information = 65533,
+ Shield = 65532
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/WindowMessage.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/WindowMessage.cs
new file mode 100644
index 0000000000..4ff7840d99
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Interop/WindowMessage.cs
@@ -0,0 +1,234 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace MS.WindowsAPICodePack.Internal
+{
+ internal enum WindowMessage
+ {
+ Null = 0x00,
+ Create = 0x01,
+ Destroy = 0x02,
+ Move = 0x03,
+ Size = 0x05,
+ Activate = 0x06,
+ SetFocus = 0x07,
+ KillFocus = 0x08,
+ Enable = 0x0A,
+ SetRedraw = 0x0B,
+ SetText = 0x0C,
+ GetText = 0x0D,
+ GetTextLength = 0x0E,
+ Paint = 0x0F,
+ Close = 0x10,
+ QueryEndSession = 0x11,
+ Quit = 0x12,
+ QueryOpen = 0x13,
+ EraseBackground = 0x14,
+ SystemColorChange = 0x15,
+ EndSession = 0x16,
+ SystemError = 0x17,
+ ShowWindow = 0x18,
+ ControlColor = 0x19,
+ WinIniChange = 0x1A,
+ SettingChange = 0x1A,
+ DevModeChange = 0x1B,
+ ActivateApplication = 0x1C,
+ FontChange = 0x1D,
+ TimeChange = 0x1E,
+ CancelMode = 0x1F,
+ SetCursor = 0x20,
+ MouseActivate = 0x21,
+ ChildActivate = 0x22,
+ QueueSync = 0x23,
+ GetMinMaxInfo = 0x24,
+ PaintIcon = 0x26,
+ IconEraseBackground = 0x27,
+ NextDialogControl = 0x28,
+ SpoolerStatus = 0x2A,
+ DrawItem = 0x2B,
+ MeasureItem = 0x2C,
+ DeleteItem = 0x2D,
+ VKeyToItem = 0x2E,
+ CharToItem = 0x2F,
+
+ SetFont = 0x30,
+ GetFont = 0x31,
+ SetHotkey = 0x32,
+ GetHotkey = 0x33,
+ QueryDragIcon = 0x37,
+ CompareItem = 0x39,
+ Compacting = 0x41,
+ WindowPositionChanging = 0x46,
+ WindowPositionChanged = 0x47,
+ Power = 0x48,
+ CopyData = 0x4A,
+ CancelJournal = 0x4B,
+ Notify = 0x4E,
+ InputLanguageChangeRequest = 0x50,
+ InputLanguageChange = 0x51,
+ TCard = 0x52,
+ Help = 0x53,
+ UserChanged = 0x54,
+ NotifyFormat = 0x55,
+ ContextMenu = 0x7B,
+ StyleChanging = 0x7C,
+ StyleChanged = 0x7D,
+ DisplayChange = 0x7E,
+ GetIcon = 0x7F,
+ SetIcon = 0x80,
+
+ NCCreate = 0x81,
+ NCDestroy = 0x82,
+ NCCalculateSize = 0x83,
+ NCHitTest = 0x84,
+ NCPaint = 0x85,
+ NCActivate = 0x86,
+ GetDialogCode = 0x87,
+ NCMouseMove = 0xA0,
+ NCLeftButtonDown = 0xA1,
+ NCLeftButtonUp = 0xA2,
+ NCLeftButtonDoubleClick = 0xA3,
+ NCRightButtonDown = 0xA4,
+ NCRightButtonUp = 0xA5,
+ NCRightButtonDoubleClick = 0xA6,
+ NCMiddleButtonDown = 0xA7,
+ NCMiddleButtonUp = 0xA8,
+ NCMiddleButtonDoubleClick = 0xA9,
+
+ KeyFirst = 0x100,
+ KeyDown = 0x100,
+ KeyUp = 0x101,
+ Char = 0x102,
+ DeadChar = 0x103,
+ SystemKeyDown = 0x104,
+ SystemKeyUp = 0x105,
+ SystemChar = 0x106,
+ SystemDeadChar = 0x107,
+ KeyLast = 0x108,
+
+ IMEStartComposition = 0x10D,
+ IMEEndComposition = 0x10E,
+ IMEComposition = 0x10F,
+ IMEKeyLast = 0x10F,
+
+ InitializeDialog = 0x110,
+ Command = 0x111,
+ SystemCommand = 0x112,
+ Timer = 0x113,
+ HorizontalScroll = 0x114,
+ VerticalScroll = 0x115,
+ InitializeMenu = 0x116,
+ InitializeMenuPopup = 0x117,
+ MenuSelect = 0x11F,
+ MenuChar = 0x120,
+ EnterIdle = 0x121,
+
+ CTLColorMessageBox = 0x132,
+ CTLColorEdit = 0x133,
+ CTLColorListbox = 0x134,
+ CTLColorButton = 0x135,
+ CTLColorDialog = 0x136,
+ CTLColorScrollBar = 0x137,
+ CTLColorStatic = 0x138,
+
+ MouseFirst = 0x200,
+ MouseMove = 0x200,
+ LeftButtonDown = 0x201,
+ LeftButtonUp = 0x202,
+ LeftButtonDoubleClick = 0x203,
+ RightButtonDown = 0x204,
+ RightButtonUp = 0x205,
+ RightButtonDoubleClick = 0x206,
+ MiddleButtonDown = 0x207,
+ MiddleButtonUp = 0x208,
+ MiddleButtonDoubleClick = 0x209,
+ MouseWheel = 0x20A,
+ MouseHorizontalWheel = 0x20E,
+
+ ParentNotify = 0x210,
+ EnterMenuLoop = 0x211,
+ ExitMenuLoop = 0x212,
+ NextMenu = 0x213,
+ Sizing = 0x214,
+ CaptureChanged = 0x215,
+ Moving = 0x216,
+ PowerBroadcast = 0x218,
+ DeviceChange = 0x219,
+
+ MDICreate = 0x220,
+ MDIDestroy = 0x221,
+ MDIActivate = 0x222,
+ MDIRestore = 0x223,
+ MDINext = 0x224,
+ MDIMaximize = 0x225,
+ MDITile = 0x226,
+ MDICascade = 0x227,
+ MDIIconArrange = 0x228,
+ MDIGetActive = 0x229,
+ MDISetMenu = 0x230,
+ EnterSizeMove = 0x231,
+ ExitSizeMove = 0x232,
+ DropFiles = 0x233,
+ MDIRefreshMenu = 0x234,
+
+ IMESetContext = 0x281,
+ IMENotify = 0x282,
+ IMEControl = 0x283,
+ IMECompositionFull = 0x284,
+ IMESelect = 0x285,
+ IMEChar = 0x286,
+ IMEKeyDown = 0x290,
+ IMEKeyUp = 0x291,
+
+ MouseHover = 0x2A1,
+ NCMouseLeave = 0x2A2,
+ MouseLeave = 0x2A3,
+
+ Cut = 0x300,
+ Copy = 0x301,
+ Paste = 0x302,
+ Clear = 0x303,
+ Undo = 0x304,
+
+ RenderFormat = 0x305,
+ RenderAllFormats = 0x306,
+ DestroyClipboard = 0x307,
+ DrawClipbard = 0x308,
+ PaintClipbard = 0x309,
+ VerticalScrollClipBoard = 0x30A,
+ SizeClipbard = 0x30B,
+ AskClipboardFormatname = 0x30C,
+ ChangeClipboardChain = 0x30D,
+ HorizontalScrollClipboard = 0x30E,
+ QueryNewPalette = 0x30F,
+ PaletteIsChanging = 0x310,
+ PaletteChanged = 0x311,
+
+ Hotkey = 0x312,
+ Print = 0x317,
+ PrintClient = 0x318,
+
+ HandHeldFirst = 0x358,
+ HandHeldlast = 0x35F,
+ PenWinFirst = 0x380,
+ PenWinLast = 0x38F,
+ CoalesceFirst = 0x390,
+ CoalesceLast = 0x39F,
+ DDE_First = 0x3E0,
+ DDE_Initiate = 0x3E0,
+ DDE_Terminate = 0x3E1,
+ DDE_Advise = 0x3E2,
+ DDE_Unadvise = 0x3E3,
+ DDE_Ack = 0x3E4,
+ DDE_Data = 0x3E5,
+ DDE_Request = 0x3E6,
+ DDE_Poke = 0x3E7,
+ DDE_Execute = 0x3E8,
+ DDE_Last = 0x3E8,
+
+ User = 0x400,
+ App = 0x8000,
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Makefile.am b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Makefile.am
new file mode 100644
index 0000000000..24e07e9bf5
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Makefile.am
@@ -0,0 +1,5 @@
+include $(top_srcdir)/xbuild.include
+
+if ! ENABLE_WINDOWSPLATFORM
+SKIP=y
+endif
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/Network.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/Network.cs
new file mode 100644
index 0000000000..93cccb59f0
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/Network.cs
@@ -0,0 +1,201 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+
+namespace Microsoft.WindowsAPICodePack.Net
+{
+ /// <summary>
+ /// Represents a network on the local machine.
+ /// It can also represent a collection of network
+ /// connections with a similar network signature.
+ /// </summary>
+ /// <remarks>
+ /// Instances of this class are obtained by calling
+ /// methods on the <see cref="NetworkListManager"/> class.
+ /// </remarks>
+ public class Network
+ {
+ #region Private Fields
+
+ INetwork network;
+
+ #endregion // Private Fields
+
+ internal Network(INetwork network)
+ {
+ this.network = network;
+ }
+
+ /// <summary>
+ /// Gets or sets the category of a network. The
+ /// categories are trusted, untrusted, or
+ /// authenticated.
+ /// </summary>
+ /// <value>A <see cref="NetworkCategory"/> value.</value>
+ public NetworkCategory Category
+ {
+ get
+ {
+ return network.GetCategory();
+ }
+
+ set
+ {
+ network.SetCategory(value);
+ }
+ }
+
+ /// <summary>
+ /// Gets the local date and time when the network
+ /// was connected.
+ /// </summary>
+ /// <value>A <see cref="System.DateTime"/> object.</value>
+ public DateTime ConnectedTime
+ {
+ get
+ {
+ uint low, high, dummy1, dummy2;
+ network.GetTimeCreatedAndConnected(out dummy1, out dummy2, out low, out high);
+ long time = high;
+ // Shift the day info into the high order bits.
+ time <<= 32;
+ time |= low;
+ return DateTime.FromFileTimeUtc(time);
+ }
+ }
+
+ /// <summary>
+ /// Gets the network connections for the network.
+ /// </summary>
+ /// <value>A <see cref="NetworkConnectionCollection"/> object.</value>
+ public NetworkConnectionCollection Connections
+ {
+ get
+ {
+ return new NetworkConnectionCollection(network.GetNetworkConnections());
+ }
+ }
+
+ /// <summary>
+ /// Gets the connectivity state of the network.
+ /// </summary>
+ /// <value>A <see cref="Connectivity"/> value.</value>
+ /// <remarks>Connectivity provides information on whether
+ /// the network is connected, and the protocols
+ /// in use for network traffic.</remarks>
+ public ConnectivityStates Connectivity
+ {
+ get
+ {
+ return network.GetConnectivity();
+ }
+ }
+
+ /// <summary>
+ /// Gets the local date and time when the
+ /// network was created.
+ /// </summary>
+ /// <value>A <see cref="System.DateTime"/> object.</value>
+ public DateTime CreatedTime
+ {
+ get
+ {
+ uint low, high, dummy1, dummy2;
+ network.GetTimeCreatedAndConnected(out low, out high, out dummy1, out dummy2);
+ long time = high;
+ //Shift the value into the high order bits.
+ time <<= 32;
+ time |= low;
+ return DateTime.FromFileTimeUtc(time);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a description for the network.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> value.</value>
+ public string Description
+ {
+ get
+ {
+ return network.GetDescription();
+ }
+
+ set
+ {
+ network.SetDescription(value);
+ }
+ }
+
+ /// <summary>
+ /// Gets the domain type of the network.
+ /// </summary>
+ /// <value>A <see cref="DomainType"/> value.</value>
+ /// <remarks>The domain
+ /// indictates whether the network is an Active
+ /// Directory Network, and whether the machine
+ /// has been authenticated by Active Directory.</remarks>
+ public DomainType DomainType
+ {
+ get
+ {
+ return network.GetDomainType();
+ }
+ }
+
+ /// <summary>
+ /// Gets a value that indicates whether there is
+ /// network connectivity.
+ /// </summary>
+ /// <value>A <see cref="System.Boolean"/> value.</value>
+ public bool IsConnected
+ {
+ get
+ {
+ return network.IsConnected;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value that indicates whether there is
+ /// Internet connectivity.
+ /// </summary>
+ /// <value>A <see cref="System.Boolean"/> value.</value>
+ public bool IsConnectedToInternet
+ {
+ get
+ {
+ return network.IsConnectedToInternet;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the name of the network.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> value.</value>
+ public string Name
+ {
+ get
+ {
+ return network.GetName();
+ }
+
+ set
+ {
+ network.SetName(value);
+ }
+ }
+
+ /// <summary>
+ /// Gets a unique identifier for the network.
+ /// </summary>
+ /// <value>A <see cref="System.Guid"/> value.</value>
+ public Guid NetworkId
+ {
+ get
+ {
+ return network.GetNetworkId();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/NetworkCollection.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/NetworkCollection.cs
new file mode 100644
index 0000000000..dc079a0342
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/NetworkCollection.cs
@@ -0,0 +1,60 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.WindowsAPICodePack.Net
+{
+ /// <summary>
+ /// An enumerable collection of <see cref="Network"/> objects.
+ /// </summary>
+ public class NetworkCollection : IEnumerable<Network>
+ {
+ #region Private Fields
+
+ IEnumerable networkEnumerable;
+
+ #endregion // Private Fields
+
+ internal NetworkCollection(IEnumerable networkEnumerable)
+ {
+ this.networkEnumerable = networkEnumerable;
+ }
+
+ #region IEnumerable<Network> Members
+
+ /// <summary>
+ /// Returns the strongly typed enumerator for this collection.
+ /// </summary>
+ /// <returns>An <see cref="System.Collections.Generic.IEnumerator{T}"/> object.</returns>
+ public IEnumerator<Network> GetEnumerator()
+ {
+ foreach (INetwork network in networkEnumerable)
+ {
+ yield return new Network(network);
+ }
+ }
+
+ #endregion
+
+ #region IEnumerable Members
+
+ /// <summary>
+ /// Returns the enumerator for this collection.
+ /// </summary>
+ ///<returns>An <see cref="System.Collections.IEnumerator"/> object.</returns>
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ foreach (INetwork network in networkEnumerable)
+ {
+ yield return new Network(network);
+ }
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/NetworkConnection.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/NetworkConnection.cs
new file mode 100644
index 0000000000..71363a0a71
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/NetworkConnection.cs
@@ -0,0 +1,115 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.WindowsAPICodePack.Net
+{
+ /// <summary>
+ /// Represents a connection to a network.
+ /// </summary>
+ /// <remarks> A collection containing instances of this class is obtained by calling
+ /// the <see cref="P:Microsoft.WindowsAPICodePack.Net.Network.Connections"/> property.</remarks>
+ public class NetworkConnection
+ {
+ #region Private Fields
+
+ INetworkConnection networkConnection;
+
+ #endregion // Private Fields
+
+ internal NetworkConnection(INetworkConnection networkConnection)
+ {
+ this.networkConnection = networkConnection;
+ }
+
+ /// <summary>
+ /// Retrieves an object that represents the network
+ /// associated with this connection.
+ /// </summary>
+ /// <returns>A <see cref="Network"/> object.</returns>
+ public Network Network
+ {
+ get
+ {
+ return new Network(networkConnection.GetNetwork());
+ }
+ }
+
+ /// <summary>
+ /// Gets the adapter identifier for this connection.
+ /// </summary>
+ /// <value>A <see cref="System.Guid"/> object.</value>
+ public Guid AdapterId
+ {
+ get
+ {
+ return networkConnection.GetAdapterId();
+ }
+ }
+ /// <summary>
+ /// Gets the unique identifier for this connection.
+ /// </summary>
+ /// <value>A <see cref="System.Guid"/> object.</value>
+ public Guid ConnectionId
+ {
+ get
+ {
+ return networkConnection.GetConnectionId();
+ }
+ }
+ /// <summary>
+ /// Gets a value that indicates the connectivity of this connection.
+ /// </summary>
+ /// <value>A <see cref="Connectivity"/> value.</value>
+ public ConnectivityStates Connectivity
+ {
+ get
+ {
+ return networkConnection.GetConnectivity();
+ }
+ }
+
+ /// <summary>
+ /// Gets a value that indicates whether the network associated
+ /// with this connection is
+ /// an Active Directory network and whether the machine
+ /// has been authenticated by Active Directory.
+ /// </summary>
+ /// <value>A <see cref="DomainType"/> value.</value>
+ public DomainType DomainType
+ {
+ get
+ {
+ return networkConnection.GetDomainType();
+ }
+ }
+ /// <summary>
+ /// Gets a value that indicates whether this
+ /// connection has Internet access.
+ /// </summary>
+ /// <value>A <see cref="System.Boolean"/> value.</value>
+ public bool IsConnectedToInternet
+ {
+ get
+ {
+ return networkConnection.IsConnectedToInternet;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value that indicates whether this connection has
+ /// network connectivity.
+ /// </summary>
+ /// <value>A <see cref="System.Boolean"/> value.</value>
+ public bool IsConnected
+ {
+ get
+ {
+ return networkConnection.IsConnected;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/NetworkConnectionCollection.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/NetworkConnectionCollection.cs
new file mode 100644
index 0000000000..4618e36fb7
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/NetworkConnectionCollection.cs
@@ -0,0 +1,60 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.WindowsAPICodePack.Net
+{
+ /// <summary>
+ /// An enumerable collection of <see cref="NetworkConnection"/> objects.
+ /// </summary>
+ public class NetworkConnectionCollection : IEnumerable<NetworkConnection>
+ {
+ #region Private Fields
+
+ IEnumerable networkConnectionEnumerable;
+
+ #endregion // Private Fields
+
+ internal NetworkConnectionCollection(IEnumerable networkConnectionEnumerable)
+ {
+ this.networkConnectionEnumerable = networkConnectionEnumerable;
+ }
+
+ #region IEnumerable<NetworkConnection> Members
+
+ /// <summary>
+ /// Returns the strongly typed enumerator for this collection.
+ /// </summary>
+ /// <returns>A <see cref="System.Collections.Generic.IEnumerator{T}"/> object.</returns>
+ public IEnumerator<NetworkConnection> GetEnumerator()
+ {
+ foreach (INetworkConnection networkConnection in networkConnectionEnumerable)
+ {
+ yield return new NetworkConnection(networkConnection);
+ }
+ }
+
+ #endregion
+
+ #region IEnumerable Members
+
+ /// <summary>
+ /// Returns the enumerator for this collection.
+ /// </summary>
+ ///<returns>A <see cref="System.Collections.IEnumerator"/> object.</returns>
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ foreach (INetworkConnection networkConnection in networkConnectionEnumerable)
+ {
+ yield return new NetworkConnection(networkConnection);
+ }
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/NetworkListEnums.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/NetworkListEnums.cs
new file mode 100644
index 0000000000..1b14b50d0e
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/NetworkListEnums.cs
@@ -0,0 +1,124 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+namespace Microsoft.WindowsAPICodePack.Net
+{
+ /// <summary>
+ /// Specifies types of network connectivity.
+ /// </summary>
+ [Flags]
+ public enum ConnectivityStates
+ {
+ /// <summary>
+ /// The underlying network interfaces have no
+ /// connectivity to any network.
+ /// </summary>
+ None = 0,
+ /// <summary>
+ /// There is connectivity to the Internet
+ /// using the IPv4 protocol.
+ /// </summary>
+ IPv4Internet = 0x40,
+ /// <summary>
+ /// There is connectivity to a routed network
+ /// using the IPv4 protocol.
+ /// </summary>
+ IPv4LocalNetwork = 0x20,
+ /// <summary>
+ /// There is connectivity to a network, but
+ /// the service cannot detect any IPv4
+ /// network traffic.
+ /// </summary>
+ IPv4NoTraffic = 1,
+ /// <summary>
+ /// There is connectivity to the local
+ /// subnet using the IPv4 protocol.
+ /// </summary>
+ IPv4Subnet = 0x10,
+ /// <summary>
+ /// There is connectivity to the Internet
+ /// using the IPv4 protocol.
+ /// </summary>
+ IPv6Internet = 0x400,
+ /// <summary>
+ /// There is connectivity to a local
+ /// network using the IPv6 protocol.
+ /// </summary>
+ IPv6LocalNetwork = 0x200,
+ /// <summary>
+ /// There is connectivity to a network,
+ /// but the service cannot detect any
+ /// IPv6 network traffic
+ /// </summary>
+ IPv6NoTraffic = 2,
+ /// <summary>
+ /// There is connectivity to the local
+ /// subnet using the IPv6 protocol.
+ /// </summary>
+ IPv6Subnet = 0x100
+ }
+
+ /// <summary>
+ /// Specifies the domain type of a network.
+ /// </summary>
+ public enum DomainType
+ {
+ /// <summary>
+ /// The network is not an Active Directory network.
+ /// </summary>
+ NonDomainNetwork = 0,
+ /// <summary>
+ /// The network is an Active Directory network, but this machine is not authenticated against it.
+ /// </summary>
+ DomainNetwork = 1,
+ /// <summary>
+ /// The network is an Active Directory network, and this machine is authenticated against it.
+ /// </summary>
+ DomainAuthenticated = 2,
+ }
+
+ /// <summary>
+ /// Specifies the trust level for a
+ /// network.
+ /// </summary>
+ public enum NetworkCategory
+ {
+ /// <summary>
+ /// The network is a public (untrusted) network.
+ /// </summary>
+ Public,
+ /// <summary>
+ /// The network is a private (trusted) network.
+ /// </summary>
+ Private,
+ /// <summary>
+ /// The network is authenticated against an Active Directory domain.
+ /// </summary>
+ Authenticated
+ }
+
+ /// <summary>
+ /// Specifies the level of connectivity for
+ /// networks returned by the
+ /// <see cref="NetworkListManager"/>
+ /// class.
+ /// </summary>
+ [Flags]
+ public enum NetworkConnectivityLevels
+ {
+ /// <summary>
+ /// Networks that the machine is connected to.
+ /// </summary>
+ Connected = 1,
+ /// <summary>
+ /// Networks that the machine is not connected to.
+ /// </summary>
+ Disconnected = 2,
+ /// <summary>
+ /// All networks.
+ /// </summary>
+ All = 3,
+ }
+
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/NetworkListManager.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/NetworkListManager.cs
new file mode 100644
index 0000000000..808ed47113
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/NetworkList/NetworkListManager.cs
@@ -0,0 +1,132 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Net
+{
+ /// <summary>
+ /// Provides access to objects that represent networks and network connections.
+ /// </summary>
+ public static class NetworkListManager
+ {
+ #region Private Fields
+
+ static NetworkListManagerClass manager = new NetworkListManagerClass();
+
+ #endregion // Private Fields
+
+ /// <summary>
+ /// Retrieves a collection of <see cref="Network"/> objects that represent the networks defined for this machine.
+ /// </summary>
+ /// <param name="level">
+ /// The <see cref="NetworkConnectivityLevels"/> that specify the connectivity level of the returned <see cref="Network"/> objects.
+ /// </param>
+ /// <returns>
+ /// A <see cref="NetworkCollection"/> of <see cref="Network"/> objects.
+ /// </returns>
+ public static NetworkCollection GetNetworks(NetworkConnectivityLevels level)
+ {
+ // Throw PlatformNotSupportedException if the user is not running Vista or beyond
+ CoreHelpers.ThrowIfNotVista();
+
+ return new NetworkCollection(manager.GetNetworks(level));
+ }
+
+ /// <summary>
+ /// Retrieves the <see cref="Network"/> identified by the specified network identifier.
+ /// </summary>
+ /// <param name="networkId">
+ /// A <see cref="System.Guid"/> that specifies the unique identifier for the network.
+ /// </param>
+ /// <returns>
+ /// The <see cref="Network"/> that represents the network identified by the identifier.
+ /// </returns>
+ public static Network GetNetwork(Guid networkId)
+ {
+ // Throw PlatformNotSupportedException if the user is not running Vista or beyond
+ CoreHelpers.ThrowIfNotVista();
+
+ return new Network(manager.GetNetwork(networkId));
+ }
+
+ /// <summary>
+ /// Retrieves a collection of <see cref="NetworkConnection"/> objects that represent the connections for this machine.
+ /// </summary>
+ /// <returns>
+ /// A <see cref="NetworkConnectionCollection"/> containing the network connections.
+ /// </returns>
+ public static NetworkConnectionCollection GetNetworkConnections()
+ {
+ // Throw PlatformNotSupportedException if the user is not running Vista or beyond
+ CoreHelpers.ThrowIfNotVista();
+
+ return new NetworkConnectionCollection(manager.GetNetworkConnections());
+ }
+
+ /// <summary>
+ /// Retrieves the <see cref="NetworkConnection"/> identified by the specified connection identifier.
+ /// </summary>
+ /// <param name="networkConnectionId">
+ /// A <see cref="System.Guid"/> that specifies the unique identifier for the network connection.
+ /// </param>
+ /// <returns>
+ /// The <see cref="NetworkConnection"/> identified by the specified identifier.
+ /// </returns>
+ public static NetworkConnection GetNetworkConnection(Guid networkConnectionId)
+ {
+ // Throw PlatformNotSupportedException if the user is not running Vista or beyond
+ CoreHelpers.ThrowIfNotVista();
+
+ return new NetworkConnection(manager.GetNetworkConnection(networkConnectionId));
+ }
+
+ /// <summary>
+ /// Gets a value that indicates whether this machine
+ /// has Internet connectivity.
+ /// </summary>
+ /// <value>A <see cref="System.Boolean"/> value.</value>
+ public static bool IsConnectedToInternet
+ {
+ get
+ {
+ // Throw PlatformNotSupportedException if the user is not running Vista or beyond
+ CoreHelpers.ThrowIfNotVista();
+
+ return manager.IsConnectedToInternet;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value that indicates whether this machine
+ /// has network connectivity.
+ /// </summary>
+ /// <value>A <see cref="System.Boolean"/> value.</value>
+ public static bool IsConnected
+ {
+ get
+ {
+ // Throw PlatformNotSupportedException if the user is not running Vista or beyond
+ CoreHelpers.ThrowIfNotVista();
+
+ return manager.IsConnected;
+ }
+ }
+
+ /// <summary>
+ /// Gets the connectivity state of this machine.
+ /// </summary>
+ /// <value>A <see cref="Connectivity"/> value.</value>
+ public static ConnectivityStates Connectivity
+ {
+ get
+ {
+ // Throw PlatformNotSupportedException if the user is not running Vista or beyond
+ CoreHelpers.ThrowIfNotVista();
+
+ return manager.GetConnectivity();
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/BatteryState.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/BatteryState.cs
new file mode 100644
index 0000000000..0ee82cf9e4
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/BatteryState.cs
@@ -0,0 +1,113 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using Microsoft.WindowsAPICodePack.Resources;
+
+namespace Microsoft.WindowsAPICodePack.ApplicationServices
+{
+ /// <summary>
+ /// A snapshot of the state of the battery.
+ /// </summary>
+ public class BatteryState
+ {
+ internal BatteryState()
+ {
+ var state = Power.GetSystemBatteryState();
+
+ if (!state.BatteryPresent)
+ {
+ throw new InvalidOperationException(LocalizedMessages.PowerManagerBatteryNotPresent);
+ }
+
+ ACOnline = state.AcOnLine;
+ MaxCharge = (int)state.MaxCapacity;
+ CurrentCharge = (int)state.RemainingCapacity;
+ ChargeRate = (int)state.Rate;
+
+ uint estimatedTime = state.EstimatedTime;
+ if (estimatedTime != uint.MaxValue) // uint.MaxValue signifies indefinite estimated time (plugged in)
+ {
+ EstimatedTimeRemaining = new TimeSpan(0, 0, (int)estimatedTime);
+ }
+ else
+ {
+ EstimatedTimeRemaining = TimeSpan.MaxValue;
+ }
+
+ SuggestedCriticalBatteryCharge = (int)state.DefaultAlert1;
+ SuggestedBatteryWarningCharge = (int)state.DefaultAlert2;
+ }
+
+ #region Public properties
+
+ /// <summary>
+ /// Gets a value that indicates whether the battery charger is
+ /// operating on external power.
+ /// </summary>
+ /// <value>A <see cref="System.Boolean"/> value. <b>True</b> indicates the battery charger is operating on AC power.</value>
+ public bool ACOnline { get; private set; }
+
+ /// <summary>
+ /// Gets the maximum charge of the battery (in mW).
+ /// </summary>
+ /// <value>An <see cref="System.Int32"/> value.</value>
+ public int MaxCharge { get; private set; }
+
+ /// <summary>
+ /// Gets the current charge of the battery (in mW).
+ /// </summary>
+ /// <value>An <see cref="System.Int32"/> value.</value>
+ public int CurrentCharge { get; private set; }
+ /// <summary>
+ /// Gets the rate of discharge for the battery (in mW).
+ /// </summary>
+ /// <remarks>
+ /// If plugged in, fully charged: DischargeRate = 0.
+ /// If plugged in, charging: DischargeRate = positive mW per hour.
+ /// If unplugged: DischargeRate = negative mW per hour.
+ /// </remarks>
+ /// <value>An <see cref="System.Int32"/> value.</value>
+ public int ChargeRate { get; private set; }
+
+ /// <summary>
+ /// Gets the estimated time remaining until the battery is empty.
+ /// </summary>
+ /// <value>A <see cref="System.TimeSpan"/> object.</value>
+ public TimeSpan EstimatedTimeRemaining { get; private set; }
+
+ /// <summary>
+ /// Gets the manufacturer's suggested battery charge level
+ /// that should cause a critical alert to be sent to the user.
+ /// </summary>
+ /// <value>An <see cref="System.Int32"/> value.</value>
+ public int SuggestedCriticalBatteryCharge { get; private set; }
+
+ /// <summary>
+ /// Gets the manufacturer's suggested battery charge level
+ /// that should cause a warning to be sent to the user.
+ /// </summary>
+ /// <value>An <see cref="System.Int32"/> value.</value>
+ public int SuggestedBatteryWarningCharge { get; private set; }
+
+ #endregion
+
+ /// <summary>
+ /// Generates a string that represents this <b>BatteryState</b> object.
+ /// </summary>
+ /// <returns>A <see cref="System.String"/> representation of this object's current state.</returns>
+ public override string ToString()
+ {
+ return string.Format(System.Globalization.CultureInfo.InvariantCulture,
+ LocalizedMessages.BatteryStateStringRepresentation,
+ Environment.NewLine,
+ ACOnline,
+ MaxCharge,
+ CurrentCharge,
+ ChargeRate,
+ EstimatedTimeRemaining,
+ SuggestedCriticalBatteryCharge,
+ SuggestedBatteryWarningCharge
+ );
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/EventManager.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/EventManager.cs
new file mode 100644
index 0000000000..c4449e5742
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/EventManager.cs
@@ -0,0 +1,91 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Threading;
+
+namespace Microsoft.WindowsAPICodePack.ApplicationServices
+{
+ /// <summary>
+ /// This class keeps track of the current state of each type of event.
+ /// The MessageManager class tracks event handlers.
+ /// This class only deals with each event type (i.e.
+ /// BatteryLifePercentChanged) as a whole.
+ /// </summary>
+ internal static class EventManager
+ {
+ // Prevents reading from PowerManager members while they are still null.
+ // MessageManager notifies the PowerManager that the member
+ // has been set and can be used.
+ internal static AutoResetEvent monitorOnReset = new AutoResetEvent(false);
+
+ #region Hardcoded GUIDS for each event
+
+ internal static readonly Guid PowerPersonalityChange = new Guid(0x245d8541, 0x3943, 0x4422, 0xb0, 0x25, 0x13, 0xA7, 0x84, 0xF6, 0x79, 0xB7);
+ internal static readonly Guid PowerSourceChange = new Guid(0x5d3e9a59, 0xe9D5, 0x4b00, 0xa6, 0xbd, 0xff, 0x34, 0xff, 0x51, 0x65, 0x48);
+ internal static readonly Guid BatteryCapacityChange = new Guid(0xa7ad8041, 0xb45a, 0x4cae, 0x87, 0xa3, 0xee, 0xcb, 0xb4, 0x68, 0xa9, 0xe1);
+ internal static readonly Guid BackgroundTaskNotification = new Guid(0x515c31d8, 0xf734, 0x163d, 0xa0, 0xfd, 0x11, 0xa0, 0x8c, 0x91, 0xe8, 0xf1);
+ internal static readonly Guid MonitorPowerStatus = new Guid(0x02731015, 0x4510, 0x4526, 0x99, 0xe6, 0xe5, 0xa1, 0x7e, 0xbd, 0x1a, 0xea);
+
+ #endregion
+
+ #region private static members
+
+ // Used to catch the initial message Windows sends when
+ // you first register for a power notification.
+ // We do not want to fire any event handlers when this happens.
+ private static bool personalityCaught;
+ private static bool powerSrcCaught;
+ private static bool batteryLifeCaught;
+ private static bool monitorOnCaught;
+
+ #endregion
+
+ /// <summary>
+ /// Determines if a message should be caught, preventing
+ /// the event handler from executing.
+ /// This is needed when an event is initially registered.
+ /// </summary>
+ /// <param name="eventGuid">The event to check.</param>
+ /// <returns>A boolean value. Returns true if the
+ /// message should be caught.</returns>
+ internal static bool IsMessageCaught(Guid eventGuid)
+ {
+ bool isMessageCaught = false;
+
+ if (eventGuid == EventManager.BatteryCapacityChange)
+ {
+ if (!batteryLifeCaught)
+ {
+ batteryLifeCaught = true;
+ isMessageCaught = true;
+ }
+ }
+ else if (eventGuid == EventManager.MonitorPowerStatus)
+ {
+ if (!monitorOnCaught)
+ {
+ monitorOnCaught = true;
+ isMessageCaught = true;
+ }
+ }
+ else if (eventGuid == EventManager.PowerPersonalityChange)
+ {
+ if (!personalityCaught)
+ {
+ personalityCaught = true;
+ isMessageCaught = true;
+ }
+ }
+ else if (eventGuid == EventManager.PowerSourceChange)
+ {
+ if (!powerSrcCaught)
+ {
+ powerSrcCaught = true;
+ isMessageCaught = true;
+ }
+ }
+
+ return isMessageCaught;
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/ExecutionState.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/ExecutionState.cs
new file mode 100644
index 0000000000..bd2ce7f53c
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/ExecutionState.cs
@@ -0,0 +1,41 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+namespace Microsoft.WindowsAPICodePack.ApplicationServices
+{
+ /// <summary>
+ /// Enumeration of execution states.
+ /// </summary>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2217:DoNotMarkEnumsWithFlags")]
+ [Flags]
+ public enum ExecutionStates
+ {
+ /// <summary>
+ /// No state configured.
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// Forces the system to be in the working state by resetting the system idle timer.
+ /// </summary>
+ SystemRequired = 0x1,
+
+ /// <summary>
+ /// Forces the display to be on by resetting the display idle timer.
+ /// </summary>
+ DisplayRequired = 0x2,
+
+ /// <summary>
+ /// Enables away mode. This value must be specified with ES_CONTINUOUS.
+ /// Away mode should be used only by media-recording and media-distribution applications that must perform critical background processing on desktop computers while the computer appears to be sleeping. See Remarks.
+ ///
+ /// Windows Server 2003 and Windows XP/2000: ES_AWAYMODE_REQUIRED is not supported.
+ /// </summary>
+ AwayModeRequired = 0x40,
+
+ /// <summary>
+ /// Informs the system that the state being set should remain in effect until the next call that uses ES_CONTINUOUS and one of the other state flags is cleared.
+ /// </summary>
+ Continuous = unchecked((int)0x80000000)
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/MessageManager.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/MessageManager.cs
new file mode 100644
index 0000000000..eb656a5041
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/MessageManager.cs
@@ -0,0 +1,180 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections;
+using System.Runtime.InteropServices;
+using System.Threading;
+using System.Windows.Forms;
+using Microsoft.WindowsAPICodePack.Resources;
+
+namespace Microsoft.WindowsAPICodePack.ApplicationServices
+{
+ /// <summary>
+ /// This class generates .NET events based on Windows messages.
+ /// The PowerRegWindow class processes the messages from Windows.
+ /// </summary>
+ internal static class MessageManager
+ {
+ private static object lockObject = new object();
+ private static PowerRegWindow window;
+
+ #region Internal static methods
+
+ /// <summary>
+ /// Registers a callback for a power event.
+ /// </summary>
+ /// <param name="eventId">Guid for the event.</param>
+ /// <param name="eventToRegister">Event handler for the specified event.</param>
+ internal static void RegisterPowerEvent(Guid eventId, EventHandler eventToRegister)
+ {
+ EnsureInitialized();
+ window.RegisterPowerEvent(eventId, eventToRegister);
+ }
+
+ /// <summary>
+ /// Unregisters an event handler for a power event.
+ /// </summary>
+ /// <param name="eventId">Guid for the event.</param>
+ /// <param name="eventToUnregister">Event handler to unregister.</param>
+ internal static void UnregisterPowerEvent(Guid eventId, EventHandler eventToUnregister)
+ {
+ EnsureInitialized();
+ window.UnregisterPowerEvent(eventId, eventToUnregister);
+ }
+
+ #endregion
+
+ /// <summary>
+ /// Ensures that the hidden window is initialized and
+ /// listening for messages.
+ /// </summary>
+ private static void EnsureInitialized()
+ {
+ lock (lockObject)
+ {
+ if (window == null)
+ {
+ // Create a new hidden window to listen
+ // for power management related window messages.
+ window = new PowerRegWindow();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Catch Windows messages and generates events for power specific
+ /// messages.
+ /// </summary>
+ internal class PowerRegWindow : Form
+ {
+ private Hashtable eventList = new Hashtable();
+ private ReaderWriterLock readerWriterLock = new ReaderWriterLock();
+
+ internal PowerRegWindow()
+ : base()
+ {
+
+ }
+
+ #region Internal Methods
+
+ /// <summary>
+ /// Adds an event handler to call when Windows sends
+ /// a message for an event.
+ /// </summary>
+ /// <param name="eventId">Guid for the event.</param>
+ /// <param name="eventToRegister">Event handler for the event.</param>
+ internal void RegisterPowerEvent(Guid eventId, EventHandler eventToRegister)
+ {
+ readerWriterLock.AcquireWriterLock(Timeout.Infinite);
+ if (!eventList.Contains(eventId))
+ {
+ Power.RegisterPowerSettingNotification(this.Handle, eventId);
+ ArrayList newList = new ArrayList();
+ newList.Add(eventToRegister);
+ eventList.Add(eventId, newList);
+ }
+ else
+ {
+ ArrayList currList = (ArrayList)eventList[eventId];
+ currList.Add(eventToRegister);
+ }
+ readerWriterLock.ReleaseWriterLock();
+ }
+
+ /// <summary>
+ /// Removes an event handler.
+ /// </summary>
+ /// <param name="eventId">Guid for the event.</param>
+ /// <param name="eventToUnregister">Event handler to remove.</param>
+ /// <exception cref="InvalidOperationException">Cannot unregister
+ /// a function that is not registered.</exception>
+ internal void UnregisterPowerEvent(Guid eventId, EventHandler eventToUnregister)
+ {
+ readerWriterLock.AcquireWriterLock(Timeout.Infinite);
+ if (eventList.Contains(eventId))
+ {
+ ArrayList currList = (ArrayList)eventList[eventId];
+ currList.Remove(eventToUnregister);
+ }
+ else
+ {
+ throw new InvalidOperationException(LocalizedMessages.MessageManagerHandlerNotRegistered);
+ }
+ readerWriterLock.ReleaseWriterLock();
+ }
+
+ #endregion
+
+ /// <summary>
+ /// Executes any registered event handlers.
+ /// </summary>
+ /// <param name="eventHandlerList">ArrayList of event handlers.</param>
+ private static void ExecuteEvents(ArrayList eventHandlerList)
+ {
+ foreach (EventHandler handler in eventHandlerList)
+ {
+ handler.Invoke(null, new EventArgs());
+ }
+ }
+
+ /// <summary>
+ /// This method is called when a Windows message
+ /// is sent to this window.
+ /// The method calls the registered event handlers.
+ /// </summary>
+ protected override void WndProc(ref Message m)
+ {
+ // Make sure it is a Power Management message.
+ if (m.Msg == PowerManagementNativeMethods.PowerBroadcastMessage &&
+ (int)m.WParam == PowerManagementNativeMethods.PowerSettingChangeMessage)
+ {
+ PowerManagementNativeMethods.PowerBroadcastSetting ps =
+ (PowerManagementNativeMethods.PowerBroadcastSetting)Marshal.PtrToStructure(
+ m.LParam, typeof(PowerManagementNativeMethods.PowerBroadcastSetting));
+
+ IntPtr pData = new IntPtr(m.LParam.ToInt64() + Marshal.SizeOf(ps));
+ Guid currentEvent = ps.PowerSetting;
+
+ // IsMonitorOn
+ if (ps.PowerSetting == EventManager.MonitorPowerStatus &&
+ ps.DataLength == Marshal.SizeOf(typeof(Int32)))
+ {
+ Int32 monitorStatus = (Int32)Marshal.PtrToStructure(pData, typeof(Int32));
+ PowerManager.IsMonitorOn = monitorStatus != 0;
+ EventManager.monitorOnReset.Set();
+ }
+
+ if (!EventManager.IsMessageCaught(currentEvent))
+ {
+ ExecuteEvents((ArrayList)eventList[currentEvent]);
+ }
+ }
+ else
+ base.WndProc(ref m);
+
+ }
+
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/PersonalityGuids.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/PersonalityGuids.cs
new file mode 100644
index 0000000000..30659a61f7
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/PersonalityGuids.cs
@@ -0,0 +1,27 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+
+namespace Microsoft.WindowsAPICodePack.ApplicationServices
+{
+ internal static class PowerPersonalityGuids
+ {
+ internal static readonly Guid HighPerformance = new Guid(0x8c5e7fda, 0xe8bf, 0x4a96, 0x9a, 0x85, 0xa6, 0xe2, 0x3a, 0x8c, 0x63, 0x5c);
+ internal static readonly Guid PowerSaver = new Guid(0xa1841308, 0x3541, 0x4fab, 0xbc, 0x81, 0xf7, 0x15, 0x56, 0xf2, 0x0b, 0x4a);
+ internal static readonly Guid Automatic = new Guid(0x381b4222, 0xf694, 0x41f0, 0x96, 0x85, 0xff, 0x5b, 0xb2, 0x60, 0xdf, 0x2e);
+
+ internal static readonly Guid All = new Guid(0x68A1E95E, 0x13EA, 0x41E1, 0x80, 0x11, 0x0C, 0x49, 0x6C, 0xA4, 0x90, 0xB0);
+
+ internal static PowerPersonality GuidToEnum(Guid guid)
+ {
+ if (guid == HighPerformance)
+ return PowerPersonality.HighPerformance;
+ else if (guid == PowerSaver)
+ return PowerPersonality.PowerSaver;
+ else if (guid == Automatic)
+ return PowerPersonality.Automatic;
+ else
+ return PowerPersonality.Unknown;
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/Power.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/Power.cs
new file mode 100644
index 0000000000..c7488b2b9d
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/Power.cs
@@ -0,0 +1,72 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
+using System.Runtime.InteropServices;
+using MS.WindowsAPICodePack.Internal;
+using Microsoft.WindowsAPICodePack.Resources;
+
+namespace Microsoft.WindowsAPICodePack.ApplicationServices
+{
+ internal static class Power
+ {
+ internal static PowerManagementNativeMethods.SystemPowerCapabilities
+ GetSystemPowerCapabilities()
+ {
+ PowerManagementNativeMethods.SystemPowerCapabilities powerCap;
+
+ uint retval = PowerManagementNativeMethods.CallNtPowerInformation(
+ PowerManagementNativeMethods.PowerInformationLevel.SystemPowerCapabilities,
+ IntPtr.Zero, 0, out powerCap,
+ (UInt32)Marshal.SizeOf(typeof(PowerManagementNativeMethods.SystemPowerCapabilities))
+ );
+
+ if (retval == CoreNativeMethods.StatusAccessDenied)
+ {
+ throw new UnauthorizedAccessException(LocalizedMessages.PowerInsufficientAccessCapabilities);
+ }
+
+ return powerCap;
+ }
+
+ internal static PowerManagementNativeMethods.SystemBatteryState GetSystemBatteryState()
+ {
+ PowerManagementNativeMethods.SystemBatteryState batteryState;
+
+ uint retval = PowerManagementNativeMethods.CallNtPowerInformation(
+ PowerManagementNativeMethods.PowerInformationLevel.SystemBatteryState,
+ IntPtr.Zero, 0, out batteryState,
+ (UInt32)Marshal.SizeOf(typeof(PowerManagementNativeMethods.SystemBatteryState))
+ );
+
+ if (retval == CoreNativeMethods.StatusAccessDenied)
+ {
+ throw new UnauthorizedAccessException(LocalizedMessages.PowerInsufficientAccessBatteryState);
+ }
+
+ return batteryState;
+ }
+
+ /// <summary>
+ /// Registers the application to receive power setting notifications
+ /// for the specific power setting event.
+ /// </summary>
+ /// <param name="handle">Handle indicating where the power setting
+ /// notifications are to be sent.</param>
+ /// <param name="powerSetting">The GUID of the power setting for
+ /// which notifications are to be sent.</param>
+ /// <returns>Returns a notification handle for unregistering
+ /// power notifications.</returns>
+ internal static int RegisterPowerSettingNotification(
+ IntPtr handle, Guid powerSetting)
+ {
+ int outHandle = PowerManagementNativeMethods.RegisterPowerSettingNotification(
+ handle,
+ ref powerSetting,
+ 0);
+
+ return outHandle;
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/PowerManager.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/PowerManager.cs
new file mode 100644
index 0000000000..731fda994c
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/PowerManager.cs
@@ -0,0 +1,404 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Diagnostics.CodeAnalysis;
+using Microsoft.WindowsAPICodePack.Resources;
+using MS.WindowsAPICodePack.Internal;
+using System.ComponentModel;
+
+namespace Microsoft.WindowsAPICodePack.ApplicationServices
+{
+ /// <summary>
+ /// Enables registration for
+ /// power-related event notifications and provides access to power settings.
+ /// </summary>
+ public static class PowerManager
+ {
+ private static bool? isMonitorOn;
+ private static bool monitorRequired;
+ private static bool requestBlockSleep;
+
+ private static readonly object monitoronlock = new object();
+
+
+ #region Notifications
+
+ /// <summary>
+ /// Raised each time the active power scheme changes.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">The event handler specified for removal was not registered.</exception>
+ /// <exception cref="System.PlatformNotSupportedException">Requires Vista/Windows Server 2008.</exception>
+ public static event EventHandler PowerPersonalityChanged
+ {
+ add
+ {
+
+
+ MessageManager.RegisterPowerEvent(
+ EventManager.PowerPersonalityChange, value);
+ }
+
+ remove
+ {
+ CoreHelpers.ThrowIfNotVista();
+
+ MessageManager.UnregisterPowerEvent(
+ EventManager.PowerPersonalityChange, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when the power source changes.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">The event handler specified for removal was not registered.</exception>
+ /// <exception cref="System.PlatformNotSupportedException">Requires Vista/Windows Server 2008.</exception>
+ public static event EventHandler PowerSourceChanged
+ {
+ add
+ {
+ CoreHelpers.ThrowIfNotVista();
+
+ MessageManager.RegisterPowerEvent(
+ EventManager.PowerSourceChange, value);
+ }
+
+ remove
+ {
+ CoreHelpers.ThrowIfNotVista();
+
+ MessageManager.UnregisterPowerEvent(
+ EventManager.PowerSourceChange, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when the remaining battery life changes.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">The event handler specified for removal was not registered.</exception>
+ /// <exception cref="System.PlatformNotSupportedException">Requires Vista/Windows Server 2008.</exception>
+ public static event EventHandler BatteryLifePercentChanged
+ {
+ add
+ {
+ CoreHelpers.ThrowIfNotVista();
+
+ MessageManager.RegisterPowerEvent(
+ EventManager.BatteryCapacityChange, value);
+ }
+ remove
+ {
+ CoreHelpers.ThrowIfNotVista();
+
+ MessageManager.UnregisterPowerEvent(
+ EventManager.BatteryCapacityChange, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when the monitor status changes.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">The event handler specified for removal was not registered.</exception>
+ /// <exception cref="System.PlatformNotSupportedException">Requires Vista/Windows Server 2008.</exception>
+ public static event EventHandler IsMonitorOnChanged
+ {
+ add
+ {
+ CoreHelpers.ThrowIfNotVista();
+
+ MessageManager.RegisterPowerEvent(
+ EventManager.MonitorPowerStatus, value);
+ }
+ remove
+ {
+ CoreHelpers.ThrowIfNotVista();
+
+ MessageManager.UnregisterPowerEvent(
+ EventManager.MonitorPowerStatus, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when the system will not be moving into an idle
+ /// state in the near future so applications should
+ /// perform any tasks that
+ /// would otherwise prevent the computer from entering an idle state.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">The event handler specified for removal was not registered.</exception>
+ /// <exception cref="System.PlatformNotSupportedException">Requires Vista/Windows Server 2008.</exception>
+ public static event EventHandler SystemBusyChanged
+ {
+ add
+ {
+ CoreHelpers.ThrowIfNotVista();
+
+ MessageManager.RegisterPowerEvent(
+ EventManager.BackgroundTaskNotification, value);
+ }
+ remove
+ {
+ CoreHelpers.ThrowIfNotVista();
+
+ MessageManager.UnregisterPowerEvent(
+ EventManager.BackgroundTaskNotification, value);
+ }
+ }
+ #endregion
+
+ /// <summary>
+ /// Gets a snapshot of the current battery state.
+ /// </summary>
+ /// <returns>A <see cref="BatteryState"/> instance that represents
+ /// the state of the battery at the time this method was called.</returns>
+ /// <exception cref="System.InvalidOperationException">The system does not have a battery.</exception>
+ /// <exception cref="System.PlatformNotSupportedException">Requires XP/Windows Server 2003 or higher.</exception>
+ public static BatteryState GetCurrentBatteryState()
+ {
+ CoreHelpers.ThrowIfNotXP();
+ return new BatteryState();
+ }
+
+ #region Power System Properties
+
+ /// <summary>
+ /// Gets or sets a value that indicates whether the monitor is
+ /// set to remain active.
+ /// </summary>
+ /// <exception cref="T:System.PlatformNotSupportedException">Requires XP/Windows Server 2003 or higher.</exception>
+ /// <exception cref="T:System.Security.SecurityException">The caller does not have sufficient privileges to set this property.
+ /// </exception>
+ /// <remarks>This information is typically used by applications
+ /// that display information but do not require
+ /// user interaction. For example, video playback applications.</remarks>
+ /// <permission cref="T:System.Security.Permissions.SecurityPermission"> to set this property. Demand value: <see cref="F:System.Security.Permissions.SecurityAction.Demand"/>; Named Permission Sets: <b>FullTrust</b>.</permission>
+ /// <value>A <see cref="System.Boolean"/> value. <b>True</b> if the monitor
+ /// is required to remain on.</value>
+ public static bool MonitorRequired
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotXP();
+ return monitorRequired;
+ }
+ [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
+ set
+ {
+ CoreHelpers.ThrowIfNotXP();
+
+ if (value)
+ {
+ PowerManager.SetThreadExecutionState(ExecutionStates.Continuous | ExecutionStates.DisplayRequired);
+ }
+ else
+ {
+ PowerManager.SetThreadExecutionState(ExecutionStates.Continuous);
+ }
+
+ monitorRequired = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value that indicates whether the system
+ /// is required to be in the working state.
+ /// </summary>
+ /// <exception cref="System.PlatformNotSupportedException">Requires XP/Windows Server 2003 or higher.</exception>
+ /// <exception cref="System.Security.SecurityException">The caller does not have sufficient privileges to set this property.
+ /// </exception>
+ /// <permission cref="System.Security.Permissions.SecurityPermission"> to set this property. Demand value: <see cref="F:System.Security.Permissions.SecurityAction.Demand"/>; Named Permission Sets: <b>FullTrust</b>.</permission>
+ /// <value>A <see cref="System.Boolean"/> value.</value>
+ public static bool RequestBlockSleep
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotXP();
+
+ return requestBlockSleep;
+ }
+ [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
+ set
+ {
+ CoreHelpers.ThrowIfNotXP();
+
+ if (value)
+ PowerManager.SetThreadExecutionState(ExecutionStates.Continuous | ExecutionStates.SystemRequired);
+ else
+ PowerManager.SetThreadExecutionState(ExecutionStates.Continuous);
+
+ requestBlockSleep = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value that indicates whether a battery is present.
+ /// The battery can be a short term battery.
+ /// </summary>
+ /// <exception cref="System.PlatformNotSupportedException">Requires XP/Windows Server 2003 or higher.</exception>
+ /// <value>A <see cref="System.Boolean"/> value.</value>
+ public static bool IsBatteryPresent
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotXP();
+
+ return Power.GetSystemBatteryState().BatteryPresent;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value that indicates whether the battery is a short term battery.
+ /// </summary>
+ /// <exception cref="System.PlatformNotSupportedException">Requires XP/Windows Server 2003 or higher.</exception>
+ /// <value>A <see cref="System.Boolean"/> value.</value>
+ public static bool IsBatteryShortTerm
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotXP();
+ return Power.GetSystemPowerCapabilities().BatteriesAreShortTerm;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value that indicates a UPS is present to prevent
+ /// sudden loss of power.
+ /// </summary>
+ /// <exception cref="System.PlatformNotSupportedException">Requires XP/Windows Server 2003 or higher.</exception>
+ /// <value>A <see cref="System.Boolean"/> value.</value>
+ public static bool IsUpsPresent
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotXP();
+
+ // Because the native method doesn't return the correct value for .UpsPresent,
+ // use .BatteriesAreShortTerm and .SystemBatteriesPresent to check for UPS
+ PowerManagementNativeMethods.SystemPowerCapabilities batt = Power.GetSystemPowerCapabilities();
+
+ return (batt.BatteriesAreShortTerm && batt.SystemBatteriesPresent);
+ }
+ }
+
+ /// <summary>
+ /// Gets a value that indicates the current power scheme.
+ /// </summary>
+ /// <exception cref="System.PlatformNotSupportedException">Requires Vista/Windows Server 2008.</exception>
+ /// <value>A <see cref="PowerPersonality"/> value.</value>
+ public static PowerPersonality PowerPersonality
+ {
+ get
+ {
+ Guid guid;
+ PowerManagementNativeMethods.PowerGetActiveScheme(IntPtr.Zero, out guid);
+
+ try
+ {
+ return PowerPersonalityGuids.GuidToEnum(guid);
+ }
+ finally
+ {
+ CoreNativeMethods.LocalFree(ref guid);
+ }
+ }
+ }
+
+
+
+ /// <summary>
+ /// Gets a value that indicates the remaining battery life
+ /// (as a percentage of the full battery charge).
+ /// This value is in the range 0-100,
+ /// where 0 is not charged and 100 is fully charged.
+ /// </summary>
+ /// <exception cref="System.InvalidOperationException">The system does not have a battery.</exception>
+ /// <exception cref="System.PlatformNotSupportedException">Requires Vista/Windows Server 2008.</exception>
+ /// <value>An <see cref="System.Int32"/> value.</value>
+ public static int BatteryLifePercent
+ {
+ get
+ {
+ // Because of the way this value is being calculated, it should not be limited to granularity
+ // as the data from the event (old way) was.
+ CoreHelpers.ThrowIfNotVista();
+ if (!Power.GetSystemBatteryState().BatteryPresent)
+ throw new InvalidOperationException(LocalizedMessages.PowerManagerBatteryNotPresent);
+
+ var state = Power.GetSystemBatteryState();
+
+ int percent = (int)Math.Round(((double)state.RemainingCapacity / state.MaxCapacity * 100), 0);
+ return percent;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value that indictates whether the monitor is on.
+ /// </summary>
+ /// <exception cref="System.PlatformNotSupportedException">Requires Vista/Windows Server 2008.</exception>
+ /// <value>A <see cref="System.Boolean"/> value.</value>
+ public static bool IsMonitorOn
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotVista();
+
+ lock (monitoronlock)
+ {
+ if (isMonitorOn == null)
+ {
+ EventHandler dummy = delegate(object sender, EventArgs args) { };
+ IsMonitorOnChanged += dummy;
+ // Wait until Windows updates the power source
+ // (through RegisterPowerSettingNotification)
+ EventManager.monitorOnReset.WaitOne();
+ }
+ }
+
+ return (bool)isMonitorOn;
+ }
+ internal set { isMonitorOn = value; }
+ }
+
+ /// <summary>
+ /// Gets the current power source.
+ /// </summary>
+ /// <exception cref="System.PlatformNotSupportedException">Requires Vista/Windows Server 2008.</exception>
+ /// <value>A <see cref="PowerSource"/> value.</value>
+ public static PowerSource PowerSource
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotVista();
+
+ if (IsUpsPresent)
+ {
+ return PowerSource.Ups;
+ }
+
+ if (!IsBatteryPresent || GetCurrentBatteryState().ACOnline)
+ {
+ return PowerSource.AC;
+ }
+
+ return PowerSource.Battery;
+ }
+ }
+ #endregion
+
+ /// <summary>
+ /// Allows an application to inform the system that it
+ /// is in use, thereby preventing the system from entering
+ /// the sleeping power state or turning off the display
+ /// while the application is running.
+ /// </summary>
+ /// <param name="executionStateOptions">The thread's execution requirements.</param>
+ /// <exception cref="Win32Exception">Thrown if the SetThreadExecutionState call fails.</exception>
+ public static void SetThreadExecutionState(ExecutionStates executionStateOptions)
+ {
+ ExecutionStates ret = PowerManagementNativeMethods.SetThreadExecutionState(executionStateOptions);
+ if (ret == ExecutionStates.None)
+ {
+ throw new Win32Exception(LocalizedMessages.PowerExecutionStateFailed);
+ }
+ }
+
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/PowerManagerException.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/PowerManagerException.cs
new file mode 100644
index 0000000000..725e46c24b
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/PowerManagerException.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.WindowsAPICodePack.ApplicationServices
+{
+ /// <summary>
+ /// This exception is thrown when there are problems with getting piece of data within PowerManager.
+ /// </summary>
+ [Serializable]
+ public class PowerManagerException : Exception
+ {
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ public PowerManagerException() { }
+
+ /// <summary>
+ /// Initializes an excpetion with a custom message.
+ /// </summary>
+ /// <param name="message">A custom message for the exception.</param>
+ public PowerManagerException(string message) : base(message) { }
+
+ /// <summary>
+ /// Initializes an exception with custom message and inner exception.
+ /// </summary>
+ /// <param name="message">A custom message for the exception.</param>
+ /// <param name="innerException">An inner exception on which to base this exception.</param>
+ public PowerManagerException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ /// <summary>
+ /// Initializes an exception from serialization info and a context.
+ /// </summary>
+ /// <param name="info">SerializationInfo for the exception.</param>
+ /// <param name="context">StreamingContext for the exception.</param>
+ protected PowerManagerException(
+ System.Runtime.Serialization.SerializationInfo info,
+ System.Runtime.Serialization.StreamingContext context)
+ : base(info, context)
+ {
+ }
+
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/PowerPersonality.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/PowerPersonality.cs
new file mode 100644
index 0000000000..8eb4cc96f3
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/PowerPersonality.cs
@@ -0,0 +1,33 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.ApplicationServices
+{
+ /// <summary>
+ /// Specifies the supported power personalities.
+ /// </summary>
+ public enum PowerPersonality
+ {
+ /// <summary>
+ /// The power personality Guid does not match a known value.
+ /// </summary>
+ Unknown,
+ /// <summary>
+ /// Power settings designed to deliver maximum performance
+ /// at the expense of power consumption savings.
+ /// </summary>
+ HighPerformance,
+
+ /// <summary>
+ /// Power settings designed consume minimum power
+ /// at the expense of system performance and responsiveness.
+ /// </summary>
+ PowerSaver,
+
+ /// <summary>
+ /// Power settings designed to balance performance
+ /// and power consumption.
+ /// </summary>
+ Automatic
+ }
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/PowerSource.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/PowerSource.cs
new file mode 100644
index 0000000000..b38ce3ca28
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PowerManagement/PowerSource.cs
@@ -0,0 +1,34 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.ApplicationServices
+{
+ /// <summary>
+ /// Specifies the power source currently supplying power to the system.
+ /// </summary>
+ /// <remarks>Application should be aware of the power source because
+ /// some power sources provide a finite power supply.
+ /// An application might take steps to conserve power while
+ /// the system is using such a source.
+ /// </remarks>
+ public enum PowerSource
+ {
+ /// <summary>
+ /// The computer is powered by an AC power source
+ /// or a similar device, such as a laptop powered
+ /// by a 12V automotive adapter.
+ /// </summary>
+ AC = 0,
+ /// <summary>
+ /// The computer is powered by a built-in battery.
+ /// A battery has a limited
+ /// amount of power; applications should conserve resources
+ /// where possible.
+ /// </summary>
+ Battery = 1,
+ /// <summary>
+ /// The computer is powered by a short-term power source
+ /// such as a UPS device.
+ /// </summary>
+ Ups = 2
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Properties/AssemblyInfo.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..58b5bbb2df
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Properties/AssemblyInfo.cs
@@ -0,0 +1,43 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+using System.Resources;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Microsoft.WindowsAPICodePack")]
+[assembly: AssemblyDescription("WindowsAPICodePack Core")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("Microsoft Windows API Code Pack for .NET Framework")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+
+[assembly: InternalsVisibleTo("Microsoft.WindowsAPICodePack.Shell")]
+[assembly: InternalsVisibleTo("Microsoft.WindowsAPICodePack.Sensors")]
+[assembly: InternalsVisibleTo("Microsoft.WindowsAPICodePack.ShellExtensions")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("ac9740bc-3035-43ee-9a68-1dde36ab1f5e")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.1.0.0")]
+[assembly: AssemblyFileVersion("1.1.0.0")]
+[assembly: NeutralResourcesLanguageAttribute("en")]
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PropertySystem/PropVariant.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PropertySystem/PropVariant.cs
new file mode 100644
index 0000000000..cab1623a61
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PropertySystem/PropVariant.cs
@@ -0,0 +1,808 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Resources;
+using Microsoft.WindowsAPICodePack.Shell.PropertySystem;
+
+namespace MS.WindowsAPICodePack.Internal
+{
+ /// <summary>
+ /// Represents the OLE struct PROPVARIANT.
+ /// This class is intended for internal use only.
+ /// </summary>
+ /// <remarks>
+ /// Originally sourced from http://blogs.msdn.com/adamroot/pages/interop-with-propvariants-in-net.aspx
+ /// and modified to support additional types including vectors and ability to set values
+ /// </remarks>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Portability", "CA1900:ValueTypeFieldsShouldBePortable", MessageId = "_ptr2")]
+ [StructLayout(LayoutKind.Explicit)]
+ public sealed class PropVariant : IDisposable
+ {
+ #region Vector Action Cache
+
+ // A static dictionary of delegates to get data from array's contained within PropVariants
+ private static Dictionary<Type, Action<PropVariant, Array, uint>> _vectorActions = null;
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
+ private static Dictionary<Type, Action<PropVariant, Array, uint>> GenerateVectorActions()
+ {
+ Dictionary<Type, Action<PropVariant, Array, uint>> cache = new Dictionary<Type, Action<PropVariant, Array, uint>>();
+
+ cache.Add(typeof(Int16), (pv, array, i) =>
+ {
+ short val;
+ PropVariantNativeMethods.PropVariantGetInt16Elem(pv, i, out val);
+ array.SetValue(val, i);
+ });
+
+ cache.Add(typeof(UInt16), (pv, array, i) =>
+ {
+ ushort val;
+ PropVariantNativeMethods.PropVariantGetUInt16Elem(pv, i, out val);
+ array.SetValue(val, i);
+ });
+
+ cache.Add(typeof(Int32), (pv, array, i) =>
+ {
+ int val;
+ PropVariantNativeMethods.PropVariantGetInt32Elem(pv, i, out val);
+ array.SetValue(val, i);
+ });
+
+ cache.Add(typeof(UInt32), (pv, array, i) =>
+ {
+ uint val;
+ PropVariantNativeMethods.PropVariantGetUInt32Elem(pv, i, out val);
+ array.SetValue(val, i);
+ });
+
+ cache.Add(typeof(Int64), (pv, array, i) =>
+ {
+ long val;
+ PropVariantNativeMethods.PropVariantGetInt64Elem(pv, i, out val);
+ array.SetValue(val, i);
+ });
+
+ cache.Add(typeof(UInt64), (pv, array, i) =>
+ {
+ ulong val;
+ PropVariantNativeMethods.PropVariantGetUInt64Elem(pv, i, out val);
+ array.SetValue(val, i);
+ });
+
+ cache.Add(typeof(DateTime), (pv, array, i) =>
+ {
+ System.Runtime.InteropServices.ComTypes.FILETIME val;
+ PropVariantNativeMethods.PropVariantGetFileTimeElem(pv, i, out val);
+
+ long fileTime = GetFileTimeAsLong(ref val);
+
+ array.SetValue(DateTime.FromFileTime(fileTime), i);
+ });
+
+ cache.Add(typeof(Boolean), (pv, array, i) =>
+ {
+ bool val;
+ PropVariantNativeMethods.PropVariantGetBooleanElem(pv, i, out val);
+ array.SetValue(val, i);
+ });
+
+ cache.Add(typeof(Double), (pv, array, i) =>
+ {
+ double val;
+ PropVariantNativeMethods.PropVariantGetDoubleElem(pv, i, out val);
+ array.SetValue(val, i);
+ });
+
+ cache.Add(typeof(Single), (pv, array, i) => // float
+ {
+ float[] val = new float[1];
+ Marshal.Copy(pv._ptr2, val, (int)i, 1);
+ array.SetValue(val[0], (int)i);
+ });
+
+ cache.Add(typeof(Decimal), (pv, array, i) =>
+ {
+ int[] val = new int[4];
+ for (int a = 0; a < val.Length; a++)
+ {
+ val[a] = Marshal.ReadInt32(pv._ptr2,
+ (int)i * sizeof(decimal) + a * sizeof(int)); //index * size + offset quarter
+ }
+ array.SetValue(new decimal(val), i);
+ });
+
+ cache.Add(typeof(String), (pv, array, i) =>
+ {
+ string val = string.Empty;
+ PropVariantNativeMethods.PropVariantGetStringElem(pv, i, ref val);
+ array.SetValue(val, i);
+ });
+
+ return cache;
+ }
+ #endregion
+
+ #region Dynamic Construction / Factory (Expressions)
+
+ /// <summary>
+ /// Attempts to create a PropVariant by finding an appropriate constructor.
+ /// </summary>
+ /// <param name="value">Object from which PropVariant should be created.</param>
+ public static PropVariant FromObject(object value)
+ {
+ if (value == null)
+ {
+ return new PropVariant();
+ }
+ else
+ {
+ var func = GetDynamicConstructor(value.GetType());
+ return func(value);
+ }
+ }
+
+ // A dictionary and lock to contain compiled expression trees for constructors
+ private static Dictionary<Type, Func<object, PropVariant>> _cache = new Dictionary<Type, Func<object, PropVariant>>();
+ private static object _padlock = new object();
+
+ // Retrieves a cached constructor expression.
+ // If no constructor has been cached, it attempts to find/add it. If it cannot be found
+ // an exception is thrown.
+ // This method looks for a public constructor with the same parameter type as the object.
+ private static Func<object, PropVariant> GetDynamicConstructor(Type type)
+ {
+ lock (_padlock)
+ {
+ // initial check, if action is found, return it
+ Func<object, PropVariant> action;
+ if (!_cache.TryGetValue(type, out action))
+ {
+ // iterates through all constructors
+ ConstructorInfo constructor = typeof(PropVariant)
+ .GetConstructor(new Type[] { type });
+
+ if (constructor == null)
+ { // if the method was not found, throw.
+ throw new ArgumentException(LocalizedMessages.PropVariantTypeNotSupported);
+ }
+ else // if the method was found, create an expression to call it.
+ {
+ // create parameters to action
+ var arg = Expression.Parameter(typeof(object), "arg");
+
+ // create an expression to invoke the constructor with an argument cast to the correct type
+ var create = Expression.New(constructor, Expression.Convert(arg, type));
+
+ // compiles expression into an action delegate
+ action = Expression.Lambda<Func<object, PropVariant>>(create, arg).Compile();
+ _cache.Add(type, action);
+ }
+ }
+ return action;
+ }
+ }
+
+ #endregion
+
+ #region Fields
+
+ [FieldOffset(0)]
+ decimal _decimal;
+
+ // This is actually a VarEnum value, but the VarEnum type
+ // requires 4 bytes instead of the expected 2.
+ [FieldOffset(0)]
+ ushort _valueType;
+
+ // Reserved Fields
+ //[FieldOffset(2)]
+ //ushort _wReserved1;
+ //[FieldOffset(4)]
+ //ushort _wReserved2;
+ //[FieldOffset(6)]
+ //ushort _wReserved3;
+
+ // In order to allow x64 compat, we need to allow for
+ // expansion of the IntPtr. However, the BLOB struct
+ // uses a 4-byte int, followed by an IntPtr, so
+ // although the valueData field catches most pointer values,
+ // we need an additional 4-bytes to get the BLOB
+ // pointer. The valueDataExt field provides this, as well as
+ // the last 4-bytes of an 8-byte value on 32-bit
+ // architectures.
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")]
+ [FieldOffset(12)]
+ IntPtr _ptr2;
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")]
+ [FieldOffset(8)]
+ IntPtr _ptr;
+ [FieldOffset(8)]
+ Int32 _int32;
+ [FieldOffset(8)]
+ UInt32 _uint32;
+ [FieldOffset(8)]
+ byte _byte;
+ [FieldOffset(8)]
+ sbyte _sbyte;
+ [FieldOffset(8)]
+ short _short;
+ [FieldOffset(8)]
+ ushort _ushort;
+ [FieldOffset(8)]
+ long _long;
+ [FieldOffset(8)]
+ ulong _ulong;
+ [FieldOffset(8)]
+ double _double;
+ [FieldOffset(8)]
+ float _float;
+
+ #endregion // struct fields
+
+ #region Constructors
+
+ /// <summary>
+ /// Default constrcutor
+ /// </summary>
+ public PropVariant()
+ {
+ // left empty
+ }
+
+ /// <summary>
+ /// Set a string value
+ /// </summary>
+ public PropVariant(string value)
+ {
+ if (value == null)
+ {
+ throw new ArgumentException(LocalizedMessages.PropVariantNullString, "value");
+ }
+
+ _valueType = (ushort)VarEnum.VT_LPWSTR;
+ _ptr = Marshal.StringToCoTaskMemUni(value);
+ }
+
+ /// <summary>
+ /// Set a string vector
+ /// </summary>
+ public PropVariant(string[] value)
+ {
+ if (value == null) { throw new ArgumentNullException("value"); }
+
+ PropVariantNativeMethods.InitPropVariantFromStringVector(value, (uint)value.Length, this);
+ }
+
+ /// <summary>
+ /// Set a bool vector
+ /// </summary>
+ public PropVariant(bool[] value)
+ {
+ if (value == null) { throw new ArgumentNullException("value"); }
+
+ PropVariantNativeMethods.InitPropVariantFromBooleanVector(value, (uint)value.Length, this);
+ }
+
+ /// <summary>
+ /// Set a short vector
+ /// </summary>
+ public PropVariant(short[] value)
+ {
+ if (value == null) { throw new ArgumentNullException("value"); }
+
+ PropVariantNativeMethods.InitPropVariantFromInt16Vector(value, (uint)value.Length, this);
+ }
+
+ /// <summary>
+ /// Set a short vector
+ /// </summary>
+ public PropVariant(ushort[] value)
+ {
+ if (value == null) { throw new ArgumentNullException("value"); }
+
+ PropVariantNativeMethods.InitPropVariantFromUInt16Vector(value, (uint)value.Length, this);
+
+ }
+
+ /// <summary>
+ /// Set an int vector
+ /// </summary>
+ public PropVariant(int[] value)
+ {
+ if (value == null) { throw new ArgumentNullException("value"); }
+
+ PropVariantNativeMethods.InitPropVariantFromInt32Vector(value, (uint)value.Length, this);
+ }
+
+ /// <summary>
+ /// Set an uint vector
+ /// </summary>
+ public PropVariant(uint[] value)
+ {
+ if (value == null) { throw new ArgumentNullException("value"); }
+
+ PropVariantNativeMethods.InitPropVariantFromUInt32Vector(value, (uint)value.Length, this);
+ }
+
+ /// <summary>
+ /// Set a long vector
+ /// </summary>
+ public PropVariant(long[] value)
+ {
+ if (value == null) { throw new ArgumentNullException("value"); }
+
+ PropVariantNativeMethods.InitPropVariantFromInt64Vector(value, (uint)value.Length, this);
+ }
+
+ /// <summary>
+ /// Set a ulong vector
+ /// </summary>
+ public PropVariant(ulong[] value)
+ {
+ if (value == null) { throw new ArgumentNullException("value"); }
+
+ PropVariantNativeMethods.InitPropVariantFromUInt64Vector(value, (uint)value.Length, this);
+ }
+
+ /// <summary>>
+ /// Set a double vector
+ /// </summary>
+ public PropVariant(double[] value)
+ {
+ if (value == null) { throw new ArgumentNullException("value"); }
+
+ PropVariantNativeMethods.InitPropVariantFromDoubleVector(value, (uint)value.Length, this);
+ }
+
+
+ /// <summary>
+ /// Set a DateTime vector
+ /// </summary>
+ public PropVariant(DateTime[] value)
+ {
+ if (value == null) { throw new ArgumentNullException("value"); }
+ System.Runtime.InteropServices.ComTypes.FILETIME[] fileTimeArr =
+ new System.Runtime.InteropServices.ComTypes.FILETIME[value.Length];
+
+ for (int i = 0; i < value.Length; i++)
+ {
+ fileTimeArr[i] = DateTimeToFileTime(value[i]);
+ }
+
+ PropVariantNativeMethods.InitPropVariantFromFileTimeVector(fileTimeArr, (uint)fileTimeArr.Length, this);
+ }
+
+ /// <summary>
+ /// Set a bool value
+ /// </summary>
+ public PropVariant(bool value)
+ {
+ _valueType = (ushort)VarEnum.VT_BOOL;
+ _int32 = (value == true) ? -1 : 0;
+ }
+
+ /// <summary>
+ /// Set a DateTime value
+ /// </summary>
+ public PropVariant(DateTime value)
+ {
+ _valueType = (ushort)VarEnum.VT_FILETIME;
+
+ System.Runtime.InteropServices.ComTypes.FILETIME ft = DateTimeToFileTime(value);
+ PropVariantNativeMethods.InitPropVariantFromFileTime(ref ft, this);
+ }
+
+
+ /// <summary>
+ /// Set a byte value
+ /// </summary>
+ public PropVariant(byte value)
+ {
+ _valueType = (ushort)VarEnum.VT_UI1;
+ _byte = value;
+ }
+
+ /// <summary>
+ /// Set a sbyte value
+ /// </summary>
+ public PropVariant(sbyte value)
+ {
+ _valueType = (ushort)VarEnum.VT_I1;
+ _sbyte = value;
+ }
+
+ /// <summary>
+ /// Set a short value
+ /// </summary>
+ public PropVariant(short value)
+ {
+ _valueType = (ushort)VarEnum.VT_I2;
+ _short = value;
+ }
+
+ /// <summary>
+ /// Set an unsigned short value
+ /// </summary>
+ public PropVariant(ushort value)
+ {
+ _valueType = (ushort)VarEnum.VT_UI2;
+ _ushort = value;
+ }
+
+ /// <summary>
+ /// Set an int value
+ /// </summary>
+ public PropVariant(int value)
+ {
+ _valueType = (ushort)VarEnum.VT_I4;
+ _int32 = value;
+ }
+
+ /// <summary>
+ /// Set an unsigned int value
+ /// </summary>
+ public PropVariant(uint value)
+ {
+ _valueType = (ushort)VarEnum.VT_UI4;
+ _uint32 = value;
+ }
+
+ /// <summary>
+ /// Set a decimal value
+ /// </summary>
+ public PropVariant(decimal value)
+ {
+ _decimal = value;
+
+ // It is critical that the value type be set after the decimal value, because they overlap.
+ // If valuetype is written first, its value will be lost when _decimal is written.
+ _valueType = (ushort)VarEnum.VT_DECIMAL;
+ }
+
+ /// <summary>
+ /// Create a PropVariant with a contained decimal array.
+ /// </summary>
+ /// <param name="value">Decimal array to wrap.</param>
+ public PropVariant(decimal[] value)
+ {
+ if (value == null) { throw new ArgumentNullException("value"); }
+
+ _valueType = (ushort)(VarEnum.VT_DECIMAL | VarEnum.VT_VECTOR);
+ _int32 = value.Length;
+
+ // allocate required memory for array with 128bit elements
+ _ptr2 = Marshal.AllocCoTaskMem(value.Length * sizeof(decimal));
+ for (int i = 0; i < value.Length; i++)
+ {
+ int[] bits = decimal.GetBits(value[i]);
+ Marshal.Copy(bits, 0, _ptr2, bits.Length);
+ }
+ }
+
+ /// <summary>
+ /// Create a PropVariant containing a float type.
+ /// </summary>
+ public PropVariant(float value)
+ {
+ _valueType = (ushort)VarEnum.VT_R4;
+
+ _float = value;
+ }
+
+ /// <summary>
+ /// Creates a PropVariant containing a float[] array.
+ /// </summary>
+ public PropVariant(float[] value)
+ {
+ if (value == null) { throw new ArgumentNullException("value"); }
+
+ _valueType = (ushort)(VarEnum.VT_R4 | VarEnum.VT_VECTOR);
+ _int32 = value.Length;
+
+ _ptr2 = Marshal.AllocCoTaskMem(value.Length * sizeof(float));
+
+ Marshal.Copy(value, 0, _ptr2, value.Length);
+ }
+
+ /// <summary>
+ /// Set a long
+ /// </summary>
+ public PropVariant(long value)
+ {
+ _long = value;
+ _valueType = (ushort)VarEnum.VT_I8;
+ }
+
+ /// <summary>
+ /// Set a ulong
+ /// </summary>
+ public PropVariant(ulong value)
+ {
+ _valueType = (ushort)VarEnum.VT_UI8;
+ _ulong = value;
+ }
+
+ /// <summary>
+ /// Set a double
+ /// </summary>
+ public PropVariant(double value)
+ {
+ _valueType = (ushort)VarEnum.VT_R8;
+ _double = value;
+ }
+
+ #endregion
+
+ #region Uncalled methods - These are currently not called, but I think may be valid in the future.
+
+ /// <summary>
+ /// Set an IUnknown value
+ /// </summary>
+ /// <param name="value">The new value to set.</param>
+ internal void SetIUnknown(object value)
+ {
+ _valueType = (ushort)VarEnum.VT_UNKNOWN;
+ _ptr = Marshal.GetIUnknownForObject(value);
+ }
+
+
+ /// <summary>
+ /// Set a safe array value
+ /// </summary>
+ /// <param name="array">The new value to set.</param>
+ internal void SetSafeArray(Array array)
+ {
+ if (array == null) { throw new ArgumentNullException("array"); }
+ const ushort vtUnknown = 13;
+ IntPtr psa = PropVariantNativeMethods.SafeArrayCreateVector(vtUnknown, 0, (uint)array.Length);
+
+ IntPtr pvData = PropVariantNativeMethods.SafeArrayAccessData(psa);
+ try // to remember to release lock on data
+ {
+ for (int i = 0; i < array.Length; ++i)
+ {
+ object obj = array.GetValue(i);
+ IntPtr punk = (obj != null) ? Marshal.GetIUnknownForObject(obj) : IntPtr.Zero;
+ Marshal.WriteIntPtr(pvData, i * IntPtr.Size, punk);
+ }
+ }
+ finally
+ {
+ PropVariantNativeMethods.SafeArrayUnaccessData(psa);
+ }
+
+ _valueType = (ushort)VarEnum.VT_ARRAY | (ushort)VarEnum.VT_UNKNOWN;
+ _ptr = psa;
+ }
+
+ #endregion
+
+ #region public Properties
+
+ /// <summary>
+ /// Gets or sets the variant type.
+ /// </summary>
+ public VarEnum VarType
+ {
+ get { return (VarEnum)_valueType; }
+ set { _valueType = (ushort)value; }
+ }
+
+ /// <summary>
+ /// Checks if this has an empty or null value
+ /// </summary>
+ /// <returns></returns>
+ public bool IsNullOrEmpty
+ {
+ get
+ {
+ return (_valueType == (ushort)VarEnum.VT_EMPTY || _valueType == (ushort)VarEnum.VT_NULL);
+ }
+ }
+
+ /// <summary>
+ /// Gets the variant value.
+ /// </summary>
+ public object Value
+ {
+ get
+ {
+ switch ((VarEnum)_valueType)
+ {
+ case VarEnum.VT_I1:
+ return _sbyte;
+ case VarEnum.VT_UI1:
+ return _byte;
+ case VarEnum.VT_I2:
+ return _short;
+ case VarEnum.VT_UI2:
+ return _ushort;
+ case VarEnum.VT_I4:
+ case VarEnum.VT_INT:
+ return _int32;
+ case VarEnum.VT_UI4:
+ case VarEnum.VT_UINT:
+ return _uint32;
+ case VarEnum.VT_I8:
+ return _long;
+ case VarEnum.VT_UI8:
+ return _ulong;
+ case VarEnum.VT_R4:
+ return _float;
+ case VarEnum.VT_R8:
+ return _double;
+ case VarEnum.VT_BOOL:
+ return _int32 == -1;
+ case VarEnum.VT_ERROR:
+ return _long;
+ case VarEnum.VT_CY:
+ return _decimal;
+ case VarEnum.VT_DATE:
+ return DateTime.FromOADate(_double);
+ case VarEnum.VT_FILETIME:
+ return DateTime.FromFileTime(_long);
+ case VarEnum.VT_BSTR:
+ return Marshal.PtrToStringBSTR(_ptr);
+ case VarEnum.VT_BLOB:
+ return GetBlobData();
+ case VarEnum.VT_LPSTR:
+ return Marshal.PtrToStringAnsi(_ptr);
+ case VarEnum.VT_LPWSTR:
+ return Marshal.PtrToStringUni(_ptr);
+ case VarEnum.VT_UNKNOWN:
+ return Marshal.GetObjectForIUnknown(_ptr);
+ case VarEnum.VT_DISPATCH:
+ return Marshal.GetObjectForIUnknown(_ptr);
+ case VarEnum.VT_DECIMAL:
+ return _decimal;
+ case VarEnum.VT_ARRAY | VarEnum.VT_UNKNOWN:
+ return CrackSingleDimSafeArray(_ptr);
+ case (VarEnum.VT_VECTOR | VarEnum.VT_LPWSTR):
+ return GetVector<string>();
+ case (VarEnum.VT_VECTOR | VarEnum.VT_I2):
+ return GetVector<Int16>();
+ case (VarEnum.VT_VECTOR | VarEnum.VT_UI2):
+ return GetVector<UInt16>();
+ case (VarEnum.VT_VECTOR | VarEnum.VT_I4):
+ return GetVector<Int32>();
+ case (VarEnum.VT_VECTOR | VarEnum.VT_UI4):
+ return GetVector<UInt32>();
+ case (VarEnum.VT_VECTOR | VarEnum.VT_I8):
+ return GetVector<Int64>();
+ case (VarEnum.VT_VECTOR | VarEnum.VT_UI8):
+ return GetVector<UInt64>();
+ case (VarEnum.VT_VECTOR|VarEnum.VT_R4):
+ return GetVector<float>();
+ case (VarEnum.VT_VECTOR | VarEnum.VT_R8):
+ return GetVector<Double>();
+ case (VarEnum.VT_VECTOR | VarEnum.VT_BOOL):
+ return GetVector<Boolean>();
+ case (VarEnum.VT_VECTOR | VarEnum.VT_FILETIME):
+ return GetVector<DateTime>();
+ case (VarEnum.VT_VECTOR | VarEnum.VT_DECIMAL):
+ return GetVector<Decimal>();
+ default:
+ // if the value cannot be marshaled
+ return null;
+ }
+ }
+ }
+
+ #endregion
+
+ #region Private Methods
+
+ private static long GetFileTimeAsLong(ref System.Runtime.InteropServices.ComTypes.FILETIME val)
+ {
+ return (((long)val.dwHighDateTime) << 32) + val.dwLowDateTime;
+ }
+
+ private static System.Runtime.InteropServices.ComTypes.FILETIME DateTimeToFileTime(DateTime value)
+ {
+ long hFT = value.ToFileTime();
+ System.Runtime.InteropServices.ComTypes.FILETIME ft =
+ new System.Runtime.InteropServices.ComTypes.FILETIME();
+ ft.dwLowDateTime = (int)(hFT & 0xFFFFFFFF);
+ ft.dwHighDateTime = (int)(hFT >> 32);
+ return ft;
+ }
+
+ private object GetBlobData()
+ {
+ byte[] blobData = new byte[_int32];
+
+ IntPtr pBlobData = _ptr2;
+ Marshal.Copy(pBlobData, blobData, 0, _int32);
+
+ return blobData;
+ }
+
+ private Array GetVector<T>()
+ {
+ int count = PropVariantNativeMethods.PropVariantGetElementCount(this);
+ if (count <= 0) { return null; }
+
+ lock (_padlock)
+ {
+ if (_vectorActions == null)
+ {
+ _vectorActions = GenerateVectorActions();
+ }
+ }
+
+ Action<PropVariant, Array, uint> action;
+ if (!_vectorActions.TryGetValue(typeof(T), out action))
+ {
+ throw new InvalidCastException(LocalizedMessages.PropVariantUnsupportedType);
+ }
+
+ Array array = new T[count];
+ for (uint i = 0; i < count; i++)
+ {
+ action(this, array, i);
+ }
+
+ return array;
+ }
+
+ private static Array CrackSingleDimSafeArray(IntPtr psa)
+ {
+ uint cDims = PropVariantNativeMethods.SafeArrayGetDim(psa);
+ if (cDims != 1)
+ throw new ArgumentException(LocalizedMessages.PropVariantMultiDimArray, "psa");
+
+ int lBound = PropVariantNativeMethods.SafeArrayGetLBound(psa, 1U);
+ int uBound = PropVariantNativeMethods.SafeArrayGetUBound(psa, 1U);
+
+ int n = uBound - lBound + 1; // uBound is inclusive
+
+ object[] array = new object[n];
+ for (int i = lBound; i <= uBound; ++i)
+ {
+ array[i] = PropVariantNativeMethods.SafeArrayGetElement(psa, ref i);
+ }
+
+ return array;
+ }
+
+ #endregion
+
+ #region IDisposable Members
+
+ /// <summary>
+ /// Disposes the object, calls the clear function.
+ /// </summary>
+ public void Dispose()
+ {
+ PropVariantNativeMethods.PropVariantClear(this);
+
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Finalizer
+ /// </summary>
+ ~PropVariant()
+ {
+ Dispose();
+ }
+
+ #endregion
+
+ /// <summary>
+ /// Provides an simple string representation of the contained data and type.
+ /// </summary>
+ /// <returns></returns>
+ public override string ToString()
+ {
+ return string.Format(System.Globalization.CultureInfo.InvariantCulture,
+ "{0}: {1}", Value, VarType.ToString());
+ }
+
+ }
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PropertySystem/PropVariantNativeMethods.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PropertySystem/PropVariantNativeMethods.cs
new file mode 100644
index 0000000000..a685ffb2a2
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PropertySystem/PropVariantNativeMethods.cs
@@ -0,0 +1,107 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem
+{
+ internal static class PropVariantNativeMethods
+ {
+ [DllImport("Ole32.dll", PreserveSig = false)] // returns hresult
+ internal extern static void PropVariantClear([In, Out] PropVariant pvar);
+
+ [DllImport("OleAut32.dll", PreserveSig = true)] // psa is actually returned, not hresult
+ internal extern static IntPtr SafeArrayCreateVector(ushort vt, int lowerBound, uint cElems);
+
+ [DllImport("OleAut32.dll", PreserveSig = false)] // returns hresult
+ internal extern static IntPtr SafeArrayAccessData(IntPtr psa);
+
+ [DllImport("OleAut32.dll", PreserveSig = false)] // returns hresult
+ internal extern static void SafeArrayUnaccessData(IntPtr psa);
+
+ [DllImport("OleAut32.dll", PreserveSig = true)] // retuns uint32
+ internal extern static uint SafeArrayGetDim(IntPtr psa);
+
+ [DllImport("OleAut32.dll", PreserveSig = false)] // returns hresult
+ internal extern static int SafeArrayGetLBound(IntPtr psa, uint nDim);
+
+ [DllImport("OleAut32.dll", PreserveSig = false)] // returns hresult
+ internal extern static int SafeArrayGetUBound(IntPtr psa, uint nDim);
+
+ // This decl for SafeArrayGetElement is only valid for cDims==1!
+ [DllImport("OleAut32.dll", PreserveSig = false)] // returns hresult
+ [return: MarshalAs(UnmanagedType.IUnknown)]
+ internal extern static object SafeArrayGetElement(IntPtr psa, ref int rgIndices);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void InitPropVariantFromPropVariantVectorElem([In] PropVariant propvarIn, uint iElem, [Out] PropVariant ppropvar);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void InitPropVariantFromFileTime([In] ref System.Runtime.InteropServices.ComTypes.FILETIME pftIn, [Out] PropVariant ppropvar);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ [return: MarshalAs(UnmanagedType.I4)]
+ internal static extern int PropVariantGetElementCount([In] PropVariant propVar);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void PropVariantGetBooleanElem([In] PropVariant propVar, [In]uint iElem, [Out, MarshalAs(UnmanagedType.Bool)] out bool pfVal);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void PropVariantGetInt16Elem([In] PropVariant propVar, [In] uint iElem, [Out] out short pnVal);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void PropVariantGetUInt16Elem([In] PropVariant propVar, [In] uint iElem, [Out] out ushort pnVal);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void PropVariantGetInt32Elem([In] PropVariant propVar, [In] uint iElem, [Out] out int pnVal);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void PropVariantGetUInt32Elem([In] PropVariant propVar, [In] uint iElem, [Out] out uint pnVal);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void PropVariantGetInt64Elem([In] PropVariant propVar, [In] uint iElem, [Out] out Int64 pnVal);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void PropVariantGetUInt64Elem([In] PropVariant propVar, [In] uint iElem, [Out] out UInt64 pnVal);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void PropVariantGetDoubleElem([In] PropVariant propVar, [In] uint iElem, [Out] out double pnVal);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void PropVariantGetFileTimeElem([In] PropVariant propVar, [In] uint iElem, [Out, MarshalAs(UnmanagedType.Struct)] out System.Runtime.InteropServices.ComTypes.FILETIME pftVal);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void PropVariantGetStringElem([In] PropVariant propVar, [In] uint iElem, [MarshalAs(UnmanagedType.LPWStr)] ref string ppszVal);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void InitPropVariantFromBooleanVector([In, MarshalAs(UnmanagedType.LPArray)] bool[] prgf, uint cElems, [Out] PropVariant ppropvar);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void InitPropVariantFromInt16Vector([In, Out] Int16[] prgn, uint cElems, [Out] PropVariant ppropvar);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void InitPropVariantFromUInt16Vector([In, Out] UInt16[] prgn, uint cElems, [Out] PropVariant ppropvar);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void InitPropVariantFromInt32Vector([In, Out] Int32[] prgn, uint cElems, [Out] PropVariant propVar);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void InitPropVariantFromUInt32Vector([In, Out] UInt32[] prgn, uint cElems, [Out] PropVariant ppropvar);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void InitPropVariantFromInt64Vector([In, Out] Int64[] prgn, uint cElems, [Out] PropVariant ppropvar);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void InitPropVariantFromUInt64Vector([In, Out] UInt64[] prgn, uint cElems, [Out] PropVariant ppropvar);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void InitPropVariantFromDoubleVector([In, Out] double[] prgn, uint cElems, [Out] PropVariant propvar);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void InitPropVariantFromFileTimeVector([In, Out] System.Runtime.InteropServices.ComTypes.FILETIME[] prgft, uint cElems, [Out] PropVariant ppropvar);
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true, PreserveSig = false)]
+ internal static extern void InitPropVariantFromStringVector([In, Out] string[] prgsz, uint cElems, [Out] PropVariant ppropvar);
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PropertySystem/PropertyKey.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PropertySystem/PropertyKey.cs
new file mode 100644
index 0000000000..474668a21d
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/PropertySystem/PropertyKey.cs
@@ -0,0 +1,150 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem
+{
+ /// <summary>
+ /// Defines a unique key for a Shell Property
+ /// </summary>
+ [StructLayout(LayoutKind.Sequential, Pack = 4)]
+ public struct PropertyKey : IEquatable<PropertyKey>
+ {
+ #region Private Fields
+
+ private Guid formatId;
+ private Int32 propertyId;
+
+ #endregion
+
+ #region Public Properties
+ /// <summary>
+ /// A unique GUID for the property
+ /// </summary>
+ public Guid FormatId
+ {
+ get
+ {
+ return formatId;
+ }
+ }
+
+ /// <summary>
+ /// Property identifier (PID)
+ /// </summary>
+ public Int32 PropertyId
+ {
+ get
+ {
+ return propertyId;
+ }
+ }
+
+ #endregion
+
+ #region Public Construction
+
+ /// <summary>
+ /// PropertyKey Constructor
+ /// </summary>
+ /// <param name="formatId">A unique GUID for the property</param>
+ /// <param name="propertyId">Property identifier (PID)</param>
+ public PropertyKey(Guid formatId, Int32 propertyId)
+ {
+ this.formatId = formatId;
+ this.propertyId = propertyId;
+ }
+
+ /// <summary>
+ /// PropertyKey Constructor
+ /// </summary>
+ /// <param name="formatId">A string represenstion of a GUID for the property</param>
+ /// <param name="propertyId">Property identifier (PID)</param>
+ public PropertyKey(string formatId, Int32 propertyId)
+ {
+ this.formatId = new Guid(formatId);
+ this.propertyId = propertyId;
+ }
+
+ #endregion
+
+ #region IEquatable<PropertyKey> Members
+
+ /// <summary>
+ /// Returns whether this object is equal to another. This is vital for performance of value types.
+ /// </summary>
+ /// <param name="other">The object to compare against.</param>
+ /// <returns>Equality result.</returns>
+ public bool Equals(PropertyKey other)
+ {
+ return other.Equals((object)this);
+ }
+
+ #endregion
+
+ #region equality and hashing
+
+ /// <summary>
+ /// Returns the hash code of the object. This is vital for performance of value types.
+ /// </summary>
+ /// <returns></returns>
+ public override int GetHashCode()
+ {
+ return formatId.GetHashCode() ^ propertyId;
+ }
+
+ /// <summary>
+ /// Returns whether this object is equal to another. This is vital for performance of value types.
+ /// </summary>
+ /// <param name="obj">The object to compare against.</param>
+ /// <returns>Equality result.</returns>
+ public override bool Equals(object obj)
+ {
+ if (obj == null)
+ return false;
+
+ if (!(obj is PropertyKey))
+ return false;
+
+ PropertyKey other = (PropertyKey)obj;
+ return other.formatId.Equals(formatId) && (other.propertyId == propertyId);
+ }
+
+ /// <summary>
+ /// Implements the == (equality) operator.
+ /// </summary>
+ /// <param name="propKey1">First property key to compare.</param>
+ /// <param name="propKey2">Second property key to compare.</param>
+ /// <returns>true if object a equals object b. false otherwise.</returns>
+ public static bool operator ==(PropertyKey propKey1, PropertyKey propKey2)
+ {
+ return propKey1.Equals(propKey2);
+ }
+
+ /// <summary>
+ /// Implements the != (inequality) operator.
+ /// </summary>
+ /// <param name="propKey1">First property key to compare</param>
+ /// <param name="propKey2">Second property key to compare.</param>
+ /// <returns>true if object a does not equal object b. false otherwise.</returns>
+ public static bool operator !=(PropertyKey propKey1, PropertyKey propKey2)
+ {
+ return !propKey1.Equals(propKey2);
+ }
+
+ /// <summary>
+ /// Override ToString() to provide a user friendly string representation
+ /// </summary>
+ /// <returns>String representing the property key</returns>
+ public override string ToString()
+ {
+ return string.Format(System.Globalization.CultureInfo.InvariantCulture,
+ LocalizedMessages.PropertyKeyFormatString,
+ formatId.ToString("B"), propertyId);
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Resources/LocalizedMessages.Designer.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Resources/LocalizedMessages.Designer.cs
new file mode 100644
index 0000000000..4a8de6309e
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Resources/LocalizedMessages.Designer.cs
@@ -0,0 +1,675 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.1
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Microsoft.WindowsAPICodePack.Resources {
+ using System;
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class LocalizedMessages {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal LocalizedMessages() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.WindowsAPICodePack.Resources.LocalizedMessages", typeof(LocalizedMessages).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Failed to register application for restart due to bad parameters..
+ /// </summary>
+ internal static string ApplicationRecoverFailedToRegisterForRestartBadParameters {
+ get {
+ return ResourceManager.GetString("ApplicationRecoverFailedToRegisterForRestartBadParameters", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Application was not registered for recovery due to bad parameters..
+ /// </summary>
+ internal static string ApplicationRecoveryBadParameters {
+ get {
+ return ResourceManager.GetString("ApplicationRecoveryBadParameters", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Application failed to register for recovery..
+ /// </summary>
+ internal static string ApplicationRecoveryFailedToRegister {
+ get {
+ return ResourceManager.GetString("ApplicationRecoveryFailedToRegister", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Application failed to registered for restart..
+ /// </summary>
+ internal static string ApplicationRecoveryFailedToRegisterForRestart {
+ get {
+ return ResourceManager.GetString("ApplicationRecoveryFailedToRegisterForRestart", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unregister for recovery failed..
+ /// </summary>
+ internal static string ApplicationRecoveryFailedToUnregister {
+ get {
+ return ResourceManager.GetString("ApplicationRecoveryFailedToUnregister", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unregister for restart failed..
+ /// </summary>
+ internal static string ApplicationRecoveryFailedToUnregisterForRestart {
+ get {
+ return ResourceManager.GetString("ApplicationRecoveryFailedToUnregisterForRestart", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to This method must be called from the registered callback method..
+ /// </summary>
+ internal static string ApplicationRecoveryMustBeCalledFromCallback {
+ get {
+ return ResourceManager.GetString("ApplicationRecoveryMustBeCalledFromCallback", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to ACOnline: {1}{0}Max Charge: {2} mWh{0}Current Charge: {3} mWh{0}Discharge Rate: {4} mWh{0}Estimated Time Remaining: {5}{0}Suggested Critical Battery Charge: {6} mWh{0}Suggested Battery Warning Charge: {7} mWh{0}.
+ /// </summary>
+ internal static string BatteryStateStringRepresentation {
+ get {
+ return ResourceManager.GetString("BatteryStateStringRepresentation", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cancelable cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string CancelableCannotBeChanged {
+ get {
+ return ResourceManager.GetString("CancelableCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Dialog caption cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string CaptionCannotBeChanged {
+ get {
+ return ResourceManager.GetString("CaptionCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to CheckBox text cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string CheckBoxCannotBeChanged {
+ get {
+ return ResourceManager.GetString("CheckBoxCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Collapsed control text cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string CollapsedTextCannotBeChanged {
+ get {
+ return ResourceManager.GetString("CollapsedTextCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Only supported on Windows 7 or newer..
+ /// </summary>
+ internal static string CoreHelpersRunningOn7 {
+ get {
+ return ResourceManager.GetString("CoreHelpersRunningOn7", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Only supported on Windows Vista or newer..
+ /// </summary>
+ internal static string CoreHelpersRunningOnVista {
+ get {
+ return ResourceManager.GetString("CoreHelpersRunningOnVista", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Only supported on Windows XP or newer..
+ /// </summary>
+ internal static string CoreHelpersRunningOnXp {
+ get {
+ return ResourceManager.GetString("CoreHelpersRunningOnXp", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Dialog cannot have more than one control with the same name..
+ /// </summary>
+ internal static string DialogCollectionCannotHaveDuplicateNames {
+ get {
+ return ResourceManager.GetString("DialogCollectionCannotHaveDuplicateNames", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Dialog control must be removed from current collections first..
+ /// </summary>
+ internal static string DialogCollectionControlAlreadyHosted {
+ get {
+ return ResourceManager.GetString("DialogCollectionControlAlreadyHosted", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Control name cannot be null or zero length..
+ /// </summary>
+ internal static string DialogCollectionControlNameNull {
+ get {
+ return ResourceManager.GetString("DialogCollectionControlNameNull", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Modifying controls collection while dialog is showing is not supported..
+ /// </summary>
+ internal static string DialogCollectionModifyShowingDialog {
+ get {
+ return ResourceManager.GetString("DialogCollectionModifyShowingDialog", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Dialog control name cannot be empty or null..
+ /// </summary>
+ internal static string DialogControlNameCannotBeEmpty {
+ get {
+ return ResourceManager.GetString("DialogControlNameCannotBeEmpty", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Dialog controls cannot be renamed..
+ /// </summary>
+ internal static string DialogControlsCannotBeRenamed {
+ get {
+ return ResourceManager.GetString("DialogControlsCannotBeRenamed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Application.
+ /// </summary>
+ internal static string DialogDefaultCaption {
+ get {
+ return ResourceManager.GetString("DialogDefaultCaption", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to .
+ /// </summary>
+ internal static string DialogDefaultContent {
+ get {
+ return ResourceManager.GetString("DialogDefaultContent", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to .
+ /// </summary>
+ internal static string DialogDefaultMainInstruction {
+ get {
+ return ResourceManager.GetString("DialogDefaultMainInstruction", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Expanded information mode cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string ExpandedDetailsCannotBeChanged {
+ get {
+ return ResourceManager.GetString("ExpandedDetailsCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Expanded control label cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string ExpandedLabelCannotBeChanged {
+ get {
+ return ResourceManager.GetString("ExpandedLabelCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Expanding state of the dialog cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string ExpandingStateCannotBeChanged {
+ get {
+ return ResourceManager.GetString("ExpandingStateCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Hyperlinks cannot be enabled/disabled while dialog is showing..
+ /// </summary>
+ internal static string HyperlinksCannotBetSet {
+ get {
+ return ResourceManager.GetString("HyperlinksCannotBetSet", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Reference path is invalid..
+ /// </summary>
+ internal static string InvalidReferencePath {
+ get {
+ return ResourceManager.GetString("InvalidReferencePath", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The specified event handler has not been registered..
+ /// </summary>
+ internal static string MessageManagerHandlerNotRegistered {
+ get {
+ return ResourceManager.GetString("MessageManagerHandlerNotRegistered", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to An error has occurred in dialog configuration..
+ /// </summary>
+ internal static string NativeTaskDialogConfigurationError {
+ get {
+ return ResourceManager.GetString("NativeTaskDialogConfigurationError", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Invalid arguments to Win32 call..
+ /// </summary>
+ internal static string NativeTaskDialogInternalErrorArgs {
+ get {
+ return ResourceManager.GetString("NativeTaskDialogInternalErrorArgs", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Dialog contents too complex..
+ /// </summary>
+ internal static string NativeTaskDialogInternalErrorComplex {
+ get {
+ return ResourceManager.GetString("NativeTaskDialogInternalErrorComplex", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to An unexpected internal error occurred in the Win32 call: {0:x}.
+ /// </summary>
+ internal static string NativeTaskDialogInternalErrorUnexpected {
+ get {
+ return ResourceManager.GetString("NativeTaskDialogInternalErrorUnexpected", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to TaskDialog feature needs to load version 6 of comctl32.dll but a different version is current loaded in memory..
+ /// </summary>
+ internal static string NativeTaskDialogVersionError {
+ get {
+ return ResourceManager.GetString("NativeTaskDialogVersionError", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Dialog owner cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string OwnerCannotBeChanged {
+ get {
+ return ResourceManager.GetString("OwnerCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to SetThreadExecutionState call failed..
+ /// </summary>
+ internal static string PowerExecutionStateFailed {
+ get {
+ return ResourceManager.GetString("PowerExecutionStateFailed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The caller had insufficient access rights to get the system battery state..
+ /// </summary>
+ internal static string PowerInsufficientAccessBatteryState {
+ get {
+ return ResourceManager.GetString("PowerInsufficientAccessBatteryState", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The caller had insufficient access rights to get the system power capabilities..
+ /// </summary>
+ internal static string PowerInsufficientAccessCapabilities {
+ get {
+ return ResourceManager.GetString("PowerInsufficientAccessCapabilities", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Failed to get active power scheme..
+ /// </summary>
+ internal static string PowerManagerActiveSchemeFailed {
+ get {
+ return ResourceManager.GetString("PowerManagerActiveSchemeFailed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Battery is not present on this system..
+ /// </summary>
+ internal static string PowerManagerBatteryNotPresent {
+ get {
+ return ResourceManager.GetString("PowerManagerBatteryNotPresent", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Progress bar cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string ProgressBarCannotBeChanged {
+ get {
+ return ResourceManager.GetString("ProgressBarCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Progress bar cannot be hosted in multiple dialogs..
+ /// </summary>
+ internal static string ProgressBarCannotBeHostedInMultipleDialogs {
+ get {
+ return ResourceManager.GetString("ProgressBarCannotBeHostedInMultipleDialogs", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to {0}, {1}.
+ /// </summary>
+ internal static string PropertyKeyFormatString {
+ get {
+ return ResourceManager.GetString("PropertyKeyFormatString", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unable to initialize PropVariant..
+ /// </summary>
+ internal static string PropVariantInitializationError {
+ get {
+ return ResourceManager.GetString("PropVariantInitializationError", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Multi-dimensional SafeArrays not supported..
+ /// </summary>
+ internal static string PropVariantMultiDimArray {
+ get {
+ return ResourceManager.GetString("PropVariantMultiDimArray", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to String argument cannot be null or empty..
+ /// </summary>
+ internal static string PropVariantNullString {
+ get {
+ return ResourceManager.GetString("PropVariantNullString", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to This Value type is not supported..
+ /// </summary>
+ internal static string PropVariantTypeNotSupported {
+ get {
+ return ResourceManager.GetString("PropVariantTypeNotSupported", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot be cast to unsupported type..
+ /// </summary>
+ internal static string PropVariantUnsupportedType {
+ get {
+ return ResourceManager.GetString("PropVariantUnsupportedType", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to delegate: {0}, state: {1}, ping: {2}.
+ /// </summary>
+ internal static string RecoverySettingsFormatString {
+ get {
+ return ResourceManager.GetString("RecoverySettingsFormatString", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to command: {0} restrictions: {1}.
+ /// </summary>
+ internal static string RestartSettingsFormatString {
+ get {
+ return ResourceManager.GetString("RestartSettingsFormatString", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to StandardButtons cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string StandardButtonsCannotBeChanged {
+ get {
+ return ResourceManager.GetString("StandardButtonsCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Startup location cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string StartupLocationCannotBeChanged {
+ get {
+ return ResourceManager.GetString("StartupLocationCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Bad button ID in closing event..
+ /// </summary>
+ internal static string TaskDialogBadButtonId {
+ get {
+ return ResourceManager.GetString("TaskDialogBadButtonId", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Button text must be non-empty..
+ /// </summary>
+ internal static string TaskDialogButtonTextEmpty {
+ get {
+ return ResourceManager.GetString("TaskDialogButtonTextEmpty", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Check box text must be provided to enable the dialog check box..
+ /// </summary>
+ internal static string TaskDialogCheckBoxTextRequiredToEnableCheckBox {
+ get {
+ return ResourceManager.GetString("TaskDialogCheckBoxTextRequiredToEnableCheckBox", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Attempting to close a non-showing dialog..
+ /// </summary>
+ internal static string TaskDialogCloseNonShowing {
+ get {
+ return ResourceManager.GetString("TaskDialogCloseNonShowing", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Application.
+ /// </summary>
+ internal static string TaskDialogDefaultCaption {
+ get {
+ return ResourceManager.GetString("TaskDialogDefaultCaption", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to .
+ /// </summary>
+ internal static string TaskDialogDefaultContent {
+ get {
+ return ResourceManager.GetString("TaskDialogDefaultContent", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to .
+ /// </summary>
+ internal static string TaskDialogDefaultMainInstruction {
+ get {
+ return ResourceManager.GetString("TaskDialogDefaultMainInstruction", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot have more than one default button of a given type..
+ /// </summary>
+ internal static string TaskDialogOnlyOneDefaultControl {
+ get {
+ return ResourceManager.GetString("TaskDialogOnlyOneDefaultControl", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Maximum value provided must be greater than the minimum value..
+ /// </summary>
+ internal static string TaskDialogProgressBarMaxValueGreaterThanMin {
+ get {
+ return ResourceManager.GetString("TaskDialogProgressBarMaxValueGreaterThanMin", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Minimum value provided must be a positive number..
+ /// </summary>
+ internal static string TaskDialogProgressBarMinValueGreaterThanZero {
+ get {
+ return ResourceManager.GetString("TaskDialogProgressBarMinValueGreaterThanZero", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Minimum value provided must less than the maximum value..
+ /// </summary>
+ internal static string TaskDialogProgressBarMinValueLessThanMax {
+ get {
+ return ResourceManager.GetString("TaskDialogProgressBarMinValueLessThanMax", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Value provided must be greater than equal to the minimum value and less than the maximum value..
+ /// </summary>
+ internal static string TaskDialogProgressBarValueInRange {
+ get {
+ return ResourceManager.GetString("TaskDialogProgressBarValueInRange", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Dialog cannot display both non-standard buttons and standard buttons..
+ /// </summary>
+ internal static string TaskDialogSupportedButtonsAndButtons {
+ get {
+ return ResourceManager.GetString("TaskDialogSupportedButtonsAndButtons", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Dialog cannot display both non-standard buttons and command links..
+ /// </summary>
+ internal static string TaskDialogSupportedButtonsAndLinks {
+ get {
+ return ResourceManager.GetString("TaskDialogSupportedButtonsAndLinks", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unknown dialog control type..
+ /// </summary>
+ internal static string TaskDialogUnkownControl {
+ get {
+ return ResourceManager.GetString("TaskDialogUnkownControl", resourceCulture);
+ }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Resources/LocalizedMessages.resx b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Resources/LocalizedMessages.resx
new file mode 100644
index 0000000000..40600e161a
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Resources/LocalizedMessages.resx
@@ -0,0 +1,324 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="ApplicationRecoverFailedToRegisterForRestartBadParameters" xml:space="preserve">
+ <value>Failed to register application for restart due to bad parameters.</value>
+ </data>
+ <data name="ApplicationRecoveryBadParameters" xml:space="preserve">
+ <value>Application was not registered for recovery due to bad parameters.</value>
+ </data>
+ <data name="ApplicationRecoveryFailedToRegister" xml:space="preserve">
+ <value>Application failed to register for recovery.</value>
+ </data>
+ <data name="ApplicationRecoveryFailedToRegisterForRestart" xml:space="preserve">
+ <value>Application failed to registered for restart.</value>
+ </data>
+ <data name="ApplicationRecoveryFailedToUnregister" xml:space="preserve">
+ <value>Unregister for recovery failed.</value>
+ </data>
+ <data name="ApplicationRecoveryFailedToUnregisterForRestart" xml:space="preserve">
+ <value>Unregister for restart failed.</value>
+ </data>
+ <data name="ApplicationRecoveryMustBeCalledFromCallback" xml:space="preserve">
+ <value>This method must be called from the registered callback method.</value>
+ </data>
+ <data name="BatteryStateStringRepresentation" xml:space="preserve">
+ <value>ACOnline: {1}{0}Max Charge: {2} mWh{0}Current Charge: {3} mWh{0}Discharge Rate: {4} mWh{0}Estimated Time Remaining: {5}{0}Suggested Critical Battery Charge: {6} mWh{0}Suggested Battery Warning Charge: {7} mWh{0}</value>
+ </data>
+ <data name="CancelableCannotBeChanged" xml:space="preserve">
+ <value>Cancelable cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="CaptionCannotBeChanged" xml:space="preserve">
+ <value>Dialog caption cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="CheckBoxCannotBeChanged" xml:space="preserve">
+ <value>CheckBox text cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="CollapsedTextCannotBeChanged" xml:space="preserve">
+ <value>Collapsed control text cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="CoreHelpersRunningOn7" xml:space="preserve">
+ <value>Only supported on Windows 7 or newer.</value>
+ </data>
+ <data name="CoreHelpersRunningOnVista" xml:space="preserve">
+ <value>Only supported on Windows Vista or newer.</value>
+ </data>
+ <data name="CoreHelpersRunningOnXp" xml:space="preserve">
+ <value>Only supported on Windows XP or newer.</value>
+ </data>
+ <data name="DialogCollectionCannotHaveDuplicateNames" xml:space="preserve">
+ <value>Dialog cannot have more than one control with the same name.</value>
+ </data>
+ <data name="DialogCollectionControlAlreadyHosted" xml:space="preserve">
+ <value>Dialog control must be removed from current collections first.</value>
+ </data>
+ <data name="DialogCollectionControlNameNull" xml:space="preserve">
+ <value>Control name cannot be null or zero length.</value>
+ </data>
+ <data name="DialogCollectionModifyShowingDialog" xml:space="preserve">
+ <value>Modifying controls collection while dialog is showing is not supported.</value>
+ </data>
+ <data name="DialogControlNameCannotBeEmpty" xml:space="preserve">
+ <value>Dialog control name cannot be empty or null.</value>
+ </data>
+ <data name="DialogControlsCannotBeRenamed" xml:space="preserve">
+ <value>Dialog controls cannot be renamed.</value>
+ </data>
+ <data name="DialogDefaultCaption" xml:space="preserve">
+ <value>Application</value>
+ </data>
+ <data name="DialogDefaultContent" xml:space="preserve">
+ <value />
+ </data>
+ <data name="DialogDefaultMainInstruction" xml:space="preserve">
+ <value />
+ </data>
+ <data name="ExpandedDetailsCannotBeChanged" xml:space="preserve">
+ <value>Expanded information mode cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="ExpandedLabelCannotBeChanged" xml:space="preserve">
+ <value>Expanded control label cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="ExpandingStateCannotBeChanged" xml:space="preserve">
+ <value>Expanding state of the dialog cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="HyperlinksCannotBetSet" xml:space="preserve">
+ <value>Hyperlinks cannot be enabled/disabled while dialog is showing.</value>
+ </data>
+ <data name="InvalidReferencePath" xml:space="preserve">
+ <value>Reference path is invalid.</value>
+ </data>
+ <data name="MessageManagerHandlerNotRegistered" xml:space="preserve">
+ <value>The specified event handler has not been registered.</value>
+ </data>
+ <data name="NativeTaskDialogConfigurationError" xml:space="preserve">
+ <value>An error has occurred in dialog configuration.</value>
+ </data>
+ <data name="NativeTaskDialogInternalErrorArgs" xml:space="preserve">
+ <value>Invalid arguments to Win32 call.</value>
+ </data>
+ <data name="NativeTaskDialogInternalErrorComplex" xml:space="preserve">
+ <value>Dialog contents too complex.</value>
+ </data>
+ <data name="NativeTaskDialogInternalErrorUnexpected" xml:space="preserve">
+ <value>An unexpected internal error occurred in the Win32 call: {0:x}</value>
+ </data>
+ <data name="NativeTaskDialogVersionError" xml:space="preserve">
+ <value>TaskDialog feature needs to load version 6 of comctl32.dll but a different version is current loaded in memory.</value>
+ </data>
+ <data name="OwnerCannotBeChanged" xml:space="preserve">
+ <value>Dialog owner cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="PowerExecutionStateFailed" xml:space="preserve">
+ <value>SetThreadExecutionState call failed.</value>
+ </data>
+ <data name="PowerInsufficientAccessBatteryState" xml:space="preserve">
+ <value>The caller had insufficient access rights to get the system battery state.</value>
+ </data>
+ <data name="PowerInsufficientAccessCapabilities" xml:space="preserve">
+ <value>The caller had insufficient access rights to get the system power capabilities.</value>
+ </data>
+ <data name="PowerManagerBatteryNotPresent" xml:space="preserve">
+ <value>Battery is not present on this system.</value>
+ </data>
+ <data name="ProgressBarCannotBeChanged" xml:space="preserve">
+ <value>Progress bar cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="ProgressBarCannotBeHostedInMultipleDialogs" xml:space="preserve">
+ <value>Progress bar cannot be hosted in multiple dialogs.</value>
+ </data>
+ <data name="PropertyKeyFormatString" xml:space="preserve">
+ <value>{0}, {1}</value>
+ </data>
+ <data name="PropVariantMultiDimArray" xml:space="preserve">
+ <value>Multi-dimensional SafeArrays not supported.</value>
+ </data>
+ <data name="PropVariantNullString" xml:space="preserve">
+ <value>String argument cannot be null or empty.</value>
+ </data>
+ <data name="PropVariantTypeNotSupported" xml:space="preserve">
+ <value>This Value type is not supported.</value>
+ </data>
+ <data name="RecoverySettingsFormatString" xml:space="preserve">
+ <value>delegate: {0}, state: {1}, ping: {2}</value>
+ </data>
+ <data name="RestartSettingsFormatString" xml:space="preserve">
+ <value>command: {0} restrictions: {1}</value>
+ </data>
+ <data name="StandardButtonsCannotBeChanged" xml:space="preserve">
+ <value>StandardButtons cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="StartupLocationCannotBeChanged" xml:space="preserve">
+ <value>Startup location cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="TaskDialogBadButtonId" xml:space="preserve">
+ <value>Bad button ID in closing event.</value>
+ </data>
+ <data name="TaskDialogButtonTextEmpty" xml:space="preserve">
+ <value>Button text must be non-empty.</value>
+ </data>
+ <data name="TaskDialogCheckBoxTextRequiredToEnableCheckBox" xml:space="preserve">
+ <value>Check box text must be provided to enable the dialog check box.</value>
+ </data>
+ <data name="TaskDialogCloseNonShowing" xml:space="preserve">
+ <value>Attempting to close a non-showing dialog.</value>
+ </data>
+ <data name="TaskDialogDefaultCaption" xml:space="preserve">
+ <value>Application</value>
+ </data>
+ <data name="TaskDialogDefaultContent" xml:space="preserve">
+ <value />
+ </data>
+ <data name="TaskDialogDefaultMainInstruction" xml:space="preserve">
+ <value />
+ </data>
+ <data name="TaskDialogOnlyOneDefaultControl" xml:space="preserve">
+ <value>Cannot have more than one default button of a given type.</value>
+ </data>
+ <data name="TaskDialogProgressBarMaxValueGreaterThanMin" xml:space="preserve">
+ <value>Maximum value provided must be greater than the minimum value.</value>
+ </data>
+ <data name="TaskDialogProgressBarMinValueGreaterThanZero" xml:space="preserve">
+ <value>Minimum value provided must be a positive number.</value>
+ </data>
+ <data name="TaskDialogProgressBarMinValueLessThanMax" xml:space="preserve">
+ <value>Minimum value provided must less than the maximum value.</value>
+ </data>
+ <data name="TaskDialogProgressBarValueInRange" xml:space="preserve">
+ <value>Value provided must be greater than equal to the minimum value and less than the maximum value.</value>
+ </data>
+ <data name="TaskDialogSupportedButtonsAndButtons" xml:space="preserve">
+ <value>Dialog cannot display both non-standard buttons and standard buttons.</value>
+ </data>
+ <data name="TaskDialogSupportedButtonsAndLinks" xml:space="preserve">
+ <value>Dialog cannot display both non-standard buttons and command links.</value>
+ </data>
+ <data name="TaskDialogUnkownControl" xml:space="preserve">
+ <value>Unknown dialog control type.</value>
+ </data>
+ <data name="PropVariantInitializationError" xml:space="preserve">
+ <value>Unable to initialize PropVariant.</value>
+ </data>
+ <data name="PowerManagerActiveSchemeFailed" xml:space="preserve">
+ <value>Failed to get active power scheme.</value>
+ </data>
+ <data name="PropVariantUnsupportedType" xml:space="preserve">
+ <value>Cannot be cast to unsupported type.</value>
+ </data>
+</root> \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/SafeHandles/SafeIconHandle.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/SafeHandles/SafeIconHandle.cs
new file mode 100644
index 0000000000..33c9122066
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/SafeHandles/SafeIconHandle.cs
@@ -0,0 +1,26 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace MS.WindowsAPICodePack.Internal
+{
+ /// <summary>
+ /// Safe Icon Handle
+ /// </summary>
+ public class SafeIconHandle : ZeroInvalidHandle
+ {
+ /// <summary>
+ /// Release the handle
+ /// </summary>
+ /// <returns>true if handled is release successfully, false otherwise</returns>
+ protected override bool ReleaseHandle()
+ {
+ if (CoreNativeMethods.DestroyIcon(handle))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/SafeHandles/SafeRegionHandle.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/SafeHandles/SafeRegionHandle.cs
new file mode 100644
index 0000000000..1c341c0010
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/SafeHandles/SafeRegionHandle.cs
@@ -0,0 +1,27 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System.Security.Permissions;
+namespace MS.WindowsAPICodePack.Internal
+{
+ /// <summary>
+ /// Safe Region Handle
+ /// </summary>
+ public class SafeRegionHandle : ZeroInvalidHandle
+ {
+ /// <summary>
+ /// Release the handle
+ /// </summary>
+ /// <returns>true if handled is release successfully, false otherwise</returns>
+ protected override bool ReleaseHandle()
+ {
+ if (CoreNativeMethods.DeleteObject(handle))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/SafeHandles/SafeWindowHandle.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/SafeHandles/SafeWindowHandle.cs
new file mode 100644
index 0000000000..9f65eb52e6
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/SafeHandles/SafeWindowHandle.cs
@@ -0,0 +1,32 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System.Security.Permissions;
+namespace MS.WindowsAPICodePack.Internal
+{
+ /// <summary>
+ /// Safe Window Handle
+ /// </summary>
+ public class SafeWindowHandle : ZeroInvalidHandle
+ {
+ /// <summary>
+ /// Release the handle
+ /// </summary>
+ /// <returns>true if handled is release successfully, false otherwise</returns>
+ protected override bool ReleaseHandle()
+ {
+ if (IsInvalid)
+ {
+ return true;
+ }
+
+ if (CoreNativeMethods.DestroyWindow(handle) != 0)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/SafeHandles/ZeroInvalidHandle.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/SafeHandles/ZeroInvalidHandle.cs
new file mode 100644
index 0000000000..7619741c20
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/SafeHandles/ZeroInvalidHandle.cs
@@ -0,0 +1,32 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using System.Security.Permissions;
+
+namespace MS.WindowsAPICodePack.Internal
+{
+ /// <summary>
+ /// Base class for Safe handles with Null IntPtr as invalid
+ /// </summary>
+ public abstract class ZeroInvalidHandle : SafeHandle
+ {
+ /// <summary>
+ /// Default constructor
+ /// </summary>
+ protected ZeroInvalidHandle()
+ : base(IntPtr.Zero, true)
+ {
+ }
+
+ /// <summary>
+ /// Determines if this is a valid handle
+ /// </summary>
+ public override bool IsInvalid
+ {
+ get { return handle == IntPtr.Zero; }
+ }
+
+ }
+}
+
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Makefile.am b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Makefile.am
new file mode 100644
index 0000000000..841093782b
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Makefile.am
@@ -0,0 +1,4 @@
+
+SUBDIRS = \
+ Core \
+ Shell
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/DefaultShellImageSizes.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/DefaultShellImageSizes.cs
new file mode 100644
index 0000000000..8c94f477a1
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/DefaultShellImageSizes.cs
@@ -0,0 +1,68 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Defines the read-only properties for default shell icon sizes.
+ /// </summary>
+ public static class DefaultIconSize
+ {
+ /// <summary>
+ /// The small size property for a 16x16 pixel Shell Icon.
+ /// </summary>
+ public static readonly System.Windows.Size Small = new System.Windows.Size(16, 16);
+
+ /// <summary>
+ /// The medium size property for a 32x32 pixel Shell Icon.
+ /// </summary>
+ public static readonly System.Windows.Size Medium = new System.Windows.Size(32, 32);
+
+ /// <summary>
+ /// The large size property for a 48x48 pixel Shell Icon.
+ /// </summary>
+ public static readonly System.Windows.Size Large = new System.Windows.Size(48, 48);
+
+ /// <summary>
+ /// The extra-large size property for a 256x256 pixel Shell Icon.
+ /// </summary>
+ public static readonly System.Windows.Size ExtraLarge = new System.Windows.Size(256, 256);
+
+ /// <summary>
+ /// The maximum size for a Shell Icon, 256x256 pixels.
+ /// </summary>
+ public static readonly System.Windows.Size Maximum = new System.Windows.Size(256, 256);
+
+ }
+
+ /// <summary>
+ /// Defines the read-only properties for default shell thumbnail sizes.
+ /// </summary>
+ public static class DefaultThumbnailSize
+ {
+ /// <summary>
+ /// Gets the small size property for a 32x32 pixel Shell Thumbnail.
+ /// </summary>
+ public static readonly System.Windows.Size Small = new System.Windows.Size(32, 32);
+
+ /// <summary>
+ /// Gets the medium size property for a 96x96 pixel Shell Thumbnail.
+ /// </summary>
+ public static readonly System.Windows.Size Medium = new System.Windows.Size(96, 96);
+
+ /// <summary>
+ /// Gets the large size property for a 256x256 pixel Shell Thumbnail.
+ /// </summary>
+ public static readonly System.Windows.Size Large = new System.Windows.Size(256, 256);
+
+ /// <summary>
+ /// Gets the extra-large size property for a 1024x1024 pixel Shell Thumbnail.
+ /// </summary>
+ public static readonly System.Windows.Size ExtraLarge = new System.Windows.Size(1024, 1024);
+
+ /// <summary>
+ /// Maximum size for the Shell Thumbnail, 1024x1024 pixels.
+ /// </summary>
+ public static readonly System.Windows.Size Maximum = new System.Windows.Size(1024, 1024);
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/EnumUnknown.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/EnumUnknown.cs
new file mode 100644
index 0000000000..53683493d6
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/EnumUnknown.cs
@@ -0,0 +1,63 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ internal class EnumUnknownClass : IEnumUnknown
+ {
+ List<ICondition> conditionList = new List<ICondition>();
+ int current = -1;
+
+ internal EnumUnknownClass(ICondition[] conditions)
+ {
+ conditionList.AddRange(conditions);
+ }
+
+ #region IEnumUnknown Members
+
+ public HResult Next(uint requestedNumber, ref IntPtr buffer, ref uint fetchedNumber)
+ {
+ current++;
+
+ if (current < conditionList.Count)
+ {
+ buffer = Marshal.GetIUnknownForObject(conditionList[current]);
+ fetchedNumber = 1;
+ return HResult.Ok;
+ }
+
+ return HResult.False;
+ }
+
+ public HResult Skip(uint number)
+ {
+ int temp = current + (int)number;
+
+ if (temp > (conditionList.Count - 1))
+ {
+ return HResult.False;
+ }
+
+ current = temp;
+ return HResult.Ok;
+ }
+
+ public HResult Reset()
+ {
+ current = -1;
+ return HResult.Ok;
+ }
+
+ public HResult Clone(out IEnumUnknown result)
+ {
+ result = new EnumUnknownClass(this.conditionList.ToArray());
+ return HResult.Ok;
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/EventHandlerExtensionMethods.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/EventHandlerExtensionMethods.cs
new file mode 100644
index 0000000000..bc324f1db0
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/EventHandlerExtensionMethods.cs
@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Diagnostics;
+using System.Threading;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Provides extension methods for raising events safely.
+ /// </summary>
+ public static class EventHandlerExtensionMethods
+ {
+ /// <summary>
+ /// Safely raises an event using EventArgs.Empty
+ /// </summary>
+ /// <param name="eventHandler">EventHandler to raise</param>
+ /// <param name="sender">Event sender</param>
+ public static void SafeRaise(this EventHandler eventHandler, object sender)
+ {
+ if (eventHandler != null)
+ {
+ eventHandler(sender, EventArgs.Empty);
+ }
+ }
+
+ /// <summary>
+ /// Safely raises an event.
+ /// </summary>
+ /// <typeparam name="T">Type of event args</typeparam>
+ /// <param name="eventHandler">EventHandler&lt;T&gt; to raise</param>
+ /// <param name="sender">Event sender</param>
+ /// <param name="args">Event args</param>
+ public static void SafeRaise<T>(this EventHandler<T> eventHandler, object sender, T args) where T : EventArgs
+ {
+ if (eventHandler != null)
+ {
+ eventHandler(sender, args);
+ }
+ }
+
+ /// <summary>
+ /// Safely raises an event using EventArgs.Empty
+ /// </summary>
+ /// <param name="eventHandler">EventHandler&lt;EventArgs&gt; to raise</param>
+ /// <param name="sender">Event sender</param>
+ public static void SafeRaise(this EventHandler<EventArgs> eventHandler, object sender)
+ {
+ SafeRaise(eventHandler, sender, EventArgs.Empty);
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/IconReference.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/IconReference.cs
new file mode 100644
index 0000000000..9ddcf9b9f6
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/IconReference.cs
@@ -0,0 +1,168 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using Microsoft.WindowsAPICodePack.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// A refence to an icon resource
+ /// </summary>
+ public struct IconReference
+ {
+ #region Private members
+
+ private string moduleName;
+ private string referencePath;
+ static private char[] commaSeparator = new char[] { ',' };
+
+ #endregion
+
+ /// <summary>
+ /// Overloaded constructor takes in the module name and resource id for the icon reference.
+ /// </summary>
+ /// <param name="moduleName">String specifying the name of an executable file, DLL, or icon file</param>
+ /// <param name="resourceId">Zero-based index of the icon</param>
+ public IconReference(string moduleName, int resourceId)
+ : this()
+ {
+ if (string.IsNullOrEmpty(moduleName))
+ {
+ throw new ArgumentNullException("moduleName");
+ }
+
+ this.moduleName = moduleName;
+ ResourceId = resourceId;
+ referencePath = string.Format(System.Globalization.CultureInfo.InvariantCulture,
+ "{0},{1}", moduleName, resourceId);
+ }
+
+ /// <summary>
+ /// Overloaded constructor takes in the module name and resource id separated by a comma.
+ /// </summary>
+ /// <param name="refPath">Reference path for the icon consiting of the module name and resource id.</param>
+ public IconReference(string refPath)
+ : this()
+ {
+ if (string.IsNullOrEmpty(refPath))
+ {
+ throw new ArgumentNullException("refPath");
+ }
+
+ string[] refParams = refPath.Split(commaSeparator);
+
+ if (refParams.Length != 2 || string.IsNullOrEmpty(refParams[0]) || string.IsNullOrEmpty(refParams[1]))
+ {
+ throw new ArgumentException(LocalizedMessages.InvalidReferencePath, "refPath");
+ }
+
+ moduleName = refParams[0];
+ ResourceId = int.Parse(refParams[1], System.Globalization.CultureInfo.InvariantCulture);
+
+ this.referencePath = refPath;
+ }
+
+ /// <summary>
+ /// String specifying the name of an executable file, DLL, or icon file
+ /// </summary>
+ public string ModuleName
+ {
+ get
+ {
+ return moduleName;
+ }
+ set
+ {
+ if (string.IsNullOrEmpty(value))
+ {
+ throw new ArgumentNullException("value");
+ }
+ moduleName = value;
+ }
+ }
+
+ /// <summary>
+ /// Zero-based index of the icon
+ /// </summary>
+ public int ResourceId { get; set; }
+
+ /// <summary>
+ /// Reference to a specific icon within a EXE, DLL or icon file.
+ /// </summary>
+ public string ReferencePath
+ {
+ get
+ {
+ return referencePath;
+ }
+ set
+ {
+ if (string.IsNullOrEmpty(value))
+ {
+ throw new ArgumentNullException("value");
+ }
+
+ string[] refParams = value.Split(commaSeparator);
+
+ if (refParams.Length != 2 || string.IsNullOrEmpty(refParams[0]) || string.IsNullOrEmpty(refParams[1]))
+ {
+ throw new ArgumentException(LocalizedMessages.InvalidReferencePath, "value");
+ }
+
+ ModuleName = refParams[0];
+ ResourceId = int.Parse(refParams[1], System.Globalization.CultureInfo.InvariantCulture);
+
+ referencePath = value;
+ }
+ }
+
+ /// <summary>
+ /// Implements the == (equality) operator.
+ /// </summary>
+ /// <param name="icon1">First object to compare.</param>
+ /// <param name="icon2">Second object to compare.</param>
+ /// <returns>True if icon1 equals icon1; false otherwise.</returns>
+ public static bool operator ==(IconReference icon1, IconReference icon2)
+ {
+ return (icon1.moduleName == icon2.moduleName) &&
+ (icon1.referencePath == icon2.referencePath) &&
+ (icon1.ResourceId == icon2.ResourceId);
+ }
+
+ /// <summary>
+ /// Implements the != (unequality) operator.
+ /// </summary>
+ /// <param name="icon1">First object to compare.</param>
+ /// <param name="icon2">Second object to compare.</param>
+ /// <returns>True if icon1 does not equals icon1; false otherwise.</returns>
+ public static bool operator !=(IconReference icon1, IconReference icon2)
+ {
+ return !(icon1 == icon2);
+ }
+
+ /// <summary>
+ /// Determines if this object is equal to another.
+ /// </summary>
+ /// <param name="obj">The object to compare</param>
+ /// <returns>Returns true if the objects are equal; false otherwise.</returns>
+ public override bool Equals(object obj)
+ {
+ if (obj == null || !(obj is IconReference)) { return false; }
+ return (this == (IconReference)obj);
+ }
+
+ /// <summary>
+ /// Generates a nearly unique hashcode for this structure.
+ /// </summary>
+ /// <returns>A hash code.</returns>
+ public override int GetHashCode()
+ {
+ int hash = this.moduleName.GetHashCode();
+ hash = hash * 31 + this.referencePath.GetHashCode();
+ hash = hash * 31 + this.ResourceId.GetHashCode();
+ return hash;
+ }
+
+ }
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/NativePoint.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/NativePoint.cs
new file mode 100644
index 0000000000..fae3e25bb5
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/NativePoint.cs
@@ -0,0 +1,78 @@
+using System.Runtime.InteropServices;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// A wrapper for the native POINT structure.
+ /// </summary>
+ [StructLayout(LayoutKind.Sequential)]
+ public struct NativePoint
+ {
+ /// <summary>
+ /// Initialize the NativePoint
+ /// </summary>
+ /// <param name="x">The x coordinate of the point.</param>
+ /// <param name="y">The y coordinate of the point.</param>
+ public NativePoint(int x, int y)
+ : this()
+ {
+ X = x;
+ Y = y;
+ }
+
+ /// <summary>
+ /// The X coordinate of the point
+ /// </summary>
+ public int X { get; set; }
+
+ /// <summary>
+ /// The Y coordinate of the point
+ /// </summary>
+ public int Y { get; set; }
+
+ /// <summary>
+ /// Determines if two NativePoints are equal.
+ /// </summary>
+ /// <param name="first">First NativePoint</param>
+ /// <param name="second">Second NativePoint</param>
+ /// <returns>True if first NativePoint is equal to the second; false otherwise.</returns>
+ public static bool operator ==(NativePoint first, NativePoint second)
+ {
+ return first.X == second.X
+ && first.Y == second.Y;
+ }
+
+ /// <summary>
+ /// Determines if two NativePoints are not equal.
+ /// </summary>
+ /// <param name="first">First NativePoint</param>
+ /// <param name="second">Second NativePoint</param>
+ /// <returns>True if first NativePoint is not equal to the second; false otherwise.</returns>
+ public static bool operator !=(NativePoint first, NativePoint second)
+ {
+ return !(first == second);
+ }
+
+ /// <summary>
+ /// Determines if this NativePoint is equal to another.
+ /// </summary>
+ /// <param name="obj">Another NativePoint to compare</param>
+ /// <returns>True if this NativePoint is equal obj; false otherwise.</returns>
+ public override bool Equals(object obj)
+ {
+ return (obj != null && obj is NativePoint) ? this == (NativePoint)obj : false;
+ }
+
+ /// <summary>
+ /// Gets a hash code for the NativePoint.
+ /// </summary>
+ /// <returns>Hash code for the NativePoint</returns>
+ public override int GetHashCode()
+ {
+ int hash = X.GetHashCode();
+ hash = hash * 31 + Y.GetHashCode();
+ return hash;
+ }
+ }
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/NativeRect.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/NativeRect.cs
new file mode 100644
index 0000000000..fea23642fd
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/NativeRect.cs
@@ -0,0 +1,96 @@
+using System.Runtime.InteropServices;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// A wrapper for a RECT struct
+ /// </summary>
+ [StructLayout(LayoutKind.Sequential)]
+ public struct NativeRect
+ {
+ /// <summary>
+ /// Position of left edge
+ /// </summary>
+ public int Left { get; set; }
+
+ /// <summary>
+ /// Position of top edge
+ /// </summary>
+ public int Top { get; set; }
+
+ /// <summary>
+ /// Position of right edge
+ /// </summary>
+ public int Right { get; set; }
+
+ /// <summary>
+ /// Position of bottom edge
+ /// </summary>
+ public int Bottom { get; set; }
+
+ /// <summary>
+ /// Creates a new NativeRect initialized with supplied values.
+ /// </summary>
+ /// <param name="left">Position of left edge</param>
+ /// <param name="top">Position of top edge</param>
+ /// <param name="right">Position of right edge</param>
+ /// <param name="bottom">Position of bottom edge</param>
+ public NativeRect(int left, int top, int right, int bottom)
+ : this()
+ {
+ Left = left;
+ Top = top;
+ Right = right;
+ Bottom = bottom;
+ }
+
+ /// <summary>
+ /// Determines if two NativeRects are equal.
+ /// </summary>
+ /// <param name="first">First NativeRect</param>
+ /// <param name="second">Second NativeRect</param>
+ /// <returns>True if first NativeRect is equal to second; false otherwise.</returns>
+ public static bool operator ==(NativeRect first, NativeRect second)
+ {
+ return first.Left == second.Left
+ && first.Top == second.Top
+ && first.Right == second.Right
+ && first.Bottom == second.Bottom;
+ }
+
+ /// <summary>
+ /// Determines if two NativeRects are not equal
+ /// </summary>
+ /// <param name="first">First NativeRect</param>
+ /// <param name="second">Second NativeRect</param>
+ /// <returns>True if first is not equal to second; false otherwise.</returns>
+ public static bool operator !=(NativeRect first, NativeRect second)
+ {
+ return !(first == second);
+ }
+
+ /// <summary>
+ /// Determines if the NativeRect is equal to another Rect.
+ /// </summary>
+ /// <param name="obj">Another NativeRect to compare</param>
+ /// <returns>True if this NativeRect is equal to the one provided; false otherwise.</returns>
+ public override bool Equals(object obj)
+ {
+ return (obj != null && obj is NativeRect) ? this == (NativeRect)obj : false;
+ }
+
+ /// <summary>
+ /// Creates a hash code for the NativeRect
+ /// </summary>
+ /// <returns>Returns hash code for this NativeRect</returns>
+ public override int GetHashCode()
+ {
+ int hash = Left.GetHashCode();
+ hash = hash * 31 + Top.GetHashCode();
+ hash = hash * 31 + Right.GetHashCode();
+ hash = hash * 31 + Bottom.GetHashCode();
+ return hash;
+ }
+ }
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/SearchCondition.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/SearchCondition.cs
new file mode 100644
index 0000000000..6906ede53b
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/SearchCondition.cs
@@ -0,0 +1,181 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Shell.PropertySystem;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Exposes properties and methods for retrieving information about a search condition.
+ /// </summary>
+ public class SearchCondition : IDisposable
+ {
+ internal SearchCondition(ICondition nativeSearchCondition)
+ {
+ if (nativeSearchCondition == null)
+ {
+ throw new ArgumentNullException("nativeSearchCondition");
+ }
+
+ NativeSearchCondition = nativeSearchCondition;
+
+ HResult hr = NativeSearchCondition.GetConditionType(out conditionType);
+
+ if (!CoreErrorHelper.Succeeded(hr))
+ {
+ throw new ShellException(hr);
+ }
+
+ if (ConditionType == SearchConditionType.Leaf)
+ {
+ using (PropVariant propVar = new PropVariant())
+ {
+ hr = NativeSearchCondition.GetComparisonInfo(out canonicalName, out conditionOperation, propVar);
+
+ if (!CoreErrorHelper.Succeeded(hr))
+ {
+ throw new ShellException(hr);
+ }
+
+ PropertyValue = propVar.Value.ToString();
+ }
+ }
+ }
+
+ internal ICondition NativeSearchCondition { get; set; }
+
+ private string canonicalName;
+ /// <summary>
+ /// The name of a property to be compared or NULL for an unspecified property.
+ /// </summary>
+ public string PropertyCanonicalName
+ {
+ get { return canonicalName; }
+ }
+
+ private PropertyKey propertyKey;
+ private PropertyKey emptyPropertyKey = new PropertyKey();
+ /// <summary>
+ /// The property key for the property that is to be compared.
+ /// </summary>
+ public PropertyKey PropertyKey
+ {
+ get
+ {
+ if (propertyKey == emptyPropertyKey)
+ {
+ int hr = PropertySystemNativeMethods.PSGetPropertyKeyFromName(PropertyCanonicalName, out propertyKey);
+ if (!CoreErrorHelper.Succeeded(hr))
+ {
+ throw new ShellException(hr);
+ }
+ }
+
+ return propertyKey;
+ }
+ }
+
+ /// <summary>
+ /// A value (in <see cref="System.String"/> format) to which the property is compared.
+ /// </summary>
+ public string PropertyValue { get; internal set; }
+
+ private SearchConditionOperation conditionOperation = SearchConditionOperation.Implicit;
+ /// <summary>
+ /// Search condition operation to be performed on the property/value combination.
+ /// See <see cref="Microsoft.WindowsAPICodePack.Shell.SearchConditionOperation"/> for more details.
+ /// </summary>
+ public SearchConditionOperation ConditionOperation
+ {
+ get { return conditionOperation; }
+ }
+
+ private SearchConditionType conditionType = SearchConditionType.Leaf;
+ /// <summary>
+ /// Represents the condition type for the given node.
+ /// </summary>
+ public SearchConditionType ConditionType
+ {
+ get { return conditionType; }
+ }
+
+ /// <summary>
+ /// Retrieves an array of the sub-conditions.
+ /// </summary>
+ public IEnumerable<SearchCondition> GetSubConditions()
+ {
+ // Our list that we'll return
+ List<SearchCondition> subConditionsList = new List<SearchCondition>();
+
+ // Get the sub-conditions from the native API
+ object subConditionObj;
+ Guid guid = new Guid(ShellIIDGuid.IEnumUnknown);
+
+ HResult hr = NativeSearchCondition.GetSubConditions(ref guid, out subConditionObj);
+
+ if (!CoreErrorHelper.Succeeded(hr))
+ {
+ throw new ShellException(hr);
+ }
+
+ // Convert each ICondition to SearchCondition
+ if (subConditionObj != null)
+ {
+ IEnumUnknown enumUnknown = subConditionObj as IEnumUnknown;
+
+ IntPtr buffer = IntPtr.Zero;
+ uint fetched = 0;
+
+ while (hr == HResult.Ok)
+ {
+ hr = enumUnknown.Next(1, ref buffer, ref fetched);
+
+ if (hr == HResult.Ok && fetched == 1)
+ {
+ subConditionsList.Add(new SearchCondition((ICondition)Marshal.GetObjectForIUnknown(buffer)));
+ }
+ }
+ }
+
+ return subConditionsList;
+ }
+
+ #region IDisposable Members
+
+ /// <summary>
+ ///
+ /// </summary>
+ ~SearchCondition()
+ {
+ Dispose(false);
+ }
+
+ /// <summary>
+ /// Release the native objects.
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Release the native objects.
+ /// </summary>
+ /// <param name="disposing"></param>
+ protected virtual void Dispose(bool disposing)
+ {
+ if (NativeSearchCondition != null)
+ {
+ Marshal.ReleaseComObject(NativeSearchCondition);
+ NativeSearchCondition = null;
+ }
+ }
+
+ #endregion
+
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/SearchConditionFactory.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/SearchConditionFactory.cs
new file mode 100644
index 0000000000..3c25dc56e7
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/SearchConditionFactory.cs
@@ -0,0 +1,481 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Shell.PropertySystem;
+using MS.WindowsAPICodePack.Internal;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Provides methods for creating or resolving a condition tree
+ /// that was obtained by parsing a query string.
+ /// </summary>
+ public static class SearchConditionFactory
+ {
+ /// <summary>
+ /// Creates a leaf condition node that represents a comparison of property value and constant value.
+ /// </summary>
+ /// <param name="propertyName">The name of a property to be compared, or null for an unspecified property.
+ /// The locale name of the leaf node is LOCALE_NAME_USER_DEFAULT.</param>
+ /// <param name="value">The constant value against which the property value should be compared.</param>
+ /// <param name="operation">Specific condition to be used when comparing the actual value and the expected value of the given property</param>
+ /// <returns>SearchCondition based on the given parameters</returns>
+ /// <remarks>
+ /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find
+ /// the properties that are indexed, look for the specific property's property description and
+ /// <see cref="P:Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.TypeFlags"/> property for IsQueryable flag.
+ /// </remarks>
+ public static SearchCondition CreateLeafCondition(string propertyName, string value, SearchConditionOperation operation)
+ {
+ using (PropVariant propVar = new PropVariant(value))
+ {
+ return CreateLeafCondition(propertyName, propVar, null, operation);
+ }
+ }
+
+ /// <summary>
+ /// Creates a leaf condition node that represents a comparison of property value and constant value.
+ /// Overload method takes a DateTime parameter for the comparison value.
+ /// </summary>
+ /// <param name="propertyName">The name of a property to be compared, or null for an unspecified property.
+ /// The locale name of the leaf node is LOCALE_NAME_USER_DEFAULT.</param>
+ /// <param name="value">The DateTime value against which the property value should be compared.</param>
+ /// <param name="operation">Specific condition to be used when comparing the actual value and the expected value of the given property</param>
+ /// <returns>SearchCondition based on the given parameters</returns>
+ /// <remarks>
+ /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find
+ /// the properties that are indexed, look for the specific property's property description and
+ /// <see cref="P:Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.TypeFlags"/> property for IsQueryable flag.
+ /// </remarks>
+ public static SearchCondition CreateLeafCondition(string propertyName, DateTime value, SearchConditionOperation operation)
+ {
+ using (PropVariant propVar = new PropVariant(value))
+ {
+ return CreateLeafCondition(propertyName, propVar, "System.StructuredQuery.CustomProperty.DateTime", operation);
+ }
+ }
+
+ /// <summary>
+ /// Creates a leaf condition node that represents a comparison of property value and Integer value.
+ /// </summary>
+ /// <param name="propertyName">The name of a property to be compared, or null for an unspecified property.
+ /// The locale name of the leaf node is LOCALE_NAME_USER_DEFAULT.</param>
+ /// <param name="value">The Integer value against which the property value should be compared.</param>
+ /// <param name="operation">Specific condition to be used when comparing the actual value and the expected value of the given property</param>
+ /// <returns>SearchCondition based on the given parameters</returns>
+ /// <remarks>
+ /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find
+ /// the properties that are indexed, look for the specific property's property description and
+ /// <see cref="P:Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.TypeFlags"/> property for IsQueryable flag.
+ /// </remarks>
+ public static SearchCondition CreateLeafCondition(string propertyName, int value, SearchConditionOperation operation)
+ {
+ using (PropVariant propVar = new PropVariant(value))
+ {
+ return CreateLeafCondition(propertyName, propVar, "System.StructuredQuery.CustomProperty.Integer", operation);
+ }
+ }
+
+ /// <summary>
+ /// Creates a leaf condition node that represents a comparison of property value and Boolean value.
+ /// </summary>
+ /// <param name="propertyName">The name of a property to be compared, or null for an unspecified property.
+ /// The locale name of the leaf node is LOCALE_NAME_USER_DEFAULT.</param>
+ /// <param name="value">The Boolean value against which the property value should be compared.</param>
+ /// <param name="operation">Specific condition to be used when comparing the actual value and the expected value of the given property</param>
+ /// <returns>SearchCondition based on the given parameters</returns>
+ /// <remarks>
+ /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find
+ /// the properties that are indexed, look for the specific property's property description and
+ /// <see cref="P:Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.TypeFlags"/> property for IsQueryable flag.
+ /// </remarks>
+ public static SearchCondition CreateLeafCondition(string propertyName, bool value, SearchConditionOperation operation)
+ {
+ using (PropVariant propVar = new PropVariant(value))
+ {
+ return CreateLeafCondition(propertyName, propVar, "System.StructuredQuery.CustomProperty.Boolean", operation);
+ }
+ }
+
+ /// <summary>
+ /// Creates a leaf condition node that represents a comparison of property value and Floating Point value.
+ /// </summary>
+ /// <param name="propertyName">The name of a property to be compared, or null for an unspecified property.
+ /// The locale name of the leaf node is LOCALE_NAME_USER_DEFAULT.</param>
+ /// <param name="value">The Floating Point value against which the property value should be compared.</param>
+ /// <param name="operation">Specific condition to be used when comparing the actual value and the expected value of the given property</param>
+ /// <returns>SearchCondition based on the given parameters</returns>
+ /// <remarks>
+ /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find
+ /// the properties that are indexed, look for the specific property's property description and
+ /// <see cref="P:Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.TypeFlags"/> property for IsQueryable flag.
+ /// </remarks>
+ public static SearchCondition CreateLeafCondition(string propertyName, double value, SearchConditionOperation operation)
+ {
+ using (PropVariant propVar = new PropVariant(value))
+ {
+ return CreateLeafCondition(propertyName, propVar, "System.StructuredQuery.CustomProperty.FloatingPoint", operation);
+ }
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
+ private static SearchCondition CreateLeafCondition(string propertyName, PropVariant propVar, string valueType, SearchConditionOperation operation)
+ {
+ IConditionFactory nativeConditionFactory = null;
+ SearchCondition condition = null;
+
+ try
+ {
+ // Same as the native "IConditionFactory:MakeLeaf" method
+ nativeConditionFactory = (IConditionFactory)new ConditionFactoryCoClass();
+
+ ICondition nativeCondition = null;
+
+ if (string.IsNullOrEmpty(propertyName) || propertyName.ToUpperInvariant() == "SYSTEM.NULL")
+ {
+ propertyName = null;
+ }
+
+ HResult hr = HResult.Fail;
+
+ hr = nativeConditionFactory.MakeLeaf(propertyName, operation, valueType,
+ propVar, null, null, null, false, out nativeCondition);
+
+ if (!CoreErrorHelper.Succeeded(hr))
+ {
+ throw new ShellException(hr);
+ }
+
+ // Create our search condition and set the various properties.
+ condition = new SearchCondition(nativeCondition);
+ }
+ finally
+ {
+ if (nativeConditionFactory != null)
+ {
+ Marshal.ReleaseComObject(nativeConditionFactory);
+ }
+ }
+
+ return condition;
+ }
+
+ /// <summary>
+ /// Creates a leaf condition node that represents a comparison of property value and constant value.
+ /// </summary>
+ /// <param name="propertyKey">The property to be compared.</param>
+ /// <param name="value">The constant value against which the property value should be compared.</param>
+ /// <param name="operation">Specific condition to be used when comparing the actual value and the expected value of the given property</param>
+ /// <returns>SearchCondition based on the given parameters</returns>
+ /// <remarks>
+ /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find
+ /// the properties that are indexed, look for the specific property's property description and
+ /// <see cref="P:Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.TypeFlags"/> property for IsQueryable flag.
+ /// </remarks>
+ public static SearchCondition CreateLeafCondition(PropertyKey propertyKey, string value, SearchConditionOperation operation)
+ {
+ string canonicalName;
+ PropertySystemNativeMethods.PSGetNameFromPropertyKey(ref propertyKey, out canonicalName);
+
+ if (string.IsNullOrEmpty(canonicalName))
+ {
+ throw new ArgumentException(LocalizedMessages.SearchConditionFactoryInvalidProperty, "propertyKey");
+ }
+
+ return CreateLeafCondition(canonicalName, value, operation);
+ }
+
+ /// <summary>
+ /// Creates a leaf condition node that represents a comparison of property value and constant value.
+ /// Overload method takes a DateTime parameter for the comparison value.
+ /// </summary>
+ /// <param name="propertyKey">The property to be compared.</param>
+ /// <param name="value">The DateTime value against which the property value should be compared.</param>
+ /// <param name="operation">Specific condition to be used when comparing the actual value and the expected value of the given property</param>
+ /// <returns>SearchCondition based on the given parameters</returns>
+ /// <remarks>
+ /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find
+ /// the properties that are indexed, look for the specific property's property description and
+ /// <see cref="P:Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.TypeFlags"/> property for IsQueryable flag.
+ /// </remarks>
+ public static SearchCondition CreateLeafCondition(PropertyKey propertyKey, DateTime value, SearchConditionOperation operation)
+ {
+ string canonicalName;
+ PropertySystemNativeMethods.PSGetNameFromPropertyKey(ref propertyKey, out canonicalName);
+
+ if (string.IsNullOrEmpty(canonicalName))
+ {
+ throw new ArgumentException(LocalizedMessages.SearchConditionFactoryInvalidProperty, "propertyKey");
+ }
+ return CreateLeafCondition(canonicalName, value, operation);
+ }
+
+ /// <summary>
+ /// Creates a leaf condition node that represents a comparison of property value and Boolean value.
+ /// Overload method takes a DateTime parameter for the comparison value.
+ /// </summary>
+ /// <param name="propertyKey">The property to be compared.</param>
+ /// <param name="value">The boolean value against which the property value should be compared.</param>
+ /// <param name="operation">Specific condition to be used when comparing the actual value and the expected value of the given property</param>
+ /// <returns>SearchCondition based on the given parameters</returns>
+ /// <remarks>
+ /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find
+ /// the properties that are indexed, look for the specific property's property description and
+ /// <see cref="P:Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.TypeFlags"/> property for IsQueryable flag.
+ /// </remarks>
+ public static SearchCondition CreateLeafCondition(PropertyKey propertyKey, bool value, SearchConditionOperation operation)
+ {
+ string canonicalName;
+ PropertySystemNativeMethods.PSGetNameFromPropertyKey(ref propertyKey, out canonicalName);
+
+ if (string.IsNullOrEmpty(canonicalName))
+ {
+ throw new ArgumentException(LocalizedMessages.SearchConditionFactoryInvalidProperty, "propertyKey");
+ }
+ return CreateLeafCondition(canonicalName, value, operation);
+ }
+
+ /// <summary>
+ /// Creates a leaf condition node that represents a comparison of property value and Floating Point value.
+ /// Overload method takes a DateTime parameter for the comparison value.
+ /// </summary>
+ /// <param name="propertyKey">The property to be compared.</param>
+ /// <param name="value">The Floating Point value against which the property value should be compared.</param>
+ /// <param name="operation">Specific condition to be used when comparing the actual value and the expected value of the given property</param>
+ /// <returns>SearchCondition based on the given parameters</returns>
+ /// <remarks>
+ /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find
+ /// the properties that are indexed, look for the specific property's property description and
+ /// <see cref="P:Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.TypeFlags"/> property for IsQueryable flag.
+ /// </remarks>
+ public static SearchCondition CreateLeafCondition(PropertyKey propertyKey, double value, SearchConditionOperation operation)
+ {
+ string canonicalName;
+ PropertySystemNativeMethods.PSGetNameFromPropertyKey(ref propertyKey, out canonicalName);
+
+ if (string.IsNullOrEmpty(canonicalName))
+ {
+ throw new ArgumentException(LocalizedMessages.SearchConditionFactoryInvalidProperty, "propertyKey");
+ }
+ return CreateLeafCondition(canonicalName, value, operation);
+ }
+
+ /// <summary>
+ /// Creates a leaf condition node that represents a comparison of property value and Integer value.
+ /// Overload method takes a DateTime parameter for the comparison value.
+ /// </summary>
+ /// <param name="propertyKey">The property to be compared.</param>
+ /// <param name="value">The Integer value against which the property value should be compared.</param>
+ /// <param name="operation">Specific condition to be used when comparing the actual value and the expected value of the given property</param>
+ /// <returns>SearchCondition based on the given parameters</returns>
+ /// <remarks>
+ /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find
+ /// the properties that are indexed, look for the specific property's property description and
+ /// <see cref="P:Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.TypeFlags"/> property for IsQueryable flag.
+ /// </remarks>
+ public static SearchCondition CreateLeafCondition(PropertyKey propertyKey, int value, SearchConditionOperation operation)
+ {
+ string canonicalName;
+ PropertySystemNativeMethods.PSGetNameFromPropertyKey(ref propertyKey, out canonicalName);
+
+ if (string.IsNullOrEmpty(canonicalName))
+ {
+ throw new ArgumentException(LocalizedMessages.SearchConditionFactoryInvalidProperty, "propertyKey");
+ }
+ return CreateLeafCondition(canonicalName, value, operation);
+ }
+
+ /// <summary>
+ /// Creates a condition node that is a logical conjunction ("AND") or disjunction ("OR")
+ /// of a collection of subconditions.
+ /// </summary>
+ /// <param name="conditionType">The SearchConditionType of the condition node.
+ /// Must be either AndCondition or OrCondition.</param>
+ /// <param name="simplify">TRUE to logically simplify the result, if possible;
+ /// then the result will not necessarily to be of the specified kind. FALSE if the result should
+ /// have exactly the prescribed structure. An application that plans to execute a query based on the
+ /// condition tree would typically benefit from setting this parameter to TRUE. </param>
+ /// <param name="conditionNodes">Array of subconditions</param>
+ /// <returns>New SearchCondition based on the operation</returns>
+ public static SearchCondition CreateAndOrCondition(SearchConditionType conditionType, bool simplify, params SearchCondition[] conditionNodes)
+ {
+ // Same as the native "IConditionFactory:MakeAndOr" method
+ IConditionFactory nativeConditionFactory = (IConditionFactory)new ConditionFactoryCoClass();
+ ICondition result = null;
+
+ try
+ {
+ //
+ List<ICondition> conditionList = new List<ICondition>();
+ if (conditionNodes != null)
+ {
+ foreach (SearchCondition c in conditionNodes)
+ {
+ conditionList.Add(c.NativeSearchCondition);
+ }
+ }
+
+ IEnumUnknown subConditions = new EnumUnknownClass(conditionList.ToArray());
+
+ HResult hr = nativeConditionFactory.MakeAndOr(conditionType, subConditions, simplify, out result);
+
+ if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); }
+ }
+ finally
+ {
+ if (nativeConditionFactory != null)
+ {
+ Marshal.ReleaseComObject(nativeConditionFactory);
+ }
+ }
+
+ return new SearchCondition(result);
+ }
+
+ /// <summary>
+ /// Creates a condition node that is a logical negation (NOT) of another condition
+ /// (a subnode of this node).
+ /// </summary>
+ /// <param name="conditionToBeNegated">SearchCondition node to be negated.</param>
+ /// <param name="simplify">True to logically simplify the result if possible; False otherwise.
+ /// In a query builder scenario, simplyfy should typically be set to false.</param>
+ /// <returns>New SearchCondition</returns>
+ public static SearchCondition CreateNotCondition(SearchCondition conditionToBeNegated, bool simplify)
+ {
+ if (conditionToBeNegated == null)
+ {
+ throw new ArgumentNullException("conditionToBeNegated");
+ }
+
+ // Same as the native "IConditionFactory:MakeNot" method
+ IConditionFactory nativeConditionFactory = (IConditionFactory)new ConditionFactoryCoClass();
+ ICondition result;
+
+ try
+ {
+ HResult hr = nativeConditionFactory.MakeNot(conditionToBeNegated.NativeSearchCondition, simplify, out result);
+
+ if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); }
+ }
+ finally
+ {
+ if (nativeConditionFactory != null)
+ {
+ Marshal.ReleaseComObject(nativeConditionFactory);
+ }
+ }
+
+ return new SearchCondition(result);
+ }
+
+ /// <summary>
+ /// Parses an input string that contains Structured Query keywords (using Advanced Query Syntax
+ /// or Natural Query Syntax) and produces a SearchCondition object.
+ /// </summary>
+ /// <param name="query">The query to be parsed</param>
+ /// <returns>Search condition resulting from the query</returns>
+ /// <remarks>For more information on structured query syntax, visit http://msdn.microsoft.com/en-us/library/bb233500.aspx and
+ /// http://www.microsoft.com/windows/products/winfamily/desktopsearch/technicalresources/advquery.mspx</remarks>
+ public static SearchCondition ParseStructuredQuery(string query)
+ {
+ return ParseStructuredQuery(query, null);
+ }
+
+ /// <summary>
+ /// Parses an input string that contains Structured Query keywords (using Advanced Query Syntax
+ /// or Natural Query Syntax) and produces a SearchCondition object.
+ /// </summary>
+ /// <param name="query">The query to be parsed</param>
+ /// <param name="cultureInfo">The culture used to select the localized language for keywords.</param>
+ /// <returns>Search condition resulting from the query</returns>
+ /// <remarks>For more information on structured query syntax, visit http://msdn.microsoft.com/en-us/library/bb233500.aspx and
+ /// http://www.microsoft.com/windows/products/winfamily/desktopsearch/technicalresources/advquery.mspx</remarks>
+ public static SearchCondition ParseStructuredQuery(string query, CultureInfo cultureInfo)
+ {
+ if (string.IsNullOrEmpty(query))
+ {
+ throw new ArgumentNullException("query");
+ }
+
+ IQueryParserManager nativeQueryParserManager = (IQueryParserManager)new QueryParserManagerCoClass();
+ IQueryParser queryParser = null;
+ IQuerySolution querySolution = null;
+ ICondition result = null;
+
+ IEntity mainType = null;
+ SearchCondition searchCondition = null;
+ try
+ {
+ // First, try to create a new IQueryParser using IQueryParserManager
+ Guid guid = new Guid(ShellIIDGuid.IQueryParser);
+ HResult hr = nativeQueryParserManager.CreateLoadedParser(
+ "SystemIndex",
+ cultureInfo == null ? (ushort)0 : (ushort)cultureInfo.LCID,
+ ref guid,
+ out queryParser);
+
+ if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); }
+
+ if (queryParser != null)
+ {
+ // If user specified natural query, set the option on the query parser
+ using (PropVariant optionValue = new PropVariant(true))
+ {
+ hr = queryParser.SetOption(StructuredQuerySingleOption.NaturalSyntax, optionValue);
+ }
+
+ if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); }
+
+ // Next, try to parse the query.
+ // Result would be IQuerySolution that we can use for getting the ICondition and other
+ // details about the parsed query.
+ hr = queryParser.Parse(query, null, out querySolution);
+
+ if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); }
+
+ if (querySolution != null)
+ {
+ // Lastly, try to get the ICondition from this parsed query
+ hr = querySolution.GetQuery(out result, out mainType);
+
+ if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); }
+ }
+ }
+
+ searchCondition = new SearchCondition(result);
+ return searchCondition;
+ }
+ catch
+ {
+ if (searchCondition != null) { searchCondition.Dispose(); }
+ throw;
+ }
+ finally
+ {
+ if (nativeQueryParserManager != null)
+ {
+ Marshal.ReleaseComObject(nativeQueryParserManager);
+ }
+
+ if (queryParser != null)
+ {
+ Marshal.ReleaseComObject(queryParser);
+ }
+
+ if (querySolution != null)
+ {
+ Marshal.ReleaseComObject(querySolution);
+ }
+
+ if (mainType != null)
+ {
+ Marshal.ReleaseComObject(mainType);
+ }
+ }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellEnums.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellEnums.cs
new file mode 100644
index 0000000000..c60a328cfe
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellEnums.cs
@@ -0,0 +1,535 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// CommonFileDialog AddPlace locations
+ /// </summary>
+ public enum FileDialogAddPlaceLocation
+ {
+ /// <summary>
+ /// At the bottom of the Favorites or Places list.
+ /// </summary>
+ Bottom = 0x00000000,
+
+ /// <summary>
+ /// At the top of the Favorites or Places list.
+ /// </summary>
+ Top = 0x00000001,
+ }
+
+ /// <summary>
+ /// One of the values that indicates how the ShellObject DisplayName should look.
+ /// </summary>
+ public enum DisplayNameType
+ {
+ /// <summary>
+ /// Returns the display name relative to the desktop.
+ /// </summary>
+ Default = 0x00000000,
+
+ /// <summary>
+ /// Returns the parsing name relative to the parent folder.
+ /// </summary>
+ RelativeToParent = unchecked((int)0x80018001),
+
+ /// <summary>
+ /// Returns the path relative to the parent folder in a
+ /// friendly format as displayed in an address bar.
+ /// </summary>
+ RelativeToParentAddressBar = unchecked((int)0x8007c001),
+
+ /// <summary>
+ /// Returns the parsing name relative to the desktop.
+ /// </summary>
+ RelativeToDesktop = unchecked((int)0x80028000),
+
+ /// <summary>
+ /// Returns the editing name relative to the parent folder.
+ /// </summary>
+ RelativeToParentEditing = unchecked((int)0x80031001),
+
+ /// <summary>
+ /// Returns the editing name relative to the desktop.
+ /// </summary>
+ RelativeToDesktopEditing = unchecked((int)0x8004c000),
+
+ /// <summary>
+ /// Returns the display name relative to the file system path.
+ /// </summary>
+ FileSystemPath = unchecked((int)0x80058000),
+
+ /// <summary>
+ /// Returns the display name relative to a URL.
+ /// </summary>
+ Url = unchecked((int)0x80068000),
+ }
+ /// <summary>
+ /// Available Library folder types
+ /// </summary>
+ public enum LibraryFolderType
+ {
+ /// <summary>
+ /// General Items
+ /// </summary>
+ Generic = 0,
+
+ /// <summary>
+ /// Documents
+ /// </summary>
+ Documents,
+
+ /// <summary>
+ /// Music
+ /// </summary>
+ Music,
+
+ /// <summary>
+ /// Pictures
+ /// </summary>
+ Pictures,
+
+ /// <summary>
+ /// Videos
+ /// </summary>
+ Videos
+
+ }
+
+ /// <summary>
+ /// Flags controlling the appearance of a window
+ /// </summary>
+ public enum WindowShowCommand
+ {
+ /// <summary>
+ /// Hides the window and activates another window.
+ /// </summary>
+ Hide = 0,
+
+ /// <summary>
+ /// Activates and displays the window (including restoring
+ /// it to its original size and position).
+ /// </summary>
+ Normal = 1,
+
+ /// <summary>
+ /// Minimizes the window.
+ /// </summary>
+ Minimized = 2,
+
+ /// <summary>
+ /// Maximizes the window.
+ /// </summary>
+ Maximized = 3,
+
+ /// <summary>
+ /// Similar to <see cref="Normal"/>, except that the window
+ /// is not activated.
+ /// </summary>
+ ShowNoActivate = 4,
+
+ /// <summary>
+ /// Activates the window and displays it in its current size
+ /// and position.
+ /// </summary>
+ Show = 5,
+
+ /// <summary>
+ /// Minimizes the window and activates the next top-level window.
+ /// </summary>
+ Minimize = 6,
+
+ /// <summary>
+ /// Minimizes the window and does not activate it.
+ /// </summary>
+ ShowMinimizedNoActivate = 7,
+
+ /// <summary>
+ /// Similar to <see cref="Normal"/>, except that the window is not
+ /// activated.
+ /// </summary>
+ ShowNA = 8,
+
+ /// <summary>
+ /// Activates and displays the window, restoring it to its original
+ /// size and position.
+ /// </summary>
+ Restore = 9,
+
+ /// <summary>
+ /// Sets the show state based on the initial value specified when
+ /// the process was created.
+ /// </summary>
+ Default = 10,
+
+ /// <summary>
+ /// Minimizes a window, even if the thread owning the window is not
+ /// responding. Use this only to minimize windows from a different
+ /// thread.
+ /// </summary>
+ ForceMinimize = 11
+ }
+
+ /// <summary>
+ /// Provides a set of flags to be used with <see cref="Microsoft.WindowsAPICodePack.Shell.SearchCondition"/>
+ /// to indicate the operation in <see cref="Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory"/> methods.
+ /// </summary>
+ public enum SearchConditionOperation
+ {
+ /// <summary>
+ /// An implicit comparison between the value of the property and the value of the constant.
+ /// </summary>
+ Implicit = 0,
+
+ /// <summary>
+ /// The value of the property and the value of the constant must be equal.
+ /// </summary>
+ Equal = 1,
+
+ /// <summary>
+ /// The value of the property and the value of the constant must not be equal.
+ /// </summary>
+ NotEqual = 2,
+
+ /// <summary>
+ /// The value of the property must be less than the value of the constant.
+ /// </summary>
+ LessThan = 3,
+
+ /// <summary>
+ /// The value of the property must be greater than the value of the constant.
+ /// </summary>
+ GreaterThan = 4,
+
+ /// <summary>
+ /// The value of the property must be less than or equal to the value of the constant.
+ /// </summary>
+ LessThanOrEqual = 5,
+
+ /// <summary>
+ /// The value of the property must be greater than or equal to the value of the constant.
+ /// </summary>
+ GreaterThanOrEqual = 6,
+
+ /// <summary>
+ /// The value of the property must begin with the value of the constant.
+ /// </summary>
+ ValueStartsWith = 7,
+
+ /// <summary>
+ /// The value of the property must end with the value of the constant.
+ /// </summary>
+ ValueEndsWith = 8,
+
+ /// <summary>
+ /// The value of the property must contain the value of the constant.
+ /// </summary>
+ ValueContains = 9,
+
+ /// <summary>
+ /// The value of the property must not contain the value of the constant.
+ /// </summary>
+ ValueNotContains = 10,
+
+ /// <summary>
+ /// The value of the property must match the value of the constant, where '?'
+ /// matches any single character and '*' matches any sequence of characters.
+ /// </summary>
+ DosWildcards = 11,
+
+ /// <summary>
+ /// The value of the property must contain a word that is the value of the constant.
+ /// </summary>
+ WordEqual = 12,
+
+ /// <summary>
+ /// The value of the property must contain a word that begins with the value of the constant.
+ /// </summary>
+ WordStartsWith = 13,
+
+ /// <summary>
+ /// The application is free to interpret this in any suitable way.
+ /// </summary>
+ ApplicationSpecific = 14
+ }
+
+ /// <summary>
+ /// Set of flags to be used with <see cref="Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory"/>.
+ /// </summary>
+ public enum SearchConditionType
+ {
+ /// <summary>
+ /// Indicates that the values of the subterms are combined by "AND".
+ /// </summary>
+ And = 0,
+
+ /// <summary>
+ /// Indicates that the values of the subterms are combined by "OR".
+ /// </summary>
+ Or = 1,
+
+ /// <summary>
+ /// Indicates a "NOT" comparison of subterms.
+ /// </summary>
+ Not = 2,
+
+ /// <summary>
+ /// Indicates that the node is a comparison between a property and a
+ /// constant value using a <see cref="Microsoft.WindowsAPICodePack.Shell.SearchConditionOperation"/>.
+ /// </summary>
+ Leaf = 3,
+ }
+
+ /// <summary>
+ /// Used to describe the view mode.
+ /// </summary>
+ public enum FolderLogicalViewMode
+ {
+ /// <summary>
+ /// The view is not specified.
+ /// </summary>
+ Unspecified = -1,
+
+ /// <summary>
+ /// This should have the same affect as Unspecified.
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// The minimum valid enumeration value. Used for validation purposes only.
+ /// </summary>
+ First = 1,
+
+ /// <summary>
+ /// Details view.
+ /// </summary>
+ Details = 1,
+
+ /// <summary>
+ /// Tiles view.
+ /// </summary>
+ Tiles = 2,
+
+ /// <summary>
+ /// Icons view.
+ /// </summary>
+ Icons = 3,
+
+ /// <summary>
+ /// Windows 7 and later. List view.
+ /// </summary>
+ List = 4,
+
+ /// <summary>
+ /// Windows 7 and later. Content view.
+ /// </summary>
+ Content = 5,
+
+ /// <summary>
+ /// The maximum valid enumeration value. Used for validation purposes only.
+ /// </summary>
+ Last = 5
+ }
+
+ /// <summary>
+ /// The direction in which the items are sorted.
+ /// </summary>
+ public enum SortDirection
+ {
+ /// <summary>
+ /// A default value for sort direction, this value should not be used;
+ /// instead use Descending or Ascending.
+ /// </summary>
+ Default = 0,
+
+ /// <summary>
+ /// The items are sorted in descending order. Whether the sort is alphabetical, numerical,
+ /// and so on, is determined by the data type of the column indicated in propkey.
+ /// </summary>
+ Descending = -1,
+
+ /// <summary>
+ /// The items are sorted in ascending order. Whether the sort is alphabetical, numerical,
+ /// and so on, is determined by the data type of the column indicated in propkey.
+ /// </summary>
+ Ascending = 1,
+ }
+
+ /// <summary>
+ /// Provides a set of flags to be used with IQueryParser::SetOption and
+ /// IQueryParser::GetOption to indicate individual options.
+ /// </summary>
+ public enum StructuredQuerySingleOption
+ {
+ /// <summary>
+ /// The value should be VT_LPWSTR and the path to a file containing a schema binary.
+ /// </summary>
+ Schema,
+
+ /// <summary>
+ /// The value must be VT_EMPTY (the default) or a VT_UI4 that is an LCID. It is used
+ /// as the locale of contents (not keywords) in the query to be searched for, when no
+ /// other information is available. The default value is the current keyboard locale.
+ /// Retrieving the value always returns a VT_UI4.
+ /// </summary>
+ Locale,
+
+ /// <summary>
+ /// This option is used to override the default word breaker used when identifying keywords
+ /// in queries. The default word breaker is chosen according to the language of the keywords
+ /// (cf. SQSO_LANGUAGE_KEYWORDS below). When setting this option, the value should be VT_EMPTY
+ /// for using the default word breaker, or a VT_UNKNOWN with an object supporting
+ /// the IWordBreaker interface. Retrieving the option always returns a VT_UNKNOWN with an object
+ /// supporting the IWordBreaker interface.
+ /// </summary>
+ WordBreaker,
+
+ /// <summary>
+ /// The value should be VT_EMPTY or VT_BOOL with VARIANT_TRUE to allow natural query
+ /// syntax (the default) or VT_BOOL with VARIANT_FALSE to allow only advanced query syntax.
+ /// Retrieving the option always returns a VT_BOOL.
+ /// This option is now deprecated, use SQSO_SYNTAX.
+ /// </summary>
+ NaturalSyntax,
+
+ /// <summary>
+ /// The value should be VT_BOOL with VARIANT_TRUE to generate query expressions
+ /// as if each word in the query had a star appended to it (unless followed by punctuation
+ /// other than a parenthesis), or VT_EMPTY or VT_BOOL with VARIANT_FALSE to
+ /// use the words as they are (the default). A word-wheeling application
+ /// will generally want to set this option to true.
+ /// Retrieving the option always returns a VT_BOOL.
+ /// </summary>
+ AutomaticWildcard,
+
+ /// <summary>
+ /// Reserved. The value should be VT_EMPTY (the default) or VT_I4.
+ /// Retrieving the option always returns a VT_I4.
+ /// </summary>
+ TraceLevel,
+
+ /// <summary>
+ /// The value must be a VT_UI4 that is a LANGID. It defaults to the default user UI language.
+ /// </summary>
+ LanguageKeywords,
+
+ /// <summary>
+ /// The value must be a VT_UI4 that is a STRUCTURED_QUERY_SYNTAX value.
+ /// It defaults to SQS_NATURAL_QUERY_SYNTAX.
+ /// </summary>
+ Syntax,
+
+ /// <summary>
+ /// The value must be a VT_BLOB that is a copy of a TIME_ZONE_INFORMATION structure.
+ /// It defaults to the current time zone.
+ /// </summary>
+ TimeZone,
+
+ /// <summary>
+ /// This setting decides what connector should be assumed between conditions when none is specified.
+ /// The value must be a VT_UI4 that is a CONDITION_TYPE. Only CT_AND_CONDITION and CT_OR_CONDITION
+ /// are valid. It defaults to CT_AND_CONDITION.
+ /// </summary>
+ ImplicitConnector,
+
+ /// <summary>
+ /// This setting decides whether there are special requirements on the case of connector keywords (such
+ /// as AND or OR). The value must be a VT_UI4 that is a CASE_REQUIREMENT value.
+ /// It defaults to CASE_REQUIREMENT_UPPER_IF_AQS.
+ /// </summary>
+ ConnectorCase,
+
+ }
+
+ /// <summary>
+ /// Provides a set of flags to be used with IQueryParser::SetMultiOption
+ /// to indicate individual options.
+ /// </summary>
+ public enum StructuredQueryMultipleOption
+ {
+ /// <summary>
+ /// The key should be property name P. The value should be a
+ /// VT_UNKNOWN with an IEnumVARIANT which has two values: a VT_BSTR that is another
+ /// property name Q and a VT_I4 that is a CONDITION_OPERATION cop. A predicate with
+ /// property name P, some operation and a value V will then be replaced by a predicate
+ /// with property name Q, operation cop and value V before further processing happens.
+ /// </summary>
+ VirtualProperty,
+
+ /// <summary>
+ /// The key should be a value type name V. The value should be a
+ /// VT_LPWSTR with a property name P. A predicate with no property name and a value of type
+ /// V (or any subtype of V) will then use property P.
+ /// </summary>
+ DefaultProperty,
+
+ /// <summary>
+ /// The key should be a value type name V. The value should be a
+ /// VT_UNKNOWN with a IConditionGenerator G. The GenerateForLeaf method of
+ /// G will then be applied to any predicate with value type V and if it returns a query
+ /// expression, that will be used. If it returns NULL, normal processing will be used
+ /// instead.
+ /// </summary>
+ GeneratorForType,
+
+ /// <summary>
+ /// The key should be a property name P. The value should be a VT_VECTOR|VT_LPWSTR,
+ /// where each string is a property name. The count must be at least one. This "map" will be
+ /// added to those of the loaded schema and used during resolution. A second call with the
+ /// same key will replace the current map. If the value is VT_NULL, the map will be removed.
+ /// </summary>
+ MapProperty,
+ }
+
+ /// <summary>
+ /// Used by IQueryParserManager::SetOption to set parsing options.
+ /// This can be used to specify schemas and localization options.
+ /// </summary>
+ public enum QueryParserManagerOption
+ {
+ /// <summary>
+ /// A VT_LPWSTR containing the name of the file that contains the schema binary.
+ /// The default value is StructuredQuerySchema.bin for the SystemIndex catalog
+ /// and StructuredQuerySchemaTrivial.bin for the trivial catalog.
+ /// </summary>
+ SchemaBinaryName = 0,
+
+ /// <summary>
+ /// Either a VT_BOOL or a VT_LPWSTR. If the value is a VT_BOOL and is FALSE,
+ /// a pre-localized schema will not be used. If the value is a VT_BOOL and is TRUE,
+ /// IQueryParserManager will use the pre-localized schema binary in
+ /// "%ALLUSERSPROFILE%\Microsoft\Windows". If the value is a VT_LPWSTR, the value should
+ /// contain the full path of the folder in which the pre-localized schema binary can be found.
+ /// The default value is VT_BOOL with TRUE.
+ /// </summary>
+ PreLocalizedSchemaBinaryPath = 1,
+
+ /// <summary>
+ /// A VT_LPWSTR containing the full path to the folder that contains the
+ /// unlocalized schema binary. The default value is "%SYSTEMROOT%\System32".
+ /// </summary>
+ UnlocalizedSchemaBinaryPath = 2,
+
+ /// <summary>
+ /// A VT_LPWSTR containing the full path to the folder that contains the
+ /// localized schema binary that can be read and written to as needed.
+ /// The default value is "%LOCALAPPDATA%\Microsoft\Windows".
+ /// </summary>
+ LocalizedSchemaBinaryPath = 3,
+
+ /// <summary>
+ /// A VT_BOOL. If TRUE, then the paths for pre-localized and localized binaries
+ /// have "\(LCID)" appended to them, where language code identifier (LCID) is
+ /// the decimal locale ID for the localized language. The default is TRUE.
+ /// </summary>
+ AppendLCIDToLocalizedPath = 4,
+
+ /// <summary>
+ /// A VT_UNKNOWN with an object supporting ISchemaLocalizerSupport.
+ /// This object will be used instead of the default localizer support object.
+ /// </summary>
+ LocalizerSupport = 5
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellException.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellException.cs
new file mode 100644
index 0000000000..fe5da6622f
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellException.cs
@@ -0,0 +1,81 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+
+ /// <summary>
+ /// An exception thrown when an error occurs while dealing with ShellObjects.
+ /// </summary>
+ [Serializable]
+ public class ShellException : ExternalException
+ {
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ public ShellException() { }
+
+ /// <summary>
+ /// Initializes a new exception using an HResult
+ /// </summary>
+ /// <param name="result">HResult error</param>
+ internal ShellException(HResult result) : this((int)result) { }
+
+ /// <summary>
+ /// Initializes an excpetion with a custom message.
+ /// </summary>
+ /// <param name="message">Custom message</param>
+ public ShellException(string message) : base(message) { }
+
+ /// <summary>
+ /// Initializes an exception with custom message and inner exception.
+ /// </summary>
+ /// <param name="message">Custom message</param>
+ /// <param name="innerException">The original exception that preceded this exception</param>
+ public ShellException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ /// <summary>
+ /// Initializes an exception with custom message and error code.
+ /// </summary>
+ /// <param name="message">Custom message</param>
+ /// <param name="errorCode">HResult error code</param>
+ public ShellException(string message, int errorCode) : base(message, errorCode) { }
+
+ /// <summary>
+ /// Initializes an exception with custom message and error code.
+ /// </summary>
+ /// <param name="message"></param>
+ /// <param name="errorCode"></param>
+ internal ShellException(string message, HResult errorCode) : this(message, (int)errorCode) { }
+
+ /// <summary>
+ /// Initializes an exception with custom message and inner exception.
+ /// </summary>
+ /// <param name="errorCode">HRESULT of an operation</param>
+ public ShellException(int errorCode)
+ : base(LocalizedMessages.ShellExceptionDefaultText, errorCode)
+ {
+ }
+
+ /// <summary>
+ /// Initializes an exception from serialization info and a context.
+ /// </summary>
+ /// <param name="info"></param>
+ /// <param name="context"></param>
+ protected ShellException(
+ System.Runtime.Serialization.SerializationInfo info,
+ System.Runtime.Serialization.StreamingContext context)
+ : base(info, context)
+ {
+ }
+
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellFile.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellFile.cs
new file mode 100644
index 0000000000..0a174f6642
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellFile.cs
@@ -0,0 +1,64 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System.IO;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// A file in the Shell Namespace
+ /// </summary>
+ public class ShellFile : ShellObject
+ {
+ #region Internal Constructor
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+ internal ShellFile(string path)
+ {
+ // Get the absolute path
+ string absPath = ShellHelper.GetAbsolutePath(path);
+
+ // Make sure this is valid
+ if (!File.Exists(absPath))
+ {
+ throw new FileNotFoundException(
+ string.Format(System.Globalization.CultureInfo.InvariantCulture,
+ LocalizedMessages.FilePathNotExist, path));
+ }
+
+ ParsingName = absPath;
+ }
+
+ internal ShellFile(IShellItem2 shellItem)
+ {
+ nativeShellItem = shellItem;
+ }
+
+ #endregion
+
+ #region Public Methods
+ /// <summary>
+ /// Constructs a new ShellFile object given a file path
+ /// </summary>
+ /// <param name="path">The file or folder path</param>
+ /// <returns>ShellFile object created using given file path.</returns>
+ static public ShellFile FromFilePath(string path)
+ {
+ return new ShellFile(path);
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ /// <summary>
+ /// The path for this file
+ /// </summary>
+ virtual public string Path
+ {
+ get { return this.ParsingName; }
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellFileSystemFolder.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellFileSystemFolder.cs
new file mode 100644
index 0000000000..7c5c45fe9e
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellFileSystemFolder.cs
@@ -0,0 +1,75 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System.IO;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// A folder in the Shell Namespace
+ /// </summary>
+ public class ShellFileSystemFolder : ShellFolder
+ {
+ #region Internal Constructor
+
+ internal ShellFileSystemFolder()
+ {
+ // Empty
+ }
+
+ internal ShellFileSystemFolder(IShellItem2 shellItem)
+ {
+ nativeShellItem = shellItem;
+ }
+
+ #endregion
+
+ #region Public Methods
+ /// <summary>
+ /// Constructs a new ShellFileSystemFolder object given a folder path
+ /// </summary>
+ /// <param name="path">The folder path</param>
+ /// <remarks>ShellFileSystemFolder created from the given folder path.</remarks>
+ public static ShellFileSystemFolder FromFolderPath(string path)
+ {
+ // Get the absolute path
+ string absPath = ShellHelper.GetAbsolutePath(path);
+
+ // Make sure this is valid
+ if (!Directory.Exists(absPath))
+ {
+ throw new DirectoryNotFoundException(
+ string.Format(System.Globalization.CultureInfo.InvariantCulture,
+ LocalizedMessages.FilePathNotExist, path));
+ }
+
+ ShellFileSystemFolder folder = new ShellFileSystemFolder();
+ try
+ {
+ folder.ParsingName = absPath;
+ return folder;
+ }
+ catch
+ {
+ folder.Dispose();
+ throw;
+ }
+
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ /// <summary>
+ /// The path for this Folder
+ /// </summary>
+ public virtual string Path
+ {
+ get { return this.ParsingName; }
+ }
+
+ #endregion
+
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellFolder.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellFolder.cs
new file mode 100644
index 0000000000..4632f74983
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellFolder.cs
@@ -0,0 +1,12 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Represents the base class for all types of folders (filesystem and non filesystem)
+ /// </summary>
+ public abstract class ShellFolder : ShellContainer
+ {
+ // empty
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellFolderItems.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellFolderItems.cs
new file mode 100644
index 0000000000..7b8ade7f2a
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellFolderItems.cs
@@ -0,0 +1,117 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ class ShellFolderItems : IEnumerator<ShellObject>
+ {
+ #region Private Fields
+
+ private IEnumIDList nativeEnumIdList;
+ private ShellObject currentItem;
+ ShellContainer nativeShellFolder;
+
+ #endregion
+
+ #region Internal Constructor
+
+ internal ShellFolderItems(ShellContainer nativeShellFolder)
+ {
+ this.nativeShellFolder = nativeShellFolder;
+
+ HResult hr = nativeShellFolder.NativeShellFolder.EnumObjects(
+ IntPtr.Zero,
+ ShellNativeMethods.ShellFolderEnumerationOptions.Folders | ShellNativeMethods.ShellFolderEnumerationOptions.NonFolders,
+ out nativeEnumIdList);
+
+
+ if (!CoreErrorHelper.Succeeded(hr))
+ {
+ if (hr == HResult.Canceled)
+ {
+ throw new System.IO.FileNotFoundException();
+ }
+ else
+ {
+ throw new ShellException(hr);
+ }
+ }
+
+
+ }
+
+ #endregion
+
+ #region IEnumerator<ShellObject> Members
+
+ public ShellObject Current
+ {
+ get
+ {
+ return currentItem;
+ }
+ }
+
+ #endregion
+
+ #region IDisposable Members
+
+ public void Dispose()
+ {
+ if (nativeEnumIdList != null)
+ {
+ Marshal.ReleaseComObject(nativeEnumIdList);
+ nativeEnumIdList = null;
+ }
+ }
+
+ #endregion
+
+ #region IEnumerator Members
+
+ object IEnumerator.Current
+ {
+ get { return currentItem; }
+
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
+ public bool MoveNext()
+ {
+ if (nativeEnumIdList == null) { return false; }
+
+ IntPtr item;
+ uint numItemsReturned;
+ uint itemsRequested = 1;
+ HResult hr = nativeEnumIdList.Next(itemsRequested, out item, out numItemsReturned);
+
+ if (numItemsReturned < itemsRequested || hr != HResult.Ok) { return false; }
+
+ currentItem = ShellObjectFactory.Create(item, nativeShellFolder);
+
+ return true;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ public void Reset()
+ {
+ if (nativeEnumIdList != null)
+ {
+ nativeEnumIdList.Reset();
+ }
+ }
+
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellHelper.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellHelper.cs
new file mode 100644
index 0000000000..11aca0a2ba
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellHelper.cs
@@ -0,0 +1,91 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Shell.PropertySystem;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// A helper class for Shell Objects
+ /// </summary>
+ internal static class ShellHelper
+ {
+ internal static string GetParsingName(IShellItem shellItem)
+ {
+ if (shellItem == null) { return null; }
+
+ string path = null;
+
+ IntPtr pszPath = IntPtr.Zero;
+ HResult hr = shellItem.GetDisplayName(ShellNativeMethods.ShellItemDesignNameOptions.DesktopAbsoluteParsing, out pszPath);
+
+ if (hr != HResult.Ok && hr != HResult.InvalidArguments)
+ {
+ throw new ShellException(LocalizedMessages.ShellHelperGetParsingNameFailed, hr);
+ }
+
+ if (pszPath != IntPtr.Zero)
+ {
+ path = Marshal.PtrToStringAuto(pszPath);
+ Marshal.FreeCoTaskMem(pszPath);
+ pszPath = IntPtr.Zero;
+ }
+
+ return path;
+
+ }
+
+ internal static string GetAbsolutePath(string path)
+ {
+ if (Uri.IsWellFormedUriString(path, UriKind.Absolute))
+ {
+ return path;
+ }
+ return Path.GetFullPath((path));
+ }
+
+ internal static PropertyKey ItemTypePropertyKey = new PropertyKey(new Guid("28636AA6-953D-11D2-B5D6-00C04FD918D0"), 11);
+
+ internal static string GetItemType(IShellItem2 shellItem)
+ {
+ if (shellItem != null)
+ {
+ string itemType = null;
+ HResult hr = shellItem.GetString(ref ItemTypePropertyKey, out itemType);
+ if (hr == HResult.Ok) { return itemType; }
+ }
+
+ return null;
+ }
+
+ internal static IntPtr PidlFromParsingName(string name)
+ {
+ IntPtr pidl;
+
+ ShellNativeMethods.ShellFileGetAttributesOptions sfgao;
+ int retCode = ShellNativeMethods.SHParseDisplayName(
+ name, IntPtr.Zero, out pidl, (ShellNativeMethods.ShellFileGetAttributesOptions)0,
+ out sfgao);
+
+ return (CoreErrorHelper.Succeeded(retCode) ? pidl : IntPtr.Zero);
+ }
+
+ internal static IntPtr PidlFromShellItem(IShellItem nativeShellItem)
+ {
+ IntPtr unknown = Marshal.GetIUnknownForObject(nativeShellItem);
+ return PidlFromUnknown(unknown);
+ }
+
+ internal static IntPtr PidlFromUnknown(IntPtr unknown)
+ {
+ IntPtr pidl;
+ int retCode = ShellNativeMethods.SHGetIDListFromObject(unknown, out pidl);
+ return (CoreErrorHelper.Succeeded(retCode) ? pidl : IntPtr.Zero);
+ }
+
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellItemArray.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellItemArray.cs
new file mode 100644
index 0000000000..f4ff3b84d6
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellItemArray.cs
@@ -0,0 +1,70 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using Microsoft.WindowsAPICodePack.Shell.PropertySystem;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ internal class ShellItemArray : IShellItemArray
+ {
+ List<IShellItem> shellItemsList = new List<IShellItem>();
+
+ internal ShellItemArray(IShellItem[] shellItems)
+ {
+ shellItemsList.AddRange(shellItems);
+ }
+
+ #region IShellItemArray Members
+
+ public HResult BindToHandler(IntPtr pbc, ref Guid rbhid, ref Guid riid, out IntPtr ppvOut)
+ {
+ throw new NotSupportedException();
+ }
+
+ public HResult GetPropertyStore(int Flags, ref Guid riid, out IntPtr ppv)
+ {
+ throw new NotSupportedException();
+ }
+
+ public HResult GetPropertyDescriptionList(ref PropertyKey keyType, ref Guid riid, out IntPtr ppv)
+ {
+ throw new NotSupportedException();
+ }
+
+ public HResult GetAttributes(ShellNativeMethods.ShellItemAttributeOptions dwAttribFlags, ShellNativeMethods.ShellFileGetAttributesOptions sfgaoMask, out ShellNativeMethods.ShellFileGetAttributesOptions psfgaoAttribs)
+ {
+ throw new NotSupportedException();
+ }
+
+ public HResult GetCount(out uint pdwNumItems)
+ {
+ pdwNumItems = (uint)shellItemsList.Count;
+ return HResult.Ok;
+ }
+
+ public HResult GetItemAt(uint dwIndex, out IShellItem ppsi)
+ {
+ int index = (int)dwIndex;
+
+ if (index < shellItemsList.Count)
+ {
+ ppsi = shellItemsList[index];
+ return HResult.Ok;
+ }
+ else
+ {
+ ppsi = null;
+ return HResult.Fail;
+ }
+ }
+
+ public HResult EnumItems(out IntPtr ppenumShellItems)
+ {
+ throw new NotSupportedException();
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellLibrary.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellLibrary.cs
new file mode 100644
index 0000000000..ae2ccd10e9
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellLibrary.cs
@@ -0,0 +1,901 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Threading;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// A Shell Library in the Shell Namespace
+ /// </summary>
+ public sealed class ShellLibrary : ShellContainer, IList<ShellFileSystemFolder>
+ {
+ #region Private Fields
+
+ private INativeShellLibrary nativeShellLibrary;
+ private IKnownFolder knownFolder;
+
+ private static Guid[] FolderTypesGuids =
+ {
+ new Guid(ShellKFIDGuid.GenericLibrary),
+ new Guid(ShellKFIDGuid.DocumentsLibrary),
+ new Guid(ShellKFIDGuid.MusicLibrary),
+ new Guid(ShellKFIDGuid.PicturesLibrary),
+ new Guid(ShellKFIDGuid.VideosLibrary)
+ };
+
+ #endregion
+
+ #region Private Constructor
+
+ private ShellLibrary()
+ {
+ CoreHelpers.ThrowIfNotWin7();
+ }
+
+ //Construct the ShellLibrary object from a native Shell Library
+ private ShellLibrary(INativeShellLibrary nativeShellLibrary)
+ : this()
+ {
+ this.nativeShellLibrary = nativeShellLibrary;
+ }
+
+ /// <summary>
+ /// Creates a shell library in the Libraries Known Folder,
+ /// using the given IKnownFolder
+ /// </summary>
+ /// <param name="sourceKnownFolder">KnownFolder from which to create the new Shell Library</param>
+ /// <param name="isReadOnly">If <B>true</B> , opens the library in read-only mode.</param>
+ private ShellLibrary(IKnownFolder sourceKnownFolder, bool isReadOnly)
+ : this()
+ {
+ Debug.Assert(sourceKnownFolder != null);
+
+ // Keep a reference locally
+ knownFolder = sourceKnownFolder;
+
+ nativeShellLibrary = (INativeShellLibrary)new ShellLibraryCoClass();
+
+ AccessModes flags = isReadOnly ?
+ AccessModes.Read :
+ AccessModes.ReadWrite;
+
+ // Get the IShellItem2
+ base.nativeShellItem = ((ShellObject)sourceKnownFolder).NativeShellItem2;
+
+ Guid guid = sourceKnownFolder.FolderId;
+
+ // Load the library from the IShellItem2
+ try
+ {
+ nativeShellLibrary.LoadLibraryFromKnownFolder(ref guid, flags);
+ }
+ catch (InvalidCastException)
+ {
+ throw new ArgumentException(LocalizedMessages.ShellLibraryInvalidLibrary, "sourceKnownFolder");
+ }
+ catch (NotImplementedException)
+ {
+ throw new ArgumentException(LocalizedMessages.ShellLibraryInvalidLibrary, "sourceKnownFolder");
+ }
+ }
+
+ #endregion
+
+ #region Public Constructors
+
+ /// <summary>
+ /// Creates a shell library in the Libraries Known Folder,
+ /// using the given shell library name.
+ /// </summary>
+ /// <param name="libraryName">The name of this library</param>
+ /// <param name="overwrite">Allow overwriting an existing library; if one exists with the same name</param>
+ public ShellLibrary(string libraryName, bool overwrite)
+ : this()
+ {
+ if (string.IsNullOrEmpty(libraryName))
+ {
+ throw new ArgumentException(LocalizedMessages.ShellLibraryEmptyName, "libraryName");
+ }
+
+ this.Name = libraryName;
+ Guid guid = new Guid(ShellKFIDGuid.Libraries);
+
+ ShellNativeMethods.LibrarySaveOptions flags = overwrite ?
+ ShellNativeMethods.LibrarySaveOptions.OverrideExisting :
+ ShellNativeMethods.LibrarySaveOptions.FailIfThere;
+
+ nativeShellLibrary = (INativeShellLibrary)new ShellLibraryCoClass();
+ nativeShellLibrary.SaveInKnownFolder(ref guid, libraryName, flags, out nativeShellItem);
+ }
+
+ /// <summary>
+ /// Creates a shell library in a given Known Folder,
+ /// using the given shell library name.
+ /// </summary>
+ /// <param name="libraryName">The name of this library</param>
+ /// <param name="sourceKnownFolder">The known folder</param>
+ /// <param name="overwrite">Override an existing library with the same name</param>
+ public ShellLibrary(string libraryName, IKnownFolder sourceKnownFolder, bool overwrite)
+ : this()
+ {
+ if (string.IsNullOrEmpty(libraryName))
+ {
+ throw new ArgumentException(LocalizedMessages.ShellLibraryEmptyName, "libraryName");
+ }
+
+ knownFolder = sourceKnownFolder;
+
+ this.Name = libraryName;
+ Guid guid = knownFolder.FolderId;
+
+ ShellNativeMethods.LibrarySaveOptions flags = overwrite ?
+ ShellNativeMethods.LibrarySaveOptions.OverrideExisting :
+ ShellNativeMethods.LibrarySaveOptions.FailIfThere;
+
+ nativeShellLibrary = (INativeShellLibrary)new ShellLibraryCoClass();
+ nativeShellLibrary.SaveInKnownFolder(ref guid, libraryName, flags, out nativeShellItem);
+ }
+
+ /// <summary>
+ /// Creates a shell library in a given local folder,
+ /// using the given shell library name.
+ /// </summary>
+ /// <param name="libraryName">The name of this library</param>
+ /// <param name="folderPath">The path to the local folder</param>
+ /// <param name="overwrite">Override an existing library with the same name</param>
+ public ShellLibrary(string libraryName, string folderPath, bool overwrite)
+ : this()
+ {
+ if (string.IsNullOrEmpty(libraryName))
+ {
+ throw new ArgumentException(LocalizedMessages.ShellLibraryEmptyName, "libraryName");
+ }
+
+ if (!Directory.Exists(folderPath))
+ {
+ throw new DirectoryNotFoundException(LocalizedMessages.ShellLibraryFolderNotFound);
+ }
+
+ this.Name = libraryName;
+
+ ShellNativeMethods.LibrarySaveOptions flags = overwrite ?
+ ShellNativeMethods.LibrarySaveOptions.OverrideExisting :
+ ShellNativeMethods.LibrarySaveOptions.FailIfThere;
+
+ Guid guid = new Guid(ShellIIDGuid.IShellItem);
+
+ IShellItem shellItemIn;
+ ShellNativeMethods.SHCreateItemFromParsingName(folderPath, IntPtr.Zero, ref guid, out shellItemIn);
+
+ nativeShellLibrary = (INativeShellLibrary)new ShellLibraryCoClass();
+ nativeShellLibrary.Save(shellItemIn, libraryName, flags, out nativeShellItem);
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ /// <summary>
+ /// The name of the library, every library must
+ /// have a name
+ /// </summary>
+ /// <exception cref="COMException">Will throw if no Icon is set</exception>
+ public override string Name
+ {
+ get
+ {
+ if (base.Name == null && NativeShellItem != null)
+ {
+ base.Name = System.IO.Path.GetFileNameWithoutExtension(ShellHelper.GetParsingName(NativeShellItem));
+ }
+
+ return base.Name;
+ }
+ }
+
+ /// <summary>
+ /// The Resource Reference to the icon.
+ /// </summary>
+ public IconReference IconResourceId
+ {
+ get
+ {
+ string iconRef;
+ nativeShellLibrary.GetIcon(out iconRef);
+ return new IconReference(iconRef);
+ }
+
+ set
+ {
+ nativeShellLibrary.SetIcon(value.ReferencePath);
+ nativeShellLibrary.Commit();
+ }
+ }
+
+ /// <summary>
+ /// One of predefined Library types
+ /// </summary>
+ /// <exception cref="COMException">Will throw if no Library Type is set</exception>
+ public LibraryFolderType LibraryType
+ {
+ get
+ {
+ Guid folderTypeGuid;
+ nativeShellLibrary.GetFolderType(out folderTypeGuid);
+
+ return GetFolderTypefromGuid(folderTypeGuid);
+ }
+
+ set
+ {
+ Guid guid = FolderTypesGuids[(int)value];
+ nativeShellLibrary.SetFolderType(ref guid);
+ nativeShellLibrary.Commit();
+ }
+ }
+
+ /// <summary>
+ /// The Guid of the Library type
+ /// </summary>
+ /// <exception cref="COMException">Will throw if no Library Type is set</exception>
+ public Guid LibraryTypeId
+ {
+ get
+ {
+ Guid folderTypeGuid;
+ nativeShellLibrary.GetFolderType(out folderTypeGuid);
+
+ return folderTypeGuid;
+ }
+ }
+
+ private static LibraryFolderType GetFolderTypefromGuid(Guid folderTypeGuid)
+ {
+ for (int i = 0; i < FolderTypesGuids.Length; i++)
+ {
+ if (folderTypeGuid.Equals(FolderTypesGuids[i]))
+ {
+ return (LibraryFolderType)i;
+ }
+ }
+ throw new ArgumentOutOfRangeException("folderTypeGuid", LocalizedMessages.ShellLibraryInvalidFolderType);
+ }
+
+ /// <summary>
+ /// By default, this folder is the first location
+ /// added to the library. The default save folder
+ /// is both the default folder where files can
+ /// be saved, and also where the library XML
+ /// file will be saved, if no other path is specified
+ /// </summary>
+ public string DefaultSaveFolder
+ {
+ get
+ {
+ Guid guid = new Guid(ShellIIDGuid.IShellItem);
+
+ IShellItem saveFolderItem;
+
+ nativeShellLibrary.GetDefaultSaveFolder(
+ ShellNativeMethods.DefaultSaveFolderType.Detect,
+ ref guid,
+ out saveFolderItem);
+
+ return ShellHelper.GetParsingName(saveFolderItem);
+ }
+ set
+ {
+ if (string.IsNullOrEmpty(value))
+ {
+ throw new ArgumentNullException("value");
+ }
+
+ if (!Directory.Exists(value))
+ {
+ throw new DirectoryNotFoundException(LocalizedMessages.ShellLibraryDefaultSaveFolderNotFound);
+ }
+
+ string fullPath = new DirectoryInfo(value).FullName;
+
+ Guid guid = new Guid(ShellIIDGuid.IShellItem);
+ IShellItem saveFolderItem;
+
+ ShellNativeMethods.SHCreateItemFromParsingName(fullPath, IntPtr.Zero, ref guid, out saveFolderItem);
+
+ nativeShellLibrary.SetDefaultSaveFolder(
+ ShellNativeMethods.DefaultSaveFolderType.Detect,
+ saveFolderItem);
+
+ nativeShellLibrary.Commit();
+ }
+ }
+
+ /// <summary>
+ /// Whether the library will be pinned to the
+ /// Explorer Navigation Pane
+ /// </summary>
+ public bool IsPinnedToNavigationPane
+ {
+ get
+ {
+ ShellNativeMethods.LibraryOptions flags = ShellNativeMethods.LibraryOptions.PinnedToNavigationPane;
+
+ nativeShellLibrary.GetOptions(out flags);
+
+ return (
+ (flags & ShellNativeMethods.LibraryOptions.PinnedToNavigationPane) ==
+ ShellNativeMethods.LibraryOptions.PinnedToNavigationPane);
+ }
+ set
+ {
+ ShellNativeMethods.LibraryOptions flags = ShellNativeMethods.LibraryOptions.Default;
+
+ if (value)
+ {
+ flags |= ShellNativeMethods.LibraryOptions.PinnedToNavigationPane;
+ }
+ else
+ {
+ flags &= ~ShellNativeMethods.LibraryOptions.PinnedToNavigationPane;
+ }
+
+ nativeShellLibrary.SetOptions(ShellNativeMethods.LibraryOptions.PinnedToNavigationPane, flags);
+ nativeShellLibrary.Commit();
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Close the library, and release its associated file system resources
+ /// </summary>
+ public void Close()
+ {
+ this.Dispose();
+ }
+
+ #endregion
+
+ #region Internal Properties
+
+ internal const string FileExtension = ".library-ms";
+
+ internal override IShellItem NativeShellItem
+ {
+ get { return NativeShellItem2; }
+ }
+
+ internal override IShellItem2 NativeShellItem2
+ {
+ get { return nativeShellItem; }
+ }
+
+ #endregion
+
+ #region Static Shell Library methods
+
+ /// <summary>
+ /// Get a the known folder FOLDERID_Libraries
+ /// </summary>
+ public static IKnownFolder LibrariesKnownFolder
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotWin7();
+ return KnownFolderHelper.FromKnownFolderId(new Guid(ShellKFIDGuid.Libraries));
+ }
+ }
+
+ /// <summary>
+ /// Load the library using a number of options
+ /// </summary>
+ /// <param name="libraryName">The name of the library</param>
+ /// <param name="isReadOnly">If <B>true</B>, loads the library in read-only mode.</param>
+ /// <returns>A ShellLibrary Object</returns>
+ public static ShellLibrary Load(string libraryName, bool isReadOnly)
+ {
+ CoreHelpers.ThrowIfNotWin7();
+
+ IKnownFolder kf = KnownFolders.Libraries;
+ string librariesFolderPath = (kf != null) ? kf.Path : string.Empty;
+
+ Guid guid = new Guid(ShellIIDGuid.IShellItem);
+ IShellItem nativeShellItem;
+ string shellItemPath = System.IO.Path.Combine(librariesFolderPath, libraryName + FileExtension);
+ int hr = ShellNativeMethods.SHCreateItemFromParsingName(shellItemPath, IntPtr.Zero, ref guid, out nativeShellItem);
+
+ if (!CoreErrorHelper.Succeeded(hr))
+ throw new ShellException(hr);
+
+ INativeShellLibrary nativeShellLibrary = (INativeShellLibrary)new ShellLibraryCoClass();
+ AccessModes flags = isReadOnly ?
+ AccessModes.Read :
+ AccessModes.ReadWrite;
+ nativeShellLibrary.LoadLibraryFromItem(nativeShellItem, flags);
+
+ ShellLibrary library = new ShellLibrary(nativeShellLibrary);
+ try
+ {
+ library.nativeShellItem = (IShellItem2)nativeShellItem;
+ library.Name = libraryName;
+
+ return library;
+ }
+ catch
+ {
+ library.Dispose();
+ throw;
+ }
+ }
+
+ /// <summary>
+ /// Load the library using a number of options
+ /// </summary>
+ /// <param name="libraryName">The name of the library.</param>
+ /// <param name="folderPath">The path to the library.</param>
+ /// <param name="isReadOnly">If <B>true</B>, opens the library in read-only mode.</param>
+ /// <returns>A ShellLibrary Object</returns>
+ public static ShellLibrary Load(string libraryName, string folderPath, bool isReadOnly)
+ {
+ CoreHelpers.ThrowIfNotWin7();
+
+ // Create the shell item path
+ string shellItemPath = System.IO.Path.Combine(folderPath, libraryName + FileExtension);
+ ShellFile item = ShellFile.FromFilePath(shellItemPath);
+
+ IShellItem nativeShellItem = item.NativeShellItem;
+ INativeShellLibrary nativeShellLibrary = (INativeShellLibrary)new ShellLibraryCoClass();
+ AccessModes flags = isReadOnly ?
+ AccessModes.Read :
+ AccessModes.ReadWrite;
+ nativeShellLibrary.LoadLibraryFromItem(nativeShellItem, flags);
+
+ ShellLibrary library = new ShellLibrary(nativeShellLibrary);
+ try
+ {
+ library.nativeShellItem = (IShellItem2)nativeShellItem;
+ library.Name = libraryName;
+
+ return library;
+ }
+ catch
+ {
+ library.Dispose();
+ throw;
+ }
+ }
+
+ /// <summary>
+ /// Load the library using a number of options
+ /// </summary>
+ /// <param name="nativeShellItem">IShellItem</param>
+ /// <param name="isReadOnly">read-only flag</param>
+ /// <returns>A ShellLibrary Object</returns>
+ internal static ShellLibrary FromShellItem(IShellItem nativeShellItem, bool isReadOnly)
+ {
+ CoreHelpers.ThrowIfNotWin7();
+
+ INativeShellLibrary nativeShellLibrary = (INativeShellLibrary)new ShellLibraryCoClass();
+
+ AccessModes flags = isReadOnly ?
+ AccessModes.Read :
+ AccessModes.ReadWrite;
+
+ nativeShellLibrary.LoadLibraryFromItem(nativeShellItem, flags);
+
+ ShellLibrary library = new ShellLibrary(nativeShellLibrary);
+ library.nativeShellItem = (IShellItem2)nativeShellItem;
+
+ return library;
+ }
+
+ /// <summary>
+ /// Load the library using a number of options
+ /// </summary>
+ /// <param name="sourceKnownFolder">A known folder.</param>
+ /// <param name="isReadOnly">If <B>true</B>, opens the library in read-only mode.</param>
+ /// <returns>A ShellLibrary Object</returns>
+ public static ShellLibrary Load(IKnownFolder sourceKnownFolder, bool isReadOnly)
+ {
+ CoreHelpers.ThrowIfNotWin7();
+ return new ShellLibrary(sourceKnownFolder, isReadOnly);
+ }
+
+ private static void ShowManageLibraryUI(ShellLibrary shellLibrary, IntPtr windowHandle, string title, string instruction, bool allowAllLocations)
+ {
+ int hr = 0;
+
+ Thread staWorker = new Thread(() =>
+ {
+ hr = ShellNativeMethods.SHShowManageLibraryUI(
+ shellLibrary.NativeShellItem,
+ windowHandle,
+ title,
+ instruction,
+ allowAllLocations ?
+ ShellNativeMethods.LibraryManageDialogOptions.NonIndexableLocationWarning :
+ ShellNativeMethods.LibraryManageDialogOptions.Default);
+ });
+
+ staWorker.SetApartmentState(ApartmentState.STA);
+ staWorker.Start();
+ staWorker.Join();
+
+ if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); }
+ }
+
+ /// <summary>
+ /// Shows the library management dialog which enables users to mange the library folders and default save location.
+ /// </summary>
+ /// <param name="libraryName">The name of the library</param>
+ /// <param name="folderPath">The path to the library.</param>
+ /// <param name="windowHandle">The parent window,or IntPtr.Zero for no parent</param>
+ /// <param name="title">A title for the library management dialog, or null to use the library name as the title</param>
+ /// <param name="instruction">An optional help string to display for the library management dialog</param>
+ /// <param name="allowAllLocations">If true, do not show warning dialogs about locations that cannot be indexed</param>
+ /// <remarks>If the library is already open in read-write mode, the dialog will not save the changes.</remarks>
+ public static void ShowManageLibraryUI(string libraryName, string folderPath, IntPtr windowHandle, string title, string instruction, bool allowAllLocations)
+ {
+ // this method is not safe for MTA consumption and will blow
+ // Access Violations if called from an MTA thread so we wrap this
+ // call up into a Worker thread that performs all operations in a
+ // single threaded apartment
+ using (ShellLibrary shellLibrary = ShellLibrary.Load(libraryName, folderPath, true))
+ {
+ ShowManageLibraryUI(shellLibrary, windowHandle, title, instruction, allowAllLocations);
+ }
+ }
+
+ /// <summary>
+ /// Shows the library management dialog which enables users to mange the library folders and default save location.
+ /// </summary>
+ /// <param name="libraryName">The name of the library</param>
+ /// <param name="windowHandle">The parent window,or IntPtr.Zero for no parent</param>
+ /// <param name="title">A title for the library management dialog, or null to use the library name as the title</param>
+ /// <param name="instruction">An optional help string to display for the library management dialog</param>
+ /// <param name="allowAllLocations">If true, do not show warning dialogs about locations that cannot be indexed</param>
+ /// <remarks>If the library is already open in read-write mode, the dialog will not save the changes.</remarks>
+ public static void ShowManageLibraryUI(string libraryName, IntPtr windowHandle, string title, string instruction, bool allowAllLocations)
+ {
+ // this method is not safe for MTA consumption and will blow
+ // Access Violations if called from an MTA thread so we wrap this
+ // call up into a Worker thread that performs all operations in a
+ // single threaded apartment
+ using (ShellLibrary shellLibrary = ShellLibrary.Load(libraryName, true))
+ {
+ ShowManageLibraryUI(shellLibrary, windowHandle, title, instruction, allowAllLocations);
+ }
+ }
+
+ /// <summary>
+ /// Shows the library management dialog which enables users to mange the library folders and default save location.
+ /// </summary>
+ /// <param name="sourceKnownFolder">A known folder.</param>
+ /// <param name="windowHandle">The parent window,or IntPtr.Zero for no parent</param>
+ /// <param name="title">A title for the library management dialog, or null to use the library name as the title</param>
+ /// <param name="instruction">An optional help string to display for the library management dialog</param>
+ /// <param name="allowAllLocations">If true, do not show warning dialogs about locations that cannot be indexed</param>
+ /// <remarks>If the library is already open in read-write mode, the dialog will not save the changes.</remarks>
+ public static void ShowManageLibraryUI(IKnownFolder sourceKnownFolder, IntPtr windowHandle, string title, string instruction, bool allowAllLocations)
+ {
+ // this method is not safe for MTA consumption and will blow
+ // Access Violations if called from an MTA thread so we wrap this
+ // call up into a Worker thread that performs all operations in a
+ // single threaded apartment
+ using (ShellLibrary shellLibrary = ShellLibrary.Load(sourceKnownFolder, true))
+ {
+ ShowManageLibraryUI(shellLibrary, windowHandle, title, instruction, allowAllLocations);
+ }
+ }
+
+ #endregion
+
+ #region Collection Members
+
+ /// <summary>
+ /// Add a new FileSystemFolder or SearchConnector
+ /// </summary>
+ /// <param name="item">The folder to add to the library.</param>
+ public void Add(ShellFileSystemFolder item)
+ {
+ if (item == null) { throw new ArgumentNullException("item"); }
+
+ nativeShellLibrary.AddFolder(item.NativeShellItem);
+ nativeShellLibrary.Commit();
+ }
+
+ /// <summary>
+ /// Add an existing folder to this library
+ /// </summary>
+ /// <param name="folderPath">The path to the folder to be added to the library.</param>
+ public void Add(string folderPath)
+ {
+ if (!Directory.Exists(folderPath))
+ {
+ throw new DirectoryNotFoundException(LocalizedMessages.ShellLibraryFolderNotFound);
+ }
+
+ Add(ShellFileSystemFolder.FromFolderPath(folderPath));
+ }
+
+ /// <summary>
+ /// Clear all items of this Library
+ /// </summary>
+ public void Clear()
+ {
+ List<ShellFileSystemFolder> list = ItemsList;
+ foreach (ShellFileSystemFolder folder in list)
+ {
+ nativeShellLibrary.RemoveFolder(folder.NativeShellItem);
+ }
+
+ nativeShellLibrary.Commit();
+ }
+
+ /// <summary>
+ /// Remove a folder or search connector
+ /// </summary>
+ /// <param name="item">The item to remove.</param>
+ /// <returns><B>true</B> if the item was removed.</returns>
+ public bool Remove(ShellFileSystemFolder item)
+ {
+ if (item == null) { throw new ArgumentNullException("item"); }
+
+ try
+ {
+ nativeShellLibrary.RemoveFolder(item.NativeShellItem);
+ nativeShellLibrary.Commit();
+ }
+ catch (COMException)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ /// <summary>
+ /// Remove a folder or search connector
+ /// </summary>
+ /// <param name="folderPath">The path of the item to remove.</param>
+ /// <returns><B>true</B> if the item was removed.</returns>
+ public bool Remove(string folderPath)
+ {
+ ShellFileSystemFolder item = ShellFileSystemFolder.FromFolderPath(folderPath);
+ return Remove(item);
+ }
+
+ #endregion
+
+ #region Disposable Pattern
+
+ /// <summary>
+ /// Release resources
+ /// </summary>
+ /// <param name="disposing">Indicates that this was called from Dispose(), rather than from the finalizer.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (nativeShellLibrary != null)
+ {
+ Marshal.ReleaseComObject(nativeShellLibrary);
+ nativeShellLibrary = null;
+ }
+
+ base.Dispose(disposing);
+ }
+
+ /// <summary>
+ /// Release resources
+ /// </summary>
+ ~ShellLibrary()
+ {
+ Dispose(false);
+ }
+
+ #endregion
+
+ #region Private Properties
+
+ private List<ShellFileSystemFolder> ItemsList
+ {
+ get { return GetFolders(); }
+ }
+
+ private List<ShellFileSystemFolder> GetFolders()
+ {
+ List<ShellFileSystemFolder> list = new List<ShellFileSystemFolder>();
+ IShellItemArray itemArray;
+
+ Guid shellItemArrayGuid = new Guid(ShellIIDGuid.IShellItemArray);
+
+ HResult hr = nativeShellLibrary.GetFolders(ShellNativeMethods.LibraryFolderFilter.AllItems, ref shellItemArrayGuid, out itemArray);
+
+ if (!CoreErrorHelper.Succeeded(hr)) { return list; }
+
+ uint count;
+ itemArray.GetCount(out count);
+
+ for (uint i = 0; i < count; ++i)
+ {
+ IShellItem shellItem;
+ itemArray.GetItemAt(i, out shellItem);
+ list.Add(new ShellFileSystemFolder(shellItem as IShellItem2));
+ }
+
+ if (itemArray != null)
+ {
+ Marshal.ReleaseComObject(itemArray);
+ itemArray = null;
+ }
+
+ return list;
+ }
+
+ #endregion
+
+ #region IEnumerable<ShellFileSystemFolder> Members
+
+ /// <summary>
+ /// Retrieves the collection enumerator.
+ /// </summary>
+ /// <returns>The enumerator.</returns>
+ new public IEnumerator<ShellFileSystemFolder> GetEnumerator()
+ {
+ return ItemsList.GetEnumerator();
+ }
+
+ #endregion
+
+ #region IEnumerable Members
+
+ /// <summary>
+ /// Retrieves the collection enumerator.
+ /// </summary>
+ /// <returns>The enumerator.</returns>
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+ {
+ return ItemsList.GetEnumerator();
+ }
+
+ #endregion
+
+ #region ICollection<ShellFileSystemFolder> Members
+
+
+ /// <summary>
+ /// Determines if an item with the specified path exists in the collection.
+ /// </summary>
+ /// <param name="fullPath">The path of the item.</param>
+ /// <returns><B>true</B> if the item exists in the collection.</returns>
+ public bool Contains(string fullPath)
+ {
+ if (string.IsNullOrEmpty(fullPath))
+ {
+ throw new ArgumentNullException("fullPath");
+ }
+
+ return ItemsList.Any(folder => string.Equals(fullPath, folder.Path, StringComparison.OrdinalIgnoreCase));
+ }
+
+ /// <summary>
+ /// Determines if a folder exists in the collection.
+ /// </summary>
+ /// <param name="item">The folder.</param>
+ /// <returns><B>true</B>, if the folder exists in the collection.</returns>
+ public bool Contains(ShellFileSystemFolder item)
+ {
+ if (item == null)
+ {
+ throw new ArgumentNullException("item");
+ }
+
+ return ItemsList.Any(folder => string.Equals(item.Path, folder.Path, StringComparison.OrdinalIgnoreCase));
+ }
+
+ #endregion
+
+ #region IList<FileSystemFolder> Members
+
+ /// <summary>
+ /// Searches for the specified FileSystemFolder and returns the zero-based index of the
+ /// first occurrence within Library list.
+ /// </summary>
+ /// <param name="item">The item to search for.</param>
+ /// <returns>The index of the item in the collection, or -1 if the item does not exist.</returns>
+ public int IndexOf(ShellFileSystemFolder item)
+ {
+ return ItemsList.IndexOf(item);
+ }
+
+ /// <summary>
+ /// Inserts a FileSystemFolder at the specified index.
+ /// </summary>
+ /// <param name="index">The index to insert at.</param>
+ /// <param name="item">The FileSystemFolder to insert.</param>
+ void IList<ShellFileSystemFolder>.Insert(int index, ShellFileSystemFolder item)
+ {
+ // Index related options are not supported by IShellLibrary doesn't support them.
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Removes an item at the specified index.
+ /// </summary>
+ /// <param name="index">The index to remove.</param>
+ void IList<ShellFileSystemFolder>.RemoveAt(int index)
+ {
+ // Index related options are not supported by IShellLibrary doesn't support them.
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Retrieves the folder at the specified index
+ /// </summary>
+ /// <param name="index">The index of the folder to retrieve.</param>
+ /// <returns>A folder.</returns>
+ public ShellFileSystemFolder this[int index]
+ {
+ get { return ItemsList[index]; }
+ set
+ {
+ // Index related options are not supported by IShellLibrary
+ // doesn't support them.
+ throw new NotImplementedException();
+ }
+ }
+ #endregion
+
+ #region ICollection<ShellFileSystemFolder> Members
+
+ /// <summary>
+ /// Copies the collection to an array.
+ /// </summary>
+ /// <param name="array">The array to copy to.</param>
+ /// <param name="arrayIndex">The index in the array at which to start the copy.</param>
+ void ICollection<ShellFileSystemFolder>.CopyTo(ShellFileSystemFolder[] array, int arrayIndex)
+ {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// The count of the items in the list.
+ /// </summary>
+ public int Count
+ {
+ get { return ItemsList.Count; }
+ }
+
+ /// <summary>
+ /// Indicates whether this list is read-only or not.
+ /// </summary>
+ public bool IsReadOnly
+ {
+ get { return false; }
+ }
+
+ #endregion
+
+ /// <summary>
+ /// Indicates whether this feature is supported on the current platform.
+ /// </summary>
+ new public static bool IsPlatformSupported
+ {
+ get
+ {
+ // We need Windows 7 onwards ...
+ return CoreHelpers.RunningOnWin7;
+ }
+ }
+ }
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellLink.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellLink.cs
new file mode 100644
index 0000000000..de95815e4a
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellLink.cs
@@ -0,0 +1,143 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Represents a link to existing FileSystem or Virtual item.
+ /// </summary>
+ public class ShellLink : ShellObject
+ {
+ /// <summary>
+ /// Path for this file e.g. c:\Windows\file.txt,
+ /// </summary>
+ private string _internalPath;
+
+ #region Internal Constructors
+
+ internal ShellLink(IShellItem2 shellItem)
+ {
+ nativeShellItem = shellItem;
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ /// <summary>
+ /// The path for this link
+ /// </summary>
+ virtual public string Path
+ {
+ get
+ {
+ if (_internalPath == null && NativeShellItem != null)
+ {
+ _internalPath = base.ParsingName;
+ }
+ return _internalPath;
+ }
+ protected set
+ {
+ this._internalPath = value;
+ }
+ }
+
+ private string internalTargetLocation;
+ /// <summary>
+ /// Gets the location to which this link points to.
+ /// </summary>
+ public string TargetLocation
+ {
+ get
+ {
+ if (string.IsNullOrEmpty(internalTargetLocation) && NativeShellItem2 != null)
+ {
+ internalTargetLocation = this.Properties.System.Link.TargetParsingPath.Value;
+ }
+ return internalTargetLocation;
+ }
+ set
+ {
+ if (value == null) { return; }
+
+ internalTargetLocation = value;
+
+ if (NativeShellItem2 != null)
+ {
+ this.Properties.System.Link.TargetParsingPath.Value = internalTargetLocation;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets the ShellObject to which this link points to.
+ /// </summary>
+ public ShellObject TargetShellObject
+ {
+ get { return ShellObjectFactory.Create(TargetLocation); }
+ }
+
+ /// <summary>
+ /// Gets or sets the link's title
+ /// </summary>
+ public string Title
+ {
+ get
+ {
+ if (NativeShellItem2 != null) { return this.Properties.System.Title.Value; }
+ return null;
+ }
+ set
+ {
+ if (value == null)
+ {
+ throw new ArgumentNullException("value");
+ }
+
+ if (NativeShellItem2 != null)
+ {
+ this.Properties.System.Title.Value = value;
+ }
+ }
+ }
+
+ private string internalArguments;
+ /// <summary>
+ /// Gets the arguments associated with this link.
+ /// </summary>
+ public string Arguments
+ {
+ get
+ {
+ if (string.IsNullOrEmpty(internalArguments) && NativeShellItem2 != null)
+ {
+ internalArguments = this.Properties.System.Link.Arguments.Value;
+ }
+
+ return internalArguments;
+ }
+ }
+
+ private string internalComments;
+ /// <summary>
+ /// Gets the comments associated with this link.
+ /// </summary>
+ public string Comments
+ {
+ get
+ {
+ if (string.IsNullOrEmpty(internalComments) && NativeShellItem2 != null)
+ {
+ internalComments = this.Properties.System.Comment.Value;
+ }
+
+ return internalComments;
+ }
+ }
+
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellNonFileSystemFolder.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellNonFileSystemFolder.cs
new file mode 100644
index 0000000000..dc608a1414
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellNonFileSystemFolder.cs
@@ -0,0 +1,25 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Represents a Non FileSystem folder (e.g. My Computer, Control Panel)
+ /// </summary>
+ public class ShellNonFileSystemFolder : ShellFolder
+ {
+ #region Internal Constructors
+
+ internal ShellNonFileSystemFolder()
+ {
+ // Empty
+ }
+
+ internal ShellNonFileSystemFolder(IShellItem2 shellItem)
+ {
+ nativeShellItem = shellItem;
+ }
+
+ #endregion
+
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellNonFileSystemItem.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellNonFileSystemItem.cs
new file mode 100644
index 0000000000..b04f2b9746
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellNonFileSystemItem.cs
@@ -0,0 +1,15 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Represents a non filesystem item (e.g. virtual items inside Control Panel)
+ /// </summary>
+ public class ShellNonFileSystemItem : ShellObject
+ {
+ internal ShellNonFileSystemItem(IShellItem2 shellItem)
+ {
+ nativeShellItem = shellItem;
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellObject.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellObject.cs
new file mode 100644
index 0000000000..23aa4c4168
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellObject.cs
@@ -0,0 +1,532 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Security.Cryptography;
+using Microsoft.WindowsAPICodePack.Shell.PropertySystem;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+using System.Runtime.InteropServices.ComTypes;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// The base class for all Shell objects in Shell Namespace.
+ /// </summary>
+ abstract public class ShellObject : IDisposable, IEquatable<ShellObject>
+ {
+
+ #region Public Static Methods
+
+ /// <summary>
+ /// Creates a ShellObject subclass given a parsing name.
+ /// For file system items, this method will only accept absolute paths.
+ /// </summary>
+ /// <param name="parsingName">The parsing name of the object.</param>
+ /// <returns>A newly constructed ShellObject object.</returns>
+ public static ShellObject FromParsingName(string parsingName)
+ {
+ return ShellObjectFactory.Create(parsingName);
+ }
+
+ /// <summary>
+ /// Indicates whether this feature is supported on the current platform.
+ /// </summary>
+ public static bool IsPlatformSupported
+ {
+ get
+ {
+ // We need Windows Vista onwards ...
+ return CoreHelpers.RunningOnVista;
+ }
+ }
+
+ #endregion
+
+ #region Internal Fields
+
+ /// <summary>
+ /// Internal member to keep track of the native IShellItem2
+ /// </summary>
+ internal IShellItem2 nativeShellItem;
+
+ #endregion
+
+ #region Constructors
+
+ internal ShellObject()
+ {
+ }
+
+ internal ShellObject(IShellItem2 shellItem)
+ {
+ nativeShellItem = shellItem;
+ }
+
+ #endregion
+
+ #region Protected Fields
+
+ /// <summary>
+ /// Parsing name for this Object e.g. c:\Windows\file.txt,
+ /// or ::{Some Guid}
+ /// </summary>
+ private string _internalParsingName;
+
+ /// <summary>
+ /// A friendly name for this object that' suitable for display
+ /// </summary>
+ private string _internalName;
+
+ /// <summary>
+ /// PID List (PIDL) for this object
+ /// </summary>
+ private IntPtr _internalPIDL = IntPtr.Zero;
+
+ #endregion
+
+ #region Internal Properties
+
+ /// <summary>
+ /// Return the native ShellFolder object as newer IShellItem2
+ /// </summary>
+ /// <exception cref="System.Runtime.InteropServices.ExternalException">If the native object cannot be created.
+ /// The ErrorCode member will contain the external error code.</exception>
+ virtual internal IShellItem2 NativeShellItem2
+ {
+ get
+ {
+ if (nativeShellItem == null && ParsingName != null)
+ {
+ Guid guid = new Guid(ShellIIDGuid.IShellItem2);
+ int retCode = ShellNativeMethods.SHCreateItemFromParsingName(ParsingName, IntPtr.Zero, ref guid, out nativeShellItem);
+
+ if (nativeShellItem == null || !CoreErrorHelper.Succeeded(retCode))
+ {
+ throw new ShellException(LocalizedMessages.ShellObjectCreationFailed, Marshal.GetExceptionForHR(retCode));
+ }
+ }
+ return nativeShellItem;
+ }
+ }
+
+ /// <summary>
+ /// Return the native ShellFolder object
+ /// </summary>
+ virtual internal IShellItem NativeShellItem
+ {
+ get { return NativeShellItem2; }
+ }
+
+ /// <summary>
+ /// Gets access to the native IPropertyStore (if one is already
+ /// created for this item and still valid. This is usually done by the
+ /// ShellPropertyWriter class. The reference will be set to null
+ /// when the writer has been closed/commited).
+ /// </summary>
+ internal IPropertyStore NativePropertyStore { get; set; }
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Updates the native shell item that maps to this shell object. This is necessary when the shell item
+ /// changes after the shell object has been created. Without this method call, the retrieval of properties will
+ /// return stale data.
+ /// </summary>
+ /// <param name="bindContext">Bind context object</param>
+ public void Update(IBindCtx bindContext)
+ {
+ HResult hr = HResult.Ok;
+
+ if (NativeShellItem2 != null)
+ {
+ hr = NativeShellItem2.Update(bindContext);
+ }
+
+ if (CoreErrorHelper.Failed(hr))
+ {
+ throw new ShellException(hr);
+ }
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ private ShellProperties properties;
+ /// <summary>
+ /// Gets an object that allows the manipulation of ShellProperties for this shell item.
+ /// </summary>
+ public ShellProperties Properties
+ {
+ get
+ {
+ if (properties == null)
+ {
+ properties = new ShellProperties(this);
+ }
+ return properties;
+ }
+ }
+
+ /// <summary>
+ /// Gets the parsing name for this ShellItem.
+ /// </summary>
+ virtual public string ParsingName
+ {
+ get
+ {
+ if (_internalParsingName == null && nativeShellItem != null)
+ {
+ _internalParsingName = ShellHelper.GetParsingName(nativeShellItem);
+ }
+ return _internalParsingName ?? string.Empty;
+ }
+ protected set
+ {
+ _internalParsingName = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets the normal display for this ShellItem.
+ /// </summary>
+ virtual public string Name
+ {
+ get
+ {
+ if (_internalName == null && NativeShellItem != null)
+ {
+ IntPtr pszString = IntPtr.Zero;
+ HResult hr = NativeShellItem.GetDisplayName(ShellNativeMethods.ShellItemDesignNameOptions.Normal, out pszString);
+ if (hr == HResult.Ok && pszString != IntPtr.Zero)
+ {
+ _internalName = Marshal.PtrToStringAuto(pszString);
+
+ // Free the string
+ Marshal.FreeCoTaskMem(pszString);
+
+ }
+ }
+ return _internalName;
+ }
+
+ protected set
+ {
+ this._internalName = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets the PID List (PIDL) for this ShellItem.
+ /// </summary>
+ internal virtual IntPtr PIDL
+ {
+ get
+ {
+ // Get teh PIDL for the ShellItem
+ if (_internalPIDL == IntPtr.Zero && NativeShellItem != null)
+ {
+ _internalPIDL = ShellHelper.PidlFromShellItem(NativeShellItem);
+ }
+
+ return _internalPIDL;
+ }
+ set
+ {
+ this._internalPIDL = value;
+ }
+ }
+
+ /// <summary>
+ /// Overrides object.ToString()
+ /// </summary>
+ /// <returns>A string representation of the object.</returns>
+ public override string ToString()
+ {
+ return this.Name;
+ }
+
+ /// <summary>
+ /// Returns the display name of the ShellFolder object. DisplayNameType represents one of the
+ /// values that indicates how the name should look.
+ /// See <see cref="Microsoft.WindowsAPICodePack.Shell.DisplayNameType"/>for a list of possible values.
+ /// </summary>
+ /// <param name="displayNameType">A disaply name type.</param>
+ /// <returns>A string.</returns>
+ public virtual string GetDisplayName(DisplayNameType displayNameType)
+ {
+ string returnValue = null;
+
+ HResult hr = HResult.Ok;
+
+ if (NativeShellItem2 != null)
+ {
+ hr = NativeShellItem2.GetDisplayName((ShellNativeMethods.ShellItemDesignNameOptions)displayNameType, out returnValue);
+ }
+
+ if (hr != HResult.Ok)
+ {
+ throw new ShellException(LocalizedMessages.ShellObjectCannotGetDisplayName, hr);
+ }
+
+ return returnValue;
+ }
+
+ /// <summary>
+ /// Gets a value that determines if this ShellObject is a link or shortcut.
+ /// </summary>
+ public bool IsLink
+ {
+ get
+ {
+ try
+ {
+ ShellNativeMethods.ShellFileGetAttributesOptions sfgao;
+ NativeShellItem.GetAttributes(ShellNativeMethods.ShellFileGetAttributesOptions.Link, out sfgao);
+ return (sfgao & ShellNativeMethods.ShellFileGetAttributesOptions.Link) != 0;
+ }
+ catch (FileNotFoundException)
+ {
+ return false;
+ }
+ catch (NullReferenceException)
+ {
+ // NativeShellItem is null
+ return false;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets a value that determines if this ShellObject is a file system object.
+ /// </summary>
+ public bool IsFileSystemObject
+ {
+ get
+ {
+ try
+ {
+ ShellNativeMethods.ShellFileGetAttributesOptions sfgao;
+ NativeShellItem.GetAttributes(ShellNativeMethods.ShellFileGetAttributesOptions.FileSystem, out sfgao);
+ return (sfgao & ShellNativeMethods.ShellFileGetAttributesOptions.FileSystem) != 0;
+ }
+ catch (FileNotFoundException)
+ {
+ return false;
+ }
+ catch (NullReferenceException)
+ {
+ // NativeShellItem is null
+ return false;
+ }
+ }
+ }
+
+ private ShellThumbnail thumbnail;
+ /// <summary>
+ /// Gets the thumbnail of the ShellObject.
+ /// </summary>
+ public ShellThumbnail Thumbnail
+ {
+ get
+ {
+ if (thumbnail == null) { thumbnail = new ShellThumbnail(this); }
+ return thumbnail;
+ }
+ }
+
+ private ShellObject parentShellObject;
+ /// <summary>
+ /// Gets the parent ShellObject.
+ /// Returns null if the object has no parent, i.e. if this object is the Desktop folder.
+ /// </summary>
+ public ShellObject Parent
+ {
+ get
+ {
+ if (parentShellObject == null && NativeShellItem2 != null)
+ {
+ IShellItem parentShellItem;
+ HResult hr = NativeShellItem2.GetParent(out parentShellItem);
+
+ if (hr == HResult.Ok && parentShellItem != null)
+ {
+ parentShellObject = ShellObjectFactory.Create(parentShellItem);
+ }
+ else if (hr == HResult.NoObject)
+ {
+ // Should return null if the parent is desktop
+ return null;
+ }
+ else
+ {
+ throw new ShellException(hr);
+ }
+ }
+
+ return parentShellObject;
+ }
+ }
+
+
+ #endregion
+
+ #region IDisposable Members
+
+ /// <summary>
+ /// Release the native and managed objects
+ /// </summary>
+ /// <param name="disposing">Indicates that this is being called from Dispose(), rather than the finalizer.</param>
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ _internalName = null;
+ _internalParsingName = null;
+ properties = null;
+ thumbnail = null;
+ parentShellObject = null;
+ }
+
+ if (properties != null)
+ {
+ properties.Dispose();
+ }
+
+ if (_internalPIDL != IntPtr.Zero)
+ {
+ ShellNativeMethods.ILFree(_internalPIDL);
+ _internalPIDL = IntPtr.Zero;
+ }
+
+ if (nativeShellItem != null)
+ {
+ Marshal.ReleaseComObject(nativeShellItem);
+ nativeShellItem = null;
+ }
+
+ if (NativePropertyStore != null)
+ {
+ Marshal.ReleaseComObject(NativePropertyStore);
+ NativePropertyStore = null;
+ }
+ }
+
+ /// <summary>
+ /// Release the native objects.
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Implement the finalizer.
+ /// </summary>
+ ~ShellObject()
+ {
+ Dispose(false);
+ }
+
+ #endregion
+
+ #region equality and hashing
+
+ /// <summary>
+ /// Returns the hash code of the object.
+ /// </summary>
+ /// <returns></returns>
+ public override int GetHashCode()
+ {
+ if (!hashValue.HasValue)
+ {
+ uint size = ShellNativeMethods.ILGetSize(PIDL);
+ if (size != 0)
+ {
+ byte[] pidlData = new byte[size];
+ Marshal.Copy(PIDL, pidlData, 0, (int)size);
+ byte[] hashData = ShellObject.hashProvider.ComputeHash(pidlData);
+ hashValue = BitConverter.ToInt32(hashData, 0);
+ }
+ else
+ {
+ hashValue = 0;
+ }
+
+ }
+ return hashValue.Value;
+ }
+ private static MD5CryptoServiceProvider hashProvider = new MD5CryptoServiceProvider();
+ private int? hashValue;
+
+ /// <summary>
+ /// Determines if two ShellObjects are identical.
+ /// </summary>
+ /// <param name="other">The ShellObject to comare this one to.</param>
+ /// <returns>True if the ShellObjects are equal, false otherwise.</returns>
+ public bool Equals(ShellObject other)
+ {
+ bool areEqual = false;
+
+ if (other != null)
+ {
+ IShellItem ifirst = this.NativeShellItem;
+ IShellItem isecond = other.NativeShellItem;
+ if (ifirst != null && isecond != null)
+ {
+ int result = 0;
+ HResult hr = ifirst.Compare(
+ isecond, SICHINTF.SICHINT_ALLFIELDS, out result);
+
+ areEqual = (hr == HResult.Ok) && (result == 0);
+ }
+ }
+
+ return areEqual;
+ }
+
+ /// <summary>
+ /// Returns whether this object is equal to another.
+ /// </summary>
+ /// <param name="obj">The object to compare against.</param>
+ /// <returns>Equality result.</returns>
+ public override bool Equals(object obj)
+ {
+ return this.Equals(obj as ShellObject);
+ }
+
+ /// <summary>
+ /// Implements the == (equality) operator.
+ /// </summary>
+ /// <param name="leftShellObject">First object to compare.</param>
+ /// <param name="rightShellObject">Second object to compare.</param>
+ /// <returns>True if leftShellObject equals rightShellObject; false otherwise.</returns>
+ public static bool operator ==(ShellObject leftShellObject, ShellObject rightShellObject)
+ {
+ if ((object)leftShellObject == null)
+ {
+ return ((object)rightShellObject == null);
+ }
+ return leftShellObject.Equals(rightShellObject);
+ }
+
+ /// <summary>
+ /// Implements the != (inequality) operator.
+ /// </summary>
+ /// <param name="leftShellObject">First object to compare.</param>
+ /// <param name="rightShellObject">Second object to compare.</param>
+ /// <returns>True if leftShellObject does not equal leftShellObject; false otherwise.</returns>
+ public static bool operator !=(ShellObject leftShellObject, ShellObject rightShellObject)
+ {
+ return !(leftShellObject == rightShellObject);
+ }
+
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellObjectCollection.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellObjectCollection.cs
new file mode 100644
index 0000000000..1c1d85dde5
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellObjectCollection.cs
@@ -0,0 +1,396 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// An ennumerable list of ShellObjects
+ /// </summary>
+ public class ShellObjectCollection : IEnumerable, IDisposable, IList<ShellObject>
+ {
+ private List<ShellObject> content = new List<ShellObject>();
+
+ bool readOnly;
+ bool isDisposed;
+
+ #region construction/disposal/finialization
+ /// <summary>
+ /// Creates a ShellObject collection from an IShellItemArray
+ /// </summary>
+ /// <param name="iArray">IShellItemArray pointer</param>
+ /// <param name="readOnly">Indicates whether the collection shouldbe read-only or not</param>
+ internal ShellObjectCollection(IShellItemArray iArray, bool readOnly)
+ {
+ this.readOnly = readOnly;
+
+ if (iArray != null)
+ {
+ try
+ {
+ uint itemCount = 0;
+ iArray.GetCount(out itemCount);
+ content.Capacity = (int)itemCount;
+ for (uint index = 0; index < itemCount; index++)
+ {
+ IShellItem iShellItem = null;
+ iArray.GetItemAt(index, out iShellItem);
+ content.Add(ShellObjectFactory.Create(iShellItem));
+ }
+ }
+ finally
+ {
+ Marshal.ReleaseComObject(iArray);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Creates a ShellObjectCollection from an IDataObject passed during Drop operation.
+ /// </summary>
+ /// <param name="dataObject">An object that implements the IDataObject COM interface.</param>
+ /// <returns>ShellObjectCollection created from the given IDataObject</returns>
+ public static ShellObjectCollection FromDataObject(System.Runtime.InteropServices.ComTypes.IDataObject dataObject)
+ {
+ IShellItemArray shellItemArray;
+ Guid iid = new Guid(ShellIIDGuid.IShellItemArray);
+ ShellNativeMethods.SHCreateShellItemArrayFromDataObject(dataObject, ref iid, out shellItemArray);
+ return new ShellObjectCollection(shellItemArray, true);
+ }
+
+ /// <summary>
+ /// Constructs an empty ShellObjectCollection
+ /// </summary>
+ public ShellObjectCollection()
+ {
+ // Left empty
+ }
+
+ /// <summary>
+ /// Finalizer
+ /// </summary>
+ ~ShellObjectCollection()
+ {
+ Dispose(false);
+ }
+
+ /// <summary>
+ /// Standard Dispose pattern
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Standard Dispose patterns
+ /// </summary>
+ /// <param name="disposing">Indicates that this is being called from Dispose(), rather than the finalizer.</param>
+ protected virtual void Dispose(bool disposing)
+ {
+ if (isDisposed == false)
+ {
+ if (disposing)
+ {
+ foreach (ShellObject shellObject in content)
+ {
+ shellObject.Dispose();
+ }
+
+ content.Clear();
+ }
+
+ isDisposed = true;
+ }
+ }
+ #endregion
+
+ #region implementation
+
+ /// <summary>
+ /// Item count
+ /// </summary>
+ public int Count { get { return content.Count; } }
+
+ /// <summary>
+ /// Collection enumeration
+ /// </summary>
+ /// <returns></returns>
+ public System.Collections.IEnumerator GetEnumerator()
+ {
+ foreach (ShellObject obj in content)
+ {
+ yield return obj;
+ }
+ }
+
+ /// <summary>
+ /// Builds the data for the CFSTR_SHELLIDLIST Drag and Clipboard data format from the
+ /// ShellObjects in the collection.
+ /// </summary>
+ /// <returns>A memory stream containing the drag/drop data.</returns>
+ public MemoryStream BuildShellIDList()
+ {
+ if (content.Count == 0)
+ {
+ throw new InvalidOperationException(LocalizedMessages.ShellObjectCollectionEmptyCollection);
+ }
+
+
+ MemoryStream mstream = new MemoryStream();
+ try
+ {
+ BinaryWriter bwriter = new BinaryWriter(mstream);
+
+
+ // number of IDLs to be written (shell objects + parent folder)
+ uint itemCount = (uint)(content.Count + 1);
+
+ // grab the object IDLs
+ IntPtr[] idls = new IntPtr[itemCount];
+
+ for (int index = 0; index < itemCount; index++)
+ {
+ if (index == 0)
+ {
+ // Because the ShellObjects passed in may be from anywhere, the
+ // parent folder reference must be the desktop.
+ idls[index] = ((ShellObject)KnownFolders.Desktop).PIDL;
+ }
+ else
+ {
+ idls[index] = content[index - 1].PIDL;
+ }
+ }
+
+ // calculate offset array (folder IDL + item IDLs)
+ uint[] offsets = new uint[itemCount + 1];
+ for (int index = 0; index < itemCount; index++)
+ {
+ if (index == 0)
+ {
+ // first offset equals size of CIDA header data
+ offsets[0] = (uint)(sizeof(uint) * (offsets.Length + 1));
+ }
+ else
+ {
+ offsets[index] = offsets[index - 1] + ShellNativeMethods.ILGetSize(idls[index - 1]);
+ }
+ }
+
+ // Fill out the CIDA header
+ //
+ // typedef struct _IDA {
+ // UINT cidl; // number of relative IDList
+ // UINT aoffset[1]; // [0]: folder IDList, [1]-[cidl]: item IDList
+ // } CIDA, * LPIDA;
+ //
+ bwriter.Write(content.Count);
+ foreach (uint offset in offsets)
+ {
+ bwriter.Write(offset);
+ }
+
+ // copy idls
+ foreach (IntPtr idl in idls)
+ {
+ byte[] data = new byte[ShellNativeMethods.ILGetSize(idl)];
+ Marshal.Copy(idl, data, 0, data.Length);
+ bwriter.Write(data, 0, data.Length);
+ }
+ }
+ catch
+ {
+ mstream.Dispose();
+ throw;
+ }
+ // return CIDA stream
+ return mstream;
+ }
+ #endregion
+
+ #region IList<ShellObject> Members
+
+ /// <summary>
+ /// Returns the index of a particualr shell object in the collection
+ /// </summary>
+ /// <param name="item">The item to search for.</param>
+ /// <returns>The index of the item found, or -1 if not found.</returns>
+ public int IndexOf(ShellObject item)
+ {
+ return content.IndexOf(item);
+ }
+
+ /// <summary>
+ /// Inserts a new shell object into the collection.
+ /// </summary>
+ /// <param name="index">The index at which to insert.</param>
+ /// <param name="item">The item to insert.</param>
+ public void Insert(int index, ShellObject item)
+ {
+ if (readOnly)
+ {
+ throw new InvalidOperationException(LocalizedMessages.ShellObjectCollectionInsertReadOnly);
+ }
+
+ content.Insert(index, item);
+ }
+
+ /// <summary>
+ /// Removes the specified ShellObject from the collection
+ /// </summary>
+ /// <param name="index">The index to remove at.</param>
+ public void RemoveAt(int index)
+ {
+ if (readOnly)
+ {
+ throw new InvalidOperationException(LocalizedMessages.ShellObjectCollectionRemoveReadOnly);
+ }
+
+ content.RemoveAt(index);
+ }
+
+ /// <summary>
+ /// The collection indexer
+ /// </summary>
+ /// <param name="index">The index of the item to retrieve.</param>
+ /// <returns>The ShellObject at the specified index</returns>
+ public ShellObject this[int index]
+ {
+ get
+ {
+ return content[index];
+ }
+ set
+ {
+ if (readOnly)
+ {
+ throw new InvalidOperationException(LocalizedMessages.ShellObjectCollectionInsertReadOnly);
+ }
+
+ content[index] = value;
+ }
+ }
+
+ #endregion
+
+ #region ICollection<ShellObject> Members
+
+ /// <summary>
+ /// Adds a ShellObject to the collection,
+ /// </summary>
+ /// <param name="item">The ShellObject to add.</param>
+ public void Add(ShellObject item)
+ {
+ if (readOnly)
+ {
+ throw new InvalidOperationException(LocalizedMessages.ShellObjectCollectionInsertReadOnly);
+ }
+
+ content.Add(item);
+ }
+
+ /// <summary>
+ /// Clears the collection of ShellObjects.
+ /// </summary>
+ public void Clear()
+ {
+ if (readOnly)
+ {
+ throw new InvalidOperationException(LocalizedMessages.ShellObjectCollectionRemoveReadOnly);
+ }
+
+ content.Clear();
+ }
+
+ /// <summary>
+ /// Determines if the collection contains a particular ShellObject.
+ /// </summary>
+ /// <param name="item">The ShellObject.</param>
+ /// <returns>true, if the ShellObject is in the list, false otherwise.</returns>
+ public bool Contains(ShellObject item)
+ {
+ return content.Contains(item);
+ }
+
+ /// <summary>
+ /// Copies the ShellObjects in the collection to a ShellObject array.
+ /// </summary>
+ /// <param name="array">The destination to copy to.</param>
+ /// <param name="arrayIndex">The index into the array at which copying will commence.</param>
+ public void CopyTo(ShellObject[] array, int arrayIndex)
+ {
+ if (array == null) { throw new ArgumentNullException("array"); }
+ if (array.Length < arrayIndex + content.Count)
+ {
+ throw new ArgumentException(LocalizedMessages.ShellObjectCollectionArrayTooSmall, "array");
+ }
+
+ for (int index = 0; index < content.Count; index++)
+ {
+ array[index + arrayIndex] = content[index];
+ }
+ }
+
+ /// <summary>
+ /// Retrieves the number of ShellObjects in the collection
+ /// </summary>
+ int ICollection<ShellObject>.Count
+ {
+ get
+ {
+ return content.Count;
+ }
+ }
+
+ /// <summary>
+ /// If true, the contents of the collection are immutable.
+ /// </summary>
+ public bool IsReadOnly
+ {
+ get
+ {
+ return readOnly;
+ }
+ }
+
+ /// <summary>
+ /// Removes a particular ShellObject from the list.
+ /// </summary>
+ /// <param name="item">The ShellObject to remove.</param>
+ /// <returns>True if the item could be removed, false otherwise.</returns>
+ public bool Remove(ShellObject item)
+ {
+ if (readOnly)
+ {
+ throw new InvalidOperationException(LocalizedMessages.ShellObjectCollectionRemoveReadOnly);
+ }
+
+ return content.Remove(item);
+ }
+
+ #endregion
+
+ #region IEnumerable<ShellObject> Members
+
+ /// <summary>
+ /// Allows for enumeration through the list of ShellObjects in the collection.
+ /// </summary>
+ /// <returns>The IEnumerator interface to use for enumeration.</returns>
+ IEnumerator<ShellObject> IEnumerable<ShellObject>.GetEnumerator()
+ {
+ foreach (ShellObject obj in content)
+ {
+ yield return obj;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellObjectContainer.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellObjectContainer.cs
new file mode 100644
index 0000000000..8a42f21159
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellObjectContainer.cs
@@ -0,0 +1,120 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Represents the base class for all types of Shell "containers". Any class deriving from this class
+ /// can contain other ShellObjects (e.g. ShellFolder, FileSystemKnownFolder, ShellLibrary, etc)
+ /// </summary>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "This will complicate the class hierarchy and naming convention used in the Shell area")]
+ public abstract class ShellContainer : ShellObject, IEnumerable<ShellObject>, IDisposable
+ {
+
+ #region Private Fields
+
+ private IShellFolder desktopFolderEnumeration;
+ private IShellFolder nativeShellFolder;
+
+ #endregion
+
+ #region Internal Properties
+
+ internal IShellFolder NativeShellFolder
+ {
+ get
+ {
+ if (nativeShellFolder == null)
+ {
+ Guid guid = new Guid(ShellIIDGuid.IShellFolder);
+ Guid handler = new Guid(ShellBHIDGuid.ShellFolderObject);
+
+ HResult hr = NativeShellItem.BindToHandler(
+ IntPtr.Zero, ref handler, ref guid, out nativeShellFolder);
+
+ if (CoreErrorHelper.Failed(hr))
+ {
+ string str = ShellHelper.GetParsingName(NativeShellItem);
+ if (str != null && str != Environment.GetFolderPath(Environment.SpecialFolder.Desktop))
+ {
+ throw new ShellException(hr);
+ }
+ }
+ }
+
+ return nativeShellFolder;
+ }
+ }
+
+ #endregion
+
+ #region Internal Constructor
+
+ internal ShellContainer() { }
+
+ internal ShellContainer(IShellItem2 shellItem) : base(shellItem) { }
+
+ #endregion
+
+ #region Disposable Pattern
+
+ /// <summary>
+ /// Release resources
+ /// </summary>
+ /// <param name="disposing"><B>True</B> indicates that this is being called from Dispose(), rather than the finalizer.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (nativeShellFolder != null)
+ {
+ Marshal.ReleaseComObject(nativeShellFolder);
+ nativeShellFolder = null;
+ }
+
+ if (desktopFolderEnumeration != null)
+ {
+ Marshal.ReleaseComObject(desktopFolderEnumeration);
+ desktopFolderEnumeration = null;
+ }
+
+ base.Dispose(disposing);
+ }
+
+ #endregion
+
+ #region IEnumerable<ShellObject> Members
+
+ /// <summary>
+ /// Enumerates through contents of the ShellObjectContainer
+ /// </summary>
+ /// <returns>Enumerated contents</returns>
+ public IEnumerator<ShellObject> GetEnumerator()
+ {
+ if (NativeShellFolder == null)
+ {
+ if (desktopFolderEnumeration == null)
+ {
+ ShellNativeMethods.SHGetDesktopFolder(out desktopFolderEnumeration);
+ }
+
+ nativeShellFolder = desktopFolderEnumeration;
+ }
+
+ return new ShellFolderItems(this);
+ }
+
+ #endregion
+
+ #region IEnumerable Members
+
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+ {
+ return new ShellFolderItems(this);
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellObjectFactory.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellObjectFactory.cs
new file mode 100644
index 0000000000..73c5147f14
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellObjectFactory.cs
@@ -0,0 +1,220 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+using System.Linq;
+using System.Threading;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ internal static class ShellObjectFactory
+ {
+ /// <summary>
+ /// Creates a ShellObject given a native IShellItem interface
+ /// </summary>
+ /// <param name="nativeShellItem"></param>
+ /// <returns>A newly constructed ShellObject object</returns>
+ internal static ShellObject Create(IShellItem nativeShellItem)
+ {
+ // Sanity check
+ Debug.Assert(nativeShellItem != null, "nativeShellItem should not be null");
+
+ // Need to make sure we're running on Vista or higher
+ if (!CoreHelpers.RunningOnVista)
+ {
+ throw new PlatformNotSupportedException(LocalizedMessages.ShellObjectFactoryPlatformNotSupported);
+ }
+
+ // A lot of APIs need IShellItem2, so just keep a copy of it here
+ IShellItem2 nativeShellItem2 = nativeShellItem as IShellItem2;
+
+ // Get the System.ItemType property
+ string itemType = ShellHelper.GetItemType(nativeShellItem2);
+
+ if (!string.IsNullOrEmpty(itemType)) { itemType = itemType.ToUpperInvariant(); }
+
+ // Get some IShellItem attributes
+ ShellNativeMethods.ShellFileGetAttributesOptions sfgao;
+ nativeShellItem2.GetAttributes(ShellNativeMethods.ShellFileGetAttributesOptions.FileSystem | ShellNativeMethods.ShellFileGetAttributesOptions.Folder, out sfgao);
+
+ // Is this item a FileSystem item?
+ bool isFileSystem = (sfgao & ShellNativeMethods.ShellFileGetAttributesOptions.FileSystem) != 0;
+
+ // Is this item a Folder?
+ bool isFolder = (sfgao & ShellNativeMethods.ShellFileGetAttributesOptions.Folder) != 0;
+
+ // Shell Library
+ ShellLibrary shellLibrary = null;
+
+ // Create the right type of ShellObject based on the above information
+
+ // 1. First check if this is a Shell Link
+ if (itemType == ".lnk")
+ {
+ return new ShellLink(nativeShellItem2);
+ }
+ // 2. Check if this is a container or a single item (entity)
+ else if (isFolder)
+ {
+ // 3. If this is a folder, check for types: Shell Library, Shell Folder or Search Container
+ if (itemType == ".library-ms" && (shellLibrary = ShellLibrary.FromShellItem(nativeShellItem2, true)) != null)
+ {
+ return shellLibrary; // we already created this above while checking for Library
+ }
+ else if (itemType == ".searchconnector-ms")
+ {
+ return new ShellSearchConnector(nativeShellItem2);
+ }
+ else if (itemType == ".search-ms")
+ {
+ return new ShellSavedSearchCollection(nativeShellItem2);
+ }
+
+ // 4. It's a ShellFolder
+ if (isFileSystem)
+ {
+ // 5. Is it a (File-System / Non-Virtual) Known Folder
+ if (!IsVirtualKnownFolder(nativeShellItem2))
+ { //needs to check if it is a known folder and not virtual
+ FileSystemKnownFolder kf = new FileSystemKnownFolder(nativeShellItem2);
+ return kf;
+ }
+
+ return new ShellFileSystemFolder(nativeShellItem2);
+ }
+
+ // 5. Is it a (Non File-System / Virtual) Known Folder
+ if (IsVirtualKnownFolder(nativeShellItem2))
+ { //needs to check if known folder is virtual
+ NonFileSystemKnownFolder kf = new NonFileSystemKnownFolder(nativeShellItem2);
+ return kf;
+ }
+
+ return new ShellNonFileSystemFolder(nativeShellItem2);
+ }
+
+ // 6. If this is an entity (single item), check if its filesystem or not
+ if (isFileSystem) { return new ShellFile(nativeShellItem2); }
+
+ return new ShellNonFileSystemItem(nativeShellItem2);
+ }
+
+ // This is a work around for the STA thread bug. This will execute the call on a non-sta thread, then return the result
+ private static bool IsVirtualKnownFolder(IShellItem2 nativeShellItem2)
+ {
+ IntPtr pidl = IntPtr.Zero;
+ try
+ {
+ IKnownFolderNative nativeFolder = null;
+ KnownFoldersSafeNativeMethods.NativeFolderDefinition definition = new KnownFoldersSafeNativeMethods.NativeFolderDefinition();
+
+ // We found a bug where the enumeration of shell folders was
+ // not reliable when called from a STA thread - it would return
+ // different results the first time vs the other times.
+ //
+ // This is a work around. We call FindFolderFromIDList on a
+ // worker MTA thread instead of the main STA thread.
+ //
+ // Ultimately, it would be a very good idea to replace the 'getting shell object' logic
+ // to get a list of pidl's in 1 step, then look up their information in a 2nd, rather than
+ // looking them up as we get them. This would replace the need for the work around.
+ object padlock = new object();
+ lock (padlock)
+ {
+ IntPtr unknown = Marshal.GetIUnknownForObject(nativeShellItem2);
+
+ ThreadPool.QueueUserWorkItem(obj =>
+ {
+ lock (padlock)
+ {
+ pidl = ShellHelper.PidlFromUnknown(unknown);
+
+ new KnownFolderManagerClass().FindFolderFromIDList(pidl, out nativeFolder);
+
+ if (nativeFolder != null)
+ {
+ nativeFolder.GetFolderDefinition(out definition);
+ }
+
+ Monitor.Pulse(padlock);
+ }
+ });
+
+ Monitor.Wait(padlock);
+ }
+
+ return nativeFolder != null && definition.category == FolderCategory.Virtual;
+ }
+ finally
+ {
+ ShellNativeMethods.ILFree(pidl);
+ }
+ }
+
+ /// <summary>
+ /// Creates a ShellObject given a parsing name
+ /// </summary>
+ /// <param name="parsingName"></param>
+ /// <returns>A newly constructed ShellObject object</returns>
+ internal static ShellObject Create(string parsingName)
+ {
+ if (string.IsNullOrEmpty(parsingName))
+ {
+ throw new ArgumentNullException("parsingName");
+ }
+
+ // Create a native shellitem from our path
+ IShellItem2 nativeShellItem;
+ Guid guid = new Guid(ShellIIDGuid.IShellItem2);
+ int retCode = ShellNativeMethods.SHCreateItemFromParsingName(parsingName, IntPtr.Zero, ref guid, out nativeShellItem);
+
+ if (!CoreErrorHelper.Succeeded(retCode))
+ {
+ throw new ShellException(LocalizedMessages.ShellObjectFactoryUnableToCreateItem, Marshal.GetExceptionForHR(retCode));
+ }
+ return ShellObjectFactory.Create(nativeShellItem);
+ }
+
+ /// <summary>
+ /// Constructs a new Shell object from IDList pointer
+ /// </summary>
+ /// <param name="idListPtr"></param>
+ /// <returns></returns>
+ internal static ShellObject Create(IntPtr idListPtr)
+ {
+ // Throw exception if not running on Win7 or newer.
+ CoreHelpers.ThrowIfNotVista();
+
+ Guid guid = new Guid(ShellIIDGuid.IShellItem2);
+
+ IShellItem2 nativeShellItem;
+ int retCode = ShellNativeMethods.SHCreateItemFromIDList(idListPtr, ref guid, out nativeShellItem);
+
+ if (!CoreErrorHelper.Succeeded(retCode)) { return null; }
+ return ShellObjectFactory.Create(nativeShellItem);
+ }
+
+ /// <summary>
+ /// Constructs a new Shell object from IDList pointer
+ /// </summary>
+ /// <param name="idListPtr"></param>
+ /// <param name="parent"></param>
+ /// <returns></returns>
+ internal static ShellObject Create(IntPtr idListPtr, ShellContainer parent)
+ {
+ IShellItem nativeShellItem;
+
+ int retCode = ShellNativeMethods.SHCreateShellItem(
+ IntPtr.Zero,
+ parent.NativeShellFolder,
+ idListPtr, out nativeShellItem);
+
+ if (!CoreErrorHelper.Succeeded(retCode)) { return null; }
+
+ return ShellObjectFactory.Create(nativeShellItem);
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellSavedSearchCollection.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellSavedSearchCollection.cs
new file mode 100644
index 0000000000..8cb1d87bd8
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellSavedSearchCollection.cs
@@ -0,0 +1,18 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Represents a saved search
+ /// </summary>
+ public class ShellSavedSearchCollection : ShellSearchCollection
+ {
+ internal ShellSavedSearchCollection(IShellItem2 shellItem)
+ : base(shellItem)
+ {
+ CoreHelpers.ThrowIfNotVista();
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellSearchCollection.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellSearchCollection.cs
new file mode 100644
index 0000000000..bca3f2e94e
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellSearchCollection.cs
@@ -0,0 +1,16 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Represents the base class for all search-related classes.
+ /// </summary>
+ public class ShellSearchCollection : ShellContainer
+ {
+ internal ShellSearchCollection() { }
+
+ internal ShellSearchCollection(IShellItem2 shellItem) : base(shellItem) { }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellSearchConnector.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellSearchConnector.cs
new file mode 100644
index 0000000000..afdb059fa0
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellSearchConnector.cs
@@ -0,0 +1,40 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// A Serch Connector folder in the Shell Namespace
+ /// </summary>
+ public sealed class ShellSearchConnector : ShellSearchCollection
+ {
+
+ #region Internal Constructor
+
+ internal ShellSearchConnector()
+ {
+ CoreHelpers.ThrowIfNotWin7();
+ }
+
+ internal ShellSearchConnector(IShellItem2 shellItem)
+ : this()
+ {
+ nativeShellItem = shellItem;
+ }
+
+ #endregion
+
+ /// <summary>
+ /// Indicates whether this feature is supported on the current platform.
+ /// </summary>
+ new public static bool IsPlatformSupported
+ {
+ get
+ {
+ // We need Windows 7 onwards ...
+ return CoreHelpers.RunningOnWin7;
+ }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellSearchFolder.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellSearchFolder.cs
new file mode 100644
index 0000000000..75b281606c
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellSearchFolder.cs
@@ -0,0 +1,266 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Shell.PropertySystem;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+using System.Linq;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Create and modify search folders.
+ /// </summary>
+ public class ShellSearchFolder : ShellSearchCollection
+ {
+ /// <summary>
+ /// Create a simple search folder. Once the appropriate parameters are set,
+ /// the search folder can be enumerated to get the search results.
+ /// </summary>
+ /// <param name="searchCondition">Specific condition on which to perform the search (property and expected value)</param>
+ /// <param name="searchScopePath">List of folders/paths to perform the search on. These locations need to be indexed by the system.</param>
+ public ShellSearchFolder(SearchCondition searchCondition, params ShellContainer[] searchScopePath)
+ {
+ CoreHelpers.ThrowIfNotVista();
+
+ NativeSearchFolderItemFactory = (ISearchFolderItemFactory)new SearchFolderItemFactoryCoClass();
+
+ this.SearchCondition = searchCondition;
+
+ if (searchScopePath != null && searchScopePath.Length > 0 && searchScopePath[0] != null)
+ {
+ this.SearchScopePaths = searchScopePath.Select(cont => cont.ParsingName);
+ }
+ }
+
+ /// <summary>
+ /// Create a simple search folder. Once the appropiate parameters are set,
+ /// the search folder can be enumerated to get the search results.
+ /// </summary>
+ /// <param name="searchCondition">Specific condition on which to perform the search (property and expected value)</param>
+ /// <param name="searchScopePath">List of folders/paths to perform the search on. These locations need to be indexed by the system.</param>
+ public ShellSearchFolder(SearchCondition searchCondition, params string[] searchScopePath)
+ {
+ CoreHelpers.ThrowIfNotVista();
+
+ NativeSearchFolderItemFactory = (ISearchFolderItemFactory)new SearchFolderItemFactoryCoClass();
+
+ if (searchScopePath != null && searchScopePath.Length > 0 && searchScopePath[0] != null)
+ {
+ this.SearchScopePaths = searchScopePath;
+ }
+
+ this.SearchCondition = searchCondition;
+ }
+
+ internal ISearchFolderItemFactory NativeSearchFolderItemFactory { get; set; }
+
+ private SearchCondition searchCondition;
+ /// <summary>
+ /// Gets the <see cref="Microsoft.WindowsAPICodePack.Shell.SearchCondition"/> of the search.
+ /// When this property is not set, the resulting search will have no filters applied.
+ /// </summary>
+ public SearchCondition SearchCondition
+ {
+ get { return searchCondition; }
+ private set
+ {
+ searchCondition = value;
+
+ NativeSearchFolderItemFactory.SetCondition(searchCondition.NativeSearchCondition);
+ }
+ }
+
+ private string[] searchScopePaths;
+ /// <summary>
+ /// Gets the search scope, as specified using an array of locations to search.
+ /// The search will include this location and all its subcontainers. The default is FOLDERID_Profile
+ /// </summary>
+ public IEnumerable<string> SearchScopePaths
+ {
+ get
+ {
+ foreach (var scopePath in searchScopePaths)
+ {
+ yield return scopePath;
+ }
+ }
+ private set
+ {
+ searchScopePaths = value.ToArray();
+ List<IShellItem> shellItems = new List<IShellItem>(searchScopePaths.Length);
+
+ Guid shellItemGuid = new Guid(ShellIIDGuid.IShellItem);
+ Guid shellItemArrayGuid = new Guid(ShellIIDGuid.IShellItemArray);
+
+ // Create IShellItem for all the scopes we were given
+ foreach (string path in searchScopePaths)
+ {
+ IShellItem scopeShellItem;
+
+ int hr = ShellNativeMethods.SHCreateItemFromParsingName(path, IntPtr.Zero, ref shellItemGuid, out scopeShellItem);
+
+ if (CoreErrorHelper.Succeeded(hr)) { shellItems.Add(scopeShellItem); }
+ }
+
+ // Create a new IShellItemArray
+ IShellItemArray scopeShellItemArray = new ShellItemArray(shellItems.ToArray());
+
+ // Set the scope on the native ISearchFolderItemFactory
+ HResult hResult = NativeSearchFolderItemFactory.SetScope(scopeShellItemArray);
+
+ if (!CoreErrorHelper.Succeeded((int)hResult)) { throw new ShellException((int)hResult); }
+ }
+ }
+
+ internal override IShellItem NativeShellItem
+ {
+ get
+ {
+ Guid guid = new Guid(ShellIIDGuid.IShellItem);
+
+ if (NativeSearchFolderItemFactory == null) { return null; }
+
+ IShellItem shellItem;
+ int hr = NativeSearchFolderItemFactory.GetShellItem(ref guid, out shellItem);
+
+ if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); }
+
+ return shellItem;
+ }
+ }
+
+
+ /// <summary>
+ /// Creates a list of stack keys, as specified. If this method is not called,
+ /// by default the folder will not be stacked.
+ /// </summary>
+ /// <param name="canonicalNames">Array of canonical names for properties on which the folder is stacked.</param>
+ /// <exception cref="System.ArgumentException">If one of the given canonical names is invalid.</exception>
+ public void SetStacks(params string[] canonicalNames)
+ {
+ if (canonicalNames == null) { throw new ArgumentNullException("canonicalNames"); }
+ List<PropertyKey> propertyKeyList = new List<PropertyKey>();
+
+ foreach (string prop in canonicalNames)
+ {
+ // Get the PropertyKey using the canonicalName passed in
+ PropertyKey propKey;
+ int result = PropertySystemNativeMethods.PSGetPropertyKeyFromName(prop, out propKey);
+
+ if (!CoreErrorHelper.Succeeded(result))
+ {
+ throw new ArgumentException(LocalizedMessages.ShellInvalidCanonicalName, "canonicalNames", Marshal.GetExceptionForHR(result));
+ }
+
+ propertyKeyList.Add(propKey);
+ }
+
+ if (propertyKeyList.Count > 0)
+ {
+ SetStacks(propertyKeyList.ToArray());
+ }
+ }
+
+ /// <summary>
+ /// Creates a list of stack keys, as specified. If this method is not called,
+ /// by default the folder will not be stacked.
+ /// </summary>
+ /// <param name="propertyKeys">Array of property keys on which the folder is stacked.</param>
+ public void SetStacks(params PropertyKey[] propertyKeys)
+ {
+ if (propertyKeys != null && propertyKeys.Length > 0)
+ {
+ NativeSearchFolderItemFactory.SetStacks((uint)propertyKeys.Length, propertyKeys);
+ }
+ }
+
+ /// <summary>
+ /// Sets the search folder display name.
+ /// </summary>
+ public void SetDisplayName(string displayName)
+ {
+ HResult hr = NativeSearchFolderItemFactory.SetDisplayName(displayName);
+
+ if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); }
+ }
+
+
+
+ /// <summary>
+ /// Sets the search folder icon size.
+ /// The default settings are based on the FolderTypeID which is set by the
+ /// SearchFolder::SetFolderTypeID method.
+ /// </summary>
+ public void SetIconSize(int value)
+ {
+ HResult hr = NativeSearchFolderItemFactory.SetIconSize(value);
+
+ if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); }
+ }
+
+ /// <summary>
+ /// Sets a search folder type ID, as specified.
+ /// </summary>
+ public void SetFolderTypeID(Guid value)
+ {
+ HResult hr = NativeSearchFolderItemFactory.SetFolderTypeID(value);
+
+ if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); }
+ }
+
+ /// <summary>
+ /// Sets folder logical view mode. The default settings are based on the FolderTypeID which is set
+ /// by the SearchFolder::SetFolderTypeID method.
+ /// </summary>
+ /// <param name="mode">The logical view mode to set.</param>
+ public void SetFolderLogicalViewMode(FolderLogicalViewMode mode)
+ {
+ HResult hr = NativeSearchFolderItemFactory.SetFolderLogicalViewMode(mode);
+
+ if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); }
+ }
+
+ /// <summary>
+ /// Creates a new column list whose columns are all visible,
+ /// given an array of PropertyKey structures. The default is based on FolderTypeID.
+ /// </summary>
+ /// <remarks>This property may not work correctly with the ExplorerBrowser control.</remarks>
+ public void SetVisibleColumns(PropertyKey[] value)
+ {
+ HResult hr = NativeSearchFolderItemFactory.SetVisibleColumns(value == null ? 0 : (uint)value.Length, value);
+
+ if (!CoreErrorHelper.Succeeded(hr))
+ {
+ throw new ShellException(LocalizedMessages.ShellSearchFolderUnableToSetVisibleColumns, Marshal.GetExceptionForHR((int)hr));
+ }
+ }
+
+ /// <summary>
+ /// Creates a list of sort column directions, as specified.
+ /// </summary>
+ /// <remarks>This property may not work correctly with the ExplorerBrowser control.</remarks>
+ public void SortColumns(SortColumn[] value)
+ {
+ HResult hr = NativeSearchFolderItemFactory.SetSortColumns(value == null ? 0 : (uint)value.Length, value);
+
+ if (!CoreErrorHelper.Succeeded(hr))
+ {
+ throw new ShellException(LocalizedMessages.ShellSearchFolderUnableToSetSortColumns, Marshal.GetExceptionForHR((int)hr));
+ }
+ }
+
+ /// <summary>
+ /// Sets a group column, as specified. If no group column is specified, no grouping occurs.
+ /// </summary>
+ /// <remarks>This property may not work correctly with the ExplorerBrowser control.</remarks>
+ public void SetGroupColumn(PropertyKey propertyKey)
+ {
+ HResult hr = NativeSearchFolderItemFactory.SetGroupColumn(ref propertyKey);
+
+ if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellThumbnail.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellThumbnail.cs
new file mode 100644
index 0000000000..f16409daab
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellThumbnail.cs
@@ -0,0 +1,357 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using System.Windows.Interop;
+using System.Windows.Media.Imaging;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Represents a thumbnail or an icon for a ShellObject.
+ /// </summary>
+ public class ShellThumbnail
+ {
+ #region Private members
+
+ /// <summary>
+ /// Native shellItem
+ /// </summary>
+ private IShellItem shellItemNative;
+
+ /// <summary>
+ /// Internal member to keep track of the current size
+ /// </summary>
+ private System.Windows.Size currentSize = new System.Windows.Size(256, 256);
+
+ #endregion
+
+ #region Constructors
+
+ /// <summary>
+ /// Internal constructor that takes in a parent ShellObject.
+ /// </summary>
+ /// <param name="shellObject"></param>
+ internal ShellThumbnail(ShellObject shellObject)
+ {
+ if (shellObject == null || shellObject.NativeShellItem == null)
+ {
+ throw new ArgumentNullException("shellObject");
+ }
+
+ shellItemNative = shellObject.NativeShellItem;
+ }
+
+ #endregion
+
+ #region Public properties
+
+ /// <summary>
+ /// Gets or sets the default size of the thumbnail or icon. The default is 32x32 pixels for icons and
+ /// 256x256 pixels for thumbnails.
+ /// </summary>
+ /// <remarks>If the size specified is larger than the maximum size of 1024x1024 for thumbnails and 256x256 for icons,
+ /// an <see cref="System.ArgumentOutOfRangeException"/> is thrown.
+ /// </remarks>
+ public System.Windows.Size CurrentSize
+ {
+ get { return currentSize; }
+ set
+ {
+ // Check for 0; negative number check not required as System.Windows.Size only allows positive numbers.
+ if (value.Height == 0 || value.Width == 0)
+ {
+ throw new System.ArgumentOutOfRangeException("value", LocalizedMessages.ShellThumbnailSizeCannotBe0);
+ }
+
+ System.Windows.Size size = (FormatOption == ShellThumbnailFormatOption.IconOnly) ?
+ DefaultIconSize.Maximum : DefaultThumbnailSize.Maximum;
+
+ if (value.Height > size.Height || value.Width > size.Width)
+ {
+ throw new System.ArgumentOutOfRangeException("value",
+ string.Format(System.Globalization.CultureInfo.InvariantCulture,
+ LocalizedMessages.ShellThumbnailCurrentSizeRange, size.ToString()));
+ }
+
+ currentSize = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets the thumbnail or icon image in <see cref="System.Drawing.Bitmap"/> format.
+ /// Null is returned if the ShellObject does not have a thumbnail or icon image.
+ /// </summary>
+ public Bitmap Bitmap { get { return GetBitmap(CurrentSize); } }
+
+ /// <summary>
+ /// Gets the thumbnail or icon image in <see cref="System.Windows.Media.Imaging.BitmapSource"/> format.
+ /// Null is returned if the ShellObject does not have a thumbnail or icon image.
+ /// </summary>
+ public BitmapSource BitmapSource { get { return GetBitmapSource(CurrentSize); } }
+
+ /// <summary>
+ /// Gets the thumbnail or icon image in <see cref="System.Drawing.Icon"/> format.
+ /// Null is returned if the ShellObject does not have a thumbnail or icon image.
+ /// </summary>
+ public Icon Icon { get { return Icon.FromHandle(Bitmap.GetHicon()); } }
+
+ /// <summary>
+ /// Gets the thumbnail or icon in small size and <see cref="System.Drawing.Bitmap"/> format.
+ /// </summary>
+ public Bitmap SmallBitmap
+ {
+ get
+ {
+ return GetBitmap(DefaultIconSize.Small, DefaultThumbnailSize.Small);
+ }
+ }
+
+ /// <summary>
+ /// Gets the thumbnail or icon in small size and <see cref="System.Windows.Media.Imaging.BitmapSource"/> format.
+ /// </summary>
+ public BitmapSource SmallBitmapSource
+ {
+ get
+ {
+ return GetBitmapSource(DefaultIconSize.Small, DefaultThumbnailSize.Small);
+ }
+ }
+
+ /// <summary>
+ /// Gets the thumbnail or icon in small size and <see cref="System.Drawing.Icon"/> format.
+ /// </summary>
+ public Icon SmallIcon { get { return Icon.FromHandle(SmallBitmap.GetHicon()); } }
+
+ /// <summary>
+ /// Gets the thumbnail or icon in Medium size and <see cref="System.Drawing.Bitmap"/> format.
+ /// </summary>
+ public Bitmap MediumBitmap
+ {
+ get
+ {
+ return GetBitmap(DefaultIconSize.Medium, DefaultThumbnailSize.Medium);
+ }
+ }
+
+ /// <summary>
+ /// Gets the thumbnail or icon in medium size and <see cref="System.Windows.Media.Imaging.BitmapSource"/> format.
+ /// </summary>
+ public BitmapSource MediumBitmapSource
+ {
+ get
+ {
+ return GetBitmapSource(DefaultIconSize.Medium, DefaultThumbnailSize.Medium);
+ }
+ }
+
+ /// <summary>
+ /// Gets the thumbnail or icon in Medium size and <see cref="System.Drawing.Icon"/> format.
+ /// </summary>
+ public Icon MediumIcon { get { return Icon.FromHandle(MediumBitmap.GetHicon()); } }
+
+ /// <summary>
+ /// Gets the thumbnail or icon in large size and <see cref="System.Drawing.Bitmap"/> format.
+ /// </summary>
+ public Bitmap LargeBitmap
+ {
+ get
+ {
+ return GetBitmap(DefaultIconSize.Large, DefaultThumbnailSize.Large);
+ }
+ }
+
+ /// <summary>
+ /// Gets the thumbnail or icon in large size and <see cref="System.Windows.Media.Imaging.BitmapSource"/> format.
+ /// </summary>
+ public BitmapSource LargeBitmapSource
+ {
+ get
+ {
+ return GetBitmapSource(DefaultIconSize.Large, DefaultThumbnailSize.Large);
+ }
+ }
+
+ /// <summary>
+ /// Gets the thumbnail or icon in Large size and <see cref="System.Drawing.Icon"/> format.
+ /// </summary>
+ public Icon LargeIcon { get { return Icon.FromHandle(LargeBitmap.GetHicon()); } }
+
+ /// <summary>
+ /// Gets the thumbnail or icon in extra large size and <see cref="System.Drawing.Bitmap"/> format.
+ /// </summary>
+ public Bitmap ExtraLargeBitmap
+ {
+ get
+ {
+ return GetBitmap(DefaultIconSize.ExtraLarge, DefaultThumbnailSize.ExtraLarge);
+ }
+ }
+
+ /// <summary>
+ /// Gets the thumbnail or icon in Extra Large size and <see cref="System.Windows.Media.Imaging.BitmapSource"/> format.
+ /// </summary>
+ public BitmapSource ExtraLargeBitmapSource
+ {
+ get
+ {
+ return GetBitmapSource(DefaultIconSize.ExtraLarge, DefaultThumbnailSize.ExtraLarge);
+ }
+ }
+
+ /// <summary>
+ /// Gets the thumbnail or icon in Extra Large size and <see cref="System.Drawing.Icon"/> format.
+ /// </summary>
+ public Icon ExtraLargeIcon { get { return Icon.FromHandle(ExtraLargeBitmap.GetHicon()); } }
+
+ /// <summary>
+ /// Gets or sets a value that determines if the current retrieval option is cache or extract, cache only, or from memory only.
+ /// The default is cache or extract.
+ /// </summary>
+ public ShellThumbnailRetrievalOption RetrievalOption { get; set; }
+
+ private ShellThumbnailFormatOption formatOption = ShellThumbnailFormatOption.Default;
+ /// <summary>
+ /// Gets or sets a value that determines if the current format option is thumbnail or icon, thumbnail only, or icon only.
+ /// The default is thumbnail or icon.
+ /// </summary>
+ public ShellThumbnailFormatOption FormatOption
+ {
+ get { return formatOption; }
+ set
+ {
+ formatOption = value;
+
+ // Do a similar check as we did in CurrentSize property setter,
+ // If our mode is IconOnly, then our max is defined by DefaultIconSize.Maximum. We should make sure
+ // our CurrentSize is within this max range
+ if (FormatOption == ShellThumbnailFormatOption.IconOnly
+ && (CurrentSize.Height > DefaultIconSize.Maximum.Height || CurrentSize.Width > DefaultIconSize.Maximum.Width))
+ {
+ CurrentSize = DefaultIconSize.Maximum;
+ }
+ }
+
+ }
+
+ /// <summary>
+ /// Gets or sets a value that determines if the user can manually stretch the returned image.
+ /// The default value is false.
+ /// </summary>
+ /// <remarks>
+ /// For example, if the caller passes in 80x80 a 96x96 thumbnail could be returned.
+ /// This could be used as a performance optimization if the caller will need to stretch
+ /// the image themselves anyway. Note that the Shell implementation performs a GDI stretch blit.
+ /// If the caller wants a higher quality image stretch, they should pass this flag and do it themselves.
+ /// </remarks>
+ public bool AllowBiggerSize { get; set; }
+
+ #endregion
+
+ #region Private Methods
+
+ private ShellNativeMethods.SIIGBF CalculateFlags()
+ {
+ ShellNativeMethods.SIIGBF flags = 0x0000;
+
+ if (AllowBiggerSize)
+ {
+ flags |= ShellNativeMethods.SIIGBF.BiggerSizeOk;
+ }
+
+ if (RetrievalOption == ShellThumbnailRetrievalOption.CacheOnly)
+ {
+ flags |= ShellNativeMethods.SIIGBF.InCacheOnly;
+ }
+ else if (RetrievalOption == ShellThumbnailRetrievalOption.MemoryOnly)
+ {
+ flags |= ShellNativeMethods.SIIGBF.MemoryOnly;
+ }
+
+ if (FormatOption == ShellThumbnailFormatOption.IconOnly)
+ {
+ flags |= ShellNativeMethods.SIIGBF.IconOnly;
+ }
+ else if (FormatOption == ShellThumbnailFormatOption.ThumbnailOnly)
+ {
+ flags |= ShellNativeMethods.SIIGBF.ThumbnailOnly;
+ }
+
+ return flags;
+ }
+
+ private IntPtr GetHBitmap(System.Windows.Size size)
+ {
+ IntPtr hbitmap = IntPtr.Zero;
+
+ // Create a size structure to pass to the native method
+ CoreNativeMethods.Size nativeSIZE = new CoreNativeMethods.Size();
+ nativeSIZE.Width = Convert.ToInt32(size.Width);
+ nativeSIZE.Height = Convert.ToInt32(size.Height);
+
+ // Use IShellItemImageFactory to get an icon
+ // Options passed in: Resize to fit
+ HResult hr = ((IShellItemImageFactory)shellItemNative).GetImage(nativeSIZE, CalculateFlags(), out hbitmap);
+
+ if (hr == HResult.Ok) { return hbitmap; }
+ else if ((uint)hr == 0x8004B200 && FormatOption == ShellThumbnailFormatOption.ThumbnailOnly)
+ {
+ // Thumbnail was requested, but this ShellItem doesn't have a thumbnail.
+ throw new InvalidOperationException(LocalizedMessages.ShellThumbnailDoesNotHaveThumbnail, Marshal.GetExceptionForHR((int)hr));
+ }
+ else if ((uint)hr == 0x80040154) // REGDB_E_CLASSNOTREG
+ {
+ throw new NotSupportedException(LocalizedMessages.ShellThumbnailNoHandler, Marshal.GetExceptionForHR((int)hr));
+ }
+
+ throw new ShellException(hr);
+ }
+
+ private Bitmap GetBitmap(System.Windows.Size iconOnlySize, System.Windows.Size thumbnailSize)
+ {
+ return GetBitmap(FormatOption == ShellThumbnailFormatOption.IconOnly ? iconOnlySize : thumbnailSize);
+ }
+
+ private Bitmap GetBitmap(System.Windows.Size size)
+ {
+ IntPtr hBitmap = GetHBitmap(size);
+
+ // return a System.Drawing.Bitmap from the hBitmap
+ Bitmap returnValue = Bitmap.FromHbitmap(hBitmap);
+
+ // delete HBitmap to avoid memory leaks
+ ShellNativeMethods.DeleteObject(hBitmap);
+
+ return returnValue;
+ }
+
+ private BitmapSource GetBitmapSource(System.Windows.Size iconOnlySize, System.Windows.Size thumbnailSize)
+ {
+ return GetBitmapSource(FormatOption == ShellThumbnailFormatOption.IconOnly ? iconOnlySize : thumbnailSize);
+ }
+
+ private BitmapSource GetBitmapSource(System.Windows.Size size)
+ {
+ IntPtr hBitmap = GetHBitmap(size);
+
+ // return a System.Media.Imaging.BitmapSource
+ // Use interop to create a BitmapSource from hBitmap.
+ BitmapSource returnValue = Imaging.CreateBitmapSourceFromHBitmap(
+ hBitmap,
+ IntPtr.Zero,
+ System.Windows.Int32Rect.Empty,
+ BitmapSizeOptions.FromEmptyOptions());
+
+ // delete HBitmap to avoid memory leaks
+ ShellNativeMethods.DeleteObject(hBitmap);
+
+ return returnValue;
+ }
+
+ #endregion
+
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellThumbnailEnums.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellThumbnailEnums.cs
new file mode 100644
index 0000000000..e0abd3660f
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/ShellThumbnailEnums.cs
@@ -0,0 +1,56 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Represents the different retrieval options for the thumbnail or icon,
+ /// such as extracting the thumbnail or icon from a file,
+ /// from the cache only, or from memory only.
+ /// </summary>
+ public enum ShellThumbnailRetrievalOption
+ {
+ /// <summary>
+ /// The default behavior loads a thumbnail. If there is no thumbnail for the current ShellItem,
+ /// the icon is retrieved. The thumbnail or icon is extracted if it is not currently cached.
+ /// </summary>
+ Default,
+
+ /// <summary>
+ /// The CacheOnly behavior returns a cached thumbnail if it is available. Allows access to the disk,
+ /// but only to retrieve a cached item. If no cached thumbnail is available, a cached per-instance icon is returned but
+ /// a thumbnail or icon is not extracted.
+ /// </summary>
+ CacheOnly = ShellNativeMethods.SIIGBF.InCacheOnly,
+
+ /// <summary>
+ /// The MemoryOnly behavior returns the item only if it is in memory. The disk is not accessed even if the item is cached.
+ /// Note that this only returns an already-cached icon and can fall back to a per-class icon if
+ /// an item has a per-instance icon that has not been cached yet. Retrieving a thumbnail,
+ /// even if it is cached, always requires the disk to be accessed, so this method should not be
+ /// called from the user interface (UI) thread without passing ShellThumbnailCacheOptions.MemoryOnly.
+ /// </summary>
+ MemoryOnly = ShellNativeMethods.SIIGBF.MemoryOnly,
+ }
+
+ /// <summary>
+ /// Represents the format options for the thumbnails and icons.
+ /// </summary>
+ public enum ShellThumbnailFormatOption
+ {
+ /// <summary>
+ /// The default behavior loads a thumbnail. An HBITMAP for the icon of the item is retrieved if there is no thumbnail for the current Shell Item.
+ /// </summary>
+ Default,
+
+ /// <summary>
+ /// The ThumbnailOnly behavior returns only the thumbnails, never the icon. Note that not all items have thumbnails
+ /// so ShellThumbnailFormatOption.ThumbnailOnly can fail in these cases.
+ /// </summary>
+ ThumbnailOnly = ShellNativeMethods.SIIGBF.ThumbnailOnly,
+
+ /// <summary>
+ /// The IconOnly behavior returns only the icon, never the thumbnail.
+ /// </summary>
+ IconOnly = ShellNativeMethods.SIIGBF.IconOnly,
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/SortColumn.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/SortColumn.cs
new file mode 100644
index 0000000000..0a6da2140a
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Common/SortColumn.cs
@@ -0,0 +1,89 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Shell.PropertySystem;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Stores information about how to sort a column that is displayed in the folder view.
+ /// </summary>
+ [StructLayout(LayoutKind.Sequential)]
+ public struct SortColumn
+ {
+
+ /// <summary>
+ /// Creates a sort column with the specified direction for the given property.
+ /// </summary>
+ /// <param name="propertyKey">Property key for the property that the user will sort.</param>
+ /// <param name="direction">The direction in which the items are sorted.</param>
+ public SortColumn(PropertyKey propertyKey, SortDirection direction)
+ : this()
+ {
+ this.propertyKey = propertyKey;
+ this.direction = direction;
+ }
+
+ /// <summary>
+ /// The ID of the column by which the user will sort. A PropertyKey structure.
+ /// For example, for the "Name" column, the property key is PKEY_ItemNameDisplay or
+ /// <see cref="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties.System.ItemName"/>.
+ /// </summary>
+ public PropertyKey PropertyKey { get { return propertyKey; } set { propertyKey = value; } }
+ private PropertyKey propertyKey;
+
+ /// <summary>
+ /// The direction in which the items are sorted.
+ /// </summary>
+ public SortDirection Direction { get { return direction; } set { direction = value; } }
+ private SortDirection direction;
+
+
+ /// <summary>
+ /// Implements the == (equality) operator.
+ /// </summary>
+ /// <param name="col1">First object to compare.</param>
+ /// <param name="col2">Second object to compare.</param>
+ /// <returns>True if col1 equals col2; false otherwise.</returns>
+ public static bool operator ==(SortColumn col1, SortColumn col2)
+ {
+ return (col1.direction == col2.direction) &&
+ (col1.propertyKey == col2.propertyKey);
+ }
+
+ /// <summary>
+ /// Implements the != (unequality) operator.
+ /// </summary>
+ /// <param name="col1">First object to compare.</param>
+ /// <param name="col2">Second object to compare.</param>
+ /// <returns>True if col1 does not equals col1; false otherwise.</returns>
+ public static bool operator !=(SortColumn col1, SortColumn col2)
+ {
+ return !(col1 == col2);
+ }
+
+ /// <summary>
+ /// Determines if this object is equal to another.
+ /// </summary>
+ /// <param name="obj">The object to compare</param>
+ /// <returns>Returns true if the objects are equal; false otherwise.</returns>
+ public override bool Equals(object obj)
+ {
+ if (obj == null || obj.GetType() != typeof(SortColumn)) { return false; }
+ return (this == (SortColumn)obj);
+ }
+
+ /// <summary>
+ /// Generates a nearly unique hashcode for this structure.
+ /// </summary>
+ /// <returns>A hash code.</returns>
+ public override int GetHashCode()
+ {
+ int hash = this.direction.GetHashCode();
+ hash = hash * 31 + this.propertyKey.GetHashCode();
+ return hash;
+ }
+
+ }
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialog.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialog.cs
new file mode 100644
index 0000000000..89ad76e623
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialog.cs
@@ -0,0 +1,1347 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+using System.Windows;
+using System.Windows.Interop;
+using System.Windows.Markup;
+using Microsoft.WindowsAPICodePack.Controls;
+using Microsoft.WindowsAPICodePack.Dialogs.Controls;
+using Microsoft.WindowsAPICodePack.Shell;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+using System.Collections.Generic;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Defines the abstract base class for the common file dialogs.
+ /// </summary>
+ [ContentProperty("Controls")]
+ public abstract class CommonFileDialog : IDialogControlHost, IDisposable
+ {
+ /// <summary>
+ /// The collection of names selected by the user.
+ /// </summary>
+ protected IEnumerable<string> FileNameCollection
+ {
+ get
+ {
+ foreach (string name in filenames)
+ {
+ yield return name;
+ }
+ }
+ }
+ private Collection<string> filenames;
+ internal readonly Collection<IShellItem> items;
+ internal DialogShowState showState = DialogShowState.PreShow;
+
+ internal IFileDialog nativeDialog;
+ internal IFileDialogCustomize customize;
+ private NativeDialogEventSink nativeEventSink;
+ private bool? canceled;
+ private bool resetSelections;
+ private IntPtr parentWindow = IntPtr.Zero;
+
+ private bool filterSet; // filters can only be set once
+
+ #region Constructors
+
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ protected CommonFileDialog()
+ {
+ if (!CoreHelpers.RunningOnVista)
+ {
+ throw new PlatformNotSupportedException(LocalizedMessages.CommonFileDialogRequiresVista);
+ }
+
+ filenames = new Collection<string>();
+ filters = new CommonFileDialogFilterCollection();
+ items = new Collection<IShellItem>();
+ controls = new CommonFileDialogControlCollection<CommonFileDialogControl>(this);
+ }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified title.
+ /// </summary>
+ /// <param name="title">The title to display in the dialog.</param>
+ protected CommonFileDialog(string title)
+ : this()
+ {
+ this.title = title;
+ }
+
+ #endregion
+
+ // Template method to allow derived dialog to create actual
+ // specific COM coclass (e.g. FileOpenDialog or FileSaveDialog).
+ internal abstract void InitializeNativeFileDialog();
+ internal abstract IFileDialog GetNativeFileDialog();
+ internal abstract void PopulateWithFileNames(Collection<string> names);
+ internal abstract void PopulateWithIShellItems(Collection<IShellItem> shellItems);
+ internal abstract void CleanUpNativeFileDialog();
+ internal abstract ShellNativeMethods.FileOpenOptions GetDerivedOptionFlags(ShellNativeMethods.FileOpenOptions flags);
+
+ #region Public API
+
+ // Events.
+ /// <summary>
+ /// Raised just before the dialog is about to return with a result. Occurs when the user clicks on the Open
+ /// or Save button on a file dialog box.
+ /// </summary>
+ public event CancelEventHandler FileOk;
+ /// <summary>
+ /// Raised just before the user navigates to a new folder.
+ /// </summary>
+ public event EventHandler<CommonFileDialogFolderChangeEventArgs> FolderChanging;
+ /// <summary>
+ /// Raised when the user navigates to a new folder.
+ /// </summary>
+ public event EventHandler FolderChanged;
+ /// <summary>
+ /// Raised when the user changes the selection in the dialog's view.
+ /// </summary>
+ public event EventHandler SelectionChanged;
+ /// <summary>
+ /// Raised when the dialog is opened to notify the application of the initial chosen filetype.
+ /// </summary>
+ public event EventHandler FileTypeChanged;
+ /// <summary>
+ /// Raised when the dialog is opening.
+ /// </summary>
+ public event EventHandler DialogOpening;
+
+ private CommonFileDialogControlCollection<CommonFileDialogControl> controls;
+ /// <summary>
+ /// Gets the collection of controls for the dialog.
+ /// </summary>
+ public CommonFileDialogControlCollection<CommonFileDialogControl> Controls
+ {
+ get { return controls; }
+ }
+
+ private CommonFileDialogFilterCollection filters;
+ /// <summary>
+ /// Gets the filters used by the dialog.
+ /// </summary>
+ public CommonFileDialogFilterCollection Filters
+ {
+ get { return filters; }
+ }
+
+ private string title;
+ /// <summary>
+ /// Gets or sets the dialog title.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string Title
+ {
+ get { return title; }
+ set
+ {
+ title = value;
+ if (NativeDialogShowing) { nativeDialog.SetTitle(value); }
+ }
+ }
+
+ // This is the first of many properties that are backed by the FOS_*
+ // bitflag options set with IFileDialog.SetOptions().
+ // SetOptions() fails
+ // if called while dialog is showing (e.g. from a callback).
+ private bool ensureFileExists;
+ /// <summary>
+ /// Gets or sets a value that determines whether the file must exist beforehand.
+ /// </summary>
+ /// <value>A <see cref="System.Boolean"/> value. <b>true</b> if the file must exist.</value>
+ /// <exception cref="System.InvalidOperationException">This property cannot be set when the dialog is visible.</exception>
+ public bool EnsureFileExists
+ {
+ get { return ensureFileExists; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.EnsureFileExistsCannotBeChanged);
+ ensureFileExists = value;
+ }
+ }
+
+ private bool ensurePathExists;
+ /// <summary>
+ /// Gets or sets a value that specifies whether the returned file must be in an existing folder.
+ /// </summary>
+ /// <value>A <see cref="System.Boolean"/> value. <b>true</b> if the file must exist.</value>
+ /// <exception cref="System.InvalidOperationException">This property cannot be set when the dialog is visible.</exception>
+ public bool EnsurePathExists
+ {
+ get { return ensurePathExists; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.EnsurePathExistsCannotBeChanged);
+ ensurePathExists = value;
+ }
+ }
+
+ private bool ensureValidNames;
+ /// <summary>Gets or sets a value that determines whether to validate file names.
+ /// </summary>
+ ///<value>A <see cref="System.Boolean"/> value. <b>true </b>to check for situations that would prevent an application from opening the selected file, such as sharing violations or access denied errors.</value>
+ /// <exception cref="System.InvalidOperationException">This property cannot be set when the dialog is visible.</exception>
+ ///
+ public bool EnsureValidNames
+ {
+ get { return ensureValidNames; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.EnsureValidNamesCannotBeChanged);
+ ensureValidNames = value;
+ }
+ }
+
+ private bool ensureReadOnly;
+ /// <summary>
+ /// Gets or sets a value that determines whether read-only items are returned.
+ /// Default value for CommonOpenFileDialog is true (allow read-only files) and
+ /// CommonSaveFileDialog is false (don't allow read-only files).
+ /// </summary>
+ /// <value>A <see cref="System.Boolean"/> value. <b>true</b> includes read-only items.</value>
+ /// <exception cref="System.InvalidOperationException">This property cannot be set when the dialog is visible.</exception>
+ public bool EnsureReadOnly
+ {
+ get { return ensureReadOnly; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.EnsureReadonlyCannotBeChanged);
+ ensureReadOnly = value;
+ }
+ }
+
+ private bool restoreDirectory;
+ /// <summary>
+ /// Gets or sets a value that determines the restore directory.
+ /// </summary>
+ /// <remarks></remarks>
+ /// <exception cref="System.InvalidOperationException">This property cannot be set when the dialog is visible.</exception>
+ public bool RestoreDirectory
+ {
+ get { return restoreDirectory; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.RestoreDirectoryCannotBeChanged);
+ restoreDirectory = value;
+ }
+ }
+
+ private bool showPlacesList = true;
+ /// <summary>
+ /// Gets or sets a value that controls whether
+ /// to show or hide the list of pinned places that
+ /// the user can choose.
+ /// </summary>
+ /// <value>A <see cref="System.Boolean"/> value. <b>true</b> if the list is visible; otherwise <b>false</b>.</value>
+ /// <exception cref="System.InvalidOperationException">This property cannot be set when the dialog is visible.</exception>
+ public bool ShowPlacesList
+ {
+
+ get { return showPlacesList; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.ShowPlacesListCannotBeChanged);
+ showPlacesList = value;
+ }
+ }
+
+ private bool addToMruList = true;
+ /// <summary>
+ /// Gets or sets a value that controls whether to show or hide the list of places where the user has recently opened or saved items.
+ /// </summary>
+ /// <value>A <see cref="System.Boolean"/> value.</value>
+ /// <exception cref="System.InvalidOperationException">This property cannot be set when the dialog is visible.</exception>
+ public bool AddToMostRecentlyUsedList
+ {
+ get { return addToMruList; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.AddToMostRecentlyUsedListCannotBeChanged);
+ addToMruList = value;
+ }
+ }
+
+ private bool showHiddenItems;
+ ///<summary>
+ /// Gets or sets a value that controls whether to show hidden items.
+ /// </summary>
+ /// <value>A <see cref="System.Boolean"/> value.<b>true</b> to show the items; otherwise <b>false</b>.</value>
+ /// <exception cref="System.InvalidOperationException">This property cannot be set when the dialog is visible.</exception>
+ public bool ShowHiddenItems
+ {
+ get { return showHiddenItems; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.ShowHiddenItemsCannotBeChanged);
+ showHiddenItems = value;
+ }
+ }
+ private bool allowPropertyEditing;
+ /// <summary>
+ /// Gets or sets a value that controls whether
+ /// properties can be edited.
+ /// </summary>
+ /// <value>A <see cref="System.Boolean"/> value. </value>
+ public bool AllowPropertyEditing
+ {
+ get { return allowPropertyEditing; }
+ set { allowPropertyEditing = value; }
+ }
+
+ private bool navigateToShortcut = true;
+ ///<summary>
+ /// Gets or sets a value that controls whether shortcuts should be treated as their target items, allowing an application to open a .lnk file.
+ /// </summary>
+ /// <value>A <see cref="System.Boolean"/> value. <b>true</b> indicates that shortcuts should be treated as their targets. </value>
+ /// <exception cref="System.InvalidOperationException">This property cannot be set when the dialog is visible.</exception>
+ public bool NavigateToShortcut
+ {
+ get { return navigateToShortcut; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.NavigateToShortcutCannotBeChanged);
+ navigateToShortcut = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the default file extension to be added to file names. If the value is null
+ /// or string.Empty, the extension is not added to the file names.
+ /// </summary>
+ public string DefaultExtension { get; set; }
+
+ /// <summary>
+ /// Gets the index for the currently selected file type.
+ /// </summary>
+ public int SelectedFileTypeIndex
+ {
+ get
+ {
+ uint fileType;
+
+ if (nativeDialog != null)
+ {
+ nativeDialog.GetFileTypeIndex(out fileType);
+ return (int)fileType;
+ }
+
+ return -1;
+ }
+ }
+
+ /// <summary>
+ /// Tries to set the File(s) Type Combo to match the value in
+ /// 'DefaultExtension'. Only doing this if 'this' is a Save dialog
+ /// as it makes no sense to do this if only Opening a file.
+ /// </summary>
+ ///
+ /// <param name="dialog">The native/IFileDialog instance.</param>
+ ///
+ private void SyncFileTypeComboToDefaultExtension(IFileDialog dialog)
+ {
+ if (DefaultExtension == null ||
+ filters.Count <= 0)
+ {
+ return;
+ }
+
+ CommonFileDialogFilter filter = null;
+
+ for (uint filtersCounter = 0; filtersCounter < filters.Count; filtersCounter++)
+ {
+ filter = (CommonFileDialogFilter)filters[(int)filtersCounter];
+
+ if (filter.Extensions.Contains(DefaultExtension))
+ {
+ // set the docType combo to match this
+ // extension. property is a 1-based index.
+ dialog.SetFileTypeIndex(filtersCounter + 1);
+
+ // we're done, exit for
+ break;
+ }
+ }
+
+ }
+
+ /// <summary>
+ /// Gets the selected filename.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ /// <exception cref="System.InvalidOperationException">This property cannot be used when multiple files are selected.</exception>
+ public string FileName
+ {
+ get
+ {
+ CheckFileNamesAvailable();
+
+ if (filenames.Count > 1)
+ {
+ throw new InvalidOperationException(LocalizedMessages.CommonFileDialogMultipleFiles);
+ }
+
+ string returnFilename = filenames[0];
+
+ // "If extension is a null reference (Nothing in Visual
+ // Basic), the returned string contains the specified
+ // path with its extension removed." Since we do not want
+ // to remove any existing extension, make sure the
+ // DefaultExtension property is NOT null.
+
+ // if we should, and there is one to set...
+ if (!string.IsNullOrEmpty(DefaultExtension))
+ {
+ returnFilename = System.IO.Path.ChangeExtension(returnFilename, DefaultExtension);
+ }
+
+ return returnFilename;
+ }
+ }
+
+ /// <summary>
+ /// Gets the selected item as a ShellObject.
+ /// </summary>
+ /// <value>A <see cref="Microsoft.WindowsAPICodePack.Shell.ShellObject"></see> object.</value>
+ /// <exception cref="System.InvalidOperationException">This property cannot be used when multiple files
+ /// are selected.</exception>
+ public ShellObject FileAsShellObject
+ {
+ get
+ {
+ CheckFileItemsAvailable();
+
+ if (items.Count > 1)
+ {
+ throw new InvalidOperationException(LocalizedMessages.CommonFileDialogMultipleItems);
+ }
+
+ if (items.Count == 0) { return null; }
+
+ return ShellObjectFactory.Create(items[0]);
+ }
+ }
+
+ /// <summary>
+ /// Adds a location, such as a folder, library, search connector, or known folder, to the list of
+ /// places available for a user to open or save items. This method actually adds an item
+ /// to the <b>Favorite Links</b> or <b>Places</b> section of the Open/Save dialog.
+ /// </summary>
+ /// <param name="place">The item to add to the places list.</param>
+ /// <param name="location">One of the enumeration values that indicates placement of the item in the list.</param>
+ public void AddPlace(ShellContainer place, FileDialogAddPlaceLocation location)
+ {
+ if (place == null)
+ {
+ throw new ArgumentNullException("place");
+ }
+
+ // Get our native dialog
+ if (nativeDialog == null)
+ {
+ InitializeNativeFileDialog();
+ nativeDialog = GetNativeFileDialog();
+ }
+
+ // Add the shellitem to the places list
+ if (nativeDialog != null)
+ {
+ nativeDialog.AddPlace(place.NativeShellItem, (ShellNativeMethods.FileDialogAddPlacement)location);
+ }
+ }
+
+ /// <summary>
+ /// Adds a location (folder, library, search connector, known folder) to the list of
+ /// places available for the user to open or save items. This method actually adds an item
+ /// to the <b>Favorite Links</b> or <b>Places</b> section of the Open/Save dialog. Overload method
+ /// takes in a string for the path.
+ /// </summary>
+ /// <param name="path">The item to add to the places list.</param>
+ /// <param name="location">One of the enumeration values that indicates placement of the item in the list.</param>
+ public void AddPlace(string path, FileDialogAddPlaceLocation location)
+ {
+ if (string.IsNullOrEmpty(path)) { throw new ArgumentNullException("path"); }
+
+ // Get our native dialog
+ if (nativeDialog == null)
+ {
+ InitializeNativeFileDialog();
+ nativeDialog = GetNativeFileDialog();
+ }
+
+ // Create a native shellitem from our path
+ IShellItem2 nativeShellItem;
+ Guid guid = new Guid(ShellIIDGuid.IShellItem2);
+ int retCode = ShellNativeMethods.SHCreateItemFromParsingName(path, IntPtr.Zero, ref guid, out nativeShellItem);
+
+ if (!CoreErrorHelper.Succeeded(retCode))
+ {
+ throw new CommonControlException(LocalizedMessages.CommonFileDialogCannotCreateShellItem, Marshal.GetExceptionForHR(retCode));
+ }
+
+ // Add the shellitem to the places list
+ if (nativeDialog != null)
+ {
+ nativeDialog.AddPlace(nativeShellItem, (ShellNativeMethods.FileDialogAddPlacement)location);
+ }
+ }
+
+ // Null = use default directory.
+ private string initialDirectory;
+ /// <summary>
+ /// Gets or sets the initial directory displayed when the dialog is shown.
+ /// A null or empty string indicates that the dialog is using the default directory.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string InitialDirectory
+ {
+ get { return initialDirectory; }
+ set { initialDirectory = value; }
+ }
+
+ private ShellContainer initialDirectoryShellContainer;
+ /// <summary>
+ /// Gets or sets a location that is always selected when the dialog is opened,
+ /// regardless of previous user action. A null value implies that the dialog is using
+ /// the default location.
+ /// </summary>
+ public ShellContainer InitialDirectoryShellContainer
+ {
+ get { return initialDirectoryShellContainer; }
+ set { initialDirectoryShellContainer = value; }
+ }
+
+ private string defaultDirectory;
+ /// <summary>
+ /// Sets the folder and path used as a default if there is not a recently used folder value available.
+ /// </summary>
+ public string DefaultDirectory
+ {
+ get { return defaultDirectory; }
+ set { defaultDirectory = value; }
+ }
+
+ private ShellContainer defaultDirectoryShellContainer;
+ /// <summary>
+ /// Sets the location (<see cref="Microsoft.WindowsAPICodePack.Shell.ShellContainer">ShellContainer</see>
+ /// used as a default if there is not a recently used folder value available.
+ /// </summary>
+ public ShellContainer DefaultDirectoryShellContainer
+ {
+ get { return defaultDirectoryShellContainer; }
+ set { defaultDirectoryShellContainer = value; }
+ }
+
+ // Null = use default identifier.
+ private Guid cookieIdentifier;
+ /// <summary>
+ /// Gets or sets a value that enables a calling application
+ /// to associate a GUID with a dialog's persisted state.
+ /// </summary>
+ public Guid CookieIdentifier
+ {
+ get { return cookieIdentifier; }
+ set { cookieIdentifier = value; }
+ }
+
+ /// <summary>
+ /// Displays the dialog.
+ /// </summary>
+ /// <param name="ownerWindowHandle">Window handle of any top-level window that will own the modal dialog box.</param>
+ /// <returns>A <see cref="CommonFileDialogResult"/> object.</returns>
+ public CommonFileDialogResult ShowDialog(IntPtr ownerWindowHandle)
+ {
+ if (ownerWindowHandle == IntPtr.Zero)
+ {
+ throw new ArgumentException(LocalizedMessages.CommonFileDialogInvalidHandle, "ownerWindowHandle");
+ }
+
+ // Set the parent / owner window
+ parentWindow = ownerWindowHandle;
+
+ // Show the modal dialog
+ return ShowDialog();
+ }
+
+ /// <summary>
+ /// Displays the dialog.
+ /// </summary>
+ /// <param name="window">Top-level WPF window that will own the modal dialog box.</param>
+ /// <returns>A <see cref="CommonFileDialogResult"/> object.</returns>
+ public CommonFileDialogResult ShowDialog(Window window)
+ {
+ if (window == null)
+ {
+ throw new ArgumentNullException("window");
+ }
+
+ // Set the parent / owner window
+ parentWindow = (new WindowInteropHelper(window)).Handle;
+
+ // Show the modal dialog
+ return ShowDialog();
+ }
+
+ /// <summary>
+ /// Displays the dialog.
+ /// </summary>
+ /// <returns>A <see cref="CommonFileDialogResult"/> object.</returns>
+ public CommonFileDialogResult ShowDialog()
+ {
+ CommonFileDialogResult result;
+
+ // Fetch derived native dialog (i.e. Save or Open).
+ InitializeNativeFileDialog();
+ nativeDialog = GetNativeFileDialog();
+
+ // Apply outer properties to native dialog instance.
+ ApplyNativeSettings(nativeDialog);
+ InitializeEventSink(nativeDialog);
+
+ // Clear user data if Reset has been called
+ // since the last show.
+ if (resetSelections)
+ {
+ resetSelections = false;
+ }
+
+ // Show dialog.
+ showState = DialogShowState.Showing;
+ int hresult = nativeDialog.Show(parentWindow);
+ showState = DialogShowState.Closed;
+
+ // Create return information.
+ if (CoreErrorHelper.Matches(hresult, (int)HResult.Win32ErrorCanceled))
+ {
+ canceled = true;
+ result = CommonFileDialogResult.Cancel;
+ filenames.Clear();
+ }
+ else
+ {
+ canceled = false;
+ result = CommonFileDialogResult.Ok;
+
+ // Populate filenames if user didn't cancel.
+ PopulateWithFileNames(filenames);
+
+ // Populate the actual IShellItems
+ PopulateWithIShellItems(items);
+ }
+
+ return result;
+ }
+ /// <summary>
+ /// Removes the current selection.
+ /// </summary>
+ public void ResetUserSelections()
+ {
+ resetSelections = true;
+ }
+
+ /// <summary>
+ /// Default file name.
+ /// </summary>
+ public string DefaultFileName { get; set; }
+
+ #endregion
+
+ #region Configuration
+
+ private void InitializeEventSink(IFileDialog nativeDlg)
+ {
+ // Check if we even need to have a sink.
+ if (FileOk != null
+ || FolderChanging != null
+ || FolderChanged != null
+ || SelectionChanged != null
+ || FileTypeChanged != null
+ || DialogOpening != null
+ || (controls != null && controls.Count > 0))
+ {
+ uint cookie;
+ nativeEventSink = new NativeDialogEventSink(this);
+ nativeDlg.Advise(nativeEventSink, out cookie);
+ nativeEventSink.Cookie = cookie;
+ }
+ }
+
+ private void ApplyNativeSettings(IFileDialog dialog)
+ {
+ Debug.Assert(dialog != null, "No dialog instance to configure");
+
+ if (parentWindow == IntPtr.Zero)
+ {
+ if (System.Windows.Application.Current != null && System.Windows.Application.Current.MainWindow != null)
+ {
+ parentWindow = (new WindowInteropHelper(System.Windows.Application.Current.MainWindow)).Handle;
+ }
+ else if (System.Windows.Forms.Application.OpenForms.Count > 0)
+ {
+ parentWindow = System.Windows.Forms.Application.OpenForms[0].Handle;
+ }
+ }
+
+ Guid guid = new Guid(ShellIIDGuid.IShellItem2);
+
+ // Apply option bitflags.
+ dialog.SetOptions(CalculateNativeDialogOptionFlags());
+
+ // Other property sets.
+ if (title != null) { dialog.SetTitle(title); }
+
+ if (initialDirectoryShellContainer != null)
+ {
+ dialog.SetFolder(((ShellObject)initialDirectoryShellContainer).NativeShellItem);
+ }
+
+ if (defaultDirectoryShellContainer != null)
+ {
+ dialog.SetDefaultFolder(((ShellObject)defaultDirectoryShellContainer).NativeShellItem);
+ }
+
+ if (!string.IsNullOrEmpty(initialDirectory))
+ {
+ // Create a native shellitem from our path
+ IShellItem2 initialDirectoryShellItem;
+ ShellNativeMethods.SHCreateItemFromParsingName(initialDirectory, IntPtr.Zero, ref guid, out initialDirectoryShellItem);
+
+ // If we get a real shell item back,
+ // then use that as the initial folder - otherwise,
+ // we'll allow the dialog to revert to the default folder.
+ // (OR should we fail loudly?)
+ if (initialDirectoryShellItem != null)
+ dialog.SetFolder(initialDirectoryShellItem);
+ }
+
+ if (!string.IsNullOrEmpty(defaultDirectory))
+ {
+ // Create a native shellitem from our path
+ IShellItem2 defaultDirectoryShellItem;
+ ShellNativeMethods.SHCreateItemFromParsingName(defaultDirectory, IntPtr.Zero, ref guid, out defaultDirectoryShellItem);
+
+ // If we get a real shell item back,
+ // then use that as the initial folder - otherwise,
+ // we'll allow the dialog to revert to the default folder.
+ // (OR should we fail loudly?)
+ if (defaultDirectoryShellItem != null)
+ {
+ dialog.SetDefaultFolder(defaultDirectoryShellItem);
+ }
+ }
+
+ // Apply file type filters, if available.
+ if (filters.Count > 0 && !filterSet)
+ {
+ dialog.SetFileTypes(
+ (uint)filters.Count,
+ filters.GetAllFilterSpecs());
+
+ filterSet = true;
+
+ SyncFileTypeComboToDefaultExtension(dialog);
+ }
+
+ if (cookieIdentifier != Guid.Empty)
+ {
+ dialog.SetClientGuid(ref cookieIdentifier);
+ }
+
+ // Set the default extension
+ if (!string.IsNullOrEmpty(DefaultExtension))
+ {
+ dialog.SetDefaultExtension(DefaultExtension);
+ }
+
+ // Set the default filename
+ dialog.SetFileName(DefaultFileName);
+ }
+
+ private ShellNativeMethods.FileOpenOptions CalculateNativeDialogOptionFlags()
+ {
+ // We start with only a few flags set by default,
+ // then go from there based on the current state
+ // of the managed dialog's property values.
+ ShellNativeMethods.FileOpenOptions flags = ShellNativeMethods.FileOpenOptions.NoTestFileCreate;
+
+ // Call to derived (concrete) dialog to
+ // set dialog-specific flags.
+ flags = GetDerivedOptionFlags(flags);
+
+ // Apply other optional flags.
+ if (ensureFileExists)
+ {
+ flags |= ShellNativeMethods.FileOpenOptions.FileMustExist;
+ }
+ if (ensurePathExists)
+ {
+ flags |= ShellNativeMethods.FileOpenOptions.PathMustExist;
+ }
+ if (!ensureValidNames)
+ {
+ flags |= ShellNativeMethods.FileOpenOptions.NoValidate;
+ }
+ if (!EnsureReadOnly)
+ {
+ flags |= ShellNativeMethods.FileOpenOptions.NoReadOnlyReturn;
+ }
+ if (restoreDirectory)
+ {
+ flags |= ShellNativeMethods.FileOpenOptions.NoChangeDirectory;
+ }
+ if (!showPlacesList)
+ {
+ flags |= ShellNativeMethods.FileOpenOptions.HidePinnedPlaces;
+ }
+ if (!addToMruList)
+ {
+ flags |= ShellNativeMethods.FileOpenOptions.DontAddToRecent;
+ }
+ if (showHiddenItems)
+ {
+ flags |= ShellNativeMethods.FileOpenOptions.ForceShowHidden;
+ }
+ if (!navigateToShortcut)
+ {
+ flags |= ShellNativeMethods.FileOpenOptions.NoDereferenceLinks;
+ }
+ return flags;
+ }
+
+ #endregion
+
+ #region IDialogControlHost Members
+
+ private static void GenerateNotImplementedException()
+ {
+ throw new NotImplementedException(LocalizedMessages.NotImplementedException);
+ }
+
+ /// <summary>
+ /// Returns if change to the colleciton is allowed.
+ /// </summary>
+ /// <returns>true if collection change is allowed.</returns>
+ public virtual bool IsCollectionChangeAllowed()
+ {
+ return true;
+ }
+
+ /// <summary>
+ /// Applies changes to the collection.
+ /// </summary>
+ public virtual void ApplyCollectionChanged()
+ {
+ // Query IFileDialogCustomize interface before adding controls
+ GetCustomizedFileDialog();
+ // Populate all the custom controls and add them to the dialog
+ foreach (CommonFileDialogControl control in controls)
+ {
+ if (!control.IsAdded)
+ {
+ control.HostingDialog = this;
+ control.Attach(customize);
+ control.IsAdded = true;
+ }
+ }
+
+ }
+
+ /// <summary>
+ /// Determines if changes to a specific property are allowed.
+ /// </summary>
+ /// <param name="propertyName">The name of the property.</param>
+ /// <param name="control">The control propertyName applies to.</param>
+ /// <returns>true if the property change is allowed.</returns>
+ public virtual bool IsControlPropertyChangeAllowed(string propertyName, DialogControl control)
+ {
+ CommonFileDialog.GenerateNotImplementedException();
+ return false;
+ }
+
+ /// <summary>
+ /// Called when a control currently in the collection
+ /// has a property changed.
+ /// </summary>
+ /// <param name="propertyName">The name of the property changed.</param>
+ /// <param name="control">The control whose property has changed.</param>
+ public virtual void ApplyControlPropertyChange(string propertyName, DialogControl control)
+ {
+ if (control == null)
+ {
+ throw new ArgumentNullException("control");
+ }
+
+ CommonFileDialogControl dialogControl = null;
+ if (propertyName == "Text")
+ {
+ CommonFileDialogTextBox textBox = control as CommonFileDialogTextBox;
+
+ if (textBox != null)
+ {
+ customize.SetEditBoxText(control.Id, textBox.Text);
+ }
+ else
+ {
+ customize.SetControlLabel(control.Id, textBox.Text);
+ }
+ }
+ else if (propertyName == "Visible" && (dialogControl = control as CommonFileDialogControl) != null)
+ {
+ ShellNativeMethods.ControlState state;
+ customize.GetControlState(control.Id, out state);
+
+ if (dialogControl.Visible == true)
+ {
+ state |= ShellNativeMethods.ControlState.Visible;
+ }
+ else if (dialogControl.Visible == false)
+ {
+ state &= ~ShellNativeMethods.ControlState.Visible;
+ }
+
+ customize.SetControlState(control.Id, state);
+ }
+ else if (propertyName == "Enabled" && dialogControl != null)
+ {
+ ShellNativeMethods.ControlState state;
+ customize.GetControlState(control.Id, out state);
+
+ if (dialogControl.Enabled == true)
+ {
+ state |= ShellNativeMethods.ControlState.Enable;
+ }
+ else if (dialogControl.Enabled == false)
+ {
+ state &= ~ShellNativeMethods.ControlState.Enable;
+ }
+
+ customize.SetControlState(control.Id, state);
+ }
+ else if (propertyName == "SelectedIndex")
+ {
+ CommonFileDialogRadioButtonList list;
+ CommonFileDialogComboBox box;
+
+ if ((list = control as CommonFileDialogRadioButtonList) != null)
+ {
+ customize.SetSelectedControlItem(list.Id, list.SelectedIndex);
+ }
+ else if ((box = control as CommonFileDialogComboBox) != null)
+ {
+ customize.SetSelectedControlItem(box.Id, box.SelectedIndex);
+ }
+ }
+ else if (propertyName == "IsChecked")
+ {
+ CommonFileDialogCheckBox checkBox = control as CommonFileDialogCheckBox;
+ if (checkBox != null)
+ {
+ customize.SetCheckButtonState(checkBox.Id, checkBox.IsChecked);
+ }
+ }
+ }
+
+ #endregion
+
+ #region Helpers
+
+ /// <summary>
+ /// Ensures that the user has selected one or more files.
+ /// </summary>
+ /// <permission cref="System.InvalidOperationException">
+ /// The dialog has not been dismissed yet or the dialog was cancelled.
+ /// </permission>
+ protected void CheckFileNamesAvailable()
+ {
+ if (showState != DialogShowState.Closed)
+ {
+ throw new InvalidOperationException(LocalizedMessages.CommonFileDialogNotClosed);
+ }
+
+ if (canceled.GetValueOrDefault())
+ {
+ throw new InvalidOperationException(LocalizedMessages.CommonFileDialogCanceled);
+ }
+
+ Debug.Assert(filenames.Count != 0,
+ "FileNames empty - shouldn't happen unless dialog canceled or not yet shown.");
+ }
+
+ /// <summary>
+ /// Ensures that the user has selected one or more files.
+ /// </summary>
+ /// <permission cref="System.InvalidOperationException">
+ /// The dialog has not been dismissed yet or the dialog was cancelled.
+ /// </permission>
+ protected void CheckFileItemsAvailable()
+ {
+ if (showState != DialogShowState.Closed)
+ {
+ throw new InvalidOperationException(LocalizedMessages.CommonFileDialogNotClosed);
+ }
+
+ if (canceled.GetValueOrDefault())
+ {
+ throw new InvalidOperationException(LocalizedMessages.CommonFileDialogCanceled);
+ }
+
+ Debug.Assert(items.Count != 0,
+ "Items list empty - shouldn't happen unless dialog canceled or not yet shown.");
+ }
+
+ private bool NativeDialogShowing
+ {
+ get
+ {
+ return (nativeDialog != null)
+ && (showState == DialogShowState.Showing || showState == DialogShowState.Closing);
+ }
+ }
+
+ internal static string GetFileNameFromShellItem(IShellItem item)
+ {
+ string filename = null;
+ IntPtr pszString = IntPtr.Zero;
+ HResult hr = item.GetDisplayName(ShellNativeMethods.ShellItemDesignNameOptions.DesktopAbsoluteParsing, out pszString);
+ if (hr == HResult.Ok && pszString != IntPtr.Zero)
+ {
+ filename = Marshal.PtrToStringAuto(pszString);
+ Marshal.FreeCoTaskMem(pszString);
+ }
+ return filename;
+ }
+
+ internal static IShellItem GetShellItemAt(IShellItemArray array, int i)
+ {
+ IShellItem result;
+ uint index = (uint)i;
+ array.GetItemAt(index, out result);
+ return result;
+ }
+
+ /// <summary>
+ /// Throws an exception when the dialog is showing preventing
+ /// a requested change to a property or the visible set of controls.
+ /// </summary>
+ /// <param name="message">The message to include in the exception.</param>
+ /// <permission cref="System.InvalidOperationException"> The dialog is in an
+ /// invalid state to perform the requested operation.</permission>
+ protected void ThrowIfDialogShowing(string message)
+ {
+ if (NativeDialogShowing)
+ {
+ throw new InvalidOperationException(message);
+ }
+ }
+ /// <summary>
+ /// Get the IFileDialogCustomize interface, preparing to add controls.
+ /// </summary>
+ private void GetCustomizedFileDialog()
+ {
+ if (customize == null)
+ {
+ if (nativeDialog == null)
+ {
+ InitializeNativeFileDialog();
+ nativeDialog = GetNativeFileDialog();
+ }
+ customize = (IFileDialogCustomize)nativeDialog;
+ }
+ }
+ #endregion
+
+ #region CheckChanged handling members
+ /// <summary>
+ /// Raises the <see cref="CommonFileDialog.FileOk"/> event just before the dialog is about to return with a result.
+ /// </summary>
+ /// <param name="e">The event data.</param>
+ protected virtual void OnFileOk(CancelEventArgs e)
+ {
+ CancelEventHandler handler = FileOk;
+ if (handler != null)
+ {
+ handler(this, e);
+ }
+ }
+ /// <summary>
+ /// Raises the <see cref="FolderChanging"/> to stop navigation to a particular location.
+ /// </summary>
+ /// <param name="e">Cancelable event arguments.</param>
+ protected virtual void OnFolderChanging(CommonFileDialogFolderChangeEventArgs e)
+ {
+ EventHandler<CommonFileDialogFolderChangeEventArgs> handler = FolderChanging;
+ if (handler != null)
+ {
+ handler(this, e);
+ }
+ }
+ /// <summary>
+ /// Raises the <see cref="CommonFileDialog.FolderChanged"/> event when the user navigates to a new folder.
+ /// </summary>
+ /// <param name="e">The event data.</param>
+ protected virtual void OnFolderChanged(EventArgs e)
+ {
+ EventHandler handler = FolderChanged;
+ if (handler != null)
+ {
+ handler(this, e);
+ }
+ }
+ /// <summary>
+ /// Raises the <see cref="CommonFileDialog.SelectionChanged"/> event when the user changes the selection in the dialog's view.
+ /// </summary>
+ /// <param name="e">The event data.</param>
+ protected virtual void OnSelectionChanged(EventArgs e)
+ {
+ EventHandler handler = SelectionChanged;
+ if (handler != null)
+ {
+ handler(this, e);
+ }
+ }
+ /// <summary>
+ /// Raises the <see cref="CommonFileDialog.FileTypeChanged"/> event when the dialog is opened to notify the
+ /// application of the initial chosen filetype.
+ /// </summary>
+ /// <param name="e">The event data.</param>
+ protected virtual void OnFileTypeChanged(EventArgs e)
+ {
+ EventHandler handler = FileTypeChanged;
+ if (handler != null)
+ {
+ handler(this, e);
+ }
+ }
+ /// <summary>
+ /// Raises the <see cref="CommonFileDialog.DialogOpening"/> event when the dialog is opened.
+ /// </summary>
+ /// <param name="e">The event data.</param>
+ protected virtual void OnOpening(EventArgs e)
+ {
+ EventHandler handler = DialogOpening;
+ if (handler != null)
+ {
+ handler(this, e);
+ }
+ }
+
+ #endregion
+
+ #region NativeDialogEventSink Nested Class
+
+ private class NativeDialogEventSink : IFileDialogEvents, IFileDialogControlEvents
+ {
+ private CommonFileDialog parent;
+ private bool firstFolderChanged = true;
+
+ public NativeDialogEventSink(CommonFileDialog commonDialog)
+ {
+ this.parent = commonDialog;
+ }
+
+ public uint Cookie { get; set; }
+
+ public HResult OnFileOk(IFileDialog pfd)
+ {
+ CancelEventArgs args = new CancelEventArgs();
+ parent.OnFileOk(args);
+
+ if (!args.Cancel)
+ {
+ // Make sure all custom properties are sync'ed
+ if (parent.Controls != null)
+ {
+ foreach (CommonFileDialogControl control in parent.Controls)
+ {
+ CommonFileDialogTextBox textBox;
+ CommonFileDialogGroupBox groupBox; ;
+
+ if ((textBox = control as CommonFileDialogTextBox) != null)
+ {
+ textBox.SyncValue();
+ textBox.Closed = true;
+ }
+ // Also check subcontrols
+ else if ((groupBox = control as CommonFileDialogGroupBox) != null)
+ {
+ foreach (CommonFileDialogControl subcontrol in groupBox.Items)
+ {
+ CommonFileDialogTextBox textbox = subcontrol as CommonFileDialogTextBox;
+ if (textbox != null)
+ {
+ textbox.SyncValue();
+ textbox.Closed = true;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return (args.Cancel ? HResult.False : HResult.Ok);
+ }
+
+ public HResult OnFolderChanging(IFileDialog pfd, IShellItem psiFolder)
+ {
+ CommonFileDialogFolderChangeEventArgs args = new CommonFileDialogFolderChangeEventArgs(
+ CommonFileDialog.GetFileNameFromShellItem(psiFolder));
+
+ if (!firstFolderChanged) { parent.OnFolderChanging(args); }
+
+ return (args.Cancel ? HResult.False : HResult.Ok);
+ }
+
+ public void OnFolderChange(IFileDialog pfd)
+ {
+ if (firstFolderChanged)
+ {
+ firstFolderChanged = false;
+ parent.OnOpening(EventArgs.Empty);
+ }
+ else
+ {
+ parent.OnFolderChanged(EventArgs.Empty);
+ }
+ }
+
+ public void OnSelectionChange(IFileDialog pfd)
+ {
+ parent.OnSelectionChanged(EventArgs.Empty);
+ }
+
+ public void OnShareViolation(
+ IFileDialog pfd,
+ IShellItem psi,
+ out ShellNativeMethods.FileDialogEventShareViolationResponse pResponse)
+ {
+ // Do nothing: we will ignore share violations,
+ // and don't register
+ // for them, so this method should never be called.
+ pResponse = ShellNativeMethods.FileDialogEventShareViolationResponse.Accept;
+ }
+
+ public void OnTypeChange(IFileDialog pfd)
+ {
+ parent.OnFileTypeChanged(EventArgs.Empty);
+ }
+
+ public void OnOverwrite(IFileDialog pfd, IShellItem psi, out ShellNativeMethods.FileDialogEventOverwriteResponse pResponse)
+ {
+ // Don't accept or reject the dialog, keep default settings
+ pResponse = ShellNativeMethods.FileDialogEventOverwriteResponse.Default;
+ }
+
+ public void OnItemSelected(IFileDialogCustomize pfdc, int dwIDCtl, int dwIDItem)
+ {
+ // Find control
+ DialogControl control = this.parent.controls.GetControlbyId(dwIDCtl);
+
+ ICommonFileDialogIndexedControls controlInterface;
+ CommonFileDialogMenu menu;
+
+ // Process ComboBox and/or RadioButtonList
+ if ((controlInterface = control as ICommonFileDialogIndexedControls) != null)
+ {
+ // Update selected item and raise SelectedIndexChanged event
+ controlInterface.SelectedIndex = dwIDItem;
+ controlInterface.RaiseSelectedIndexChangedEvent();
+ }
+ // Process Menu
+ else if ((menu = control as CommonFileDialogMenu) != null)
+ {
+ // Find the menu item that was clicked and invoke it's click event
+ foreach (CommonFileDialogMenuItem item in menu.Items)
+ {
+ if (item.Id == dwIDItem)
+ {
+ item.RaiseClickEvent();
+ break;
+ }
+ }
+ }
+ }
+
+ public void OnButtonClicked(IFileDialogCustomize pfdc, int dwIDCtl)
+ {
+ // Find control
+ DialogControl control = this.parent.controls.GetControlbyId(dwIDCtl);
+ CommonFileDialogButton button = control as CommonFileDialogButton;
+ // Call corresponding event
+ if (button != null)
+ {
+ button.RaiseClickEvent();
+ }
+ }
+
+ public void OnCheckButtonToggled(IFileDialogCustomize pfdc, int dwIDCtl, bool bChecked)
+ {
+ // Find control
+ DialogControl control = this.parent.controls.GetControlbyId(dwIDCtl);
+
+ CommonFileDialogCheckBox box = control as CommonFileDialogCheckBox;
+ // Update control and call corresponding event
+ if (box != null)
+ {
+ box.IsChecked = bChecked;
+ box.RaiseCheckedChangedEvent();
+ }
+ }
+
+ public void OnControlActivating(IFileDialogCustomize pfdc, int dwIDCtl)
+ {
+ }
+ }
+
+ #endregion
+
+ #region IDisposable Members
+
+ /// <summary>
+ /// Releases the unmanaged resources used by the CommonFileDialog class and optionally
+ /// releases the managed resources.
+ /// </summary>
+ /// <param name="disposing"><b>true</b> to release both managed and unmanaged resources;
+ /// <b>false</b> to release only unmanaged resources.</param>
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ CleanUpNativeFileDialog();
+ }
+ }
+
+ /// <summary>
+ /// Releases the resources used by the current instance of the CommonFileDialog class.
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ #endregion
+
+ /// <summary>
+ /// Indicates whether this feature is supported on the current platform.
+ /// </summary>
+ public static bool IsPlatformSupported
+ {
+ get
+ {
+ // We need Windows Vista onwards ...
+ return CoreHelpers.RunningOnVista;
+ }
+ }
+ }
+
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogButton.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogButton.cs
new file mode 100644
index 0000000000..879352a6b7
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogButton.cs
@@ -0,0 +1,59 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Diagnostics;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs.Controls
+{
+ /// <summary>
+ /// Creates the push button controls used by the Common File Dialog.
+ /// </summary>
+ public class CommonFileDialogButton : CommonFileDialogProminentControl
+ {
+ /// <summary>
+ /// Initializes a new instance of this class.
+ /// </summary>
+ public CommonFileDialogButton() : base(string.Empty) { }
+
+ /// <summary>
+ /// Initializes a new instance of this class with the text only.
+ /// </summary>
+ /// <param name="text">The text to display for this control.</param>
+ public CommonFileDialogButton(string text) : base(text) { }
+
+ /// <summary>
+ /// Initializes a new instance of this class with the specified name and text.
+ /// </summary>
+ /// <param name="name">The name of this control.</param>
+ /// <param name="text">The text to display for this control.</param>
+ public CommonFileDialogButton(string name, string text) : base(name, text) { }
+
+ /// <summary>
+ /// Attach the PushButton control to the dialog object
+ /// </summary>
+ /// <param name="dialog">Target dialog</param>
+ internal override void Attach(IFileDialogCustomize dialog)
+ {
+ Debug.Assert(dialog != null, "CommonFileDialogButton.Attach: dialog parameter can not be null");
+
+ // Add a push button control
+ dialog.AddPushButton(this.Id, this.Text);
+
+ // Make this control prominent if needed
+ if (IsProminent) { dialog.MakeProminent(this.Id); }
+
+ // Sync unmanaged properties with managed properties
+ SyncUnmanagedProperties();
+ }
+
+ /// <summary>
+ /// Occurs when the user clicks the control. This event is routed from COM via the event sink.
+ /// </summary>
+ public event EventHandler Click = delegate { };
+ internal void RaiseClickEvent()
+ {
+ // Make sure that this control is enabled and has a specified delegate
+ if (Enabled) { this.Click(this, EventArgs.Empty); }
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogCheckBox.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogCheckBox.cs
new file mode 100644
index 0000000000..199d2f7bed
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogCheckBox.cs
@@ -0,0 +1,106 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Diagnostics;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs.Controls
+{
+ /// <summary>
+ /// Creates the check button controls used by the Common File Dialog.
+ /// </summary>
+ public class CommonFileDialogCheckBox : CommonFileDialogProminentControl
+ {
+ private bool isChecked;
+ /// <summary>
+ /// Gets or sets the state of the check box.
+ /// </summary>
+ public bool IsChecked
+ {
+ get { return isChecked; }
+ set
+ {
+ // Check if property has changed
+ if (isChecked != value)
+ {
+ isChecked = value;
+ ApplyPropertyChange("IsChecked");
+ }
+ }
+ }
+
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ public CommonFileDialogCheckBox() { }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified text.
+ /// </summary>
+ /// <param name="text">The text to display for this control.</param>
+ public CommonFileDialogCheckBox(string text) : base(text) { }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified name and text.
+ /// </summary>
+ /// <param name="name">The name of this control.</param>
+ /// <param name="text">The text to display for this control.</param>
+ public CommonFileDialogCheckBox(string name, string text) : base(name, text) { }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified text and check state.
+ /// </summary>
+ /// <param name="text">The text to display for this control.</param>
+ /// <param name="isChecked">The check state of this control.</param>
+ public CommonFileDialogCheckBox(string text, bool isChecked)
+ : base(text)
+ {
+ this.isChecked = isChecked;
+ }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified name, text and check state.
+ /// </summary>
+ /// <param name="name">The name of this control.</param>
+ /// <param name="text">The text to display for this control.</param>
+ /// <param name="isChecked">The check state of this control.</param>
+ public CommonFileDialogCheckBox(string name, string text, bool isChecked)
+ : base(name, text)
+ {
+ this.isChecked = isChecked;
+ }
+
+ /// <summary>
+ /// Occurs when the user changes the check state.
+ /// </summary>
+ public event EventHandler CheckedChanged = delegate { };
+ internal void RaiseCheckedChangedEvent()
+ {
+ // Make sure that this control is enabled and has a specified delegate
+ if (Enabled)
+ {
+ this.CheckedChanged(this, EventArgs.Empty);
+ }
+ }
+
+ /// <summary>
+ /// Attach the CheckButton control to the dialog object.
+ /// </summary>
+ /// <param name="dialog">the target dialog</param>
+ internal override void Attach(IFileDialogCustomize dialog)
+ {
+ Debug.Assert(dialog != null, "CommonFileDialogCheckBox.Attach: dialog parameter can not be null");
+
+ // Add a check button control
+ dialog.AddCheckButton(this.Id, this.Text, this.isChecked);
+
+ // Make this control prominent if needed
+ if (IsProminent) { dialog.MakeProminent(this.Id); }
+
+ // Make sure this property is set
+ ApplyPropertyChange("IsChecked");
+
+ // Sync unmanaged properties with managed properties
+ SyncUnmanagedProperties();
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogComboBox.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogComboBox.cs
new file mode 100644
index 0000000000..cebe120e1a
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogComboBox.cs
@@ -0,0 +1,174 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Windows.Markup;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs.Controls
+{
+ /// <summary>
+ /// Creates the ComboBox controls in the Common File Dialog.
+ /// </summary>
+ [ContentProperty("Items")]
+ public class CommonFileDialogComboBox : CommonFileDialogProminentControl, ICommonFileDialogIndexedControls
+ {
+ private readonly Collection<CommonFileDialogComboBoxItem> items = new Collection<CommonFileDialogComboBoxItem>();
+ /// <summary>
+ /// Gets the collection of CommonFileDialogComboBoxItem objects.
+ /// </summary>
+ public Collection<CommonFileDialogComboBoxItem> Items
+ {
+ get { return items; }
+ }
+
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ public CommonFileDialogComboBox()
+ {
+ }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified name.
+ /// </summary>
+ /// <param name="name">Text to display for this control</param>
+ public CommonFileDialogComboBox(string name)
+ : base(name, string.Empty)
+ {
+ }
+
+ #region ICommonFileDialogIndexedControls Members
+
+ private int selectedIndex = -1;
+ /// <summary>
+ /// Gets or sets the current index of the selected item.
+ /// </summary>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")]
+ public int SelectedIndex
+ {
+ get { return selectedIndex; }
+ set
+ {
+ // Don't update property if it hasn't changed
+ if (selectedIndex == value)
+ return;
+
+ if (HostingDialog == null)
+ {
+ selectedIndex = value;
+ return;
+ }
+
+ // Only update this property if it has a valid value
+ if (value >= 0 && value < items.Count)
+ {
+ selectedIndex = value;
+ ApplyPropertyChange("SelectedIndex");
+ }
+ else
+ {
+ throw new IndexOutOfRangeException(LocalizedMessages.ComboBoxIndexOutsideBounds);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Occurs when the SelectedIndex is changed.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// By initializing the SelectedIndexChanged event with an empty
+ /// delegate, it is not necessary to check
+ /// if the SelectedIndexChanged is not null.
+ ///
+ /// </remarks>
+ public event EventHandler SelectedIndexChanged = delegate { };
+
+ /// <summary>
+ /// Raises the SelectedIndexChanged event if this control is
+ /// enabled.
+ /// </summary>
+ /// <remarks>Because this method is defined in an interface, we can either
+ /// have it as public, or make it private and explicitly implement (like below).
+ /// Making it public doesn't really help as its only internal (but can't have this
+ /// internal because of the interface)
+ /// </remarks>
+ void ICommonFileDialogIndexedControls.RaiseSelectedIndexChangedEvent()
+ {
+ // Make sure that this control is enabled and has a specified delegate
+ if (Enabled)
+ SelectedIndexChanged(this, EventArgs.Empty);
+ }
+
+ #endregion
+
+ /// <summary>
+ /// Attach the ComboBox control to the dialog object
+ /// </summary>
+ /// <param name="dialog">The target dialog</param>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")]
+ internal override void Attach(IFileDialogCustomize dialog)
+ {
+ Debug.Assert(dialog != null, "CommonFileDialogComboBox.Attach: dialog parameter can not be null");
+
+ // Add the combo box control
+ dialog.AddComboBox(this.Id);
+
+ // Add the combo box items
+ for (int index = 0; index < items.Count; index++)
+ dialog.AddControlItem(this.Id, index, items[index].Text);
+
+ // Set the currently selected item
+ if (selectedIndex >= 0 && selectedIndex < items.Count)
+ {
+ dialog.SetSelectedControlItem(this.Id, this.selectedIndex);
+ }
+ else if (selectedIndex != -1)
+ {
+ throw new IndexOutOfRangeException(LocalizedMessages.ComboBoxIndexOutsideBounds);
+ }
+
+ // Make this control prominent if needed
+ if (IsProminent)
+ dialog.MakeProminent(this.Id);
+
+ // Sync additional properties
+ SyncUnmanagedProperties();
+ }
+
+ }
+
+ /// <summary>
+ /// Creates a ComboBoxItem for the Common File Dialog.
+ /// </summary>
+ public class CommonFileDialogComboBoxItem
+ {
+ private string text = string.Empty;
+ /// <summary>
+ /// Gets or sets the string that is displayed for this item.
+ /// </summary>
+ public string Text
+ {
+ get { return text; }
+ set { text = value; }
+ }
+
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ public CommonFileDialogComboBoxItem()
+ {
+ }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified text.
+ /// </summary>
+ /// <param name="text">The text to use for the combo box item.</param>
+ public CommonFileDialogComboBoxItem(string text)
+ {
+ this.text = text;
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogControl.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogControl.cs
new file mode 100644
index 0000000000..fe2a204e2d
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogControl.cs
@@ -0,0 +1,116 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Dialogs.Controls
+{
+ /// <summary>
+ /// Defines an abstract class that supports shared functionality for the
+ /// common file dialog controls.
+ /// </summary>
+ public abstract class CommonFileDialogControl : DialogControl
+ {
+ /// <summary>
+ /// Holds the text that is displayed for this control.
+ /// </summary>
+ private string textValue;
+
+ /// <summary>
+ /// Gets or sets the text string that is displayed on the control.
+ /// </summary>
+ public virtual string Text
+ {
+ get { return textValue; }
+ set
+ {
+ // Don't update this property if it hasn't changed
+ if (value != textValue)
+ {
+ textValue = value;
+ ApplyPropertyChange("Text");
+ }
+ }
+ }
+
+ private bool enabled = true;
+ /// <summary>
+ /// Gets or sets a value that determines if this control is enabled.
+ /// </summary>
+ public bool Enabled
+ {
+ get { return enabled; }
+ set
+ {
+ // Don't update this property if it hasn't changed
+ if (value == enabled) { return; }
+
+ enabled = value;
+ ApplyPropertyChange("Enabled");
+ }
+ }
+
+ private bool visible = true;
+ /// <summary>
+ /// Gets or sets a boolean value that indicates whether
+ /// this control is visible.
+ /// </summary>
+ public bool Visible
+ {
+ get { return visible; }
+ set
+ {
+ // Don't update this property if it hasn't changed
+ if (value == visible) { return; }
+
+ visible = value;
+ ApplyPropertyChange("Visible");
+ }
+ }
+
+ private bool isAdded;
+ /// <summary>
+ /// Has this control been added to the dialog
+ /// </summary>
+ internal bool IsAdded
+ {
+ get { return isAdded; }
+ set { isAdded = value; }
+ }
+
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ protected CommonFileDialogControl() { }
+
+ /// <summary>
+ /// Creates a new instance of this class with the text.
+ /// </summary>
+ /// <param name="text">The text of the common file dialog control.</param>
+ protected CommonFileDialogControl(string text)
+ : base()
+ {
+ this.textValue = text;
+ }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified name and text.
+ /// </summary>
+ /// <param name="name">The name of the common file dialog control.</param>
+ /// <param name="text">The text of the common file dialog control.</param>
+ protected CommonFileDialogControl(string name, string text)
+ : base(name)
+ {
+ this.textValue = text;
+ }
+
+ /// <summary>
+ /// Attach the custom control itself to the specified dialog
+ /// </summary>
+ /// <param name="dialog">the target dialog</param>
+ internal abstract void Attach(IFileDialogCustomize dialog);
+
+ internal virtual void SyncUnmanagedProperties()
+ {
+ ApplyPropertyChange("Enabled");
+ ApplyPropertyChange("Visible");
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogControlCollection.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogControlCollection.cs
new file mode 100644
index 0000000000..96dc6b4bda
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogControlCollection.cs
@@ -0,0 +1,168 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs.Controls
+{
+ /// <summary>
+ /// Provides a strongly typed collection for dialog controls.
+ /// </summary>
+ /// <typeparam name="T">DialogControl</typeparam>
+ public sealed class CommonFileDialogControlCollection<T> : Collection<T> where T : DialogControl
+ {
+ private IDialogControlHost hostingDialog;
+
+ internal CommonFileDialogControlCollection(IDialogControlHost host)
+ {
+ hostingDialog = host;
+ }
+
+ /// <summary>
+ /// Inserts an dialog control at the specified index.
+ /// </summary>
+ /// <param name="index">The location to insert the control.</param>
+ /// <param name="control">The item to insert.</param>
+ /// <permission cref="System.InvalidOperationException">A control with
+ /// the same name already exists in this collection -or-
+ /// the control is being hosted by another dialog -or- the associated dialog is
+ /// showing and cannot be modified.</permission>
+ protected override void InsertItem(int index, T control)
+ {
+ // Check for duplicates, lack of host,
+ // and during-show adds.
+ if (Items.Contains(control))
+ {
+ throw new InvalidOperationException(
+ LocalizedMessages.DialogControlCollectionMoreThanOneControl);
+ }
+ if (control.HostingDialog != null)
+ {
+ throw new InvalidOperationException(
+ LocalizedMessages.DialogControlCollectionRemoveControlFirst);
+ }
+ if (!hostingDialog.IsCollectionChangeAllowed())
+ {
+ throw new InvalidOperationException(
+ LocalizedMessages.DialogControlCollectionModifyingControls);
+ }
+ if (control is CommonFileDialogMenuItem)
+ {
+ throw new InvalidOperationException(
+ LocalizedMessages.DialogControlCollectionMenuItemControlsCannotBeAdded);
+ }
+
+ // Reparent, add control.
+ control.HostingDialog = hostingDialog;
+ base.InsertItem(index, control);
+
+ // Notify that we've added a control.
+ hostingDialog.ApplyCollectionChanged();
+ }
+
+ /// <summary>
+ /// Removes the control at the specified index.
+ /// </summary>
+ /// <param name="index">The location of the control to remove.</param>
+ /// <permission cref="System.InvalidOperationException">
+ /// The associated dialog is
+ /// showing and cannot be modified.</permission>
+ protected override void RemoveItem(int index)
+ {
+ throw new NotSupportedException(LocalizedMessages.DialogControlCollectionCannotRemoveControls);
+ }
+
+ /// <summary>
+ /// Defines the indexer that supports accessing controls by name.
+ /// </summary>
+ /// <remarks>
+ /// <para>Control names are case sensitive.</para>
+ /// <para>This indexer is useful when the dialog is created in XAML
+ /// rather than constructed in code.</para></remarks>
+ ///<exception cref="System.ArgumentException">
+ /// The name cannot be null or a zero-length string.</exception>
+ /// <remarks>If there is more than one control with the same name, only the <B>first control</B> will be returned.</remarks>
+ public T this[string name]
+ {
+ get
+ {
+ if (string.IsNullOrEmpty(name))
+ {
+ throw new ArgumentException(LocalizedMessages.DialogControlCollectionEmptyName, "name");
+ }
+
+ foreach (T control in base.Items)
+ {
+ CommonFileDialogGroupBox groupBox;
+ // NOTE: we don't ToLower() the strings - casing effects
+ // hash codes, so we are case-sensitive.
+ if (control.Name == name)
+ {
+ return control;
+ }
+ else if ((groupBox = control as CommonFileDialogGroupBox) != null)
+ {
+ foreach (T subControl in groupBox.Items)
+ {
+ if (subControl.Name == name) { return subControl; }
+ }
+ }
+ }
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// Recursively searches for the control who's id matches the value
+ /// passed in the <paramref name="id"/> parameter.
+ /// </summary>
+ ///
+ /// <param name="id">An integer containing the identifier of the
+ /// control being searched for.</param>
+ ///
+ /// <returns>A DialogControl who's id matches the value of the
+ /// <paramref name="id"/> parameter.</returns>
+ ///
+ internal DialogControl GetControlbyId(int id)
+ {
+ return GetSubControlbyId(Items.Cast<DialogControl>(), id);
+ }
+
+ /// <summary>
+ /// Recursively searches for a given control id in the
+ /// collection passed via the <paramref name="controlCollection"/> parameter.
+ /// </summary>
+ ///
+ /// <param name="controlCollection">A Collection&lt;CommonFileDialogControl&gt;</param>
+ /// <param name="id">An int containing the identifier of the control
+ /// being searched for.</param>
+ ///
+ /// <returns>A DialogControl who's Id matches the value of the
+ /// <paramref name="id"/> parameter.</returns>
+ ///
+ internal DialogControl GetSubControlbyId(IEnumerable<DialogControl> controlCollection, int id)
+ {
+ // if ctrlColl is null, it will throw in the foreach.
+ if (controlCollection == null) { return null; }
+
+ foreach (DialogControl control in controlCollection)
+ {
+ if (control.Id == id) { return control; }
+
+ // Search GroupBox child items
+ CommonFileDialogGroupBox groupBox = control as CommonFileDialogGroupBox;
+ if (groupBox != null)
+ {
+ var temp = GetSubControlbyId(groupBox.Items, id);
+ if (temp != null) { return temp; }
+ }
+ }
+
+ return null;
+ }
+
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogFilter.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogFilter.cs
new file mode 100644
index 0000000000..5d1879c6d7
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogFilter.cs
@@ -0,0 +1,167 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.ObjectModel;
+using System.Text;
+using Microsoft.WindowsAPICodePack.Shell;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Stores the file extensions used when filtering files in File Open and File Save dialogs.
+ /// </summary>
+ public class CommonFileDialogFilter
+ {
+ // We'll keep a parsed list of separate
+ // extensions and rebuild as needed.
+
+ private Collection<string> extensions;
+ private string rawDisplayName;
+
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ public CommonFileDialogFilter()
+ {
+ extensions = new Collection<string>();
+ }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified display name and
+ /// file extension list.
+ /// </summary>
+ /// <param name="rawDisplayName">The name of this filter.</param>
+ /// <param name="extensionList">The list of extensions in
+ /// this filter. See remarks.</param>
+ /// <remarks>The <paramref name="extensionList"/> can use a semicolon(";")
+ /// or comma (",") to separate extensions. Extensions can be prefaced
+ /// with a period (".") or with the file wild card specifier "*.".</remarks>
+ /// <permission cref="System.ArgumentNullException">
+ /// The <paramref name="extensionList"/> cannot be null or a
+ /// zero-length string.
+ /// </permission>
+ public CommonFileDialogFilter(string rawDisplayName, string extensionList)
+ : this()
+ {
+ if (string.IsNullOrEmpty(extensionList))
+ {
+ throw new ArgumentNullException("extensionList");
+ }
+
+ this.rawDisplayName = rawDisplayName;
+
+ // Parse string and create extension strings.
+ // Format: "bat,cmd", or "bat;cmd", or "*.bat;*.cmd"
+ // Can support leading "." or "*." - these will be stripped.
+ string[] rawExtensions = extensionList.Split(',', ';');
+ foreach (string extension in rawExtensions)
+ {
+ extensions.Add(CommonFileDialogFilter.NormalizeExtension(extension));
+ }
+ }
+ /// <summary>
+ /// Gets or sets the display name for this filter.
+ /// </summary>
+ /// <permission cref="System.ArgumentNullException">
+ /// The value for this property cannot be set to null or a
+ /// zero-length string.
+ /// </permission>
+ public string DisplayName
+ {
+ get
+ {
+ if (showExtensions)
+ {
+ return string.Format(System.Globalization.CultureInfo.InvariantCulture,
+ "{0} ({1})",
+ rawDisplayName,
+ CommonFileDialogFilter.GetDisplayExtensionList(extensions));
+ }
+
+ return rawDisplayName;
+ }
+
+ set
+ {
+ if (string.IsNullOrEmpty(value))
+ {
+ throw new ArgumentNullException("value");
+ }
+ rawDisplayName = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets a collection of the individual extensions
+ /// described by this filter.
+ /// </summary>
+ public Collection<string> Extensions
+ {
+ get { return extensions; }
+ }
+
+ private bool showExtensions = true;
+ /// <summary>
+ /// Gets or sets a value that controls whether the extensions are displayed.
+ /// </summary>
+ public bool ShowExtensions
+ {
+ get { return showExtensions; }
+ set { showExtensions = value; }
+ }
+
+ private static string NormalizeExtension(string rawExtension)
+ {
+ rawExtension = rawExtension.Trim();
+ rawExtension = rawExtension.Replace("*.", null);
+ rawExtension = rawExtension.Replace(".", null);
+ return rawExtension;
+ }
+
+ private static string GetDisplayExtensionList(Collection<string> extensions)
+ {
+ StringBuilder extensionList = new StringBuilder();
+ foreach (string extension in extensions)
+ {
+ if (extensionList.Length > 0) { extensionList.Append(", "); }
+ extensionList.Append("*.");
+ extensionList.Append(extension);
+ }
+
+ return extensionList.ToString();
+ }
+
+ /// <summary>
+ /// Internal helper that generates a single filter
+ /// specification for this filter, used by the COM API.
+ /// </summary>
+ /// <returns>Filter specification for this filter</returns>
+ ///
+ internal ShellNativeMethods.FilterSpec GetFilterSpec()
+ {
+ StringBuilder filterList = new StringBuilder();
+ foreach (string extension in extensions)
+ {
+ if (filterList.Length > 0) { filterList.Append(";"); }
+
+ filterList.Append("*.");
+ filterList.Append(extension);
+
+ }
+ return new ShellNativeMethods.FilterSpec(DisplayName, filterList.ToString());
+ }
+
+ /// <summary>
+ /// Returns a string representation for this filter that includes
+ /// the display name and the list of extensions.
+ /// </summary>
+ /// <returns>A <see cref="System.String"/>.</returns>
+ public override string ToString()
+ {
+ return string.Format(System.Globalization.CultureInfo.InvariantCulture,
+ "{0} ({1})",
+ rawDisplayName,
+ CommonFileDialogFilter.GetDisplayExtensionList(extensions));
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogFilterCollection.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogFilterCollection.cs
new file mode 100644
index 0000000000..49ee6a2010
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogFilterCollection.cs
@@ -0,0 +1,29 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System.Collections.ObjectModel;
+using Microsoft.WindowsAPICodePack.Shell;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Provides a strongly typed collection for file dialog filters.
+ /// </summary>
+ public class CommonFileDialogFilterCollection : Collection<CommonFileDialogFilter>
+ {
+ // Make the default constructor internal so users can't instantiate this
+ // collection by themselves.
+ internal CommonFileDialogFilterCollection() { }
+
+ internal ShellNativeMethods.FilterSpec[] GetAllFilterSpecs()
+ {
+ ShellNativeMethods.FilterSpec[] filterSpecs = new ShellNativeMethods.FilterSpec[this.Count];
+
+ for (int i = 0; i < this.Count; i++)
+ {
+ filterSpecs[i] = this[i].GetFilterSpec();
+ }
+
+ return filterSpecs;
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogFolderChangeEventArgs.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogFolderChangeEventArgs.cs
new file mode 100644
index 0000000000..e794c86000
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogFolderChangeEventArgs.cs
@@ -0,0 +1,28 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System.ComponentModel;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Creates the event data associated with <see cref="CommonFileDialog.FolderChanging"/> event.
+ /// </summary>
+ ///
+ public class CommonFileDialogFolderChangeEventArgs : CancelEventArgs
+ {
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ /// <param name="folder">The name of the folder.</param>
+ public CommonFileDialogFolderChangeEventArgs(string folder)
+ {
+ Folder = folder;
+ }
+
+ /// <summary>
+ /// Gets or sets the name of the folder.
+ /// </summary>
+ public string Folder { get; set; }
+
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogGroupBox.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogGroupBox.cs
new file mode 100644
index 0000000000..cb0b49db7c
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogGroupBox.cs
@@ -0,0 +1,93 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Windows.Markup;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs.Controls
+{
+ /// <summary>
+ /// Represents a group box control for the Common File Dialog.
+ /// </summary>note
+ [ContentProperty("Items")]
+ public class CommonFileDialogGroupBox : CommonFileDialogProminentControl
+ {
+ private Collection<DialogControl> items;
+ /// <summary>
+ /// Gets the collection of controls for this group box.
+ /// </summary>
+ public Collection<DialogControl> Items
+ {
+ get { return items; }
+ }
+
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ public CommonFileDialogGroupBox()
+ : base(string.Empty)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// Create a new instance of this class with the specified text.
+ /// </summary>
+ /// <param name="text">The text to display for this control.</param>
+ public CommonFileDialogGroupBox(string text)
+ : base(text)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified name and text.
+ /// </summary>
+ /// <param name="name">The name of this control.</param>
+ /// <param name="text">The text to display for this control.</param>
+ public CommonFileDialogGroupBox(string name, string text)
+ : base(name, text)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// Initializes the item collection for this class.
+ /// </summary>
+ private void Initialize()
+ {
+ items = new Collection<DialogControl>();
+ }
+
+ /// <summary>
+ /// Attach the GroupBox control to the dialog object
+ /// </summary>
+ /// <param name="dialog">Target dialog</param>
+ internal override void Attach(IFileDialogCustomize dialog)
+ {
+ Debug.Assert(dialog != null, "CommonFileDialogGroupBox.Attach: dialog parameter can not be null");
+
+ // Start a visual group
+ dialog.StartVisualGroup(this.Id, this.Text);
+
+ // Add child controls
+ foreach (CommonFileDialogControl item in this.items)
+ {
+ item.HostingDialog = HostingDialog;
+ item.Attach(dialog);
+ }
+
+ // End visual group
+ dialog.EndVisualGroup();
+
+ // Make this control prominent if needed
+ if (IsProminent)
+ dialog.MakeProminent(this.Id);
+
+ // Sync unmanaged properties with managed properties
+ SyncUnmanagedProperties();
+ }
+
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogLabel.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogLabel.cs
new file mode 100644
index 0000000000..373a5c4f68
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogLabel.cs
@@ -0,0 +1,45 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System.Diagnostics;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs.Controls
+{
+ /// <summary>
+ /// Defines the label controls in the Common File Dialog.
+ /// </summary>
+ public class CommonFileDialogLabel : CommonFileDialogControl
+ {
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ public CommonFileDialogLabel() { }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified text.
+ /// </summary>
+ /// <param name="text">The text to display for this control.</param>
+ public CommonFileDialogLabel(string text) : base(text) { }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified name and text.
+ /// </summary>
+ /// <param name="name">The name of this control.</param>
+ /// <param name="text">The text to display for this control.</param>
+ public CommonFileDialogLabel(string name, string text) : base(name, text) { }
+
+ /// <summary>
+ /// Attach this control to the dialog object
+ /// </summary>
+ /// <param name="dialog">Target dialog</param>
+ internal override void Attach(IFileDialogCustomize dialog)
+ {
+ Debug.Assert(dialog != null, "CommonFileDialog.Attach: dialog parameter can not be null");
+
+ // Add a text control
+ dialog.AddText(this.Id, this.Text);
+
+ // Sync unmanaged properties with managed properties
+ SyncUnmanagedProperties();
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogMenu.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogMenu.cs
new file mode 100644
index 0000000000..3fa81e297d
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogMenu.cs
@@ -0,0 +1,102 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Windows.Markup;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs.Controls
+{
+ /// <summary>
+ /// Defines the menu controls for the Common File Dialog.
+ /// </summary>
+ [ContentProperty("Items")]
+ public class CommonFileDialogMenu : CommonFileDialogProminentControl
+ {
+ private Collection<CommonFileDialogMenuItem> items = new Collection<CommonFileDialogMenuItem>();
+ /// <summary>
+ /// Gets the collection of CommonFileDialogMenuItem objects.
+ /// </summary>
+ public Collection<CommonFileDialogMenuItem> Items
+ {
+ get { return items; }
+ }
+
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ public CommonFileDialogMenu() : base() { }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified text.
+ /// </summary>
+ /// <param name="text">The text to display for this control.</param>
+ public CommonFileDialogMenu(string text) : base(text) { }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified name and text.
+ /// </summary>
+ /// <param name="name">The name of this control.</param>
+ /// <param name="text">The text to display for this control.</param>
+ public CommonFileDialogMenu(string name, string text) : base(name, text) { }
+
+ /// <summary>
+ /// Attach the Menu control to the dialog object.
+ /// </summary>
+ /// <param name="dialog">the target dialog</param>
+ internal override void Attach(IFileDialogCustomize dialog)
+ {
+ Debug.Assert(dialog != null, "CommonFileDialogMenu.Attach: dialog parameter can not be null");
+
+ // Add the menu control
+ dialog.AddMenu(this.Id, this.Text);
+
+ // Add the menu items
+ foreach (CommonFileDialogMenuItem item in this.items)
+ dialog.AddControlItem(this.Id, item.Id, item.Text);
+
+ // Make prominent as needed
+ if (IsProminent)
+ dialog.MakeProminent(this.Id);
+
+ // Sync unmanaged properties with managed properties
+ SyncUnmanagedProperties();
+ }
+ }
+
+ /// <summary>
+ /// Creates the CommonFileDialogMenuItem items for the Common File Dialog.
+ /// </summary>
+ public class CommonFileDialogMenuItem : CommonFileDialogControl
+ {
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ public CommonFileDialogMenuItem() : base(string.Empty) { }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified text.
+ /// </summary>
+ /// <param name="text">The text to display for this control.</param>
+ public CommonFileDialogMenuItem(string text) : base(text) { }
+
+ /// <summary>
+ /// Occurs when a user clicks a menu item.
+ /// </summary>
+ public event EventHandler Click = delegate { };
+ internal void RaiseClickEvent()
+ {
+ // Make sure that this control is enabled and has a specified delegate
+ if (Enabled) { Click(this, EventArgs.Empty); }
+ }
+
+ /// <summary>
+ /// Attach this control to the dialog object
+ /// </summary>
+ /// <param name="dialog">Target dialog</param>
+ internal override void Attach(IFileDialogCustomize dialog)
+ {
+ // Items are added via the menu itself
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogProminentControl.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogProminentControl.cs
new file mode 100644
index 0000000000..efdd9755fe
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogProminentControl.cs
@@ -0,0 +1,47 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System.Windows.Markup;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs.Controls
+{
+ /// <summary>
+ /// Defines the properties and constructors for all prominent controls in the Common File Dialog.
+ /// </summary>
+ [ContentProperty("Items")]
+ public abstract class CommonFileDialogProminentControl : CommonFileDialogControl
+ {
+ private bool isProminent;
+
+ /// <summary>
+ /// Gets or sets the prominent value of this control.
+ /// </summary>
+ /// <remarks>Only one control can be specified as prominent. If more than one control is specified prominent,
+ /// then an 'E_UNEXPECTED' exception will be thrown when these controls are added to the dialog.
+ /// A group box control can only be specified as prominent if it contains one control and that control is of type 'CommonFileDialogProminentControl'.
+ /// </remarks>
+ public bool IsProminent
+ {
+ get { return isProminent; }
+ set { isProminent = value; }
+ }
+
+
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ protected CommonFileDialogProminentControl() { }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified text.
+ /// </summary>
+ /// <param name="text">The text to display for this control.</param>
+ protected CommonFileDialogProminentControl(string text) : base(text) { }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified name and text.
+ /// </summary>
+ /// <param name="name">The name of this control.</param>
+ /// <param name="text">The text to display for this control.</param>
+ protected CommonFileDialogProminentControl(string name, string text) : base(name, text) { }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogRadioButtonList.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogRadioButtonList.cs
new file mode 100644
index 0000000000..4314dce489
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogRadioButtonList.cs
@@ -0,0 +1,152 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Windows.Markup;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+namespace Microsoft.WindowsAPICodePack.Dialogs.Controls
+{
+ /// <summary>
+ /// Represents a radio button list for the Common File Dialog.
+ /// </summary>
+ [ContentProperty("Items")]
+ public class CommonFileDialogRadioButtonList : CommonFileDialogControl, ICommonFileDialogIndexedControls
+ {
+ private Collection<CommonFileDialogRadioButtonListItem> items = new Collection<CommonFileDialogRadioButtonListItem>();
+ /// <summary>
+ /// Gets the collection of CommonFileDialogRadioButtonListItem objects
+ /// </summary>
+ public Collection<CommonFileDialogRadioButtonListItem> Items
+ {
+ get { return items; }
+ }
+
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ public CommonFileDialogRadioButtonList() { }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified name.
+ /// </summary>
+ /// <param name="name">The name of this control.</param>
+ public CommonFileDialogRadioButtonList(string name) : base(name, string.Empty) { }
+
+ #region ICommonFileDialogIndexedControls Members
+
+ private int selectedIndex = -1;
+ /// <summary>
+ /// Gets or sets the current index of the selected item.
+ /// </summary>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")]
+ public int SelectedIndex
+ {
+ get { return selectedIndex; }
+ set
+ {
+ // Don't update this property if it hasn't changed
+ if (selectedIndex == value) { return; }
+
+ // If the native dialog has not been created yet
+ if (HostingDialog == null)
+ {
+ selectedIndex = value;
+ }
+ else if (value >= 0 && value < items.Count)
+ {
+ selectedIndex = value;
+ ApplyPropertyChange("SelectedIndex");
+ }
+ else
+ {
+ throw new IndexOutOfRangeException(LocalizedMessages.RadioButtonListIndexOutOfBounds);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Occurs when the user changes the SelectedIndex.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// By initializing the SelectedIndexChanged event with an empty
+ /// delegate, we can skip the test to determine
+ /// if the SelectedIndexChanged is null.
+ /// test.
+ /// </remarks>
+ public event EventHandler SelectedIndexChanged = delegate { };
+
+ /// <summary>
+ /// Occurs when the user changes the SelectedIndex.
+ /// </summary>
+ /// <remarks>Because this method is defined in an interface, we can either
+ /// have it as public, or make it private and explicitly implement (like below).
+ /// Making it public doesn't really help as its only internal (but can't have this
+ /// internal because of the interface)
+ /// </remarks>
+ void ICommonFileDialogIndexedControls.RaiseSelectedIndexChangedEvent()
+ {
+ // Make sure that this control is enabled and has a specified delegate
+ if (Enabled) { SelectedIndexChanged(this, EventArgs.Empty); }
+ }
+
+ #endregion
+
+ /// <summary>
+ /// Attach the RadioButtonList control to the dialog object
+ /// </summary>
+ /// <param name="dialog">The target dialog</param>
+ internal override void Attach(IFileDialogCustomize dialog)
+ {
+ Debug.Assert(dialog != null, "CommonFileDialogRadioButtonList.Attach: dialog parameter can not be null");
+
+ // Add the radio button list control
+ dialog.AddRadioButtonList(this.Id);
+
+ // Add the radio button list items
+ for (int index = 0; index < items.Count; index++)
+ {
+ dialog.AddControlItem(this.Id, index, items[index].Text);
+ }
+
+ // Set the currently selected item
+ if (selectedIndex >= 0 && selectedIndex < items.Count)
+ {
+ dialog.SetSelectedControlItem(this.Id, this.selectedIndex);
+ }
+ else if (selectedIndex != -1)
+ {
+ throw new IndexOutOfRangeException(LocalizedMessages.RadioButtonListIndexOutOfBounds);
+ }
+
+ // Sync unmanaged properties with managed properties
+ SyncUnmanagedProperties();
+ }
+ }
+
+ /// <summary>
+ /// Represents a list item for the CommonFileDialogRadioButtonList object.
+ /// </summary>
+ public class CommonFileDialogRadioButtonListItem
+ {
+ /// <summary>
+ /// Gets or sets the string that will be displayed for this list item.
+ /// </summary>
+ public string Text { get; set; }
+
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ public CommonFileDialogRadioButtonListItem() : this(string.Empty) { }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified text.
+ /// </summary>
+ /// <param name="text">The string that you want to display for this list item.</param>
+ public CommonFileDialogRadioButtonListItem(string text)
+ {
+ Text = text;
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogResult.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogResult.cs
new file mode 100644
index 0000000000..b026dcdc69
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogResult.cs
@@ -0,0 +1,25 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Specifies identifiers to indicate the return value of a CommonFileDialog dialog.
+ /// </summary>
+ public enum CommonFileDialogResult
+ {
+ /// <summary>
+ /// Default value for enumeration, a dialog box should never return this value.
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// The dialog box return value is OK (usually sent from a button labeled OK or Save).
+ /// </summary>
+ Ok = 1,
+
+ /// <summary>
+ /// The dialog box return value is Cancel (usually sent from a button labeled Cancel).
+ /// </summary>
+ Cancel = 2,
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogSeperator.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogSeperator.cs
new file mode 100644
index 0000000000..c2d1d11e35
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogSeperator.cs
@@ -0,0 +1,27 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System.Diagnostics;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs.Controls
+{
+ /// <summary>
+ /// Defines the class for the simplest separator controls.
+ /// </summary>
+ public class CommonFileDialogSeparator : CommonFileDialogControl
+ {
+ /// <summary>
+ /// Attach the Separator control to the dialog object
+ /// </summary>
+ /// <param name="dialog">Target dialog</param>
+ internal override void Attach(IFileDialogCustomize dialog)
+ {
+ Debug.Assert(dialog != null, "CommonFileDialogSeparator.Attach: dialog parameter can not be null");
+
+ // Add a separator
+ dialog.AddSeparator(this.Id);
+
+ // Sync unmanaged properties with managed properties
+ SyncUnmanagedProperties();
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogStandardFilters.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogStandardFilters.cs
new file mode 100644
index 0000000000..4f24ccb82f
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogStandardFilters.cs
@@ -0,0 +1,62 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Defines the class of commonly used file filters.
+ /// </summary>
+ public static class CommonFileDialogStandardFilters
+ {
+ private static CommonFileDialogFilter textFilesFilter;
+ /// <summary>
+ /// Gets a value that specifies the filter for *.txt files.
+ /// </summary>
+ public static CommonFileDialogFilter TextFiles
+ {
+ get
+ {
+ if (textFilesFilter == null)
+ {
+ textFilesFilter = new CommonFileDialogFilter(LocalizedMessages.CommonFiltersText, "*.txt");
+ }
+ return textFilesFilter;
+ }
+ }
+
+ private static CommonFileDialogFilter pictureFilesFilter;
+ /// <summary>
+ /// Gets a value that specifies the filter for picture files.
+ /// </summary>
+ public static CommonFileDialogFilter PictureFiles
+ {
+ get
+ {
+ if (pictureFilesFilter == null)
+ {
+ pictureFilesFilter = new CommonFileDialogFilter(LocalizedMessages.CommonFiltersPicture,
+ "*.bmp, *.jpg, *.jpeg, *.png, *.ico");
+ }
+ return pictureFilesFilter;
+ }
+
+ }
+ private static CommonFileDialogFilter officeFilesFilter;
+ /// <summary>
+ /// Gets a value that specifies the filter for Microsoft Office files.
+ /// </summary>
+ public static CommonFileDialogFilter OfficeFiles
+ {
+ get
+ {
+ if (officeFilesFilter == null)
+ {
+ officeFilesFilter = new CommonFileDialogFilter(LocalizedMessages.CommonFiltersOffice,
+ "*.doc, *.docx, *.xls, *.xlsx, *.ppt, *.pptx");
+ }
+ return officeFilesFilter;
+ }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogTextBox.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogTextBox.cs
new file mode 100644
index 0000000000..106c4f1ee1
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogTextBox.cs
@@ -0,0 +1,101 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Diagnostics;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs.Controls
+{
+ /// <summary>
+ /// Defines the text box controls in the Common File Dialog.
+ /// </summary>
+ public class CommonFileDialogTextBox : CommonFileDialogControl
+ {
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ public CommonFileDialogTextBox() : base(string.Empty) { }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified text.
+ /// </summary>
+ /// <param name="text">The text to display for this control.</param>
+ public CommonFileDialogTextBox(string text) : base(text) { }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified name and text.
+ /// </summary>
+ /// <param name="name">The name of this control.</param>
+ /// <param name="text">The text to display for this control.</param>
+ public CommonFileDialogTextBox(string name, string text) : base(name, text) { }
+
+ internal bool Closed { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value for the text string contained in the CommonFileDialogTextBox.
+ /// </summary>
+ public override string Text
+ {
+ get
+ {
+ if (!Closed)
+ {
+ SyncValue();
+ }
+
+ return base.Text;
+ }
+
+ set
+ {
+ if (customizedDialog != null)
+ {
+ customizedDialog.SetEditBoxText(this.Id, value);
+ }
+
+ base.Text = value;
+ }
+ }
+
+ /// <summary>
+ /// Holds an instance of the customized (/native) dialog and should
+ /// be null until after the Attach() call is made.
+ /// </summary>
+ private IFileDialogCustomize customizedDialog;
+
+ /// <summary>
+ /// Attach the TextBox control to the dialog object
+ /// </summary>
+ /// <param name="dialog">Target dialog</param>
+ internal override void Attach(IFileDialogCustomize dialog)
+ {
+ Debug.Assert(dialog != null, "CommonFileDialogTextBox.Attach: dialog parameter can not be null");
+
+ // Add a text entry control
+ dialog.AddEditBox(this.Id, this.Text);
+
+ // Set to local instance in order to gate access to same.
+ customizedDialog = dialog;
+
+ // Sync unmanaged properties with managed properties
+ SyncUnmanagedProperties();
+
+ Closed = false;
+ }
+
+ internal void SyncValue()
+ {
+ // Make sure that the local native dialog instance is NOT
+ // null. If it's null, just return the "textValue" var,
+ // otherwise, use the native call to get the text value,
+ // setting the textValue member variable then return it.
+
+ if (customizedDialog != null)
+ {
+ string textValue;
+ customizedDialog.GetEditBoxText(this.Id, out textValue);
+
+ base.Text = textValue;
+ }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonOpenFileDialog.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonOpenFileDialog.cs
new file mode 100644
index 0000000000..5423e009c5
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonOpenFileDialog.cs
@@ -0,0 +1,193 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Shell;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Creates a Vista or Windows 7 Common File Dialog, allowing the user to select one or more files.
+ /// </summary>
+ ///
+ public class CommonOpenFileDialog : CommonFileDialog
+ {
+ private NativeFileOpenDialog openDialogCoClass;
+
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ public CommonOpenFileDialog()
+ : base()
+ {
+ // For Open file dialog, allow read only files.
+ base.EnsureReadOnly = true;
+ }
+
+ /// <summary>
+ /// Creates a new instance of this class with the specified name.
+ /// </summary>
+ /// <param name="name">The name of this dialog.</param>
+ public CommonOpenFileDialog(string name)
+ : base(name)
+ {
+ // For Open file dialog, allow read only files.
+ base.EnsureReadOnly = true;
+ }
+
+ #region Public API specific to Open
+
+ /// <summary>
+ /// Gets a collection of the selected file names.
+ /// </summary>
+ /// <remarks>This property should only be used when the
+ /// <see cref="CommonOpenFileDialog.Multiselect"/>
+ /// property is <b>true</b>.</remarks>
+ public IEnumerable<string> FileNames
+ {
+ get
+ {
+ CheckFileNamesAvailable();
+ return base.FileNameCollection;
+ }
+ }
+
+ /// <summary>
+ /// Gets a collection of the selected items as ShellObject objects.
+ /// </summary>
+ /// <remarks>This property should only be used when the
+ /// <see cref="CommonOpenFileDialog.Multiselect"/>
+ /// property is <b>true</b>.</remarks>
+ public ICollection<ShellObject> FilesAsShellObject
+ {
+ get
+ {
+ // Check if we have selected files from the user.
+ CheckFileItemsAvailable();
+
+ // temp collection to hold our shellobjects
+ ICollection<ShellObject> resultItems = new Collection<ShellObject>();
+
+ // Loop through our existing list of filenames, and try to create a concrete type of
+ // ShellObject (e.g. ShellLibrary, FileSystemFolder, ShellFile, etc)
+ foreach (IShellItem si in items)
+ {
+ resultItems.Add(ShellObjectFactory.Create(si));
+ }
+
+ return resultItems;
+ }
+ }
+
+
+ private bool multiselect;
+ /// <summary>
+ /// Gets or sets a value that determines whether the user can select more than one file.
+ /// </summary>
+ public bool Multiselect
+ {
+ get { return multiselect; }
+ set { multiselect = value; }
+ }
+
+ private bool isFolderPicker;
+ /// <summary>
+ /// Gets or sets a value that determines whether the user can select folders or files.
+ /// Default value is false.
+ /// </summary>
+ public bool IsFolderPicker
+ {
+ get { return isFolderPicker; }
+ set { isFolderPicker = value; }
+ }
+
+ private bool allowNonFileSystem;
+ /// <summary>
+ /// Gets or sets a value that determines whether the user can select non-filesystem items,
+ /// such as <b>Library</b>, <b>Search Connectors</b>, or <b>Known Folders</b>.
+ /// </summary>
+ public bool AllowNonFileSystemItems
+ {
+ get { return allowNonFileSystem; }
+ set { allowNonFileSystem = value; }
+ }
+ #endregion
+
+ internal override IFileDialog GetNativeFileDialog()
+ {
+ Debug.Assert(openDialogCoClass != null, "Must call Initialize() before fetching dialog interface");
+
+ return (IFileDialog)openDialogCoClass;
+ }
+
+ internal override void InitializeNativeFileDialog()
+ {
+ if (openDialogCoClass == null)
+ {
+ openDialogCoClass = new NativeFileOpenDialog();
+ }
+ }
+
+ internal override void CleanUpNativeFileDialog()
+ {
+ if (openDialogCoClass != null)
+ {
+ Marshal.ReleaseComObject(openDialogCoClass);
+ }
+ }
+
+ internal override void PopulateWithFileNames(Collection<string> names)
+ {
+ IShellItemArray resultsArray;
+ uint count;
+
+ openDialogCoClass.GetResults(out resultsArray);
+ resultsArray.GetCount(out count);
+ names.Clear();
+ for (int i = 0; i < count; i++)
+ {
+ names.Add(GetFileNameFromShellItem(GetShellItemAt(resultsArray, i)));
+ }
+ }
+
+ internal override void PopulateWithIShellItems(Collection<IShellItem> items)
+ {
+ IShellItemArray resultsArray;
+ uint count;
+
+ openDialogCoClass.GetResults(out resultsArray);
+ resultsArray.GetCount(out count);
+ items.Clear();
+ for (int i = 0; i < count; i++)
+ {
+ items.Add(GetShellItemAt(resultsArray, i));
+ }
+ }
+
+ internal override ShellNativeMethods.FileOpenOptions GetDerivedOptionFlags(ShellNativeMethods.FileOpenOptions flags)
+ {
+ if (multiselect)
+ {
+ flags |= ShellNativeMethods.FileOpenOptions.AllowMultiSelect;
+ }
+ if (isFolderPicker)
+ {
+ flags |= ShellNativeMethods.FileOpenOptions.PickFolders;
+ }
+
+ if (!allowNonFileSystem)
+ {
+ flags |= ShellNativeMethods.FileOpenOptions.ForceFilesystem;
+ }
+ else if (allowNonFileSystem)
+ {
+ flags |= ShellNativeMethods.FileOpenOptions.AllNonStorageItems;
+ }
+
+ return flags;
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonSaveFileDialog.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonSaveFileDialog.cs
new file mode 100644
index 0000000000..54d0ca6de0
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonSaveFileDialog.cs
@@ -0,0 +1,305 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Shell;
+using Microsoft.WindowsAPICodePack.Shell.PropertySystem;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+using System.Text;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ /// <summary>
+ /// Creates a Vista or Windows 7 Common File Dialog, allowing the user to select the filename and location for a saved file.
+ /// </summary>
+ /// <permission cref="System.Security.Permissions.FileDialogPermission">
+ /// to save a file. Associated enumeration: <see cref="System.Security.Permissions.SecurityAction.LinkDemand"/>.
+ /// </permission>
+ public sealed class CommonSaveFileDialog : CommonFileDialog
+ {
+ private NativeFileSaveDialog saveDialogCoClass;
+
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ public CommonSaveFileDialog() { }
+ /// <summary>
+ /// Creates a new instance of this class with the specified name.
+ /// </summary>
+ /// <param name="name">The name of this dialog.</param>
+ public CommonSaveFileDialog(string name) : base(name) { }
+
+ #region Public API specific to Save
+
+ private bool overwritePrompt = true;
+ /// <summary>
+ /// Gets or sets a value that controls whether to prompt before
+ /// overwriting an existing file of the same name. Default value is true.
+ /// </summary>
+ /// <permission cref="System.InvalidOperationException">
+ /// This property cannot be changed when the dialog is showing.
+ /// </permission>
+ public bool OverwritePrompt
+ {
+ get { return overwritePrompt; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.OverwritePromptCannotBeChanged);
+ overwritePrompt = value;
+ }
+ }
+
+ private bool createPrompt;
+ /// <summary>
+ /// Gets or sets a value that controls whether to prompt for creation if the item returned in the save dialog does not exist.
+ /// </summary>
+ /// <remarks>Note that this does not actually create the item.</remarks>
+ /// <permission cref="System.InvalidOperationException">
+ /// This property cannot be changed when the dialog is showing.
+ /// </permission>
+ public bool CreatePrompt
+ {
+ get { return createPrompt; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.CreatePromptCannotBeChanged);
+ createPrompt = value;
+ }
+ }
+
+ private bool isExpandedMode;
+ /// <summary>
+ /// Gets or sets a value that controls whether to the save dialog
+ /// displays in expanded mode.
+ /// </summary>
+ /// <remarks>Expanded mode controls whether the dialog
+ /// shows folders for browsing or hides them.</remarks>
+ /// <permission cref="System.InvalidOperationException">
+ /// This property cannot be changed when the dialog is showing.
+ /// </permission>
+ public bool IsExpandedMode
+ {
+ get { return isExpandedMode; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.IsExpandedModeCannotBeChanged);
+ isExpandedMode = value;
+ }
+ }
+
+ private bool alwaysAppendDefaultExtension;
+ /// <summary>
+ /// Gets or sets a value that controls whether the
+ /// returned file name has a file extension that matches the
+ /// currently selected file type. If necessary, the dialog appends the correct
+ /// file extension.
+ /// </summary>
+ /// <permission cref="System.InvalidOperationException">
+ /// This property cannot be changed when the dialog is showing.
+ /// </permission>
+ public bool AlwaysAppendDefaultExtension
+ {
+ get { return alwaysAppendDefaultExtension; }
+ set
+ {
+ ThrowIfDialogShowing(LocalizedMessages.AlwaysAppendDefaultExtensionCannotBeChanged);
+ alwaysAppendDefaultExtension = value;
+ }
+ }
+
+ /// <summary>
+ /// Sets an item to appear as the initial entry in a <b>Save As</b> dialog.
+ /// </summary>
+ /// <param name="item">The initial entry to be set in the dialog.</param>
+ /// <remarks>The name of the item is displayed in the file name edit box,
+ /// and the containing folder is opened in the view. This would generally be
+ /// used when the application is saving an item that already exists.</remarks>
+ public void SetSaveAsItem(ShellObject item)
+ {
+ if (item == null)
+ {
+ throw new ArgumentNullException("item");
+ }
+
+ InitializeNativeFileDialog();
+ IFileSaveDialog nativeDialog = GetNativeFileDialog() as IFileSaveDialog;
+
+ // Get the native IShellItem from ShellObject
+ if (nativeDialog != null)
+ {
+ nativeDialog.SetSaveAsItem(item.NativeShellItem);
+ }
+ }
+
+ /// <summary>
+ /// Specifies which properties will be collected in the save dialog.
+ /// </summary>
+ /// <param name="appendDefault">True to show default properties for the currently selected
+ /// filetype in addition to the properties specified by propertyList. False to show only properties
+ /// specified by pList.
+ /// <param name="propertyList">List of properties to collect. This parameter can be null.</param>
+ /// </param>
+ /// <remarks>
+ /// SetCollectedPropertyKeys can be called at any time before the dialog is displayed or while it
+ /// is visible. If different properties are to be collected depending on the chosen filetype,
+ /// then SetCollectedProperties can be called in response to CommonFileDialog::FileTypeChanged event.
+ /// Note: By default, no properties are collected in the save dialog.
+ /// </remarks>
+ public void SetCollectedPropertyKeys(bool appendDefault, params PropertyKey[] propertyList)
+ {
+ // Loop through all our property keys and create a semicolon-delimited property list string.
+ // The string we pass to PSGetPropertyDescriptionListFromString must
+ // start with "prop:", followed a list of canonical names for each
+ // property that is to collected.
+ if (propertyList != null && propertyList.Length > 0 && propertyList[0] != null)
+ {
+ StringBuilder sb = new StringBuilder("prop:");
+ foreach (PropertyKey key in propertyList)
+ {
+ string canonicalName = ShellPropertyDescriptionsCache.Cache.GetPropertyDescription(key).CanonicalName;
+ if (!string.IsNullOrEmpty(canonicalName)) { sb.AppendFormat("{0};", canonicalName); }
+ }
+
+ Guid guid = new Guid(ShellIIDGuid.IPropertyDescriptionList);
+ IPropertyDescriptionList propertyDescriptionList = null;
+
+ try
+ {
+ int hr = PropertySystemNativeMethods.PSGetPropertyDescriptionListFromString(
+ sb.ToString(),
+ ref guid,
+ out propertyDescriptionList);
+
+ // If we get a IPropertyDescriptionList, setit on the native dialog.
+ if (CoreErrorHelper.Succeeded(hr))
+ {
+ InitializeNativeFileDialog();
+ IFileSaveDialog nativeDialog = GetNativeFileDialog() as IFileSaveDialog;
+
+ if (nativeDialog != null)
+ {
+ hr = nativeDialog.SetCollectedProperties(propertyDescriptionList, appendDefault);
+
+ if (!CoreErrorHelper.Succeeded(hr))
+ {
+ throw new ShellException(hr);
+ }
+ }
+ }
+ }
+ finally
+ {
+ if (propertyDescriptionList != null)
+ {
+ Marshal.ReleaseComObject(propertyDescriptionList);
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// Retrieves the set of property values for a saved item or an item in the process of being saved.
+ /// </summary>
+ /// <returns>Collection of property values collected from the save dialog</returns>
+ /// <remarks>This property can be called while the dialog is showing to retrieve the current
+ /// set of values in the metadata collection pane. It can also be called after the dialog
+ /// has closed, to retrieve the final set of values. The call to this method will fail
+ /// unless property collection has been turned on with a call to SetCollectedPropertyKeys method.
+ /// </remarks>
+ public ShellPropertyCollection CollectedProperties
+ {
+ get
+ {
+ InitializeNativeFileDialog();
+ IFileSaveDialog nativeDialog = GetNativeFileDialog() as IFileSaveDialog;
+
+ if (nativeDialog != null)
+ {
+ IPropertyStore propertyStore;
+ HResult hr = nativeDialog.GetProperties(out propertyStore);
+
+ if (propertyStore != null && CoreErrorHelper.Succeeded(hr))
+ {
+ return new ShellPropertyCollection(propertyStore);
+ }
+ }
+
+ return null;
+ }
+ }
+
+ #endregion
+
+ internal override void InitializeNativeFileDialog()
+ {
+ if (saveDialogCoClass == null)
+ {
+ saveDialogCoClass = new NativeFileSaveDialog();
+ }
+ }
+
+ internal override IFileDialog GetNativeFileDialog()
+ {
+ Debug.Assert(saveDialogCoClass != null, "Must call Initialize() before fetching dialog interface");
+ return (IFileDialog)saveDialogCoClass;
+ }
+
+ internal override void PopulateWithFileNames(
+ System.Collections.ObjectModel.Collection<string> names)
+ {
+ IShellItem item;
+ saveDialogCoClass.GetResult(out item);
+
+ if (item == null)
+ {
+ throw new InvalidOperationException(LocalizedMessages.SaveFileNullItem);
+ }
+ names.Clear();
+ names.Add(GetFileNameFromShellItem(item));
+ }
+
+ internal override void PopulateWithIShellItems(System.Collections.ObjectModel.Collection<IShellItem> items)
+ {
+ IShellItem item;
+ saveDialogCoClass.GetResult(out item);
+
+ if (item == null)
+ {
+ throw new InvalidOperationException(LocalizedMessages.SaveFileNullItem);
+ }
+ items.Clear();
+ items.Add(item);
+ }
+
+ internal override void CleanUpNativeFileDialog()
+ {
+ if (saveDialogCoClass != null)
+ {
+ Marshal.ReleaseComObject(saveDialogCoClass);
+ }
+ }
+
+ internal override ShellNativeMethods.FileOpenOptions GetDerivedOptionFlags(ShellNativeMethods.FileOpenOptions flags)
+ {
+ if (overwritePrompt)
+ {
+ flags |= ShellNativeMethods.FileOpenOptions.OverwritePrompt;
+ }
+ if (createPrompt)
+ {
+ flags |= ShellNativeMethods.FileOpenOptions.CreatePrompt;
+ }
+ if (!isExpandedMode)
+ {
+ flags |= ShellNativeMethods.FileOpenOptions.DefaultNoMiniMode;
+ }
+ if (alwaysAppendDefaultExtension)
+ {
+ flags |= ShellNativeMethods.FileOpenOptions.StrictFileTypes;
+ }
+ return flags;
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/ICommonFileDialogIndexedControls.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/ICommonFileDialogIndexedControls.cs
new file mode 100644
index 0000000000..75d29c1829
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/ICommonFileDialogIndexedControls.cs
@@ -0,0 +1,23 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs.Controls
+{
+ /// <summary>
+ /// Specifies a property, event and method that indexed controls need
+ /// to implement.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// not sure where else to put this, so leaving here for now.
+ /// </remarks>
+ interface ICommonFileDialogIndexedControls
+ {
+ int SelectedIndex { get; set; }
+
+ event EventHandler SelectedIndexChanged;
+
+ void RaiseSelectedIndexChangedEvent();
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Controls/CommandLinkWPF.xaml b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Controls/CommandLinkWPF.xaml
new file mode 100644
index 0000000000..34a7de57f1
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Controls/CommandLinkWPF.xaml
@@ -0,0 +1,171 @@
+<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
+
+<UserControl x:Class="Microsoft.WindowsAPICodePack.Controls.WindowsPresentationFoundation.CommandLink"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ Width="325"
+ Height="63"
+ HorizontalAlignment="Left"
+ Margin="0,0,0,12"
+ >
+ <UserControl.Resources>
+ <Style TargetType="{x:Type RadioButton}">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type RadioButton}">
+ <Canvas>
+ <Canvas Name="Normal" Opacity="1">
+ <StackPanel Margin="7,7,7,7" Orientation="Horizontal">
+ <Image Source="{Binding Path=Icon}" />
+ <StackPanel Margin="6,0,0,10">
+ <TextBlock FontFamily="Segoe" FontSize="16" Foreground="#282671" Text="{Binding Path=Link}">
+ <TextBlock.BitmapEffect>
+ <OuterGlowBitmapEffect GlowColor="White" GlowSize="5"/>
+ </TextBlock.BitmapEffect>
+ </TextBlock>
+ <TextBlock FontFamily="Segoe" FontSize="10" Foreground="#282671" Text="{Binding Path=Note}">
+ <TextBlock.BitmapEffect>
+ <OuterGlowBitmapEffect GlowColor="White" GlowSize="5"/>
+ </TextBlock.BitmapEffect>
+ </TextBlock>
+ </StackPanel>
+ </StackPanel>
+ </Canvas>
+ <Canvas Opacity="0" Name="Selected">
+ <Rectangle Stroke="Cyan" Fill="White" RadiusX="2" RadiusY ="2" Width="520" Height="63"/>
+ <StackPanel Margin="7,7,7,7" Orientation="Horizontal">
+ <Image Source="{Binding Path=Icon}" />
+ <StackPanel Margin="6,0,0,10">
+ <TextBlock FontFamily="Segoe" FontSize="16" Foreground="#5380f6" Text="{Binding Path=Link}">
+ <TextBlock.BitmapEffect>
+ <OuterGlowBitmapEffect GlowColor="White" GlowSize="5"/>
+ </TextBlock.BitmapEffect>
+ </TextBlock>
+ <TextBlock FontFamily="Segoe" FontSize="10" Foreground="#5380f6" Text="{Binding Path=Note}">
+ <TextBlock.BitmapEffect>
+ <OuterGlowBitmapEffect GlowColor="White" GlowSize="5"/>
+ </TextBlock.BitmapEffect>
+ </TextBlock>
+ </StackPanel>
+ </StackPanel>
+ </Canvas>
+ <Canvas Opacity="0" Name="Hover">
+ <Rectangle Stroke="Gray" RadiusX="2" RadiusY ="2" Width="520" Height="63">
+ <Rectangle.Fill>
+ <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
+ <LinearGradientBrush.GradientStops>
+ <GradientStop Color="White" Offset="0"/>
+ <GradientStop Color="#F9F9F9" Offset="0.30"/>
+ </LinearGradientBrush.GradientStops>
+ </LinearGradientBrush>
+ </Rectangle.Fill>
+ </Rectangle>
+ <StackPanel Margin="7,7,7,7" Orientation="Horizontal">
+ <Image Source="{Binding Path=Icon}" />
+ <StackPanel Margin="6,0,0,10">
+ <TextBlock FontFamily="Segoe" FontSize="16" Foreground="#5380f6" Text="{Binding Path=Link}">
+ <TextBlock.BitmapEffect>
+ <OuterGlowBitmapEffect GlowColor="White" GlowSize="5"/>
+ </TextBlock.BitmapEffect>
+ </TextBlock>
+ <TextBlock FontFamily="Segoe" FontSize="10" Foreground="#5380f6" Text="{Binding Path=Note}">
+ <TextBlock.BitmapEffect>
+ <OuterGlowBitmapEffect GlowColor="White" GlowSize="5"/>
+ </TextBlock.BitmapEffect>
+ </TextBlock>
+ </StackPanel>
+ </StackPanel>
+ </Canvas>
+ <Canvas Opacity="0" Name="Pressed">
+ <Rectangle Stroke="#6868a9" RadiusX="2" RadiusY ="2" Width="520" Height="63">
+ <Rectangle.Fill>
+ <LinearGradientBrush StartPoint="0,0.25" EndPoint="1,0.75">
+ <LinearGradientBrush.GradientStops>
+ <GradientStop Color="#93b9db" Offset="0"/>
+ <GradientStop Color="#ebf6fa" Offset="0.50"/>
+ <GradientStop Color="#93b9db" Offset="1"/>
+ </LinearGradientBrush.GradientStops>
+ </LinearGradientBrush>
+ </Rectangle.Fill>
+ <Rectangle.BitmapEffect>
+ <OuterGlowBitmapEffect GlowColor="LightGray" GlowSize="3"/>
+ </Rectangle.BitmapEffect>
+ </Rectangle>
+ <StackPanel Margin="7,7,7,7" Orientation="Horizontal">
+ <Image Source="{Binding Path=Icon}" />
+ <StackPanel Margin="6,0,0,10">
+ <TextBlock FontFamily="Segoe" FontSize="16" Foreground="#294073" Text="{Binding Path=Link}">
+ <TextBlock.BitmapEffect>
+ <OuterGlowBitmapEffect GlowColor="White" GlowSize="5"/>
+ </TextBlock.BitmapEffect>
+ </TextBlock>
+ <TextBlock FontFamily="Segoe" FontSize="10" Foreground="#294073" Text="{Binding Path=Note}">
+ <TextBlock.BitmapEffect>
+ <OuterGlowBitmapEffect GlowColor="White" GlowSize="5"/>
+ </TextBlock.BitmapEffect>
+ </TextBlock>
+ </StackPanel>
+ </StackPanel>
+ </Canvas>
+ </Canvas>
+ <ControlTemplate.Triggers>
+ <DataTrigger Value="True" Binding="{Binding Path=IsChecked, RelativeSource={RelativeSource Self}}">
+ <DataTrigger.EnterActions>
+ <BeginStoryboard>
+ <Storyboard Storyboard.TargetName="Selected" Storyboard.TargetProperty="Opacity">
+ <DoubleAnimation AccelerationRatio="0.2" DecelerationRatio="0.3" From="0.3" To="0.7" Duration="0:0:2" AutoReverse="True" RepeatBehavior="Forever"/>
+ </Storyboard>
+ </BeginStoryboard>
+ </DataTrigger.EnterActions>
+ <DataTrigger.ExitActions>
+ <BeginStoryboard>
+ <Storyboard Storyboard.TargetName="Selected" Storyboard.TargetProperty="Opacity">
+ <DoubleAnimation To="0" Duration="0:0:1" />
+ </Storyboard>
+ </BeginStoryboard>
+ </DataTrigger.ExitActions>
+ </DataTrigger>
+ <EventTrigger RoutedEvent="Button.MouseEnter">
+ <EventTrigger.Actions>
+ <BeginStoryboard>
+ <Storyboard Storyboard.TargetName="Hover" Storyboard.TargetProperty="Opacity">
+ <DoubleAnimation To="1" Duration="0:0:0.2"/>
+ </Storyboard>
+ </BeginStoryboard>
+ </EventTrigger.Actions>
+ </EventTrigger>
+ <EventTrigger RoutedEvent="Button.MouseLeave">
+ <EventTrigger.Actions>
+ <BeginStoryboard>
+ <Storyboard Storyboard.TargetName="Hover" Storyboard.TargetProperty="Opacity">
+ <DoubleAnimation To="0" Duration="0:0:0.5"/>
+ </Storyboard>
+ </BeginStoryboard>
+ </EventTrigger.Actions>
+ </EventTrigger>
+ <EventTrigger RoutedEvent="Button.PreviewMouseLeftButtonDown">
+ <EventTrigger.Actions>
+ <BeginStoryboard>
+ <Storyboard Storyboard.TargetName="Pressed" Storyboard.TargetProperty="Opacity">
+ <DoubleAnimation To="1" Duration="0:0:0.2"/>
+ </Storyboard>
+ </BeginStoryboard>
+ </EventTrigger.Actions>
+ </EventTrigger>
+ <EventTrigger RoutedEvent="Button.PreviewMouseLeftButtonUp">
+ <EventTrigger.Actions>
+ <BeginStoryboard>
+ <Storyboard Storyboard.TargetName="Pressed" Storyboard.TargetProperty="Opacity">
+ <DoubleAnimation To="0" Duration="0:0:0.5"/>
+ </Storyboard>
+ </BeginStoryboard>
+ </EventTrigger.Actions>
+ </EventTrigger>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+ </UserControl.Resources>
+ <RadioButton GroupName="commandLinkGroup" Name="button"/>
+</UserControl>
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Controls/CommandLinkWPF.xaml.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Controls/CommandLinkWPF.xaml.cs
new file mode 100644
index 0000000000..59464842c6
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Controls/CommandLinkWPF.xaml.cs
@@ -0,0 +1,132 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System.ComponentModel;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+using System.Windows.Media;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Controls.WindowsPresentationFoundation
+{
+ /// <summary>
+ /// Implements a CommandLink button that can be used in WPF user interfaces.
+ /// </summary>
+ public partial class CommandLink : UserControl, INotifyPropertyChanged
+ {
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ public CommandLink()
+ {
+ // Throw PlatformNotSupportedException if the user is not running Vista or beyond
+ CoreHelpers.ThrowIfNotVista();
+
+ this.DataContext = this;
+ InitializeComponent();
+ this.button.Click += new RoutedEventHandler(button_Click);
+ }
+
+ void button_Click(object sender, RoutedEventArgs e)
+ {
+ e.Source = this;
+ if (Click != null)
+ {
+ Click(sender, e);
+ }
+ }
+
+ /// <summary>
+ /// Routed UI command to use for this button
+ /// </summary>
+ public RoutedUICommand Command { get; set; }
+
+ /// <summary>
+ /// Occurs when the control is clicked.
+ /// </summary>
+ public event RoutedEventHandler Click;
+
+ private string link;
+
+ /// <summary>
+ /// Specifies the main instruction text
+ /// </summary>
+ public string Link
+ {
+ get { return link; }
+ set
+ {
+ link = value;
+
+ if (PropertyChanged != null)
+ {
+ PropertyChanged(this, new PropertyChangedEventArgs("Link"));
+ }
+ }
+ }
+ private string note;
+
+ /// <summary>
+ /// Specifies the supporting note text
+ /// </summary>
+ public string Note
+ {
+ get { return note; }
+ set
+ {
+ note = value;
+ if (PropertyChanged != null)
+ {
+ PropertyChanged(this, new PropertyChangedEventArgs("Note"));
+ }
+ }
+ }
+ private ImageSource icon;
+
+ /// <summary>
+ /// Icon to set for the command link button
+ /// </summary>
+ public ImageSource Icon
+ {
+ get { return icon; }
+ set
+ {
+ icon = value;
+ if (PropertyChanged != null)
+ {
+ PropertyChanged(this, new PropertyChangedEventArgs("Icon"));
+ }
+ }
+ }
+
+ /// <summary>
+ /// Indicates if the button is in a checked state
+ /// </summary>
+ public bool? IsCheck
+ {
+ get { return button.IsChecked; }
+ set { button.IsChecked = value; }
+ }
+
+
+ #region INotifyPropertyChanged Members
+
+ /// <summary>
+ /// Occurs when a property value changes.
+ /// </summary>
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ #endregion
+
+ /// <summary>
+ /// Indicates whether this feature is supported on the current platform.
+ /// </summary>
+ public static bool IsPlatformSupported
+ {
+ get
+ {
+ return CoreHelpers.RunningOnVista;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Controls/CommandLinkWinforms.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Controls/CommandLinkWinforms.cs
new file mode 100644
index 0000000000..a2fe9b7bfb
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Controls/CommandLinkWinforms.cs
@@ -0,0 +1,152 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.ComponentModel;
+using System.Text;
+using System.Windows.Forms;
+using Microsoft.WindowsAPICodePack.Shell;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Controls.WindowsForms
+{
+ /// <summary>
+ /// Implements a CommandLink button that can be used in
+ /// WinForms user interfaces.
+ /// </summary>
+ public class CommandLink : Button
+ {
+ /// <summary>
+ /// Gets a System.Windows.Forms.CreateParams on the base class when
+ /// creating a window.
+ /// </summary>
+ protected override CreateParams CreateParams
+ {
+
+ get
+ {
+ // Add BS_COMMANDLINK style before control creation.
+ CreateParams cp = base.CreateParams;
+
+ cp.Style = AddCommandLinkStyle(cp.Style);
+
+ return cp;
+ }
+ }
+
+ // Let Windows handle the rendering.
+ /// <summary>
+ /// Creates a new instance of this class.
+ /// </summary>
+ public CommandLink()
+ {
+ CoreHelpers.ThrowIfNotVista();
+
+ FlatStyle = FlatStyle.System;
+ }
+
+ // Add Design-Time Support.
+
+ /// <summary>
+ /// Increase default width.
+ /// </summary>
+ protected override System.Drawing.Size DefaultSize
+ {
+ get { return new System.Drawing.Size(180, 60); }
+ }
+
+ /// <summary>
+ /// Specifies the supporting note text
+ /// </summary>
+ [Category("Appearance")]
+ [Description("Specifies the supporting note text.")]
+ [BrowsableAttribute(true)]
+ [DefaultValue("(Note Text)")]
+ public string NoteText
+ {
+ get { return (GetNote(this)); }
+ set
+ {
+ SetNote(this, value);
+ }
+ }
+
+ /// <summary>
+ /// Enable shield icon to be set at design-time.
+ /// </summary>
+ [Category("Appearance")]
+ [Description("Indicates whether the button should be decorated with the security shield icon (Windows Vista only).")]
+ [BrowsableAttribute(true)]
+ [DefaultValue(false)]
+ public bool UseElevationIcon
+ {
+ get { return (useElevationIcon); }
+ set
+ {
+ useElevationIcon = value;
+ SetShieldIcon(this, this.useElevationIcon);
+ }
+ }
+ private bool useElevationIcon;
+
+
+ #region Interop helpers
+
+ private static int AddCommandLinkStyle(int style)
+ {
+ // Only add BS_COMMANDLINK style on Windows Vista or above.
+ // Otherwise, button creation will fail.
+ if (CoreHelpers.RunningOnVista)
+ {
+ style |= ShellNativeMethods.CommandLink;
+ }
+
+ return style;
+ }
+
+ private static string GetNote(System.Windows.Forms.Button Button)
+ {
+ IntPtr retVal = CoreNativeMethods.SendMessage(
+ Button.Handle,
+ ShellNativeMethods.GetNoteLength,
+ IntPtr.Zero,
+ IntPtr.Zero);
+
+ // Add 1 for null terminator, to get the entire string back.
+ int len = ((int)retVal) + 1;
+ StringBuilder strBld = new StringBuilder(len);
+
+ retVal = CoreNativeMethods.SendMessage(Button.Handle, ShellNativeMethods.GetNote, ref len, strBld);
+ return strBld.ToString();
+ }
+
+ private static void SetNote(System.Windows.Forms.Button button, string text)
+ {
+ // This call will be ignored on versions earlier than Windows Vista.
+ CoreNativeMethods.SendMessage(button.Handle, ShellNativeMethods.SetNote, 0, text);
+ }
+
+ static internal void SetShieldIcon(System.Windows.Forms.Button Button, bool Show)
+ {
+ IntPtr fRequired = new IntPtr(Show ? 1 : 0);
+ CoreNativeMethods.SendMessage(
+ Button.Handle,
+ ShellNativeMethods.SetShield,
+ IntPtr.Zero,
+ fRequired);
+ }
+
+ #endregion
+
+ /// <summary>
+ /// Indicates whether this feature is supported on the current platform.
+ /// </summary>
+ public static bool IsPlatformSupported
+ {
+ get
+ {
+ // We need Windows Vista onwards ...
+ return CoreHelpers.RunningOnVista;
+ }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CustomDictionary.xml b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CustomDictionary.xml
new file mode 100644
index 0000000000..dcdeb48fb7
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CustomDictionary.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<Dictionary>
+ <Words>
+ <Recognized>
+ <Word>Redirectable</Word>
+ <Word>Relaunch</Word>
+ <Word>Transcoded</Word>
+ <Word>Unlocalized</Word>
+ <Word>Cc</Word>
+ <Word>Blu</Word>
+ <Word>Multiselect</Word>
+ <Word>Precreate</Word>
+ <Word>Roamable</Word>
+ <Word>Svcd</Word>
+ <Word>Vcd</Word>
+ <Word>Csc</Word>
+ <Word>Oem</Word>
+ <Word>Unshare</Word>
+ <Word>Param</Word>
+ </Recognized>
+ </Words>
+ <Acronyms>
+ <CasingExceptions>
+ <Acronym>API</Acronym>
+ <!-- COME BACK TO FIX THE BELOW -->
+ <Acronym>TTYTDD</Acronym>
+ <Acronym>SFGAO</Acronym>
+ <Acronym>DOP</Acronym>
+ <Acronym>DRM</Acronym>
+ <Acronym>DTV</Acronym>
+ <Acronym>DVDID</Acronym>
+ <Acronym>EXIF</Acronym>
+ <Acronym>EXIFS</Acronym>
+ <Acronym>FRN</Acronym>
+ <Acronym>GPS</Acronym>
+ <Acronym>ID</Acronym>
+ <Acronym>ISO</Acronym>
+ <Acronym>LCID</Acronym>
+ <Acronym>MCDI</Acronym>
+ <Acronym>MIME</Acronym>
+ <Acronym>SAP</Acronym>
+ <Acronym>ATSC</Acronym>
+ <Acronym>CDR</Acronym>
+ <Acronym>CDRW</Acronym>
+ <Acronym>DOS</Acronym>
+ <Acronym>HDDVD</Acronym>
+ <Acronym>HDDVDR</Acronym>
+ <Acronym>HDDVDRAM</Acronym>
+ <Acronym>HDDVDROM</Acronym>
+ <Acronym>ROM</Acronym>
+ <Acronym>Csc</Acronym>
+ </CasingExceptions>
+ </Acronyms>
+ <DiscreteExceptions>
+ <Term>Wildcards</Term>
+ <Term>Showplaces</Term>
+ </DiscreteExceptions>
+</Dictionary> \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Design/ShellObjects.cd b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Design/ShellObjects.cd
new file mode 100644
index 0000000000..ae8f19cac6
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Design/ShellObjects.cd
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ClassDiagram MajorVersion="1" MinorVersion="1">
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.ShellObject" Collapsed="true">
+ <Position X="4.75" Y="0.5" Width="1.5" />
+ <TypeIdentifier>
+ <HashCode>AAoAAAgAAGAACQANgAJASAYAQABAAIAAAAAAAAAiAiQ=</HashCode>
+ <FileName>Common\ShellObject.cs</FileName>
+ </TypeIdentifier>
+ <Lollipop Position="0.2" />
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.ShellLibrary" Collapsed="true">
+ <Position X="1" Y="4.25" Width="1.5" />
+ <TypeIdentifier>
+ <HashCode>AGIAoEAQACAAABBRCIAARCQCAAIABAAMCAEEAAPQKAQ=</HashCode>
+ <FileName>Common\ShellLibrary.cs</FileName>
+ </TypeIdentifier>
+ <Lollipop Orientation="Bottom" Position="0.531" />
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.FileSystemKnownFolder" Collapsed="true">
+ <Position X="2.5" Y="7.5" Width="2" />
+ <TypeIdentifier>
+ <HashCode>BAAAABAAACAgAAoAAkSCIIAAQARAAAAIAoAEIAAACAA=</HashCode>
+ <FileName>KnownFolders\FileSystemKnownFolder.cs</FileName>
+ </TypeIdentifier>
+ <Lollipop Orientation="Bottom" Position="0.242" />
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.ShellContainer" Collapsed="true">
+ <Position X="4.25" Y="2" Width="1.5" />
+ <TypeIdentifier>
+ <HashCode>ACAAAAIAAKAAABAAAAAABAAAAAAAAIAAAAAAAAAAAAA=</HashCode>
+ <FileName>Common\ShellObjectContainer.cs</FileName>
+ </TypeIdentifier>
+ <Lollipop Position="0.179" />
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.ShellLink" Collapsed="true">
+ <Position X="2" Y="1.5" Width="1.5" />
+ <TypeIdentifier>
+ <HashCode>AAQAAACAAAAAAEKAAIAAAIAABAAgESAAIAACAAQAAAA=</HashCode>
+ <FileName>Common\ShellLink.cs</FileName>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.NonFileSystemKnownFolder" Collapsed="true">
+ <Position X="5" Y="7.5" Width="2.25" />
+ <TypeIdentifier>
+ <HashCode>BAAAABAAACAgAAoAAkSCIIAAQARAAAAIAoAEIAAACAA=</HashCode>
+ <FileName>KnownFolders\NonFileSystemKnownFolder.cs</FileName>
+ </TypeIdentifier>
+ <Lollipop Orientation="Bottom" Position="0.273" />
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.ShellFile" Collapsed="true">
+ <Position X="8.5" Y="2.75" Width="1.5" />
+ <TypeIdentifier>
+ <HashCode>AAAAAAgAAAAAAAIAAAAAAAAABAAAAAAAAAABAAAAAAA=</HashCode>
+ <FileName>Common\ShellFile.cs</FileName>
+ </TypeIdentifier>
+ <Lollipop Position="0.2" />
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.ShellFolder" Collapsed="true">
+ <Position X="4.75" Y="4.25" Width="1.5" />
+ <TypeIdentifier>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ <FileName>Common\ShellFolder.cs</FileName>
+ <NewMemberFileName>ShellFolder.cs</NewMemberFileName>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.ShellObjectNode" Collapsed="true">
+ <Position X="7" Y="1.5" Width="2.25" />
+ <TypeIdentifier>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ <FileName>Common\ShellObjectNode.cs</FileName>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.ShellNonFileSystemItem" Collapsed="true">
+ <Position X="6.25" Y="2.75" Width="1.75" />
+ <TypeIdentifier>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ <FileName>Common\ShellNonFileSystemItem.cs</FileName>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.ShellSearchCollection" Collapsed="true">
+ <Position X="8.75" Y="4.25" Width="1.75" />
+ <TypeIdentifier>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ <FileName>Common\ShellSearchCollection.cs</FileName>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.ShellFileSystemFolder" Collapsed="true">
+ <Position X="2.75" Y="6.25" Width="1.75" />
+ <TypeIdentifier>
+ <HashCode>AAAAAAAAAAAAAAIAIAAAAAAABAAAAAAAAAAAAAAAAAA=</HashCode>
+ <FileName>Common\ShellFileSystemFolder.cs</FileName>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.ShellNonFileSystemFolder" Collapsed="true">
+ <Position X="5" Y="6.25" Width="2" />
+ <TypeIdentifier>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ <FileName>Common\ShellNonFileSystemFolder.cs</FileName>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.ShellSavedSearchCollection" Collapsed="true">
+ <Position X="7.25" Y="6.25" Width="2.25" />
+ <TypeIdentifier>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ <FileName>Common\ShellSavedSearchCollection.cs</FileName>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.ShellSearchConnector" Collapsed="true">
+ <Position X="9.75" Y="6.25" Width="1.75" />
+ <TypeIdentifier>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ <FileName>Common\ShellSearchConnector.cs</FileName>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.ShellSearchFolder" Collapsed="true">
+ <Position X="12" Y="6.25" Width="1.5" />
+ <TypeIdentifier>
+ <HashCode>AAQAEBAAAAAQAAABBEAAAQAIAIAAAAAAAJBAAgAAAAA=</HashCode>
+ <FileName>Common\ShellSearchFolder.cs</FileName>
+ </TypeIdentifier>
+ </Class>
+ <Interface Name="Microsoft.WindowsAPICodePack.Shell.IKnownFolder" Collapsed="true">
+ <Position X="8" Y="7.5" Width="1.5" />
+ <TypeIdentifier>
+ <HashCode>BAAAABAAAAAgAAoAAkCAIIAAQARAAAAIAoAEIAAACAA=</HashCode>
+ <FileName>KnownFolders\IKnownFolder.cs</FileName>
+ </TypeIdentifier>
+ </Interface>
+ <Font Name="Segoe UI" Size="9" />
+</ClassDiagram> \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Design/ShellThumbnailClassDiagram.cd b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Design/ShellThumbnailClassDiagram.cd
new file mode 100644
index 0000000000..b60a69a949
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Design/ShellThumbnailClassDiagram.cd
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ClassDiagram MajorVersion="1" MinorVersion="1" GroupingSetting="Access" MembersFormat="FullSignature">
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.ShellThumbnail">
+ <Position X="0.5" Y="0.5" Width="4" />
+ <TypeIdentifier>
+ <HashCode>QAABAABAAAAAAASAABkIABggAQAACgABgBIQAAEAAEI=</HashCode>
+ <FileName>Common\ShellThumbnail.cs</FileName>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.DefaultIconSize">
+ <Position X="5.25" Y="0.5" Width="1.5" />
+ <TypeIdentifier>
+ <HashCode>gAAAAAAAAAAAAAAQAAAAAABgAAAAAAAAAAAAAAAEAAA=</HashCode>
+ <FileName>Common\DefaultShellImageSizes.cs</FileName>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.DefaultThumbnailSize">
+ <Position X="7" Y="0.5" Width="1.75" />
+ <TypeIdentifier>
+ <HashCode>gAAAAAAAAAAAAAAQAAAAAABgAAAAAAAAAAAAAAAEAAA=</HashCode>
+ <FileName>Common\DefaultShellImageSizes.cs</FileName>
+ </TypeIdentifier>
+ </Class>
+ <Enum Name="Microsoft.WindowsAPICodePack.Shell.ShellThumbnailRetrievalOptions">
+ <Position X="5.25" Y="2.5" Width="2.5" />
+ <TypeIdentifier>
+ <HashCode>AAAAAAAAAAAAAACAAAAAIAAAAAAAAAAAAAAAIAAAAAA=</HashCode>
+ <FileName>Common\ShellThumbnailEnums.cs</FileName>
+ </TypeIdentifier>
+ </Enum>
+ <Enum Name="Microsoft.WindowsAPICodePack.Shell.ShellThumbnailFormatOptions">
+ <Position X="8.25" Y="2.5" Width="2.25" />
+ <TypeIdentifier>
+ <HashCode>BAAAAAAAAAAAAAAAACAAIAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ <FileName>Common\ShellThumbnailEnums.cs</FileName>
+ </TypeIdentifier>
+ </Enum>
+ <Font Name="Segoe UI" Size="9" />
+</ClassDiagram> \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/DesktopWindowManager/DesktopWindowManagerNativeMethods.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/DesktopWindowManager/DesktopWindowManagerNativeMethods.cs
new file mode 100644
index 0000000000..974c1440a6
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/DesktopWindowManager/DesktopWindowManagerNativeMethods.cs
@@ -0,0 +1,65 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using System.Security;
+using Microsoft.WindowsAPICodePack.Shell.Interop;
+using Microsoft.WindowsAPICodePack.Shell;
+
+namespace MS.WindowsAPICodePack.Internal
+{
+ internal static class DWMMessages
+ {
+ internal const int WM_DWMCOMPOSITIONCHANGED = 0x031E;
+ internal const int WM_DWMNCRENDERINGCHANGED = 0x031F;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct Margins
+ {
+ public int LeftWidth; // width of left border that retains its size
+ public int RightWidth; // width of right border that retains its size
+ public int TopHeight; // height of top border that retains its size
+ public int BottomHeight; // height of bottom border that retains its size
+
+ public Margins(bool fullWindow)
+ {
+ LeftWidth = RightWidth = TopHeight = BottomHeight = (fullWindow ? -1 : 0);
+ }
+ };
+
+ internal enum CompositionEnable
+ {
+ Disable = 0,
+ Enable = 1
+ }
+
+ /// <summary>
+ /// Internal class that contains interop declarations for
+ /// functions that are not benign and are performance critical.
+ /// </summary>
+ [SuppressUnmanagedCodeSecurity]
+ internal static class DesktopWindowManagerNativeMethods
+ {
+ [DllImport("DwmApi.dll")]
+ internal static extern int DwmExtendFrameIntoClientArea(
+ IntPtr hwnd,
+ ref Margins m);
+
+ [DllImport("DwmApi.dll", PreserveSig = false)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool DwmIsCompositionEnabled();
+
+ [DllImport("DwmApi.dll")]
+ internal static extern int DwmEnableComposition(
+ CompositionEnable compositionAction);
+
+ [DllImport("user32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool GetWindowRect(IntPtr hwnd, [Out] out NativeRect rect);
+
+ [DllImport("user32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool GetClientRect(IntPtr hwnd, [Out] out NativeRect rect);
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/DesktopWindowManager/GlassEvents.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/DesktopWindowManager/GlassEvents.cs
new file mode 100644
index 0000000000..d21351aec3
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/DesktopWindowManager/GlassEvents.cs
@@ -0,0 +1,22 @@
+using System;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Event argument for The GlassAvailabilityChanged event
+ /// </summary>
+ public class AeroGlassCompositionChangedEventArgs : EventArgs
+ {
+ internal AeroGlassCompositionChangedEventArgs(bool avialbility)
+ {
+ GlassAvailable = avialbility;
+ }
+
+ /// <summary>
+ /// The new GlassAvailable state
+ /// </summary>
+ public bool GlassAvailable { get; private set; }
+
+ }
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/DesktopWindowManager/GlassForm.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/DesktopWindowManager/GlassForm.cs
new file mode 100644
index 0000000000..b850b08e15
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/DesktopWindowManager/GlassForm.cs
@@ -0,0 +1,144 @@
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using MS.WindowsAPICodePack.Internal;
+
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Windows Glass Form
+ /// Inherit from this form to be able to enable glass on Windows Form
+ /// </summary>
+ public class GlassForm : Form
+ {
+ #region properties
+
+ /// <summary>
+ /// Get determines if AeroGlass is enabled on the desktop. Set enables/disables AreoGlass on the desktop.
+ /// </summary>
+ public static bool AeroGlassCompositionEnabled
+ {
+ set
+ {
+ DesktopWindowManagerNativeMethods.DwmEnableComposition(
+ value ? CompositionEnable.Enable : CompositionEnable.Disable);
+ }
+ get
+ {
+ return DesktopWindowManagerNativeMethods.DwmIsCompositionEnabled();
+ }
+ }
+
+ #endregion
+
+ #region events
+
+ /// <summary>
+ /// Fires when the availability of Glass effect changes.
+ /// </summary>
+ public event EventHandler<AeroGlassCompositionChangedEventArgs> AeroGlassCompositionChanged;
+
+ #endregion
+
+ #region operations
+
+ /// <summary>
+ /// Makes the background of current window transparent
+ /// </summary>
+ public void SetAeroGlassTransparency()
+ {
+ this.BackColor = Color.Transparent;
+ }
+
+ /// <summary>
+ /// Excludes a Control from the AeroGlass frame.
+ /// </summary>
+ /// <param name="control">The control to exclude.</param>
+ /// <remarks>Many non-WPF rendered controls (i.e., the ExplorerBrowser control) will not
+ /// render properly on top of an AeroGlass frame. </remarks>
+ public void ExcludeControlFromAeroGlass(Control control)
+ {
+ if (control == null) { throw new ArgumentNullException("control"); }
+
+ if (AeroGlassCompositionEnabled)
+ {
+ Rectangle clientScreen = this.RectangleToScreen(this.ClientRectangle);
+ Rectangle controlScreen = control.RectangleToScreen(control.ClientRectangle);
+
+ Margins margins = new Margins();
+ margins.LeftWidth = controlScreen.Left - clientScreen.Left;
+ margins.RightWidth = clientScreen.Right - controlScreen.Right;
+ margins.TopHeight = controlScreen.Top - clientScreen.Top;
+ margins.BottomHeight = clientScreen.Bottom - controlScreen.Bottom;
+
+ // Extend the Frame into client area
+ DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(Handle, ref margins);
+ }
+ }
+
+ /// <summary>
+ /// Resets the AeroGlass exclusion area.
+ /// </summary>
+ public void ResetAeroGlass()
+ {
+ if (this.Handle != IntPtr.Zero)
+ {
+ Margins margins = new Margins(true);
+ DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(this.Handle, ref margins);
+ }
+ }
+ #endregion
+
+ #region implementation
+ /// <summary>
+ /// Catches the DWM messages to this window and fires the appropriate event.
+ /// </summary>
+ /// <param name="m"></param>
+
+ protected override void WndProc(ref System.Windows.Forms.Message m)
+ {
+ if (m.Msg == DWMMessages.WM_DWMCOMPOSITIONCHANGED
+ || m.Msg == DWMMessages.WM_DWMNCRENDERINGCHANGED)
+ {
+ if (AeroGlassCompositionChanged != null)
+ {
+ AeroGlassCompositionChanged.Invoke(this,
+ new AeroGlassCompositionChangedEventArgs(AeroGlassCompositionEnabled));
+ }
+ }
+
+ base.WndProc(ref m);
+ }
+
+ /// <summary>
+ /// Initializes the Form for AeroGlass
+ /// </summary>
+ /// <param name="e">The arguments for this event</param>
+ protected override void OnLoad(EventArgs e)
+ {
+ base.OnLoad(e);
+ ResetAeroGlass();
+ }
+
+ /// <summary>
+ /// Overide OnPaint to paint the background as black.
+ /// </summary>
+ /// <param name="e">PaintEventArgs</param>
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ base.OnPaint(e);
+
+ if (DesignMode == false)
+ {
+ if (AeroGlassCompositionEnabled && e != null)
+ {
+ // Paint the all the regions black to enable glass
+ e.Graphics.FillRectangle(Brushes.Black, this.ClientRectangle);
+ }
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/DesktopWindowManager/GlassWindow.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/DesktopWindowManager/GlassWindow.cs
new file mode 100644
index 0000000000..894cea6651
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/DesktopWindowManager/GlassWindow.cs
@@ -0,0 +1,150 @@
+using System;
+using System.Windows.Interop;
+using System.Windows.Media;
+using MS.WindowsAPICodePack.Internal;
+using Microsoft.WindowsAPICodePack.Shell.Interop;
+using System.Windows;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+
+ /// <summary>
+ /// WPF Glass Window
+ /// Inherit from this window class to enable glass on a WPF window
+ /// </summary>
+ public class GlassWindow : Window
+ {
+ #region properties
+
+ /// <summary>
+ /// Get determines if AeroGlass is enabled on the desktop. Set enables/disables AreoGlass on the desktop.
+ /// </summary>
+ public static bool AeroGlassCompositionEnabled
+ {
+ set
+ {
+ DesktopWindowManagerNativeMethods.DwmEnableComposition(
+ value ? CompositionEnable.Enable : CompositionEnable.Disable);
+ }
+ get
+ {
+ return DesktopWindowManagerNativeMethods.DwmIsCompositionEnabled();
+ }
+ }
+
+ #endregion
+
+ #region events
+
+ /// <summary>
+ /// Fires when the availability of Glass effect changes.
+ /// </summary>
+ public event EventHandler<AeroGlassCompositionChangedEventArgs> AeroGlassCompositionChanged;
+
+ #endregion
+
+ #region operations
+
+ /// <summary>
+ /// Makes the background of current window transparent from both Wpf and Windows Perspective
+ /// </summary>
+ public void SetAeroGlassTransparency()
+ {
+ // Set the Background to transparent from Win32 perpective
+ HwndSource.FromHwnd(windowHandle).CompositionTarget.BackgroundColor = System.Windows.Media.Colors.Transparent;
+
+ // Set the Background to transparent from WPF perpective
+ this.Background = Brushes.Transparent;
+ }
+
+ /// <summary>
+ /// Excludes a UI element from the AeroGlass frame.
+ /// </summary>
+ /// <param name="element">The element to exclude.</param>
+ /// <remarks>Many non-WPF rendered controls (i.e., the ExplorerBrowser control) will not
+ /// render properly on top of an AeroGlass frame. </remarks>
+ public void ExcludeElementFromAeroGlass(FrameworkElement element)
+ {
+ if (AeroGlassCompositionEnabled && element != null)
+ {
+ // calculate total size of window nonclient area
+ HwndSource hwndSource = PresentationSource.FromVisual(this) as HwndSource;
+ NativeRect windowRect;
+ NativeRect clientRect;
+ DesktopWindowManagerNativeMethods.GetWindowRect(hwndSource.Handle, out windowRect);
+ DesktopWindowManagerNativeMethods.GetClientRect(hwndSource.Handle, out clientRect);
+ Size nonClientSize = new Size(
+ (double)(windowRect.Right - windowRect.Left) - (double)(clientRect.Right - clientRect.Left),
+ (double)(windowRect.Bottom - windowRect.Top) - (double)(clientRect.Bottom - clientRect.Top));
+
+ // calculate size of element relative to nonclient area
+ GeneralTransform transform = element.TransformToAncestor(this);
+ Point topLeftFrame = transform.Transform(new Point(0, 0));
+ Point bottomRightFrame = transform.Transform(new Point(
+ element.ActualWidth + nonClientSize.Width,
+ element.ActualHeight + nonClientSize.Height));
+
+ // Create a margin structure
+ Margins margins = new Margins();
+ margins.LeftWidth = (int)topLeftFrame.X;
+ margins.RightWidth = (int)(this.ActualWidth - bottomRightFrame.X);
+ margins.TopHeight = (int)(topLeftFrame.Y);
+ margins.BottomHeight = (int)(this.ActualHeight - bottomRightFrame.Y);
+
+ // Extend the Frame into client area
+ DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(windowHandle, ref margins);
+ }
+ }
+
+ /// <summary>
+ /// Resets the AeroGlass exclusion area.
+ /// </summary>
+ public void ResetAeroGlass()
+ {
+ Margins margins = new Margins(true);
+ DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(windowHandle, ref margins);
+ }
+
+ #endregion
+
+ #region implementation
+ private IntPtr windowHandle;
+
+ private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
+ {
+ if (msg == DWMMessages.WM_DWMCOMPOSITIONCHANGED
+ || msg == DWMMessages.WM_DWMNCRENDERINGCHANGED)
+ {
+ if (AeroGlassCompositionChanged != null)
+ {
+ AeroGlassCompositionChanged.Invoke(this,
+ new AeroGlassCompositionChangedEventArgs(AeroGlassCompositionEnabled));
+ }
+
+ handled = true;
+ }
+ return IntPtr.Zero;
+ }
+
+ /// <summary>
+ /// OnSourceInitialized
+ /// Override SourceInitialized to initialize windowHandle for this window.
+ /// A valid windowHandle is available only after the sourceInitialized is completed
+ /// </summary>
+ /// <param name="e">EventArgs</param>
+ protected override void OnSourceInitialized(EventArgs e)
+ {
+ base.OnSourceInitialized(e);
+ WindowInteropHelper interopHelper = new WindowInteropHelper(this);
+ this.windowHandle = interopHelper.Handle;
+
+ // add Window Proc hook to capture DWM messages
+ HwndSource source = HwndSource.FromHwnd(windowHandle);
+ source.AddHook(new HwndSourceHook(WndProc));
+
+ ResetAeroGlass();
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/CommonControlException.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/CommonControlException.cs
new file mode 100644
index 0000000000..c7eace18df
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/CommonControlException.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Runtime.InteropServices;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Controls
+{
+ /// <summary>
+ /// An exception thrown when an error occurs while dealing with Control objects.
+ /// </summary>
+ [Serializable]
+ public class CommonControlException : COMException
+ {
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ public CommonControlException() { }
+
+ /// <summary>
+ /// Initializes an excpetion with a custom message.
+ /// </summary>
+ /// <param name="message"></param>
+ public CommonControlException(string message) : base(message) { }
+
+ /// <summary>
+ /// Initializes an exception with custom message and inner exception.
+ /// </summary>
+ /// <param name="message"></param>
+ /// <param name="innerException"></param>
+ public CommonControlException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ /// <summary>
+ /// Initializes an exception with custom message and error code.
+ /// </summary>
+ /// <param name="message"></param>
+ /// <param name="errorCode"></param>
+ public CommonControlException(string message, int errorCode) : base(message, errorCode) { }
+
+ /// <summary>
+ /// Initializes an exception with custom message and error code.
+ /// </summary>
+ /// <param name="message"></param>
+ /// <param name="errorCode"></param>
+ internal CommonControlException(string message, HResult errorCode) : this(message, (int)errorCode) { }
+
+ /// <summary>
+ /// Initializes an exception from serialization info and a context.
+ /// </summary>
+ /// <param name="info"></param>
+ /// <param name="context"></param>
+ protected CommonControlException(
+ System.Runtime.Serialization.SerializationInfo info,
+ System.Runtime.Serialization.StreamingContext context)
+ : base(info, context)
+ {
+ }
+
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowser.WPF.xaml b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowser.WPF.xaml
new file mode 100644
index 0000000000..9d5cee96ed
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowser.WPF.xaml
@@ -0,0 +1,8 @@
+<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
+<UserControl x:Class="Microsoft.WindowsAPICodePack.Controls.WindowsPresentationFoundation.ExplorerBrowser"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ <Grid x:Name="root">
+ <TextBlock Margin="10,10,10,10"> Explorer Browser Control </TextBlock>
+ </Grid>
+</UserControl>
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowser.WPF.xaml.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowser.WPF.xaml.cs
new file mode 100644
index 0000000000..24ff186f00
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowser.WPF.xaml.cs
@@ -0,0 +1,987 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+using System;
+using System.Collections.ObjectModel;
+using System.Threading;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Forms.Integration;
+using System.Windows.Threading;
+using Microsoft.WindowsAPICodePack.Shell;
+
+
+namespace Microsoft.WindowsAPICodePack.Controls.WindowsPresentationFoundation
+{
+ /// <summary>
+ /// Interaction logic for ExplorerBrowser.xaml
+ /// </summary>
+ public partial class ExplorerBrowser : UserControl, IDisposable
+ {
+ /// <summary>
+ /// The underlying WinForms control
+ /// </summary>
+ public Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser ExplorerBrowserControl
+ {
+ get;
+ set;
+ }
+
+ private ObservableCollection<ShellObject> selectedItems;
+ private ObservableCollection<ShellObject> items;
+ private ObservableCollection<ShellObject> navigationLog;
+ private DispatcherTimer dtCLRUpdater = new DispatcherTimer();
+
+ private ShellObject initialNavigationTarget;
+ private ExplorerBrowserViewMode? initialViewMode;
+
+ private AutoResetEvent itemsChanged = new AutoResetEvent(false);
+ private AutoResetEvent selectionChanged = new AutoResetEvent(false);
+ private int selectionChangeWaitCount;
+
+ /// <summary>
+ /// Hosts the ExplorerBrowser WinForms wrapper in this control
+ /// </summary>
+ public ExplorerBrowser()
+ {
+ InitializeComponent();
+
+ // the ExplorerBrowser WinForms control
+ ExplorerBrowserControl = new Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser();
+
+ // back the dependency collection properties with instances
+ SelectedItems = selectedItems = new ObservableCollection<ShellObject>();
+ Items = items = new ObservableCollection<ShellObject>();
+ NavigationLog = navigationLog = new ObservableCollection<ShellObject>();
+
+ // hook up events for collection synchronization
+ ExplorerBrowserControl.ItemsChanged += new EventHandler(ItemsChanged);
+ ExplorerBrowserControl.SelectionChanged += new EventHandler(SelectionChanged);
+ ExplorerBrowserControl.ViewEnumerationComplete += new EventHandler(ExplorerBrowserControl_ViewEnumerationComplete);
+ ExplorerBrowserControl.ViewSelectedItemChanged += new EventHandler(ExplorerBrowserControl_ViewSelectedItemChanged);
+ ExplorerBrowserControl.NavigationLog.NavigationLogChanged += new EventHandler<NavigationLogEventArgs>(NavigationLogChanged);
+
+ // host the control
+ WindowsFormsHost host = new WindowsFormsHost();
+ try
+ {
+ host.Child = ExplorerBrowserControl;
+ this.root.Children.Clear();
+ this.root.Children.Add(host);
+ }
+ catch
+ {
+ host.Dispose();
+ throw;
+ }
+
+ Loaded += new RoutedEventHandler(ExplorerBrowser_Loaded);
+ }
+
+ void ExplorerBrowserControl_ViewSelectedItemChanged(object sender, EventArgs e)
+ {
+ }
+
+ void ExplorerBrowserControl_ViewEnumerationComplete(object sender, EventArgs e)
+ {
+ itemsChanged.Set();
+ selectionChanged.Set();
+ }
+
+ /// <summary>
+ /// To avoid the 'Dispatcher processing has been suspended' InvalidOperationException on Win7,
+ /// the ExplorerBorwser native control is initialized after this control is fully loaded.
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="e"></param>
+ void ExplorerBrowser_Loaded(object sender, RoutedEventArgs e)
+ {
+ // setup timer to update dependency properties from CLR properties of WinForms ExplorerBrowser object
+ dtCLRUpdater.Tick += new EventHandler(UpdateDependencyPropertiesFromCLRPRoperties);
+ dtCLRUpdater.Interval = new TimeSpan(100 * 10000); // 100ms
+ dtCLRUpdater.Start();
+
+ if (initialNavigationTarget != null)
+ {
+ ExplorerBrowserControl.Navigate(initialNavigationTarget);
+ initialNavigationTarget = null;
+ }
+
+ if (initialViewMode != null)
+ {
+ ExplorerBrowserControl.ContentOptions.ViewMode = (ExplorerBrowserViewMode)initialViewMode;
+ initialViewMode = null;
+ }
+ }
+
+ /// <summary>
+ /// Map changes to the CLR flags to the dependency properties
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="e"></param>
+ void UpdateDependencyPropertiesFromCLRPRoperties(object sender, EventArgs e)
+ {
+ AlignLeft = ExplorerBrowserControl.ContentOptions.AlignLeft;
+ AutoArrange = ExplorerBrowserControl.ContentOptions.AutoArrange;
+ CheckSelect = ExplorerBrowserControl.ContentOptions.CheckSelect;
+ ExtendedTiles = ExplorerBrowserControl.ContentOptions.ExtendedTiles;
+ FullRowSelect = ExplorerBrowserControl.ContentOptions.FullRowSelect;
+ HideFileNames = ExplorerBrowserControl.ContentOptions.HideFileNames;
+ NoBrowserViewState = ExplorerBrowserControl.ContentOptions.NoBrowserViewState;
+ NoColumnHeader = ExplorerBrowserControl.ContentOptions.NoColumnHeader;
+ NoHeaderInAllViews = ExplorerBrowserControl.ContentOptions.NoHeaderInAllViews;
+ NoIcons = ExplorerBrowserControl.ContentOptions.NoIcons;
+ NoSubfolders = ExplorerBrowserControl.ContentOptions.NoSubfolders;
+ SingleClickActivate = ExplorerBrowserControl.ContentOptions.SingleClickActivate;
+ SingleSelection = ExplorerBrowserControl.ContentOptions.SingleSelection;
+ ThumbnailSize = ExplorerBrowserControl.ContentOptions.ThumbnailSize;
+ ViewMode = ExplorerBrowserControl.ContentOptions.ViewMode;
+ AlwaysNavigate = ExplorerBrowserControl.NavigationOptions.AlwaysNavigate;
+ NavigateOnce = ExplorerBrowserControl.NavigationOptions.NavigateOnce;
+ AdvancedQueryPane = ExplorerBrowserControl.NavigationOptions.PaneVisibility.AdvancedQuery;
+ CommandsPane = ExplorerBrowserControl.NavigationOptions.PaneVisibility.Commands;
+ CommandsOrganizePane = ExplorerBrowserControl.NavigationOptions.PaneVisibility.CommandsOrganize;
+ CommandsViewPane = ExplorerBrowserControl.NavigationOptions.PaneVisibility.CommandsView;
+ DetailsPane = ExplorerBrowserControl.NavigationOptions.PaneVisibility.Details;
+ NavigationPane = ExplorerBrowserControl.NavigationOptions.PaneVisibility.Navigation;
+ PreviewPane = ExplorerBrowserControl.NavigationOptions.PaneVisibility.Preview;
+ QueryPane = ExplorerBrowserControl.NavigationOptions.PaneVisibility.Query;
+ NavigationLogIndex = ExplorerBrowserControl.NavigationLog.CurrentLocationIndex;
+
+ if (itemsChanged.WaitOne(1, false))
+ {
+ items.Clear();
+ foreach (ShellObject obj in ExplorerBrowserControl.Items)
+ {
+ items.Add(obj);
+ }
+ }
+
+ if (selectionChanged.WaitOne(1, false))
+ {
+ selectionChangeWaitCount = 4;
+ }
+ else if (selectionChangeWaitCount > 0)
+ {
+ selectionChangeWaitCount--;
+
+ if (selectionChangeWaitCount == 0)
+ {
+ selectedItems.Clear();
+ foreach (ShellObject obj in ExplorerBrowserControl.SelectedItems)
+ {
+ selectedItems.Add(obj);
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// Synchronize NavigationLog collection to dependency collection
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="args"></param>
+ void NavigationLogChanged(object sender, NavigationLogEventArgs args)
+ {
+ navigationLog.Clear();
+ foreach (ShellObject obj in ExplorerBrowserControl.NavigationLog.Locations)
+ {
+ navigationLog.Add(obj);
+ }
+ }
+
+ /// <summary>
+ /// Synchronize SelectedItems collection to dependency collection
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="e"></param>
+ void SelectionChanged(object sender, EventArgs e)
+ {
+ selectionChanged.Set();
+ }
+
+ // Synchronize ItemsCollection to dependency collection
+ void ItemsChanged(object sender, EventArgs e)
+ {
+ itemsChanged.Set();
+ }
+
+ /// <summary>
+ /// The items in the ExplorerBrowser window
+ /// </summary>
+ public ObservableCollection<ShellObject> Items
+ {
+ get
+ {
+ return (ObservableCollection<ShellObject>)GetValue(ItemsProperty);
+ }
+ set
+ {
+ SetValue(ItemsPropertyKey, value);
+ }
+ }
+
+ private static readonly DependencyPropertyKey ItemsPropertyKey =
+ DependencyProperty.RegisterReadOnly(
+ "Items", typeof(ObservableCollection<ShellObject>),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(null));
+
+ /// <summary>
+ /// The items in the ExplorerBrowser window
+ /// </summary>
+ public static readonly DependencyProperty ItemsProperty = ItemsPropertyKey.DependencyProperty;
+
+ /// <summary>
+ /// The selected items in the ExplorerBrowser window
+ /// </summary>
+ public ObservableCollection<ShellObject> SelectedItems
+ {
+ get
+ {
+ return (ObservableCollection<ShellObject>)GetValue(SelectedItemsProperty);
+ }
+ internal set
+ {
+ SetValue(SelectedItemsPropertyKey, value);
+ }
+ }
+
+ private static readonly DependencyPropertyKey SelectedItemsPropertyKey =
+ DependencyProperty.RegisterReadOnly(
+ "SelectedItems", typeof(ObservableCollection<ShellObject>),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(null));
+
+ /// <summary>
+ /// The selected items in the ExplorerBrowser window
+ /// </summary>
+ public ObservableCollection<ShellObject> NavigationLog
+ {
+ get
+ {
+ return (ObservableCollection<ShellObject>)GetValue(NavigationLogProperty);
+ }
+ internal set
+ {
+ SetValue(NavigationLogPropertyKey, value);
+ }
+ }
+
+ private static readonly DependencyPropertyKey NavigationLogPropertyKey =
+ DependencyProperty.RegisterReadOnly(
+ "NavigationLog", typeof(ObservableCollection<ShellObject>),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(null));
+
+ /// <summary>
+ /// The NavigationLog
+ /// </summary>
+ public static readonly DependencyProperty NavigationLogProperty = NavigationLogPropertyKey.DependencyProperty;
+
+ /// <summary>
+ /// The selected items in the ExplorerBrowser window
+ /// </summary>
+ public static readonly DependencyProperty SelectedItemsProperty = SelectedItemsPropertyKey.DependencyProperty;
+
+
+ /// <summary>
+ /// The location the explorer browser is navigating to
+ /// </summary>
+ public ShellObject NavigationTarget
+ {
+ get
+ {
+ return (ShellObject)GetValue(NavigationTargetProperty);
+ }
+ set
+ {
+ SetValue(NavigationTargetProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The DependencyProperty for the NavigationTarget property
+ /// </summary>
+ public static readonly DependencyProperty NavigationTargetProperty =
+ DependencyProperty.Register(
+ "NavigationTarget", typeof(ShellObject),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(null, navigationTargetChanged));
+
+ private static void navigationTargetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+
+ if (instance.ExplorerBrowserControl.explorerBrowserControl != null)
+ {
+ instance.ExplorerBrowserControl.Navigate((ShellObject)e.NewValue);
+ }
+ else
+ {
+ instance.initialNavigationTarget = (ShellObject)e.NewValue;
+ }
+ }
+
+ /// <summary>
+ /// The view should be left-aligned.
+ /// </summary>
+ public bool AlignLeft
+ {
+ get { return (bool)GetValue(AlignLeftProperty); }
+ set { SetValue(AlignLeftProperty, value); }
+ }
+
+ internal static DependencyProperty AlignLeftProperty =
+ DependencyProperty.Register(
+ "AlignLeft", typeof(bool),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(false, OnAlignLeftChanged));
+
+ private static void OnAlignLeftChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ instance.ExplorerBrowserControl.ContentOptions.AlignLeft = (bool)e.NewValue;
+ }
+
+
+ /// <summary>
+ /// Automatically arrange the elements in the view.
+ /// </summary>
+ public bool AutoArrange
+ {
+ get { return (bool)GetValue(AutoArrangeProperty); }
+ set { SetValue(AutoArrangeProperty, value); }
+ }
+
+ internal static DependencyProperty AutoArrangeProperty =
+ DependencyProperty.Register(
+ "AutoArrange", typeof(bool),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(false, OnAutoArrangeChanged));
+
+ private static void OnAutoArrangeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ instance.ExplorerBrowserControl.ContentOptions.AutoArrange = (bool)e.NewValue;
+ }
+
+ /// <summary>
+ /// Turns on check mode for the view
+ /// </summary>
+ public bool CheckSelect
+ {
+ get { return (bool)GetValue(CheckSelectProperty); }
+ set { SetValue(CheckSelectProperty, value); }
+ }
+
+ internal static DependencyProperty CheckSelectProperty =
+ DependencyProperty.Register(
+ "CheckSelect", typeof(bool),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(false, OnCheckSelectChanged));
+
+ private static void OnCheckSelectChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ {
+ instance.ExplorerBrowserControl.ContentOptions.CheckSelect = (bool)e.NewValue;
+ }
+ }
+
+ /// <summary>
+ /// When the view is in "tile view mode" the layout of a single item should be extended to the width of the view.
+ /// </summary>
+ public bool ExtendedTiles
+ {
+ get { return (bool)GetValue(ExtendedTilesProperty); }
+ set { SetValue(ExtendedTilesProperty, value); }
+ }
+
+ internal static DependencyProperty ExtendedTilesProperty =
+ DependencyProperty.Register(
+ "ExtendedTiles", typeof(bool),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(false, OnExtendedTilesChanged));
+
+ private static void OnExtendedTilesChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ instance.ExplorerBrowserControl.ContentOptions.ExtendedTiles = (bool)e.NewValue;
+ }
+
+ /// <summary>
+ /// When an item is selected, the item and all its sub-items are highlighted.
+ /// </summary>
+ public bool FullRowSelect
+ {
+ get { return (bool)GetValue(FullRowSelectProperty); }
+ set { SetValue(FullRowSelectProperty, value); }
+ }
+
+ internal static DependencyProperty FullRowSelectProperty =
+ DependencyProperty.Register(
+ "FullRowSelect", typeof(bool),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(false, OnFullRowSelectChanged));
+
+ private static void OnFullRowSelectChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ {
+ instance.ExplorerBrowserControl.ContentOptions.FullRowSelect = (bool)e.NewValue;
+ }
+ }
+
+ /// <summary>
+ /// The view should not display file names
+ /// </summary>
+ public bool HideFileNames
+ {
+ get { return (bool)GetValue(HideFileNamesProperty); }
+ set { SetValue(HideFileNamesProperty, value); }
+ }
+
+ internal static DependencyProperty HideFileNamesProperty =
+ DependencyProperty.Register(
+ "HideFileNames", typeof(bool),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(false, OnHideFileNamesChanged));
+
+ private static void OnHideFileNamesChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ {
+ instance.ExplorerBrowserControl.ContentOptions.HideFileNames = (bool)e.NewValue;
+ }
+ }
+
+ /// <summary>
+ /// The view should not save view state in the browser.
+ /// </summary>
+ public bool NoBrowserViewState
+ {
+ get { return (bool)GetValue(NoBrowserViewStateProperty); }
+ set { SetValue(NoBrowserViewStateProperty, value); }
+ }
+
+ internal static DependencyProperty NoBrowserViewStateProperty =
+ DependencyProperty.Register(
+ "NoBrowserViewState", typeof(bool),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(false, OnNoBrowserViewStateChanged));
+
+ private static void OnNoBrowserViewStateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ {
+ instance.ExplorerBrowserControl.ContentOptions.NoBrowserViewState = (bool)e.NewValue;
+ }
+ }
+
+ /// <summary>
+ /// Do not display a column header in the view in any view mode.
+ /// </summary>
+ public bool NoColumnHeader
+ {
+ get { return (bool)GetValue(NoColumnHeaderProperty); }
+ set { SetValue(NoColumnHeaderProperty, value); }
+ }
+
+ internal static DependencyProperty NoColumnHeaderProperty =
+ DependencyProperty.Register(
+ "NoColumnHeader", typeof(bool),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(false, OnNoColumnHeaderChanged));
+
+ private static void OnNoColumnHeaderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ instance.ExplorerBrowserControl.ContentOptions.NoColumnHeader = (bool)e.NewValue;
+ }
+
+ /// <summary>
+ /// Only show the column header in details view mode.
+ /// </summary>
+ public bool NoHeaderInAllViews
+ {
+ get { return (bool)GetValue(NoHeaderInAllViewsProperty); }
+ set { SetValue(NoHeaderInAllViewsProperty, value); }
+ }
+
+ internal static DependencyProperty NoHeaderInAllViewsProperty =
+ DependencyProperty.Register(
+ "NoHeaderInAllViews", typeof(bool),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(false, OnNoHeaderInAllViewsChanged));
+
+ private static void OnNoHeaderInAllViewsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ {
+ instance.ExplorerBrowserControl.ContentOptions.NoHeaderInAllViews = (bool)e.NewValue;
+ }
+ }
+
+ /// <summary>
+ /// The view should not display icons.
+ /// </summary>
+ public bool NoIcons
+ {
+ get { return (bool)GetValue(NoIconsProperty); }
+ set { SetValue(NoIconsProperty, value); }
+ }
+
+ internal static DependencyProperty NoIconsProperty =
+ DependencyProperty.Register(
+ "NoIcons", typeof(bool),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(false, OnNoIconsChanged));
+
+ private static void OnNoIconsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ {
+ instance.ExplorerBrowserControl.ContentOptions.NoIcons = (bool)e.NewValue;
+ }
+ }
+
+ /// <summary>
+ /// Do not show subfolders.
+ /// </summary>
+ public bool NoSubfolders
+ {
+ get { return (bool)GetValue(NoSubfoldersProperty); }
+ set { SetValue(NoSubfoldersProperty, value); }
+ }
+
+ internal static DependencyProperty NoSubfoldersProperty =
+ DependencyProperty.Register(
+ "NoSubfolders", typeof(bool),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(false, OnNoSubfoldersChanged));
+
+ private static void OnNoSubfoldersChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ {
+ instance.ExplorerBrowserControl.ContentOptions.NoSubfolders = (bool)e.NewValue;
+ }
+ }
+
+ /// <summary>
+ /// Navigate with a single click
+ /// </summary>
+ public bool SingleClickActivate
+ {
+ get { return (bool)GetValue(SingleClickActivateProperty); }
+ set { SetValue(SingleClickActivateProperty, value); }
+ }
+
+ internal static DependencyProperty SingleClickActivateProperty =
+ DependencyProperty.Register(
+ "SingleClickActivate", typeof(bool),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(false, OnSingleClickActivateChanged));
+
+ private static void OnSingleClickActivateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ {
+ instance.ExplorerBrowserControl.ContentOptions.SingleClickActivate = (bool)e.NewValue;
+ }
+ }
+
+ /// <summary>
+ /// Do not allow more than a single item to be selected.
+ /// </summary>
+ public bool SingleSelection
+ {
+ get { return (bool)GetValue(SingleSelectionProperty); }
+ set { SetValue(SingleSelectionProperty, value); }
+ }
+
+ internal static DependencyProperty SingleSelectionProperty =
+ DependencyProperty.Register(
+ "SingleSelection", typeof(bool),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(false, OnSingleSelectionChanged));
+
+ private static void OnSingleSelectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ {
+ instance.ExplorerBrowserControl.ContentOptions.SingleSelection = (bool)e.NewValue;
+ }
+ }
+
+ /// <summary>
+ /// The size of the thumbnails in the explorer browser
+ /// </summary>
+ public int ThumbnailSize
+ {
+ get { return (int)GetValue(ThumbnailSizeProperty); }
+ set { SetValue(ThumbnailSizeProperty, value); }
+ }
+
+ internal static DependencyProperty ThumbnailSizeProperty =
+ DependencyProperty.Register(
+ "ThumbnailSize", typeof(int),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(32, OnThumbnailSizeChanged));
+
+ private static void OnThumbnailSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ {
+ instance.ExplorerBrowserControl.ContentOptions.ThumbnailSize = (int)e.NewValue;
+ }
+ }
+
+
+
+ /// <summary>
+ /// The various view modes of the explorer browser control
+ /// </summary>
+ public ExplorerBrowserViewMode ViewMode
+ {
+ get { return (ExplorerBrowserViewMode)GetValue(ViewModeProperty); }
+ set { SetValue(ViewModeProperty, value); }
+ }
+
+ internal static DependencyProperty ViewModeProperty =
+ DependencyProperty.Register(
+ "ViewMode", typeof(ExplorerBrowserViewMode),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(ExplorerBrowserViewMode.Auto, OnViewModeChanged));
+
+ private static void OnViewModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+
+ if (instance.ExplorerBrowserControl != null)
+ {
+ if (instance.ExplorerBrowserControl.explorerBrowserControl == null)
+ {
+ instance.initialViewMode = (ExplorerBrowserViewMode)e.NewValue;
+ }
+ else
+ {
+ instance.ExplorerBrowserControl.ContentOptions.ViewMode = (ExplorerBrowserViewMode)e.NewValue;
+ }
+ }
+ }
+
+
+ /// <summary>
+ /// Always navigate, even if you are attempting to navigate to the current folder.
+ /// </summary>
+ public bool AlwaysNavigate
+ {
+ get { return (bool)GetValue(AlwaysNavigateProperty); }
+ set { SetValue(AlwaysNavigateProperty, value); }
+ }
+
+ internal static DependencyProperty AlwaysNavigateProperty =
+ DependencyProperty.Register(
+ "AlwaysNavigate", typeof(bool),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(false, OnAlwaysNavigateChanged));
+
+ private static void OnAlwaysNavigateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ {
+ instance.ExplorerBrowserControl.NavigationOptions.AlwaysNavigate = (bool)e.NewValue;
+ }
+ }
+
+ /// <summary>
+ /// Do not navigate further than the initial navigation.
+ /// </summary>
+ public bool NavigateOnce
+ {
+ get { return (bool)GetValue(NavigateOnceProperty); }
+ set { SetValue(NavigateOnceProperty, value); }
+ }
+
+ internal static DependencyProperty NavigateOnceProperty =
+ DependencyProperty.Register(
+ "NavigateOnce", typeof(bool),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(false, OnNavigateOnceChanged));
+
+ private static void OnNavigateOnceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ {
+ instance.ExplorerBrowserControl.NavigationOptions.NavigateOnce = (bool)e.NewValue;
+ }
+ }
+
+ /// <summary>
+ /// Show/Hide the AdvancedQuery pane on subsequent navigation
+ /// </summary>
+ public PaneVisibilityState AdvancedQueryPane
+ {
+ get { return (PaneVisibilityState)GetValue(AdvancedQueryPaneProperty); }
+ set { SetValue(AdvancedQueryPaneProperty, value); }
+ }
+
+ internal static DependencyProperty AdvancedQueryPaneProperty =
+ DependencyProperty.Register(
+ "AdvancedQueryPane", typeof(PaneVisibilityState),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(PaneVisibilityState.DoNotCare, OnAdvancedQueryPaneChanged));
+
+ private static void OnAdvancedQueryPaneChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ {
+ instance.ExplorerBrowserControl.NavigationOptions.PaneVisibility.AdvancedQuery = (PaneVisibilityState)e.NewValue;
+ }
+ }
+
+ /// <summary>
+ /// Show/Hide the Commands pane on subsequent navigation
+ /// </summary>
+ public PaneVisibilityState CommandsPane
+ {
+ get { return (PaneVisibilityState)GetValue(CommandsPaneProperty); }
+ set { SetValue(CommandsPaneProperty, value); }
+ }
+
+ internal static DependencyProperty CommandsPaneProperty =
+ DependencyProperty.Register(
+ "CommandsPane", typeof(PaneVisibilityState),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(PaneVisibilityState.DoNotCare, OnCommandsPaneChanged));
+
+ private static void OnCommandsPaneChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ {
+ instance.ExplorerBrowserControl.NavigationOptions.PaneVisibility.Commands =
+ (PaneVisibilityState)e.NewValue;
+ }
+ }
+
+ /// <summary>
+ /// Show/Hide the Organize menu in the Commands pane on subsequent navigation
+ /// </summary>
+ public PaneVisibilityState CommandsOrganizePane
+ {
+ get { return (PaneVisibilityState)GetValue(CommandsOrganizePaneProperty); }
+ set { SetValue(CommandsOrganizePaneProperty, value); }
+ }
+
+ internal static DependencyProperty CommandsOrganizePaneProperty =
+ DependencyProperty.Register(
+ "CommandsOrganizePane", typeof(PaneVisibilityState),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(PaneVisibilityState.DoNotCare, OnCommandsOrganizePaneChanged));
+
+ private static void OnCommandsOrganizePaneChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ {
+ instance.ExplorerBrowserControl.NavigationOptions.PaneVisibility.CommandsOrganize =
+ (PaneVisibilityState)e.NewValue;
+ }
+ }
+
+ /// <summary>
+ /// Show/Hide the View menu in the Commands pane on subsequent navigation
+ /// </summary>
+ public PaneVisibilityState CommandsViewPane
+ {
+ get { return (PaneVisibilityState)GetValue(CommandsViewPaneProperty); }
+ set { SetValue(CommandsViewPaneProperty, value); }
+ }
+
+ internal static DependencyProperty CommandsViewPaneProperty =
+ DependencyProperty.Register(
+ "CommandsViewPane", typeof(PaneVisibilityState),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(PaneVisibilityState.DoNotCare, OnCommandsViewPaneChanged));
+
+ private static void OnCommandsViewPaneChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ {
+ instance.ExplorerBrowserControl.NavigationOptions.PaneVisibility.CommandsView = (PaneVisibilityState)e.NewValue;
+ }
+ }
+
+ /// <summary>
+ /// Show/Hide the Details pane on subsequent navigation
+ /// </summary>
+ public PaneVisibilityState DetailsPane
+ {
+ get { return (PaneVisibilityState)GetValue(DetailsPaneProperty); }
+ set { SetValue(DetailsPaneProperty, value); }
+ }
+
+ internal static DependencyProperty DetailsPaneProperty =
+ DependencyProperty.Register(
+ "DetailsPane", typeof(PaneVisibilityState),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(PaneVisibilityState.DoNotCare, OnDetailsPaneChanged));
+
+ private static void OnDetailsPaneChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ {
+ instance.ExplorerBrowserControl.NavigationOptions.PaneVisibility.Details = (PaneVisibilityState)e.NewValue;
+ }
+ }
+
+ /// <summary>
+ /// Show/Hide the Navigation pane on subsequent navigation
+ /// </summary>
+ public PaneVisibilityState NavigationPane
+ {
+ get { return (PaneVisibilityState)GetValue(NavigationPaneProperty); }
+ set { SetValue(NavigationPaneProperty, value); }
+ }
+
+ internal static DependencyProperty NavigationPaneProperty =
+ DependencyProperty.Register(
+ "NavigationPane", typeof(PaneVisibilityState),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(PaneVisibilityState.DoNotCare, OnNavigationPaneChanged));
+
+ private static void OnNavigationPaneChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ {
+ instance.ExplorerBrowserControl.NavigationOptions.PaneVisibility.Navigation = (PaneVisibilityState)e.NewValue;
+ }
+ }
+
+ /// <summary>
+ /// Show/Hide the Preview pane on subsequent navigation
+ /// </summary>
+ public PaneVisibilityState PreviewPane
+ {
+ get { return (PaneVisibilityState)GetValue(PreviewPaneProperty); }
+ set { SetValue(PreviewPaneProperty, value); }
+ }
+
+ internal static DependencyProperty PreviewPaneProperty =
+ DependencyProperty.Register(
+ "PreviewPane", typeof(PaneVisibilityState),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(PaneVisibilityState.DoNotCare, OnPreviewPaneChanged));
+
+ private static void OnPreviewPaneChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ {
+ instance.ExplorerBrowserControl.NavigationOptions.PaneVisibility.Preview = (PaneVisibilityState)e.NewValue;
+ }
+ }
+
+ /// <summary>
+ /// Show/Hide the Query pane on subsequent navigation
+ /// </summary>
+ public PaneVisibilityState QueryPane
+ {
+ get { return (PaneVisibilityState)GetValue(QueryPaneProperty); }
+ set { SetValue(QueryPaneProperty, value); }
+ }
+
+ internal static DependencyProperty QueryPaneProperty =
+ DependencyProperty.Register(
+ "QueryPane", typeof(PaneVisibilityState),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(PaneVisibilityState.DoNotCare, OnQueryPaneChanged));
+
+ private static void OnQueryPaneChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ {
+ instance.ExplorerBrowserControl.NavigationOptions.PaneVisibility.Query = (PaneVisibilityState)e.NewValue;
+ }
+ }
+
+
+ /// <summary>
+ /// Navigation log index
+ /// </summary>
+ public int NavigationLogIndex
+ {
+ get { return (int)GetValue(NavigationLogIndexProperty); }
+ set { SetValue(NavigationLogIndexProperty, value); }
+ }
+
+ internal static DependencyProperty NavigationLogIndexProperty =
+ DependencyProperty.Register(
+ "NavigationLogIndex", typeof(int),
+ typeof(ExplorerBrowser),
+ new PropertyMetadata(0, OnNavigationLogIndexChanged));
+
+ private static void OnNavigationLogIndexChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ExplorerBrowser instance = d as ExplorerBrowser;
+ if (instance.ExplorerBrowserControl != null)
+ instance.ExplorerBrowserControl.NavigationLog.NavigateLog((int)e.NewValue);
+ }
+
+
+ #region IDisposable Members
+
+ /// <summary>
+ /// Disposes the class
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Disposes the browser.
+ /// </summary>
+ /// <param name="disposed"></param>
+ protected virtual void Dispose(bool disposed)
+ {
+ if (disposed)
+ {
+ if (itemsChanged != null)
+ {
+ itemsChanged.Close();
+ }
+
+ if (selectionChanged != null)
+ {
+ selectionChanged.Close();
+ }
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowser.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowser.cs
new file mode 100644
index 0000000000..29ff0921cf
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowser.cs
@@ -0,0 +1,889 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Runtime.InteropServices;
+using System.Windows.Forms;
+using Microsoft.WindowsAPICodePack.Shell;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+using System.Text;
+using System.Linq;
+using Microsoft.WindowsAPICodePack.Shell.Interop;
+
+namespace Microsoft.WindowsAPICodePack.Controls.WindowsForms
+{
+ /// <summary>
+ /// This class is a wrapper around the Windows Explorer Browser control.
+ /// </summary>
+ public sealed class ExplorerBrowser :
+ System.Windows.Forms.UserControl,
+ Microsoft.WindowsAPICodePack.Controls.IServiceProvider,
+ IExplorerPaneVisibility,
+ IExplorerBrowserEvents,
+ ICommDlgBrowser3,
+ IMessageFilter
+ {
+ #region properties
+ /// <summary>
+ /// Options that control how the ExplorerBrowser navigates
+ /// </summary>
+ public ExplorerBrowserNavigationOptions NavigationOptions { get; private set; }
+
+ /// <summary>
+ /// Options that control how the content of the ExplorerBorwser looks
+ /// </summary>
+ public ExplorerBrowserContentOptions ContentOptions { get; private set; }
+
+ private IShellItemArray shellItemsArray;
+ private ShellObjectCollection itemsCollection;
+ /// <summary>
+ /// The set of ShellObjects in the Explorer Browser
+ /// </summary>
+ public ShellObjectCollection Items
+ {
+ get
+ {
+ if (shellItemsArray != null)
+ {
+ Marshal.ReleaseComObject(shellItemsArray);
+ }
+
+ if (itemsCollection != null)
+ {
+ itemsCollection.Dispose();
+ itemsCollection = null;
+ }
+
+ shellItemsArray = GetItemsArray();
+ itemsCollection = new ShellObjectCollection(shellItemsArray, true);
+
+ return itemsCollection;
+ }
+ }
+
+ private IShellItemArray selectedShellItemsArray;
+ private ShellObjectCollection selectedItemsCollection;
+ /// <summary>
+ /// The set of selected ShellObjects in the Explorer Browser
+ /// </summary>
+ public ShellObjectCollection SelectedItems
+ {
+ get
+ {
+ if (selectedShellItemsArray != null)
+ {
+ Marshal.ReleaseComObject(selectedShellItemsArray);
+ }
+
+ if (selectedItemsCollection != null)
+ {
+ selectedItemsCollection.Dispose();
+ selectedItemsCollection = null;
+ }
+
+ selectedShellItemsArray = GetSelectedItemsArray();
+ selectedItemsCollection = new ShellObjectCollection(selectedShellItemsArray, true);
+
+ return selectedItemsCollection;
+ }
+ }
+
+ /// <summary>
+ /// Contains the navigation history of the ExplorerBrowser
+ /// </summary>
+ public ExplorerBrowserNavigationLog NavigationLog { get; private set; }
+
+ /// <summary>
+ /// The name of the property bag used to persist changes to the ExplorerBrowser's view state.
+ /// </summary>
+ public string PropertyBagName
+ {
+ get { return propertyBagName; }
+ set
+ {
+ propertyBagName = value;
+ if (explorerBrowserControl != null)
+ {
+ explorerBrowserControl.SetPropertyBag(propertyBagName);
+ }
+ }
+ }
+
+ #endregion
+
+ #region operations
+ /// <summary>
+ /// Clears the Explorer Browser of existing content, fills it with
+ /// content from the specified container, and adds a new point to the Travel Log.
+ /// </summary>
+ /// <param name="shellObject">The shell container to navigate to.</param>
+ /// <exception cref="System.Runtime.InteropServices.COMException">Will throw if navigation fails for any other reason.</exception>
+ public void Navigate(ShellObject shellObject)
+ {
+ if (shellObject == null)
+ {
+ throw new ArgumentNullException("shellObject");
+ }
+
+ if (explorerBrowserControl == null)
+ {
+ antecreationNavigationTarget = shellObject;
+ }
+ else
+ {
+ HResult hr = explorerBrowserControl.BrowseToObject(shellObject.NativeShellItem, 0);
+ if (hr != HResult.Ok)
+ {
+ if ((hr == HResult.ResourceInUse || hr == HResult.Canceled) && NavigationFailed != null)
+ {
+ NavigationFailedEventArgs args = new NavigationFailedEventArgs();
+ args.FailedLocation = shellObject;
+ NavigationFailed(this, args);
+ }
+ else
+ {
+ throw new CommonControlException(LocalizedMessages.ExplorerBrowserBrowseToObjectFailed, hr);
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// Navigates within the navigation log. This does not change the set of
+ /// locations in the navigation log.
+ /// </summary>
+ /// <param name="direction">Forward of Backward</param>
+ /// <returns>True if the navigation succeeded, false if it failed for any reason.</returns>
+ public bool NavigateLogLocation(NavigationLogDirection direction)
+ {
+ return NavigationLog.NavigateLog(direction);
+ }
+
+ /// <summary>
+ /// Navigate within the navigation log. This does not change the set of
+ /// locations in the navigation log.
+ /// </summary>
+ /// <param name="navigationLogIndex">An index into the navigation logs Locations collection.</param>
+ /// <returns>True if the navigation succeeded, false if it failed for any reason.</returns>
+ public bool NavigateLogLocation(int navigationLogIndex)
+ {
+ return NavigationLog.NavigateLog(navigationLogIndex);
+ }
+ #endregion
+
+ #region events
+
+ /// <summary>
+ /// Fires when the SelectedItems collection changes.
+ /// </summary>
+ public event EventHandler SelectionChanged;
+
+ /// <summary>
+ /// Fires when the Items colection changes.
+ /// </summary>
+ public event EventHandler ItemsChanged;
+
+ /// <summary>
+ /// Fires when a navigation has been initiated, but is not yet complete.
+ /// </summary>
+ public event EventHandler<NavigationPendingEventArgs> NavigationPending;
+
+ /// <summary>
+ /// Fires when a navigation has been 'completed': no NavigationPending listener
+ /// has cancelled, and the ExplorerBorwser has created a new view. The view
+ /// will be populated with new items asynchronously, and ItemsChanged will be
+ /// fired to reflect this some time later.
+ /// </summary>
+ public event EventHandler<NavigationCompleteEventArgs> NavigationComplete;
+
+ /// <summary>
+ /// Fires when either a NavigationPending listener cancels the navigation, or
+ /// if the operating system determines that navigation is not possible.
+ /// </summary>
+ public event EventHandler<NavigationFailedEventArgs> NavigationFailed;
+
+ /// <summary>
+ /// Fires when the ExplorerBorwser view has finished enumerating files.
+ /// </summary>
+ public event EventHandler ViewEnumerationComplete;
+
+ /// <summary>
+ /// Fires when the item selected in the view has changed (i.e., a rename ).
+ /// This is not the same as SelectionChanged.
+ /// </summary>
+ public event EventHandler ViewSelectedItemChanged;
+
+ #endregion
+
+ #region implementation
+
+ #region construction
+ internal ExplorerBrowserClass explorerBrowserControl;
+
+ // for the IExplorerBrowserEvents Advise call
+ internal uint eventsCookie;
+
+ // name of the property bag that contains the view state options of the browser
+ string propertyBagName = typeof(ExplorerBrowser).FullName;
+
+ /// <summary>
+ /// Initializes the ExplorerBorwser WinForms wrapper.
+ /// </summary>
+ public ExplorerBrowser()
+ : base()
+ {
+ NavigationOptions = new ExplorerBrowserNavigationOptions(this);
+ ContentOptions = new ExplorerBrowserContentOptions(this);
+ NavigationLog = new ExplorerBrowserNavigationLog(this);
+ }
+
+ #endregion
+
+ #region message handlers
+
+ /// <summary>
+ /// Displays a placeholder for the explorer browser in design mode
+ /// </summary>
+ /// <param name="e">Contains information about the paint event.</param>
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ if (DesignMode && e != null)
+ {
+ using (LinearGradientBrush linGrBrush = new LinearGradientBrush(
+ ClientRectangle,
+ Color.Aqua,
+ Color.CadetBlue,
+ LinearGradientMode.ForwardDiagonal))
+ {
+ e.Graphics.FillRectangle(linGrBrush, ClientRectangle);
+ }
+
+ using (Font font = new Font("Garamond", 30))
+ {
+ using (StringFormat sf = new StringFormat())
+ {
+ sf.Alignment = StringAlignment.Center;
+ sf.LineAlignment = StringAlignment.Center;
+ e.Graphics.DrawString(
+ "ExplorerBrowserControl",
+ font,
+ Brushes.White,
+ ClientRectangle,
+ sf);
+ }
+ }
+ }
+
+ base.OnPaint(e);
+ }
+
+ ShellObject antecreationNavigationTarget;
+ ExplorerBrowserViewEvents viewEvents;
+
+ /// <summary>
+ /// Creates and initializes the native ExplorerBrowser control
+ /// </summary>
+ protected override void OnCreateControl()
+ {
+ base.OnCreateControl();
+
+ if (this.DesignMode == false)
+ {
+ explorerBrowserControl = new ExplorerBrowserClass();
+
+ // hooks up IExplorerPaneVisibility and ICommDlgBrowser event notifications
+ ExplorerBrowserNativeMethods.IUnknown_SetSite(explorerBrowserControl, this);
+
+ // hooks up IExplorerBrowserEvents event notification
+ explorerBrowserControl.Advise(
+ Marshal.GetComInterfaceForObject(this, typeof(IExplorerBrowserEvents)),
+ out eventsCookie);
+
+ // sets up ExplorerBrowser view connection point events
+ viewEvents = new ExplorerBrowserViewEvents(this);
+
+ NativeRect rect = new NativeRect();
+ rect.Top = ClientRectangle.Top;
+ rect.Left = ClientRectangle.Left;
+ rect.Right = ClientRectangle.Right;
+ rect.Bottom = ClientRectangle.Bottom;
+
+ explorerBrowserControl.Initialize(this.Handle, ref rect, null);
+
+ // Force an initial show frames so that IExplorerPaneVisibility works the first time it is set.
+ // This also enables the control panel to be browsed to. If it is not set, then navigating to
+ // the control panel succeeds, but no items are visible in the view.
+ explorerBrowserControl.SetOptions(ExplorerBrowserOptions.ShowFrames);
+
+ explorerBrowserControl.SetPropertyBag(propertyBagName);
+
+ if (antecreationNavigationTarget != null)
+ {
+ BeginInvoke(new MethodInvoker(
+ delegate
+ {
+ Navigate(antecreationNavigationTarget);
+ antecreationNavigationTarget = null;
+ }));
+ }
+ }
+
+ Application.AddMessageFilter(this);
+ }
+
+ /// <summary>
+ /// Sizes the native control to match the WinForms control wrapper.
+ /// </summary>
+ /// <param name="e">Contains information about the size changed event.</param>
+ protected override void OnSizeChanged(EventArgs e)
+ {
+ if (explorerBrowserControl != null)
+ {
+ NativeRect rect = new NativeRect();
+ rect.Top = ClientRectangle.Top;
+ rect.Left = ClientRectangle.Left;
+ rect.Right = ClientRectangle.Right;
+ rect.Bottom = ClientRectangle.Bottom;
+
+ IntPtr ptr = IntPtr.Zero;
+ explorerBrowserControl.SetRect(ref ptr, rect);
+ }
+
+ base.OnSizeChanged(e);
+ }
+
+ /// <summary>
+ /// Cleans up the explorer browser events+object when the window is being taken down.
+ /// </summary>
+ /// <param name="e">An EventArgs that contains event data.</param>
+ protected override void OnHandleDestroyed(EventArgs e)
+ {
+ if (explorerBrowserControl != null)
+ {
+ // unhook events
+ viewEvents.DisconnectFromView();
+ explorerBrowserControl.Unadvise(eventsCookie);
+ ExplorerBrowserNativeMethods.IUnknown_SetSite(explorerBrowserControl, null);
+
+ // destroy the explorer browser control
+ explorerBrowserControl.Destroy();
+
+ // release com reference to it
+ Marshal.ReleaseComObject(explorerBrowserControl);
+ explorerBrowserControl = null;
+ }
+
+ base.OnHandleDestroyed(e);
+ }
+ #endregion
+
+ #region object interfaces
+
+ #region IServiceProvider
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="guidService">calling service</param>
+ /// <param name="riid">requested interface guid</param>
+ /// <param name="ppvObject">caller-allocated memory for interface pointer</param>
+ /// <returns></returns>
+ HResult Microsoft.WindowsAPICodePack.Controls.IServiceProvider.QueryService(
+ ref Guid guidService, ref Guid riid, out IntPtr ppvObject)
+ {
+ HResult hr = HResult.Ok;
+
+ if (guidService.CompareTo(new Guid(ExplorerBrowserIIDGuid.IExplorerPaneVisibility)) == 0)
+ {
+ // Responding to this SID allows us to control the visibility of the
+ // explorer browser panes
+ ppvObject =
+ Marshal.GetComInterfaceForObject(this, typeof(IExplorerPaneVisibility));
+ hr = HResult.Ok;
+ }
+ else if (guidService.CompareTo(new Guid(ExplorerBrowserIIDGuid.ICommDlgBrowser)) == 0)
+ {
+ if (riid.CompareTo(new Guid(ExplorerBrowserIIDGuid.ICommDlgBrowser)) == 0)
+ {
+ ppvObject = Marshal.GetComInterfaceForObject(this, typeof(ICommDlgBrowser3));
+ hr = HResult.Ok;
+ }
+ // The below lines are commented out to decline requests for the ICommDlgBrowser2 interface.
+ // This interface is incorrectly marshaled back to unmanaged, and causes an exception.
+ // There is a bug for this, I have not figured the underlying cause.
+ // Remove this comment and uncomment the following code to enable the ICommDlgBrowser2 interface
+ //else if (riid.CompareTo(new Guid(ExplorerBrowserIIDGuid.ICommDlgBrowser2)) == 0)
+ //{
+ // ppvObject = Marshal.GetComInterfaceForObject(this, typeof(ICommDlgBrowser3));
+ // hr = HResult.Ok;
+ //}
+ else if (riid.CompareTo(new Guid(ExplorerBrowserIIDGuid.ICommDlgBrowser3)) == 0)
+ {
+ ppvObject = Marshal.GetComInterfaceForObject(this, typeof(ICommDlgBrowser3));
+ hr = HResult.Ok;
+ }
+ else
+ {
+ ppvObject = IntPtr.Zero;
+ hr = HResult.NoInterface;
+ }
+ }
+ else
+ {
+ IntPtr nullObj = IntPtr.Zero;
+ ppvObject = nullObj;
+ hr = HResult.NoInterface;
+ }
+
+ return hr;
+ }
+ #endregion
+
+ #region IExplorerPaneVisibility
+ /// <summary>
+ /// Controls the visibility of the explorer borwser panes
+ /// </summary>
+ /// <param name="explorerPane">a guid identifying the pane</param>
+ /// <param name="peps">the pane state desired</param>
+ /// <returns></returns>
+ HResult IExplorerPaneVisibility.GetPaneState(ref Guid explorerPane, out ExplorerPaneState peps)
+ {
+ switch (explorerPane.ToString())
+ {
+ case ExplorerBrowserViewPanes.AdvancedQuery:
+ peps = VisibilityToPaneState(NavigationOptions.PaneVisibility.AdvancedQuery);
+ break;
+ case ExplorerBrowserViewPanes.Commands:
+ peps = VisibilityToPaneState(NavigationOptions.PaneVisibility.Commands);
+ break;
+ case ExplorerBrowserViewPanes.CommandsOrganize:
+ peps = VisibilityToPaneState(NavigationOptions.PaneVisibility.CommandsOrganize);
+ break;
+ case ExplorerBrowserViewPanes.CommandsView:
+ peps = VisibilityToPaneState(NavigationOptions.PaneVisibility.CommandsView);
+ break;
+ case ExplorerBrowserViewPanes.Details:
+ peps = VisibilityToPaneState(NavigationOptions.PaneVisibility.Details);
+ break;
+ case ExplorerBrowserViewPanes.Navigation:
+ peps = VisibilityToPaneState(NavigationOptions.PaneVisibility.Navigation);
+ break;
+ case ExplorerBrowserViewPanes.Preview:
+ peps = VisibilityToPaneState(NavigationOptions.PaneVisibility.Preview);
+ break;
+ case ExplorerBrowserViewPanes.Query:
+ peps = VisibilityToPaneState(NavigationOptions.PaneVisibility.Query);
+ break;
+ default:
+#if LOG_UNKNOWN_PANES
+ System.Diagnostics.Debugger.Log( 4, "ExplorerBrowser", "unknown pane view state. id=" + explorerPane.ToString( ) );
+#endif
+ peps = VisibilityToPaneState(PaneVisibilityState.Show);
+ break;
+ }
+
+ return HResult.Ok;
+ }
+
+ private static ExplorerPaneState VisibilityToPaneState(PaneVisibilityState visibility)
+ {
+ switch (visibility)
+ {
+ case PaneVisibilityState.DoNotCare:
+ return ExplorerPaneState.DoNotCare;
+
+ case PaneVisibilityState.Hide:
+ return ExplorerPaneState.DefaultOff | ExplorerPaneState.Force;
+
+ case PaneVisibilityState.Show:
+ return ExplorerPaneState.DefaultOn | ExplorerPaneState.Force;
+
+ default:
+ throw new ArgumentException("unexpected PaneVisibilityState");
+ }
+ }
+
+ #endregion
+
+ #region IExplorerBrowserEvents
+ HResult IExplorerBrowserEvents.OnNavigationPending(IntPtr pidlFolder)
+ {
+ bool canceled = false;
+
+ if (NavigationPending != null)
+ {
+ NavigationPendingEventArgs args = new NavigationPendingEventArgs();
+
+ // For some special items (like network machines), ShellObject.FromIDList
+ // might return null
+ args.PendingLocation = ShellObjectFactory.Create(pidlFolder);
+
+ if (args.PendingLocation != null)
+ {
+ foreach (Delegate del in NavigationPending.GetInvocationList())
+ {
+ del.DynamicInvoke(new object[] { this, args });
+ if (args.Cancel)
+ {
+ canceled = true;
+ }
+ }
+ }
+ }
+
+ return canceled ? HResult.Canceled : HResult.Ok;
+ }
+
+ HResult IExplorerBrowserEvents.OnViewCreated(object psv)
+ {
+ viewEvents.ConnectToView((IShellView)psv);
+
+ return HResult.Ok;
+ }
+
+ HResult IExplorerBrowserEvents.OnNavigationComplete(IntPtr pidlFolder)
+ {
+ // view mode may change
+ ContentOptions.folderSettings.ViewMode = GetCurrentViewMode();
+
+ if (NavigationComplete != null)
+ {
+ NavigationCompleteEventArgs args = new NavigationCompleteEventArgs();
+ args.NewLocation = ShellObjectFactory.Create(pidlFolder);
+ NavigationComplete(this, args);
+ }
+ return HResult.Ok;
+ }
+
+ HResult IExplorerBrowserEvents.OnNavigationFailed(IntPtr pidlFolder)
+ {
+ if (NavigationFailed != null)
+ {
+ NavigationFailedEventArgs args = new NavigationFailedEventArgs();
+ args.FailedLocation = ShellObjectFactory.Create(pidlFolder);
+ NavigationFailed(this, args);
+ }
+ return HResult.Ok;
+ }
+ #endregion
+
+ #region ICommDlgBrowser
+ HResult ICommDlgBrowser3.OnDefaultCommand(IntPtr ppshv)
+ {
+ return HResult.False;
+ //return HResult.Ok;
+ }
+
+ HResult ICommDlgBrowser3.OnStateChange(IntPtr ppshv, CommDlgBrowserStateChange uChange)
+ {
+ if (uChange == CommDlgBrowserStateChange.SelectionChange)
+ {
+ FireSelectionChanged();
+ }
+
+ return HResult.Ok;
+ }
+
+ HResult ICommDlgBrowser3.IncludeObject(IntPtr ppshv, IntPtr pidl)
+ {
+ // items in the view have changed, so the collections need updating
+ FireContentChanged();
+
+ return HResult.Ok;
+ }
+
+ #endregion
+
+ #region ICommDlgBrowser2 Members
+
+ // The below methods can be called into, but marshalling the response causes an exception to be
+ // thrown from unmanaged code. At this time, I decline calls requesting the ICommDlgBrowser2
+ // interface. This is logged as a bug, but moved to less of a priority, as it only affects being
+ // able to change the default action text for remapping the default action.
+
+ HResult ICommDlgBrowser3.GetDefaultMenuText(IShellView shellView, IntPtr text, int cchMax)
+ {
+ return HResult.False;
+ //return HResult.Ok;
+ //OK if new
+ //False if default
+ //other if error
+ }
+
+ HResult ICommDlgBrowser3.GetViewFlags(out uint pdwFlags)
+ {
+ //var flags = CommDlgBrowser2ViewFlags.NoSelectVerb;
+ //Marshal.WriteInt32(pdwFlags, 0);
+ pdwFlags = (uint)CommDlgBrowser2ViewFlags.ShowAllFiles;
+ return HResult.Ok;
+ }
+
+ HResult ICommDlgBrowser3.Notify(IntPtr pshv, CommDlgBrowserNotifyType notifyType)
+ {
+ return HResult.Ok;
+ }
+
+ #endregion
+
+ #region ICommDlgBrowser3 Members
+
+ HResult ICommDlgBrowser3.GetCurrentFilter(StringBuilder pszFileSpec, int cchFileSpec)
+ {
+ // If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
+ return HResult.Ok;
+ }
+
+ HResult ICommDlgBrowser3.OnColumnClicked(IShellView ppshv, int iColumn)
+ {
+ // If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
+ return HResult.Ok;
+ }
+
+ HResult ICommDlgBrowser3.OnPreViewCreated(IShellView ppshv)
+ {
+ // If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code
+ return HResult.Ok;
+ }
+
+ #endregion
+
+ #region IMessageFilter Members
+
+ bool IMessageFilter.PreFilterMessage(ref System.Windows.Forms.Message m)
+ {
+ HResult hr = HResult.False;
+ if (explorerBrowserControl != null)
+ {
+ // translate keyboard input
+ hr = ((IInputObject)explorerBrowserControl).TranslateAcceleratorIO(ref m);
+ }
+ return (hr == HResult.Ok);
+ }
+
+ #endregion
+
+ #endregion
+
+ #region utilities
+
+ /// <summary>
+ /// Returns the current view mode of the browser
+ /// </summary>
+ /// <returns></returns>
+ internal FolderViewMode GetCurrentViewMode()
+ {
+ IFolderView2 ifv2 = GetFolderView2();
+ uint viewMode = 0;
+ if (ifv2 != null)
+ {
+ try
+ {
+ HResult hr = ifv2.GetCurrentViewMode(out viewMode);
+ if (hr != HResult.Ok) { throw new ShellException(hr); }
+ }
+ finally
+ {
+ Marshal.ReleaseComObject(ifv2);
+ ifv2 = null;
+ }
+ }
+ return (FolderViewMode)viewMode;
+ }
+
+ /// <summary>
+ /// Gets the IFolderView2 interface from the explorer browser.
+ /// </summary>
+ /// <returns></returns>
+ internal IFolderView2 GetFolderView2()
+ {
+ Guid iid = new Guid(ExplorerBrowserIIDGuid.IFolderView2);
+ IntPtr view = IntPtr.Zero;
+ if (this.explorerBrowserControl != null)
+ {
+ HResult hr = this.explorerBrowserControl.GetCurrentView(ref iid, out view);
+ switch (hr)
+ {
+ case HResult.Ok:
+ break;
+
+ case HResult.NoInterface:
+ case HResult.Fail:
+#if LOG_KNOWN_COM_ERRORS
+ Debugger.Log( 2, "ExplorerBrowser", "Unable to obtain view. Error=" + e.ToString( ) );
+#endif
+ return null;
+
+ default:
+ throw new CommonControlException(LocalizedMessages.ExplorerBrowserFailedToGetView, hr);
+ }
+
+ return (IFolderView2)Marshal.GetObjectForIUnknown(view);
+ }
+ return null;
+ }
+
+ /// <summary>
+ /// Gets the selected items in the explorer browser as an IShellItemArray
+ /// </summary>
+ /// <returns></returns>
+ internal IShellItemArray GetSelectedItemsArray()
+ {
+ IShellItemArray iArray = null;
+ IFolderView2 iFV2 = GetFolderView2();
+ if (iFV2 != null)
+ {
+ try
+ {
+ Guid iidShellItemArray = new Guid(ShellIIDGuid.IShellItemArray);
+ object oArray = null;
+ HResult hr = iFV2.Items((uint)ShellViewGetItemObject.Selection, ref iidShellItemArray, out oArray);
+ iArray = oArray as IShellItemArray;
+ if (hr != HResult.Ok &&
+ hr != HResult.ElementNotFound &&
+ hr != HResult.Fail)
+ {
+ throw new CommonControlException(LocalizedMessages.ExplorerBrowserUnexpectedError, hr);
+ }
+ }
+ finally
+ {
+ Marshal.ReleaseComObject(iFV2);
+ iFV2 = null;
+ }
+ }
+
+ return iArray;
+ }
+
+ internal int GetItemsCount()
+ {
+ int itemsCount = 0;
+
+ IFolderView2 iFV2 = GetFolderView2();
+ if (iFV2 != null)
+ {
+ try
+ {
+ HResult hr = iFV2.ItemCount((uint)ShellViewGetItemObject.AllView, out itemsCount);
+
+ if (hr != HResult.Ok &&
+ hr != HResult.ElementNotFound &&
+ hr != HResult.Fail)
+ {
+ throw new CommonControlException(LocalizedMessages.ExplorerBrowserItemCount, hr);
+ }
+ }
+ finally
+ {
+ Marshal.ReleaseComObject(iFV2);
+ iFV2 = null;
+ }
+ }
+
+ return itemsCount;
+ }
+
+ internal int GetSelectedItemsCount()
+ {
+ int itemsCount = 0;
+
+ IFolderView2 iFV2 = GetFolderView2();
+ if (iFV2 != null)
+ {
+ try
+ {
+ HResult hr = iFV2.ItemCount((uint)ShellViewGetItemObject.Selection, out itemsCount);
+
+ if (hr != HResult.Ok &&
+ hr != HResult.ElementNotFound &&
+ hr != HResult.Fail)
+ {
+ throw new CommonControlException(LocalizedMessages.ExplorerBrowserSelectedItemCount, hr);
+ }
+ }
+ finally
+ {
+ Marshal.ReleaseComObject(iFV2);
+ iFV2 = null;
+ }
+ }
+
+ return itemsCount;
+ }
+
+ /// <summary>
+ /// Gets the items in the ExplorerBrowser as an IShellItemArray
+ /// </summary>
+ /// <returns></returns>
+ internal IShellItemArray GetItemsArray()
+ {
+ IShellItemArray iArray = null;
+ IFolderView2 iFV2 = GetFolderView2();
+ if (iFV2 != null)
+ {
+ try
+ {
+ Guid iidShellItemArray = new Guid(ShellIIDGuid.IShellItemArray);
+ object oArray = null;
+ HResult hr = iFV2.Items((uint)ShellViewGetItemObject.AllView, ref iidShellItemArray, out oArray);
+ if (hr != HResult.Ok &&
+ hr != HResult.Fail &&
+ hr != HResult.ElementNotFound &&
+ hr != HResult.InvalidArguments)
+ {
+ throw new CommonControlException(LocalizedMessages.ExplorerBrowserViewItems, hr);
+ }
+
+ iArray = oArray as IShellItemArray;
+ }
+ finally
+ {
+ Marshal.ReleaseComObject(iFV2);
+ iFV2 = null;
+ }
+ }
+ return iArray;
+ }
+
+ #endregion
+
+ #region view event forwarding
+ internal void FireSelectionChanged()
+ {
+ if (SelectionChanged != null)
+ {
+ SelectionChanged(this, EventArgs.Empty);
+ }
+ }
+
+ internal void FireContentChanged()
+ {
+ if (ItemsChanged != null)
+ {
+ ItemsChanged.Invoke(this, EventArgs.Empty);
+ }
+ }
+
+ internal void FireContentEnumerationComplete()
+ {
+ if (ViewEnumerationComplete != null)
+ {
+ ViewEnumerationComplete.Invoke(this, EventArgs.Empty);
+ }
+ }
+
+ internal void FireSelectedItemChanged()
+ {
+ if (ViewSelectedItemChanged != null)
+ {
+ ViewSelectedItemChanged.Invoke(this, EventArgs.Empty);
+ }
+ }
+ #endregion
+
+ #endregion
+
+ }
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserContentOptions.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserContentOptions.cs
new file mode 100644
index 0000000000..dfeccaef3b
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserContentOptions.cs
@@ -0,0 +1,334 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Controls.WindowsForms;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Controls
+{
+ /// <summary>
+ /// These options control how the content of the Explorer Browser
+ /// is rendered.
+ /// </summary>
+ public class ExplorerBrowserContentOptions
+ {
+ #region construction
+ ExplorerBrowser eb;
+ internal ExplorerBrowserContentOptions(ExplorerBrowser eb)
+ {
+ this.eb = eb;
+ }
+ #endregion
+
+ #region ViewMode property
+ // This is a one-way property of the explorer browser.
+ // Keeping it around for the get implementations.
+ internal FolderSettings folderSettings = new FolderSettings();
+
+ /// <summary>
+ /// The viewing mode of the Explorer Browser
+ /// </summary>
+ public ExplorerBrowserViewMode ViewMode
+ {
+ get
+ {
+ return (ExplorerBrowserViewMode)folderSettings.ViewMode;
+ }
+ set
+ {
+ folderSettings.ViewMode = (FolderViewMode)value;
+
+ if (eb.explorerBrowserControl != null)
+ {
+ eb.explorerBrowserControl.SetFolderSettings(folderSettings);
+ }
+ }
+ }
+ #endregion
+
+ #region Flags property
+ /// <summary>
+ /// The binary representation of the ExplorerBrowser content flags
+ /// </summary>
+ public ExplorerBrowserContentSectionOptions Flags
+ {
+ get
+ {
+ return (ExplorerBrowserContentSectionOptions)folderSettings.Options;
+ }
+ set
+ {
+ folderSettings.Options = (FolderOptions)value | FolderOptions.UseSearchFolders | FolderOptions.NoWebView;
+ if (eb.explorerBrowserControl != null)
+ {
+ eb.explorerBrowserControl.SetFolderSettings(folderSettings);
+ }
+ }
+ }
+ #endregion
+
+ #region content flags to properties mapping
+ /// <summary>
+ /// The view should be left-aligned.
+ /// </summary>
+ public bool AlignLeft
+ {
+ get
+ {
+ return IsFlagSet(ExplorerBrowserContentSectionOptions.AlignLeft);
+ }
+ set
+ {
+ SetFlag(ExplorerBrowserContentSectionOptions.AlignLeft, value);
+ }
+ }
+ /// <summary>
+ /// Automatically arrange the elements in the view.
+ /// </summary>
+ public bool AutoArrange
+ {
+ get
+ {
+ return IsFlagSet(ExplorerBrowserContentSectionOptions.AutoArrange);
+ }
+ set
+ {
+ SetFlag(ExplorerBrowserContentSectionOptions.AutoArrange, value);
+ }
+ }
+ /// <summary>
+ /// Turns on check mode for the view
+ /// </summary>
+ public bool CheckSelect
+ {
+ get
+ {
+ return IsFlagSet(ExplorerBrowserContentSectionOptions.CheckSelect);
+ }
+ set
+ {
+ SetFlag(ExplorerBrowserContentSectionOptions.CheckSelect, value);
+ }
+ }
+ /// <summary>
+ /// When the view is in "tile view mode" the layout of a single item should be extended to the width of the view.
+ /// </summary>
+ public bool ExtendedTiles
+ {
+ get
+ {
+ return IsFlagSet(ExplorerBrowserContentSectionOptions.ExtendedTiles);
+ }
+ set
+ {
+ SetFlag(ExplorerBrowserContentSectionOptions.ExtendedTiles, value);
+ }
+ }
+ /// <summary>
+ /// When an item is selected, the item and all its sub-items are highlighted.
+ /// </summary>
+ public bool FullRowSelect
+ {
+ get
+ {
+ return IsFlagSet(ExplorerBrowserContentSectionOptions.FullRowSelect);
+ }
+ set
+ {
+ SetFlag(ExplorerBrowserContentSectionOptions.FullRowSelect, value);
+ }
+ }
+ /// <summary>
+ /// The view should not display file names
+ /// </summary>
+ public bool HideFileNames
+ {
+ get
+ {
+ return IsFlagSet(ExplorerBrowserContentSectionOptions.HideFileNames);
+ }
+ set
+ {
+ SetFlag(ExplorerBrowserContentSectionOptions.HideFileNames, value);
+ }
+ }
+ /// <summary>
+ /// The view should not save view state in the browser.
+ /// </summary>
+ public bool NoBrowserViewState
+ {
+ get
+ {
+ return IsFlagSet(ExplorerBrowserContentSectionOptions.NoBrowserViewState);
+ }
+ set
+ {
+ SetFlag(ExplorerBrowserContentSectionOptions.NoBrowserViewState, value);
+ }
+ }
+ /// <summary>
+ /// Do not display a column header in the view in any view mode.
+ /// </summary>
+ public bool NoColumnHeader
+ {
+ get
+ {
+ return IsFlagSet(ExplorerBrowserContentSectionOptions.NoColumnHeader);
+ }
+ set
+ {
+ SetFlag(ExplorerBrowserContentSectionOptions.NoColumnHeader, value);
+ }
+ }
+ /// <summary>
+ /// Only show the column header in details view mode.
+ /// </summary>
+ public bool NoHeaderInAllViews
+ {
+ get
+ {
+ return IsFlagSet(ExplorerBrowserContentSectionOptions.NoHeaderInAllViews);
+ }
+ set
+ {
+ SetFlag(ExplorerBrowserContentSectionOptions.NoHeaderInAllViews, value);
+ }
+ }
+ /// <summary>
+ /// The view should not display icons.
+ /// </summary>
+ public bool NoIcons
+ {
+ get
+ {
+ return IsFlagSet(ExplorerBrowserContentSectionOptions.NoIcons);
+ }
+ set
+ {
+ SetFlag(ExplorerBrowserContentSectionOptions.NoIcons, value);
+ }
+ }
+ /// <summary>
+ /// Do not show subfolders.
+ /// </summary>
+ public bool NoSubfolders
+ {
+ get
+ {
+ return IsFlagSet(ExplorerBrowserContentSectionOptions.NoSubfolders);
+ }
+ set
+ {
+ SetFlag(ExplorerBrowserContentSectionOptions.NoSubfolders, value);
+ }
+ }
+ /// <summary>
+ /// Navigate with a single click
+ /// </summary>
+ public bool SingleClickActivate
+ {
+ get
+ {
+ return IsFlagSet(ExplorerBrowserContentSectionOptions.SingleClickActivate);
+ }
+ set
+ {
+ SetFlag(ExplorerBrowserContentSectionOptions.SingleClickActivate, value);
+ }
+ }
+ /// <summary>
+ /// Do not allow more than a single item to be selected.
+ /// </summary>
+ public bool SingleSelection
+ {
+ get
+ {
+ return IsFlagSet(ExplorerBrowserContentSectionOptions.SingleSelection);
+ }
+ set
+ {
+ SetFlag(ExplorerBrowserContentSectionOptions.SingleSelection, value);
+ }
+ }
+
+ private bool IsFlagSet(ExplorerBrowserContentSectionOptions flag)
+ {
+ return (folderSettings.Options & (FolderOptions)flag) != 0;
+ }
+
+ private void SetFlag(ExplorerBrowserContentSectionOptions flag, bool value)
+ {
+ if (value)
+ folderSettings.Options |= (FolderOptions)flag;
+ else
+ folderSettings.Options = folderSettings.Options & ~(FolderOptions)flag;
+
+ if (eb.explorerBrowserControl != null)
+ eb.explorerBrowserControl.SetFolderSettings(folderSettings);
+ }
+
+ #endregion
+
+ #region thumbnail size
+ /// <summary>
+ /// The size of the thumbnails in pixels
+ /// </summary>
+ public int ThumbnailSize
+ {
+ get
+ {
+ int iconSize = 0;
+ IFolderView2 iFV2 = eb.GetFolderView2();
+ if (iFV2 != null)
+ {
+ try
+ {
+ int fvm = 0;
+ HResult hr = iFV2.GetViewModeAndIconSize(out fvm, out iconSize);
+ if (hr != HResult.Ok)
+ {
+ throw new CommonControlException(LocalizedMessages.ExplorerBrowserIconSize, hr);
+ }
+ }
+ finally
+ {
+ Marshal.ReleaseComObject(iFV2);
+ iFV2 = null;
+ }
+ }
+
+ return iconSize;
+ }
+ set
+ {
+ IFolderView2 iFV2 = eb.GetFolderView2();
+ if (iFV2 != null)
+ {
+ try
+ {
+ int fvm = 0;
+ int iconSize = 0;
+ HResult hr = iFV2.GetViewModeAndIconSize(out fvm, out iconSize);
+ if (hr != HResult.Ok)
+ {
+ throw new CommonControlException(LocalizedMessages.ExplorerBrowserIconSize, hr);
+ }
+ hr = iFV2.SetViewModeAndIconSize(fvm, value);
+ if (hr != HResult.Ok)
+ {
+ throw new CommonControlException(LocalizedMessages.ExplorerBrowserIconSize, hr);
+ }
+ }
+ finally
+ {
+ Marshal.ReleaseComObject(iFV2);
+ iFV2 = null;
+ }
+ }
+ }
+ }
+ #endregion
+ }
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserDiagram.cd b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserDiagram.cd
new file mode 100644
index 0000000000..5188dd1d6d
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserDiagram.cd
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ClassDiagram MajorVersion="1" MinorVersion="1">
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.ExplorerBrowser">
+ <Position X="0.5" Y="0.5" Width="2" />
+ <Members>
+ <Field Name="explorerBrowserControl" Hidden="true" />
+ <Method Name="GetFolderView" Hidden="true" />
+ <Method Name="GetFolderView2" Hidden="true" />
+ <Method Name="GetItemsArray" Hidden="true" />
+ <Method Name="GetSelectedItemsArray" Hidden="true" />
+ <Method Name="IExplorerPaneVisibility.GetPaneState" Hidden="true" />
+ <Method Name="Microsoft.WindowsAPICodePack.Shell.IServiceProvider.QueryService" Hidden="true" />
+ <Method Name="OnCreateControl" Hidden="true" />
+ <Method Name="OnHandleDestroyed" Hidden="true" />
+ <Method Name="OnPaint" Hidden="true" />
+ <Method Name="OnSizeChanged" Hidden="true" />
+ <Method Name="VisibilityToPaneState" Hidden="true" />
+ </Members>
+ <TypeIdentifier>
+ <HashCode>AADgIAAAIAgBOAEAAABAQAAAAEAACAAGAAAQcACAAAA=</HashCode>
+ <FileName>ExplorerBrowser\ExplorerBrowser.cs</FileName>
+ </TypeIdentifier>
+ <Lollipop Position="0.2" />
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.ExplorerBrowserContentOptions">
+ <Position X="3.5" Y="2.75" Width="2.75" />
+ <Compartments>
+ <Compartment Name="Fields" Collapsed="true" />
+ <Compartment Name="Methods" Collapsed="true" />
+ </Compartments>
+ <TypeIdentifier>
+ <HashCode>AAAABAAAAAoIAgEAAggAEAAgEQAAAAACABJAAAUAAAA=</HashCode>
+ <FileName>ExplorerBrowser\ExplorerBrowserContentOptions.cs</FileName>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.ExplorerBrowserPaneVisibility">
+ <Position X="0.5" Y="5" Width="2.75" />
+ <Compartments>
+ <Compartment Name="Fields" Collapsed="true" />
+ </Compartments>
+ <TypeIdentifier>
+ <HashCode>AABAggAAAAgJAAAAAACAABAAAAAAAAwFAAQAQAAAQBA=</HashCode>
+ <FileName>ExplorerBrowser\ExplorerBrowserPaneVisibility.cs</FileName>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.ExplorerBrowserNavigationLog">
+ <Position X="7.25" Y="4" Width="3" />
+ <Members>
+ <Method Name="ExplorerBrowserNavigationLog" Hidden="true" />
+ </Members>
+ <TypeIdentifier>
+ <HashCode>AAAAAAAAAAAAABAAAAIgAAEAAAAAAABAAAAQAAAAAAQ=</HashCode>
+ <FileName>ExplorerBrowser\ExplorerBrowserNavigationLog.cs</FileName>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.ExplorerBrowserNavigationOptions">
+ <Position X="2.75" Y="0.5" Width="3" />
+ <Members>
+ <Field Name="eb" Hidden="true" />
+ <Method Name="ExplorerBrowserNavigationOptions" Hidden="true" />
+ <Method Name="IsFlagSet" Hidden="true" />
+ <Method Name="SetFlag" Hidden="true" />
+ </Members>
+ <Compartments>
+ <Compartment Name="Methods" Collapsed="true" />
+ </Compartments>
+ <TypeIdentifier>
+ <HashCode>AAAABAAIAAAIAAAAEAACAAAgAAAAAAAAACAAAAAAAAA=</HashCode>
+ <FileName>ExplorerBrowser\ExplorerBrowserNavigationOptions.cs</FileName>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.NavigationPendingArgs">
+ <Position X="5.75" Y="7.75" Width="2" />
+ <TypeIdentifier>
+ <HashCode>AAAAAAAAQAAAAAAAAAAAAAAAAAAAABAAAAAAAAAgAAA=</HashCode>
+ <FileName>ExplorerBrowser\ExplorerBrowserEvents.cs</FileName>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.NavigationCompleteArgs">
+ <Position X="0.75" Y="7.75" Width="2" />
+ <TypeIdentifier>
+ <HashCode>AAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ <FileName>ExplorerBrowser\ExplorerBrowserEvents.cs</FileName>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Microsoft.WindowsAPICodePack.Shell.NavigationFailedArgs">
+ <Position X="3.25" Y="7.75" Width="1.75" />
+ <TypeIdentifier>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAA=</HashCode>
+ <FileName>ExplorerBrowser\ExplorerBrowserEvents.cs</FileName>
+ </TypeIdentifier>
+ </Class>
+ <Font Name="Segoe UI" Size="9" />
+</ClassDiagram> \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserEnums.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserEnums.cs
new file mode 100644
index 0000000000..3ccb002db9
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserEnums.cs
@@ -0,0 +1,162 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+
+namespace Microsoft.WindowsAPICodePack.Controls
+{
+ /// <summary>
+ /// Indicates the viewing mode of the explorer browser
+ /// </summary>
+ public enum ExplorerBrowserViewMode
+ {
+ /// <summary>
+ /// Choose the best view mode for the folder
+ /// </summary>
+ Auto = -1,
+
+ /// <summary>
+ /// (New for Windows7)
+ /// </summary>
+ Content = 8,
+
+ /// <summary>
+ /// Object names and other selected information, such as the size or date last updated, are shown.
+ /// </summary>
+ Details = 4,
+
+ /// <summary>
+ /// The view should display medium-size icons.
+ /// </summary>
+ Icon = 1,
+
+ /// <summary>
+ /// Object names are displayed in a list view.
+ /// </summary>
+ List = 3,
+
+ /// <summary>
+ /// The view should display small icons.
+ /// </summary>
+ SmallIcon = 2,
+
+ /// <summary>
+ /// The view should display thumbnail icons.
+ /// </summary>
+ Thumbnail = 5,
+
+ /// <summary>
+ /// The view should display icons in a filmstrip format.
+ /// </summary>
+ ThumbStrip = 7,
+
+ /// <summary>
+ /// The view should display large icons.
+ /// </summary>
+ Tile = 6
+ }
+
+ /// <summary>
+ /// Specifies the options that control subsequent navigation.
+ /// Typically use one, or a bitwise combination of these
+ /// flags to specify how the explorer browser navigates.
+ /// </summary>
+ [Flags]
+ public enum ExplorerBrowserNavigateOptions
+ {
+ /// <summary>
+ /// Always navigate, even if you are attempting to navigate to the current folder.
+ /// </summary>
+ AlwaysNavigate = 0x00000004,
+
+ /// <summary>
+ /// Do not navigate further than the initial navigation.
+ /// </summary>
+ NavigateOnce = 0x00000001,
+ }
+
+ /// <summary>
+ /// Indicates the content options of the explorer browser.
+ /// Typically use one, or a bitwise combination of these
+ /// flags to specify how conent should appear in the
+ /// explorer browser control
+ /// </summary>
+ [Flags]
+ public enum ExplorerBrowserContentSectionOptions
+ {
+ /// <summary>
+ /// No options.
+ /// </summary>
+ None = 0,
+ /// <summary>
+ /// The view should be left-aligned.
+ /// </summary>
+ AlignLeft = 0x00000800,
+ /// <summary>
+ /// Automatically arrange the elements in the view.
+ /// </summary>
+ AutoArrange = 0x00000001,
+ /// <summary>
+ /// Turns on check mode for the view
+ /// </summary>
+ CheckSelect = 0x08040000,
+ /// <summary>
+ /// When the view is set to "Tile" the layout of a single item should be extended to the width of the view.
+ /// </summary>
+ ExtendedTiles = 0x02000000,
+ /// <summary>
+ /// When an item is selected, the item and all its sub-items are highlighted.
+ /// </summary>
+ FullRowSelect = 0x00200000,
+ /// <summary>
+ /// The view should not display file names
+ /// </summary>
+ HideFileNames = 0x00020000,
+ /// <summary>
+ /// The view should not save view state in the browser.
+ /// </summary>
+ NoBrowserViewState = 0x10000000,
+ /// <summary>
+ /// Do not display a column header in the view in any view mode.
+ /// </summary>
+ NoColumnHeader = 0x00800000,
+ /// <summary>
+ /// Only show the column header in details view mode.
+ /// </summary>
+ NoHeaderInAllViews = 0x01000000,
+ /// <summary>
+ /// The view should not display icons.
+ /// </summary>
+ NoIcons = 0x00001000,
+ /// <summary>
+ /// Do not show subfolders.
+ /// </summary>
+ NoSubfolders = 0x00000080,
+ /// <summary>
+ /// Navigate with a single click
+ /// </summary>
+ SingleClickActivate = 0x00008000,
+ /// <summary>
+ /// Do not allow more than a single item to be selected.
+ /// </summary>
+ SingleSelection = 0x00000040,
+ }
+
+ /// <summary>
+ /// Indicates the visibility state of an ExplorerBrowser pane
+ /// </summary>
+ public enum PaneVisibilityState
+ {
+ /// <summary>
+ /// Allow the explorer browser to determine if this pane is displayed.
+ /// </summary>
+ DoNotCare,
+ /// <summary>
+ /// Hide the pane
+ /// </summary>
+ Hide,
+ /// <summary>
+ /// Show the pane
+ /// </summary>
+ Show
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserEvents.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserEvents.cs
new file mode 100644
index 0000000000..1efcb79bdf
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserEvents.cs
@@ -0,0 +1,47 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using Microsoft.WindowsAPICodePack.Shell;
+
+namespace Microsoft.WindowsAPICodePack.Controls
+{
+
+ /// <summary>
+ /// Event argument for The NavigationPending event
+ /// </summary>
+ public class NavigationPendingEventArgs : EventArgs
+ {
+ /// <summary>
+ /// The location being navigated to
+ /// </summary>
+ public ShellObject PendingLocation { get; set; }
+
+ /// <summary>
+ /// Set to 'True' to cancel the navigation.
+ /// </summary>
+ public bool Cancel { get; set; }
+
+ }
+
+ /// <summary>
+ /// Event argument for The NavigationComplete event
+ /// </summary>
+ public class NavigationCompleteEventArgs : EventArgs
+ {
+ /// <summary>
+ /// The new location of the explorer browser
+ /// </summary>
+ public ShellObject NewLocation { get; set; }
+ }
+
+ /// <summary>
+ /// Event argument for the NavigatinoFailed event
+ /// </summary>
+ public class NavigationFailedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// The location the the browser would have navigated to.
+ /// </summary>
+ public ShellObject FailedLocation { get; set; }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserPaneVisibility.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserPaneVisibility.cs
new file mode 100644
index 0000000000..23fe146ec2
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserPaneVisibility.cs
@@ -0,0 +1,57 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Controls
+{
+ /// <summary>
+ /// Controls the visibility of the various ExplorerBrowser panes on subsequent navigation
+ /// </summary>
+ public class ExplorerBrowserPaneVisibility
+ {
+ /// <summary>
+ /// The pane on the left side of the Windows Explorer window that hosts the folders tree and Favorites.
+ /// </summary>
+ public PaneVisibilityState Navigation { get; set; }
+
+
+ /// <summary>
+ /// Commands module along the top of the Windows Explorer window.
+ /// </summary>
+ public PaneVisibilityState Commands { get; set; }
+
+ /// <summary>
+ /// Organize menu within the commands module.
+ /// </summary>
+ public PaneVisibilityState CommandsOrganize { get; set; }
+
+
+ /// <summary>
+ /// View menu within the commands module.
+ /// </summary>
+ public PaneVisibilityState CommandsView { get; set; }
+
+
+ /// <summary>
+ /// Pane showing metadata along the bottom of the Windows Explorer window.
+ /// </summary>
+ public PaneVisibilityState Details { get; set; }
+
+
+ /// <summary>
+ /// Pane on the right of the Windows Explorer window that shows a large reading preview of the file.
+ /// </summary>
+ public PaneVisibilityState Preview { get; set; }
+
+
+ /// <summary>
+ /// Quick filter buttons to aid in a search.
+ /// </summary>
+ public PaneVisibilityState Query { get; set; }
+
+
+ /// <summary>
+ /// Additional fields and options to aid in a search.
+ /// </summary>
+ public PaneVisibilityState AdvancedQuery { get; set; }
+
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserViewEvents.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserViewEvents.cs
new file mode 100644
index 0000000000..b47a1fe65e
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/ExplorerBrowserViewEvents.cs
@@ -0,0 +1,161 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Controls;
+using Microsoft.WindowsAPICodePack.Controls.WindowsForms;
+
+namespace MS.WindowsAPICodePack.Internal
+{
+ /// <summary>
+ /// This provides a connection point container compatible dispatch interface for
+ /// hooking into the ExplorerBrowser view.
+ /// </summary>
+ [ComVisible(true)]
+ [ClassInterface(ClassInterfaceType.AutoDual)]
+ public class ExplorerBrowserViewEvents : IDisposable
+ {
+ #region implementation
+ private uint viewConnectionPointCookie;
+ private object viewDispatch;
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")]
+ private IntPtr nullPtr = IntPtr.Zero;
+
+ private Guid IID_DShellFolderViewEvents = new Guid(ExplorerBrowserIIDGuid.DShellFolderViewEvents);
+ private Guid IID_IDispatch = new Guid(ExplorerBrowserIIDGuid.IDispatch);
+ private ExplorerBrowser parent;
+ #endregion
+
+ #region contstruction
+ /// <summary>
+ /// Default constructor for ExplorerBrowserViewEvents
+ /// </summary>
+ public ExplorerBrowserViewEvents() : this(null) { }
+
+ internal ExplorerBrowserViewEvents(ExplorerBrowser parent)
+ {
+ this.parent = parent;
+ }
+ #endregion
+
+ #region operations
+ internal void ConnectToView(IShellView psv)
+ {
+ DisconnectFromView();
+
+ HResult hr = psv.GetItemObject(
+ ShellViewGetItemObject.Background,
+ ref IID_IDispatch,
+ out viewDispatch);
+
+ if (hr == HResult.Ok)
+ {
+ hr = ExplorerBrowserNativeMethods.ConnectToConnectionPoint(
+ this,
+ ref IID_DShellFolderViewEvents,
+ true,
+ viewDispatch,
+ ref viewConnectionPointCookie,
+ ref nullPtr);
+
+ if (hr != HResult.Ok)
+ {
+ Marshal.ReleaseComObject(viewDispatch);
+ }
+ }
+ }
+
+ internal void DisconnectFromView()
+ {
+ if (viewDispatch != null)
+ {
+ ExplorerBrowserNativeMethods.ConnectToConnectionPoint(
+ IntPtr.Zero,
+ ref IID_DShellFolderViewEvents,
+ false,
+ viewDispatch,
+ ref viewConnectionPointCookie,
+ ref nullPtr);
+
+ Marshal.ReleaseComObject(viewDispatch);
+ viewDispatch = null;
+ viewConnectionPointCookie = 0;
+ }
+ }
+ #endregion
+
+ #region IDispatch events
+ // These need to be public to be accessible via AutoDual reflection
+
+ /// <summary>
+ /// The view selection has changed
+ /// </summary>
+ [DispId(ExplorerBrowserViewDispatchIds.SelectionChanged)]
+ public void ViewSelectionChanged()
+ {
+ parent.FireSelectionChanged();
+ }
+
+ /// <summary>
+ /// The contents of the view have changed
+ /// </summary>
+ [DispId(ExplorerBrowserViewDispatchIds.ContentsChanged)]
+ public void ViewContentsChanged()
+ {
+ parent.FireContentChanged();
+ }
+
+ /// <summary>
+ /// The enumeration of files in the view is complete
+ /// </summary>
+ [DispId(ExplorerBrowserViewDispatchIds.FileListEnumDone)]
+ public void ViewFileListEnumDone()
+ {
+ parent.FireContentEnumerationComplete();
+ }
+
+ /// <summary>
+ /// The selected item in the view has changed (not the same as the selection has changed)
+ /// </summary>
+ [DispId(ExplorerBrowserViewDispatchIds.SelectedItemChanged)]
+ public void ViewSelectedItemChanged()
+ {
+ parent.FireSelectedItemChanged();
+ }
+ #endregion
+
+ /// <summary>
+ /// Finalizer for ExplorerBrowserViewEvents
+ /// </summary>
+ ~ExplorerBrowserViewEvents()
+ {
+ Dispose(false);
+ }
+
+ #region IDisposable Members
+
+ /// <summary>
+ /// Disconnects and disposes object.
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Disconnects and disposes object.
+ /// </summary>
+ /// <param name="disposed"></param>
+ protected virtual void Dispose(bool disposed)
+ {
+ if (disposed)
+ {
+ DisconnectFromView();
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/NavigationLog.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/NavigationLog.cs
new file mode 100644
index 0000000000..7770264bd1
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/NavigationLog.cs
@@ -0,0 +1,262 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using Microsoft.WindowsAPICodePack.Controls.WindowsForms;
+using Microsoft.WindowsAPICodePack.Shell;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Controls
+{
+
+ /// <summary>
+ /// The navigation log is a history of the locations visited by the explorer browser.
+ /// </summary>
+ public class ExplorerBrowserNavigationLog
+ {
+ #region operations
+ /// <summary>
+ /// Clears the contents of the navigation log.
+ /// </summary>
+ public void ClearLog()
+ {
+ // nothing to do
+ if (_locations.Count == 0) { return; }
+
+ bool oldCanNavigateBackward = CanNavigateBackward;
+ bool oldCanNavigateForward = CanNavigateForward;
+
+ _locations.Clear();
+ this.currentLocationIndex = -1;
+
+ NavigationLogEventArgs args = new NavigationLogEventArgs();
+ args.LocationsChanged = true;
+ args.CanNavigateBackwardChanged = (oldCanNavigateBackward != CanNavigateBackward);
+ args.CanNavigateForwardChanged = (oldCanNavigateForward != CanNavigateForward);
+ if (NavigationLogChanged != null)
+ {
+ NavigationLogChanged(this, args);
+ }
+ }
+ #endregion
+
+ #region properties
+ /// <summary>
+ /// Indicates the presence of locations in the log that can be
+ /// reached by calling Navigate(Forward)
+ /// </summary>
+ public bool CanNavigateForward
+ {
+ get
+ {
+ return (CurrentLocationIndex < (_locations.Count - 1));
+ }
+ }
+
+ /// <summary>
+ /// Indicates the presence of locations in the log that can be
+ /// reached by calling Navigate(Backward)
+ /// </summary>
+ public bool CanNavigateBackward
+ {
+ get
+ {
+ return (CurrentLocationIndex > 0);
+ }
+ }
+
+ /// <summary>
+ /// The navigation log
+ /// </summary>
+ public IEnumerable<ShellObject> Locations
+ {
+ get { foreach (var obj in _locations) { yield return obj; } }
+ }
+ private List<ShellObject> _locations = new List<ShellObject>();
+
+ /// <summary>
+ /// An index into the Locations collection. The ShellObject pointed to
+ /// by this index is the current location of the ExplorerBrowser.
+ /// </summary>
+ public int CurrentLocationIndex
+ {
+ get
+ {
+ return currentLocationIndex;
+ }
+ }
+
+
+ /// <summary>
+ /// Gets the shell object in the Locations collection pointed to
+ /// by CurrentLocationIndex.
+ /// </summary>
+ public ShellObject CurrentLocation
+ {
+ get
+ {
+ if (currentLocationIndex < 0) { return null; }
+
+ return _locations[currentLocationIndex];
+ }
+ }
+ #endregion
+
+ #region events
+ /// <summary>
+ /// Fires when the navigation log changes or
+ /// the current navigation position changes
+ /// </summary>
+ public event EventHandler<NavigationLogEventArgs> NavigationLogChanged;
+ #endregion
+
+ #region implementation
+
+ private ExplorerBrowser parent = null;
+
+ /// <summary>
+ /// The pending navigation log action. null if the user is not navigating
+ /// via the navigation log.
+ /// </summary>
+ private PendingNavigation pendingNavigation;
+
+ /// <summary>
+ /// The index into the Locations collection. -1 if the Locations colleciton
+ /// is empty.
+ /// </summary>
+ private int currentLocationIndex = -1;
+
+ internal ExplorerBrowserNavigationLog(ExplorerBrowser parent)
+ {
+ if (parent == null)
+ {
+ throw new ArgumentException(LocalizedMessages.NavigationLogNullParent, "parent");
+ }
+
+ // Hook navigation events from the parent to distinguish between
+ // navigation log induced navigation, and other navigations.
+ this.parent = parent;
+ this.parent.NavigationComplete += new EventHandler<NavigationCompleteEventArgs>(OnNavigationComplete);
+ this.parent.NavigationFailed += new EventHandler<NavigationFailedEventArgs>(OnNavigationFailed);
+ }
+
+ private void OnNavigationFailed(object sender, NavigationFailedEventArgs args)
+ {
+ pendingNavigation = null;
+ }
+
+ private void OnNavigationComplete(object sender, NavigationCompleteEventArgs args)
+ {
+ NavigationLogEventArgs eventArgs = new NavigationLogEventArgs();
+ bool oldCanNavigateBackward = CanNavigateBackward;
+ bool oldCanNavigateForward = CanNavigateForward;
+
+ if ((pendingNavigation != null))
+ {
+ // navigation log traversal in progress
+
+ // determine if new location is the same as the traversal request
+ int result = 0;
+ pendingNavigation.Location.NativeShellItem.Compare(
+ args.NewLocation.NativeShellItem, SICHINTF.SICHINT_ALLFIELDS, out result);
+ bool shellItemsEqual = (result == 0);
+ if (shellItemsEqual == false)
+ {
+ // new location is different than traversal request,
+ // behave is if it never happened!
+ // remove history following currentLocationIndex, append new item
+ if (currentLocationIndex < (_locations.Count - 1))
+ {
+ _locations.RemoveRange((int)currentLocationIndex + 1, (int)(_locations.Count - (currentLocationIndex + 1)));
+ }
+ _locations.Add(args.NewLocation);
+ currentLocationIndex = (_locations.Count - 1);
+ eventArgs.LocationsChanged = true;
+ }
+ else
+ {
+ // log traversal successful, update index
+ currentLocationIndex = (int)pendingNavigation.Index;
+ eventArgs.LocationsChanged = false;
+ }
+ pendingNavigation = null;
+ }
+ else
+ {
+ // remove history following currentLocationIndex, append new item
+ if (currentLocationIndex < (_locations.Count - 1))
+ {
+ _locations.RemoveRange((int)currentLocationIndex + 1, (int)(_locations.Count - (currentLocationIndex + 1)));
+ }
+ _locations.Add(args.NewLocation);
+ currentLocationIndex = (_locations.Count - 1);
+ eventArgs.LocationsChanged = true;
+ }
+
+ // update event args
+ eventArgs.CanNavigateBackwardChanged = (oldCanNavigateBackward != CanNavigateBackward);
+ eventArgs.CanNavigateForwardChanged = (oldCanNavigateForward != CanNavigateForward);
+
+ if (NavigationLogChanged != null)
+ {
+ NavigationLogChanged(this, eventArgs);
+ }
+ }
+
+ internal bool NavigateLog(NavigationLogDirection direction)
+ {
+ // determine proper index to navigate to
+ int locationIndex = 0;
+ if (direction == NavigationLogDirection.Backward && CanNavigateBackward)
+ {
+ locationIndex = (currentLocationIndex - 1);
+ }
+ else if (direction == NavigationLogDirection.Forward && CanNavigateForward)
+ {
+ locationIndex = (currentLocationIndex + 1);
+ }
+ else
+ {
+ return false;
+ }
+
+ // initiate traversal request
+ ShellObject location = _locations[(int)locationIndex];
+ pendingNavigation = new PendingNavigation(location, locationIndex);
+ parent.Navigate(location);
+ return true;
+ }
+
+ internal bool NavigateLog(int index)
+ {
+ // can't go anywhere
+ if (index >= _locations.Count || index < 0) { return false; }
+
+ // no need to re navigate to the same location
+ if (index == currentLocationIndex) { return false; }
+
+ // initiate traversal request
+ ShellObject location = _locations[(int)index];
+ pendingNavigation = new PendingNavigation(location, index);
+ parent.Navigate(location);
+ return true;
+ }
+
+ #endregion
+ }
+
+ /// <summary>
+ /// A navigation traversal request
+ /// </summary>
+ internal class PendingNavigation
+ {
+ internal PendingNavigation(ShellObject location, int index)
+ {
+ Location = location;
+ Index = index;
+ }
+
+ internal ShellObject Location { get; set; }
+ internal int Index { get; set; }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/NavigationLogEnums.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/NavigationLogEnums.cs
new file mode 100644
index 0000000000..b7e3ba3dde
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/NavigationLogEnums.cs
@@ -0,0 +1,21 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+
+namespace Microsoft.WindowsAPICodePack.Controls
+{
+ /// <summary>
+ /// The direction argument for Navigate
+ /// </summary>
+ public enum NavigationLogDirection
+ {
+ /// <summary>
+ /// Navigates forward through the navigation log
+ /// </summary>
+ Forward,
+
+ /// <summary>
+ /// Navigates backward through the travel log
+ /// </summary>
+ Backward
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/NavigationLogEvents.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/NavigationLogEvents.cs
new file mode 100644
index 0000000000..377738e121
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/NavigationLogEvents.cs
@@ -0,0 +1,27 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+
+namespace Microsoft.WindowsAPICodePack.Controls
+{
+ /// <summary>
+ /// The event argument for NavigationLogChangedEvent
+ /// </summary>
+ public class NavigationLogEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Indicates CanNavigateForward has changed
+ /// </summary>
+ public bool CanNavigateForwardChanged { get; set; }
+
+ /// <summary>
+ /// Indicates CanNavigateBackward has changed
+ /// </summary>
+ public bool CanNavigateBackwardChanged { get; set; }
+
+ /// <summary>
+ /// Indicates the Locations collection has changed
+ /// </summary>
+ public bool LocationsChanged { get; set; }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/NavigationOptions.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/NavigationOptions.cs
new file mode 100644
index 0000000000..e34a8c50b7
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ExplorerBrowser/NavigationOptions.cs
@@ -0,0 +1,105 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+using Microsoft.WindowsAPICodePack.Controls.WindowsForms;
+
+namespace Microsoft.WindowsAPICodePack.Controls
+{
+
+ /// <summary>
+ /// These options control the results subsequent navigations of the ExplorerBrowser
+ /// </summary>
+ public class ExplorerBrowserNavigationOptions
+ {
+ #region construction
+ ExplorerBrowser eb;
+ internal ExplorerBrowserNavigationOptions(ExplorerBrowser eb)
+ {
+ this.eb = eb;
+ PaneVisibility = new ExplorerBrowserPaneVisibility();
+ }
+ #endregion
+
+ #region Flags property
+ /// <summary>
+ /// The binary flags that are passed to the explorer browser control's GetOptions/SetOptions methods
+ /// </summary>
+ public ExplorerBrowserNavigateOptions Flags
+ {
+ get
+ {
+ ExplorerBrowserOptions ebo = new ExplorerBrowserOptions();
+ if (eb.explorerBrowserControl != null)
+ {
+ eb.explorerBrowserControl.GetOptions(out ebo);
+ return (ExplorerBrowserNavigateOptions)ebo;
+ }
+ return (ExplorerBrowserNavigateOptions)ebo;
+ }
+ set
+ {
+ ExplorerBrowserOptions ebo = (ExplorerBrowserOptions)value;
+ if (eb.explorerBrowserControl != null)
+ {
+ // Always forcing SHOWFRAMES because we handle IExplorerPaneVisibility
+ eb.explorerBrowserControl.SetOptions(ebo | ExplorerBrowserOptions.ShowFrames);
+ }
+ }
+ }
+ #endregion
+
+ #region control flags to properties mapping
+ /// <summary>
+ /// Do not navigate further than the initial navigation.
+ /// </summary>
+ public bool NavigateOnce
+ {
+ get
+ {
+ return IsFlagSet(ExplorerBrowserNavigateOptions.NavigateOnce);
+ }
+ set
+ {
+ SetFlag(ExplorerBrowserNavigateOptions.NavigateOnce, value);
+ }
+ }
+ /// <summary>
+ /// Always navigate, even if you are attempting to navigate to the current folder.
+ /// </summary>
+ public bool AlwaysNavigate
+ {
+ get
+ {
+ return IsFlagSet(ExplorerBrowserNavigateOptions.AlwaysNavigate);
+ }
+ set
+ {
+ SetFlag(ExplorerBrowserNavigateOptions.AlwaysNavigate, value);
+ }
+ }
+
+ private bool IsFlagSet(ExplorerBrowserNavigateOptions flag)
+ {
+ return (Flags & flag) != 0;
+ }
+
+ private void SetFlag(ExplorerBrowserNavigateOptions flag, bool value)
+ {
+ if (value)
+ {
+ Flags |= flag;
+ }
+ else
+ {
+ Flags = Flags & ~flag;
+ }
+ }
+ #endregion
+
+ #region ExplorerBrowser pane visibility
+ /// <summary>
+ /// Controls the visibility of the various ExplorerBrowser panes on subsequent navigation
+ /// </summary>
+ public ExplorerBrowserPaneVisibility PaneVisibility { get; private set; }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/GlobalSuppressions.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/GlobalSuppressions.cs
new file mode 100644
index 0000000000..ec82e06bd8
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/GlobalSuppressions.cs
@@ -0,0 +1,871 @@
+// This file is used by Code Analysis to maintain SuppressMessage
+// attributes that are applied to this project.
+// Project-level suppressions either have no target or are given
+// a specific target and scoped to a namespace, type, member, etc.
+//
+// To add a suppression to this file, right-click the message in the
+// Error List, point to "Suppress Message(s)", and click
+// "In Project Suppression File".
+// You do not need to add suppressions to this file manually.
+
+
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Scope = "member", Target = "Microsoft.WindowsAPICodePack.ApplicationServices.PowerPersonalityGuids.#All")]
+
+#region CA1709 - Identifiers should use proper casing - "API" acronym chosen for clarity
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "API")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Controls", MessageId = "API")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsForms", MessageId = "API")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsPresentationFoundation", MessageId = "API")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Dialogs", MessageId = "API")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Shell", MessageId = "API")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Shell.Interop", MessageId = "API")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem", MessageId = "API")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem", MessageId = "API")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Taskbar", MessageId = "API")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "MS.WindowsAPICodePack.Internal", MessageId = "API")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Dialogs.Controls", MessageId = "API")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Sensors", MessageId = "API")]
+#endregion
+
+#region CA1709 - Identifiers should use proper casing - acronyms capitalized for clarity
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaHDDVDROM", MessageId = "HDDVDROM")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaHDDVDRAM", MessageId = "HDDVDRAM")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaHDDVDR", MessageId = "HDDVDR")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaCDRW", MessageId = "CDRW")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaCDR", MessageId = "CDR")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaBluRayROM", MessageId = "ROM")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIcons.#DriveHDDVD", MessageId = "HDDVD")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaHDDVDROM", MessageId = "HDDVDROM")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaHDDVDRAM", MessageId = "HDDVDRAM")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaHDDVDR", MessageId = "HDDVDR")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaCDRW", MessageId = "CDRW")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaCDR", MessageId = "CDR")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaBluRayROM", MessageId = "ROM")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#DriveHDDVD", MessageId = "HDDVD")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellSearchFolder.#SetFolderTypeID(System.Guid)", MessageId = "ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectCollection.#BuildShellIDList()", MessageId = "ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.QueryParserManagerOption.#AppendLCIDToLocalizedPath", MessageId = "LCID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#IsDTVContent", MessageId="DTV")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#IsSAP", MessageId="SAP")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#IsATSCContent", MessageId="ATSC")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSync.#HandlerID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSync.#HandlerCollectionID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSync.#ItemID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemShell.#SFGAOFlagsStrings", MessageId="SFGAO")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ISOSpeed", MessageId="ISO")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#EXIFVersion", MessageId="EXIF")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Music.#AlbumID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Identity.#ProviderID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Identity.#UniqueID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Document.#ClientID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Document.#DocumentID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+PropGroup.#GPS", MessageId="GPS")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Link.#TargetSFGAOFlagsStrings", MessageId="SFGAO")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Link.#TargetSFGAOFlags", MessageId="SFGAO")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Search.#EntryID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Media.#ContentID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Media.#ClassSecondaryID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Media.#CollectionGroupID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Media.#DVDID", MessageId="DVDID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Media.#ClassPrimaryID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Media.#CollectionID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Media.#MCDI", MessageId="MCDI")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPropGroup.#GPS", MessageId="GPS")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Photo.#ISOSpeed", MessageId="ISO")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Photo.#EXIFVersion", MessageId="EXIF")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemLink.#TargetSFGAOFlagsStrings", MessageId="SFGAO")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemLink.#TargetSFGAOFlags", MessageId="SFGAO")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#ImageID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DOP", MessageId="DOP")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#VersionID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DOPNumerator", MessageId="DOP")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DOPDenominator", MessageId="DOP")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAppUserModel.#ID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#ConversationID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#CcName", MessageId="Cc")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#CcAddress", MessageId="Cc")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#MCDI", MessageId="MCDI")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#CollectionID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#ClassPrimaryID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#ClassSecondaryID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#ContentID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#DVDID", MessageId="DVDID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#CollectionGroupID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+AppUserModel.#ID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Sync.#HandlerID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Sync.#ItemID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Sync.#HandlerCollectionID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+RecordedTV.#IsSAP", MessageId="SAP")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+RecordedTV.#IsATSCContent", MessageId="ATSC")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+RecordedTV.#IsDTVContent", MessageId="DTV")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#ProviderItemID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#DescriptionID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#MIMEType", MessageId="MIME")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#DRM", MessageId="DRM")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#SFGAOFlags", MessageId="SFGAO")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#GPS", MessageId="GPS")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FileFRN", MessageId="FRN")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#AcquisitionID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Message.#ConversationID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Message.#CcName", MessageId="Cc")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Message.#CcAddress", MessageId="Cc")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyConditionOperation.#DOSWildCards", MessageId="DOS")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System.#SFGAOFlags", MessageId="SFGAO")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System.#FileFRN", MessageId="FRN")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System.#DescriptionID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System.#ProviderItemID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System.#MIMEType", MessageId="MIME")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System.#AcquisitionID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Contact.#TTYTDDTelephone", MessageId="TTYTDD")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Shell.#SFGAOFlagsStrings", MessageId="SFGAO")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMusic.#AlbumID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+GPS.#VersionID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+GPS.#DOPNumerator", MessageId="DOP")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+GPS.#DOPDenominator", MessageId="DOP")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Image.#ImageID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemContact.#TTYTDDTelephone", MessageId="TTYTDD")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemIdentity.#ProviderID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemIdentity.#UniqueID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#ClientID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#DocumentID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSearch.#EntryID", MessageId="ID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.ExtendedLinguisticServices.MappingAvailableServices.#TransliterationDevanagariToLatin", MessageId="Devanagari")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.ExtendedLinguisticServices.MappingAvailableServices.#TransliterationHantToHans", MessageId="Hant")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.ExtendedLinguisticServices.MappingAvailableServices.#TransliterationHansToHant", MessageId="Hant")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Dialogs.CommonOpenFileDialog.#Multiselect", MessageId="Multiselect")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.Interop.Message.#LParam", MessageId="Param")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.Interop.Message.#WParam", MessageId="Param")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.KnownFolders.#Ringtones", MessageId="Ringtones")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.KnownFolders.#SamplePlaylists", MessageId="Playlists")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.KnownFolders.#Playlists", MessageId="Playlists")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.KnownFolders.#PublicRingtones", MessageId="Ringtones")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.RedirectionCapability.#Redirectable", MessageId="Redirectable")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaBluRay", MessageId="Blu")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaBluRayRE", MessageId="Blu")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#DriveBluRay", MessageId="Blu")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaSvcd", MessageId="Svcd")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaBluRayROM", MessageId="Blu")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaVcd", MessageId="Vcd")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIconIdentifier.#MediaBluRayR", MessageId="Blu")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaBluRayR", MessageId="Blu")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaBluRay", MessageId="Blu")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaBluRayRE", MessageId="Blu")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIcons.#DriveBluRay", MessageId="Blu")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaSvcd", MessageId="Svcd")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaBluRayROM", MessageId="Blu")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.StockIcons.#MediaVcd", MessageId="Vcd")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.QueryParserManagerOption.#UnlocalizedSchemaBinaryPath", MessageId="Unlocalized")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.DefinitionOptions.#Roamable", MessageId="Roamable")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.DefinitionOptions.#Precreate", MessageId="Precreate")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.ShellObjectChangeTypes.#NetUnshare", MessageId="Unshare")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#TranscodedForSync", MessageId="Transcoded")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Photo.#TranscodedForSync", MessageId="Transcoded")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAppUserModel.#RelaunchCommand", MessageId="Relaunch")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAppUserModel.#RelaunchDisplayNameResource", MessageId="Relaunch")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAppUserModel.#RelaunchIconResource", MessageId="Relaunch")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+AppUserModel.#RelaunchDisplayNameResource", MessageId="Relaunch")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+AppUserModel.#RelaunchIconResource", MessageId="Relaunch")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+AppUserModel.#RelaunchCommand", MessageId="Relaunch")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Video.#TranscodedForSync", MessageId="Transcoded")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope="member", Target="Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#TranscodedForSync", MessageId="Transcoded")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties.#GetProperty`1(System.String)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties.#GetProperty`1(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+GPS.#DOP", MessageId = "DOP")]
+#endregion
+
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+GPS", MessageId = "GPS")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS", MessageId = "GPS")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDRM", MessageId = "DRM")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+DRM", MessageId = "DRM")]
+
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.MessageListener.#get_Running()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.Interop.ShellObjectWatcherNativeMethods.#CreateBindCtx(System.Int32,System.Runtime.InteropServices.ComTypes.IBindCtx&)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.#SHGetPathFromIDListW(System.IntPtr,System.Text.StringBuilder)")]
+
+
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1805:DoNotInitializeUnnecessarily", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.MessageListener.#.cctor()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1805:DoNotInitializeUnnecessarily", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ChangeNotifyLock.#.ctor(Microsoft.WindowsAPICodePack.Shell.Interop.Message)")]
+
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1014:MarkAssembliesWithClsCompliant", Justification = "There are places where unsigned values are used, which is considered not Cls compliant.")]
+
+// Suppressed - Valid
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames")]
+
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchCondition.#GetSubConditions()", Justification = "This method either creates a new instance of an object or has the potential of throwing an exception.")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties.#GetPropertyWriter()", Justification = "This method either creates a new instance of an object or has the potential of throwing an exception.")]
+
+// There is logic that needs to be intialized within the static constructor that would require a different implementation if moved inline.
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.FolderIdentifiers.#.cctor()")]
+
+// These enum's do not represent flags (even though their values may suggest it)
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1027:MarkEnumsWithFlags", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.ShellThumbnailFormatOption")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1027:MarkEnumsWithFlags", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.ShellThumbnailRetrievalOption")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1027:MarkEnumsWithFlags", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarProgressBarState")]
+
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2217:DoNotMarkEnumsWithFlags", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyColumnStateOptions")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2217:DoNotMarkEnumsWithFlags", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Controls.ExplorerBrowserContentSectionOptions")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2217:DoNotMarkEnumsWithFlags", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyTypeOptions")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2217:DoNotMarkEnumsWithFlags", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectChangeTypes")]
+
+// For whatever reason, the FxCop dictionary won't accept these exceptions.
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "WildCards", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyConditionOperation.#DOSWildCards")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "ShowPlaces", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialog.#ShowPlacesList")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Csc", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.KnownFolders.#SearchCsc")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "X", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.NativePoint.#X")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Y", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.NativePoint.#Y")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "x", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.NativePoint.#.ctor(System.Int32,System.Int32)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "y", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.NativePoint.#.ctor(System.Int32,System.Int32)")]
+
+// Excessive switch/case.
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties.#CreateTypedProperty(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyCollection.#CreateTypedProperty(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey,Microsoft.WindowsAPICodePack.Shell.PropertySystem.IPropertyStore)")]
+
+// Follows native values
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Controls.ExplorerBrowserViewMode")]
+
+// Initialized via being marshaled.
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.Interop.LogFont", Justification = "Initialized via marshaler.")]
+
+// Need to index based on this type.
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1043:UseIntegralOrStringArgumentForIndexers", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyCollection.#Item[Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey]")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1043:UseIntegralOrStringArgumentForIndexers", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.PropertyHandlers.PropertyStoreCache.#Item[Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey]")]
+
+// This exception is captured, but thrown later.
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.JumpList.#Refresh()")]
+
+// This needs to be read-write collection for WPF databinding
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsPresentationFoundation.ExplorerBrowser.#Items")]
+
+// This interface probably isn't required, or could be converted to something else.
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1040:AvoidEmptyInterfaces", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Taskbar.IJumpListTask")]
+
+// Fix these
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsForms")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsPresentationFoundation")]
+
+// Investigate further?
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Interoperability", "CA1408:DoNotUseAutoDualClassInterfaceType", Scope = "type", Target = "MS.WindowsAPICodePack.Internal.ExplorerBrowserViewEvents")]
+
+// Suppressed - FxCop bug?
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnail.#SetImage(System.Windows.Media.Imaging.BitmapSource)")]
+
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.PreviewHandlers.PreviewHandler.#Microsoft.WindowsAPICodePack.Shell.Interop.IPreviewHandler.DoPreview()", Justification = "The exception is handled at a later time.")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.PreviewHandlers.PreviewHandler`1.#Microsoft.WindowsAPICodePack.Shell.Interop.IPreviewHandler.DoPreview()", Justification = "The exception is handled at a later time.")]
+
+#region CA1006 - Nested Generic Types - Investigate
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#NamespaceClsid")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCommunication.#FollowUpIconIndex")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertyDevicesNotifications.#MissedCall")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertyDevicesNotifications.#NewMessage")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertyDevicesNotifications.#NewVoicemail")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertyDevicesNotifications.#StorageFull")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertyDevicesNotifications.#StorageFullLinkText")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#AcquisitionID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#Capacity")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#DateAccessed")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#DateAcquired")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#DateArchived")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#DateCompleted")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#DateCreated")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#DateImported")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#DateModified")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#DueDate")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#EndDate")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FileAllocationSize")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FileAttributes")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FileCount")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FileFRN")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FlagColor")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FlagStatus")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FreeSpace")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#Importance")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsAttachment")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsDefaultNonOwnerSaveLocation")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsDefaultSaveLocation")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsDeleted")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsEncrypted")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsFlagged")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsFlaggedComplete")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsIncomplete")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsLocationSupported")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsPinnedToNamespaceTree")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsRead")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsSearchOnlyItem")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsSendToTarget")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#IsShared")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#ItemDate")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#NamespaceCLSID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#OfflineAvailability")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#OfflineStatus")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#PerceivedType")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#PercentFull")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#Priority")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#Rating")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#Sensitivity")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#SFGAOFlags")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#ShareUserRating")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#SharingStatus")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#SimpleRating")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#Size")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#StartDate")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#Thumbnail")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#ThumbnailCacheId")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#TotalFileSize")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAppUserModel.#ExcludeFromShowInNewInstall")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAppUserModel.#IsDestListSeparator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAppUserModel.#PreventPinning")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAudio.#ChannelCount")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAudio.#EncodingBitrate")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAudio.#IsVariableBitRate")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAudio.#PeakValue")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAudio.#SampleRate")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAudio.#SampleSize")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAudio.#StreamNumber")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCalendar.#IsOnline")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCalendar.#IsRecurring")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCalendar.#ReminderTime")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCalendar.#ResponseStatus")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCalendar.#ShowTimeAs")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCommunication.#DateItemExpires")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCommunication.#FollowupIconIndex")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCommunication.#HeaderItem")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCommunication.#SecurityFlags")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCommunication.#TaskStatus")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemContact.#Anniversary")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemContact.#Birthday")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemContact.#GenderValue")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#BatteryLife")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#BatteryPlusCharging")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#ChargingState")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#Connected")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#ContainerId")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#IsDefault")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#IsNetworkConnected")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#IsShared")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#IsSoftwareInstalling")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#LaunchDeviceStageFromExplorer")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#LocalMachine")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#MissedCalls")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#NewPictures")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#NotificationStore")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#NotWorkingProperly")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#Paired")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#Roaming")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#SafeRemovalRequired")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#SignalStrength")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#StorageCapacity")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#StorageFreeSpace")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#StorageFreeSpacePercent")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#TextMessages")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices.#Voicemail")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#ByteCount")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#CharacterCount")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#DateCreated")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#DatePrinted")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#DateSaved")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#HiddenSlideCount")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#LineCount")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#MultimediaClipCount")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#NoteCount")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#PageCount")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#ParagraphCount")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#Security")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#SlideCount")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#TotalEditingTime")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument.#WordCount")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDRM.#DatePlayExpires")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDRM.#DatePlayStarts")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDRM.#IsProtected")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDRM.#PlayCount")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#Altitude")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#AltitudeDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#AltitudeNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#AltitudeRef")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#Date")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestBearing")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestBearingDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestBearingNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestDistance")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestDistanceDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestDistanceNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#Differential")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DOP")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DOPDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DOPNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#ImgDirection")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#ImgDirectionDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#ImgDirectionNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#Speed")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#SpeedDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#SpeedNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#Track")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#TrackDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#TrackNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemIdentity.#IsMeIdentity")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemIdentity.#ProviderID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#BitDepth")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#ColorSpace")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#CompressedBitsPerPixel")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#CompressedBitsPerPixelDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#CompressedBitsPerPixelNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#Compression")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#HorizontalResolution")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#HorizontalSize")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#ResolutionUnit")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#VerticalResolution")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage.#VerticalSize")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemLink.#DateVisited")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemLink.#Status")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemLink.#TargetSFGAOFlags")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#AverageLevel")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#DateEncoded")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#Duration")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#FrameCount")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia.#Year")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#DateReceived")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#DateSent")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#Flags")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#HasAttachments")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#IsFwdOrReply")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#ProofInProgress")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#ToDoFlags")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMusic.#IsCompilation")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMusic.#TrackNumber")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemNote.#Color")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#Aperture")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ApertureDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ApertureNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#Brightness")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#BrightnessDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#BrightnessNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#Contrast")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#DateTaken")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#DigitalZoom")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#DigitalZoomDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#DigitalZoomNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ExposureBias")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ExposureBiasDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ExposureBiasNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ExposureIndex")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ExposureIndexDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ExposureIndexNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ExposureProgram")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ExposureTime")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ExposureTimeDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ExposureTimeNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#Flash")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FlashEnergy")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FlashEnergyDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FlashEnergyNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FNumber")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FNumberDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FNumberNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FocalLength")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FocalLengthDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FocalLengthInFilm")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FocalLengthNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FocalPlaneXResolution")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FocalPlaneXResolutionDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FocalPlaneXResolutionNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FocalPlaneYResolution")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FocalPlaneYResolutionDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#FocalPlaneYResolutionNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#GainControl")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#GainControlDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#GainControlNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ISOSpeed")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#LightSource")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#MakerNoteOffset")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#MaxAperture")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#MaxApertureDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#MaxApertureNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#MeteringMode")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#Orientation")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#PhotometricInterpretation")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ProgramMode")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#Saturation")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#Sharpness")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ShutterSpeed")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ShutterSpeedDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#ShutterSpeedNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#SubjectDistance")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#SubjectDistanceDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#SubjectDistanceNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#TranscodedForSync")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto.#WhiteBalance")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#ChannelNumber")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#DateContentExpires")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#IsATSCContent")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#IsClosedCaptioningAvailable")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#IsDTVContent")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#IsHDContent")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#IsRepeatBroadcast")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#IsSAP")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#OriginalBroadcastDate")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV.#RecordingTime")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSearch.#EntryID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSearch.#GatherTime")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSearch.#HitCount")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSearch.#IsClosedDirectory")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSearch.#IsFullyContained")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSearch.#Rank")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSoftware.#DateLastUsed")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSync.#HandlerCollectionID")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSync.#HandlerType")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSync.#ProgressPercentage")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSync.#State")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#EncodingBitrate")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#FourCC")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#FrameHeight")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#FrameRate")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#FrameWidth")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#HorizontalAspectRatio")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#SampleSize")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#StreamNumber")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#TranscodedForSync")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#VerticalAspectRatio")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVolume.#IsMappedDrive")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVolume.#IsRoot")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo.#TotalBitrate")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertyDevicesNotifications.#LowBattery")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAppUserModel.#IsDestinationListSeparator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAudio.#IsVariableBitrate")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestinationBearing")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestinationBearingDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestinationBearingNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestinationDistance")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestinationDistanceNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#ImageDirection")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#ImageDirectionDenominator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#ImageDirectionNumerator")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS.#DestinationDistanceDenominator")]
+#endregion
+
+#region CA1034 - Visible Nested Types - Investigate, should be fixed when we address Property System issues
+// The layout of the PropertySystem has many public types nested within a type
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertyContactJA")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertyDevicesNotifications")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAppUserModel")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemAudio")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCalendar")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCommunication")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemComputer")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemContact")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevice")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDeviceInterface")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDevices")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDocument")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemDRM")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemGPS")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemIdentity")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemIdentityProvider")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemImage")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemJournal")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemLayoutPattern")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemLink")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMedia")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMusic")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemNote")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPhoto")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPropGroup")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemPropList")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemRecordedTV")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSearch")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemShell")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSoftware")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemSync")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemTask")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVideo")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemVolume")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+AppUserModel")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Audio")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Calendar")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Communication")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Computer")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Contact")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Contact+JA")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Device")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+DeviceInterface")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Devices")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Devices+Notifications")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Document")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+DRM")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+GPS")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Identity")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+IdentityProvider")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Image")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+JA")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Journal")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+LayoutPattern")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Link")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Media")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Message")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Music")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Note")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Notifications")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Photo")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+PropGroup")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+PropList")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+RecordedTV")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Search")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Shell")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Software")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Sync")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Task")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Video")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "For this entire generated class, there are generics using nullable values, which is a nested generic throwing this excpetion.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Volume")]
+#endregion
+
+#region CA1065 - Investigate and fix
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations", Justification = "In this case, an exception is thrown from a property getter, which can happen when wrappin a native API call.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.ExplorerBrowserContentOptions.#ThumbnailSize")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations", Justification = "In this case, an exception is thrown from a property getter, which can happen when wrappin a native API call.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObject.#Parent")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations", Justification = "In this case, an exception is thrown from a property getter, which can happen when wrappin a native API call.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyCollection.#Item[Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey]")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations", Justification = "In this case, an exception is thrown from a property getter, which can happen when wrappin a native API call.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyCollection.#Item[System.String]")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations", Justification = "In this case, an exception is thrown from a property getter, which can happen when wrappin a native API call.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchCondition.#PropertyKey")]
+#endregion
+
+#region CA1710 - Use Correct suffix - won't fix (for now?)
+// Changing the type names will break the naming pattern in the ShellObject area.
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The naming pattern in the ShellObject area would be too confusing if every type ended in Dictionary or List.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.ShellFileSystemFolder")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The naming pattern in the ShellObject area would be too confusing if every type ended in Dictionary or List.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.ShellFolder")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The naming pattern in the ShellObject area would be too confusing if every type ended in Dictionary or List.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.ShellSearchConnector")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The naming pattern in the ShellObject area would be too confusing if every type ended in Dictionary or List.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.ShellSearchFolder")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The naming pattern in the ShellObject area would be too confusing if every type ended in Dictionary or List.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.ShellNonFileSystemFolder")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The naming pattern in the ShellObject area would be too confusing if every type ended in Dictionary or List.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.ShellLibrary")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The naming pattern in the ShellObject area would be too confusing if every type ended in Dictionary or List.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.FileSystemKnownFolder")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The naming pattern in the ShellObject area would be too confusing if every type ended in Dictionary or List.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.NonFileSystemKnownFolder")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The naming pattern in the ShellObject area would be too confusing if every type ended in Dictionary or List.", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.IKnownFolder")]
+#endregion
+
+#region CA1724 - Conflicting typename/namespace - Fix - Property System Changes
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Shell")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Media")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces", Scope = "type", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem")]
+#endregion
+
+#region CA1726 - Flags reserved name - Investigate, but they may be valid use of the word.
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flag", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FlagColor")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flag", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FlagColorText")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flag", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FlagStatus")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flag", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#FlagStatusText")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flag", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System.#FlagColor")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flag", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System.#FlagStatus")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flag", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System.#FlagStatusText")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.ExplorerBrowserContentOptions.#Flags")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.ExplorerBrowserNavigationOptions.#Flags")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystem.#SFGAOFlags")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemCommunication.#SecurityFlags")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemLink.#TargetSFGAOFlags")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemLink.#TargetSFGAOFlagsStrings")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#Flags")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemMessage.#ToDoFlags")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties+PropertySystemShell.#SFGAOFlagsStrings")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.#TypeFlags")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.#ViewFlags")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Communication.#SecurityFlags")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Link.#TargetSFGAOFlags")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Link.#TargetSFGAOFlagsStrings")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Message.#Flags")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System+Message.#ToDoFlags")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flag", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties+System.#FlagColorText")]
+
+#endregion
+
+#region CA1806 - Ignoring Method Results - Fix these eventually.
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(System.IntPtr,MS.WindowsAPICodePack.Internal.Margins@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassWindow.#ResetAeroGlass()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(System.IntPtr,MS.WindowsAPICodePack.Internal.Margins@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassWindow.#ExcludeElementFromAeroGlass(System.Windows.FrameworkElement)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(System.IntPtr,MS.WindowsAPICodePack.Internal.Margins@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassForm.#ExcludeControlFromAeroGlass(System.Windows.Forms.Control)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(System.IntPtr,MS.WindowsAPICodePack.Internal.Margins@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassForm.#ResetAeroGlass()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.IPropertyStore.SetValue(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey@,MS.WindowsAPICodePack.Internal.PropVariant@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarNativeMethods.#SetWindowProperty(System.IntPtr,Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey,System.String)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailNativeMethods.ReleaseDC(System.IntPtr,System.IntPtr)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailScreenCapture.#GrabWindowBitmap(System.IntPtr,System.Drawing.Size)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertySystemNativeMethods.PSGetNameFromPropertyKey(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey@,System.String@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.#CanonicalName")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.SHCreateShellItemArrayFromDataObject(System.Runtime.InteropServices.ComTypes.IDataObject,System.Guid@,Microsoft.WindowsAPICodePack.Shell.IShellItemArray@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectCollection.#FromDataObject(System.Runtime.InteropServices.ComTypes.IDataObject)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.SHCreateItemFromParsingName(System.String,System.IntPtr,System.Guid@,Microsoft.WindowsAPICodePack.Shell.IShellItem@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellLibrary.#.ctor(System.String,System.String,System.Boolean)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.SHCreateItemFromParsingName(System.String,System.IntPtr,System.Guid@,Microsoft.WindowsAPICodePack.Shell.IShellItem@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellLibrary.#DefaultSaveFolder")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.SHGetDesktopFolder(Microsoft.WindowsAPICodePack.Shell.IShellFolder@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellContainer.#GetEnumerator()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertySystemNativeMethods.PSGetNameFromPropertyKey(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey@,System.String@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory.#CreateLeafCondition(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey,System.String,Microsoft.WindowsAPICodePack.Shell.SearchConditionOperation)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertySystemNativeMethods.PSGetNameFromPropertyKey(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey@,System.String@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory.#CreateLeafCondition(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey,System.Int32,Microsoft.WindowsAPICodePack.Shell.SearchConditionOperation)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertySystemNativeMethods.PSGetNameFromPropertyKey(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey@,System.String@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory.#CreateLeafCondition(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey,System.Double,Microsoft.WindowsAPICodePack.Shell.SearchConditionOperation)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertySystemNativeMethods.PSGetNameFromPropertyKey(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey@,System.String@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory.#CreateLeafCondition(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey,System.DateTime,Microsoft.WindowsAPICodePack.Shell.SearchConditionOperation)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertySystemNativeMethods.PSGetNameFromPropertyKey(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey@,System.String@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory.#CreateLeafCondition(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey,System.Boolean,Microsoft.WindowsAPICodePack.Shell.SearchConditionOperation)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.IPropertyStore.SetValue(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey@,MS.WindowsAPICodePack.Internal.PropVariant@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.JumpListSeparator.#NativeShellLink")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.IPropertyStore.SetValue(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey@,MS.WindowsAPICodePack.Internal.PropVariant@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.JumpListLink.#NativeShellLink")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(System.IntPtr,MS.WindowsAPICodePack.Internal.MARGINS@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassWindow.#ResetAeroGlass()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(System.IntPtr,MS.WindowsAPICodePack.Internal.MARGINS@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassWindow.#ExcludeElementFromAeroGlass(System.Windows.FrameworkElement)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.DwmEnableComposition(MS.WindowsAPICodePack.Internal.CompositionEnable)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassWindow.#AeroGlassCompositionEnabled")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(System.IntPtr,MS.WindowsAPICodePack.Internal.MARGINS@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassForm.#ResetAeroGlass()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.DwmExtendFrameIntoClientArea(System.IntPtr,MS.WindowsAPICodePack.Internal.MARGINS@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassForm.#ExcludeControlFromAeroGlass(System.Windows.Forms.Control)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.SHCreateItemFromParsingName(System.String,System.IntPtr,System.Guid@,Microsoft.WindowsAPICodePack.Shell.IShellItem2@)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialog.#ApplyNativeSettings(Microsoft.WindowsAPICodePack.Dialogs.IFileDialog)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.DwmEnableComposition(MS.WindowsAPICodePack.Internal.CompositionEnable)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassForm.#AeroGlassCompositionEnabled")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailNativeMethods.DwmInvalidateIconicBitmaps(System.IntPtr)", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarWindowManager.#InvalidatePreview(Microsoft.WindowsAPICodePack.Taskbar.TaskbarWindow)")]
+#endregion
+
+#region CA1811 - Uncalled code - Mostly getters for properties, investigate.
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Uncalled property getters. Removing the getter can affect Marshaling and will raise a Read-Only FxCop warning.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailProxyWindow.#WindowsControl")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Uncalled property getters. Removing the getter can affect Marshaling and will raise a Read-Only FxCop warning.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.JumpListCustomCategoryCollection.#IsReadOnly")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Uncalled property getters. Removing the getter can affect Marshaling and will raise a Read-Only FxCop warning.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialog+NativeDialogEventSink.#Cookie")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Uncalled property getters. Removing the getter can affect Marshaling and will raise a Read-Only FxCop warning.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnail.#AddedToTaskbar")]
+#endregion
+
+#region CA1822 - Investigate these, probably leave as is.
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailManager.#SetThumbnailClip(System.IntPtr,System.Nullable`1<System.Drawing.Rectangle>)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#SetProgressValue(System.Int32,System.Int32,System.Windows.Window)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#SetProgressValue(System.Int32,System.Int32,System.IntPtr)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#SetProgressState(Microsoft.WindowsAPICodePack.Taskbar.TaskbarProgressBarState,System.Windows.Window)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#SetProgressState(Microsoft.WindowsAPICodePack.Taskbar.TaskbarProgressBarState,System.IntPtr)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#SetOverlayIcon(System.Windows.Window,System.Drawing.Icon,System.String)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#SetOverlayIcon(System.IntPtr,System.Drawing.Icon,System.String)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#SetCurrentProcessAppId(System.String)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#SetApplicationIdForSpecificWindow(System.IntPtr,System.String)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#IsPlatformSupported")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#GetCurrentProcessAppId()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#SetApplicationIdForSpecificWindow(System.Windows.Window,System.String)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolBarManager.#AddButtons(System.Windows.UIElement,Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolBarButton[])")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolBarManager.#AddButtons(System.IntPtr,Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolBarButton[])")]
+#endregion
+
+#region CA2000 - Dispose objects before they lose scope - Investigate.
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.PreviewHandlers.PreviewHandler.#Microsoft.WindowsAPICodePack.Shell.Interop.IPreviewHandler.DoPreview()", Justification = "Control added to list which is disposed via IDisposable.")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyCollection.#.ctor(System.String)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailScreenCapture.#GrabWindowBitmap(System.IntPtr,System.Drawing.Size)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarWindowManager.#AddThumbnailButtons(System.Windows.UIElement,Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolBarButton[])")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarWindowManager.#AddThumbnailButtons(System.IntPtr,Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolBarButton[])")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory.#ParseStructuredQuery(System.String,System.Globalization.CultureInfo)")]
+#endregion
+
+#region CA2118, CA2122, CA2123 - LinkDemand related
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.#DwmExtendFrameIntoClientArea(System.IntPtr,MS.WindowsAPICodePack.Internal.Margins&)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.#DwmEnableComposition(MS.WindowsAPICodePack.Internal.CompositionEnable)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.#DwmExtendFrameIntoClientArea(System.IntPtr,MS.WindowsAPICodePack.Internal.MARGINS&)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.#DwmIsCompositionEnabled()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.#GetClientRect(System.IntPtr,MS.WindowsAPICodePack.Internal.CoreNativeMethods+Rect&)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.#GetWindowRect(System.IntPtr,MS.WindowsAPICodePack.Internal.CoreNativeMethods+Rect&)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.ExplorerBrowserNativeMethods.#ConnectToConnectionPoint(System.Object,System.Guid&,System.Boolean,System.Object,System.UInt32&,System.IntPtr&)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.#GetClientRect(System.IntPtr,Microsoft.WindowsAPICodePack.Shell.NativeRect&)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.DesktopWindowManagerNativeMethods.#GetWindowRect(System.IntPtr,Microsoft.WindowsAPICodePack.Shell.NativeRect&)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectFactory.#IsVirtualKnownFolder(Microsoft.WindowsAPICodePack.Shell.IShellItem2)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.MessageListener.#.ctor()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.PropertyHandlers.PropertyHandler.#.ctor()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.PreviewHandlers.ShellObjectBasedPreviewHandler`1.#Microsoft.WindowsAPICodePack.Shell.Interop.IInitializeWithItem.Initialize(System.IntPtr,Microsoft.WindowsAPICodePack.Shell.AccessModes)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.ThumbnailProviders.ShellObjectBasedThumbnailProvider.#Microsoft.WindowsAPICodePack.Shell.Interop.IInitializeWithItem.Initialize(System.IntPtr,Microsoft.WindowsAPICodePack.Shell.AccessModes)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectWatcher.#ProcessChangeNotificationEvent(Microsoft.WindowsAPICodePack.Shell.WindowMessageEventArgs)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectWatcher.#ProcessParentChangeNotificationEvent(Microsoft.WindowsAPICodePack.Shell.WindowMessageEventArgs)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectWatcher.#StopWatching()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StorageStream.#Read(System.Byte[],System.Int32,System.Int32)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StorageStream.#Seek(System.Int64,System.IO.SeekOrigin)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StorageStream.#Write(System.Byte[],System.Int32,System.Int32)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectWatcher.#.ctor(Microsoft.WindowsAPICodePack.Shell.ShellObject,System.Boolean)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.MessageListener.#CrossThreadCreateWindow()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.IntPtrExtensions.#MarshalAs`1(System.IntPtr)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ReadOnlyIStreamStream.#Read(System.Byte[],System.Int32,System.Int32)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ReadOnlyIStreamStream.#Seek(System.Int64,System.IO.SeekOrigin)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.ThumbnailProviders.ShellItemBasedThumbnailProvider.#Microsoft.WindowsAPICodePack.Shell.Interop.IInitializeWithItem.Initialize(System.IntPtr,Microsoft.WindowsAPICodePack.Shell.AccessModes)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.PreviewHandlers.ShellObjectBasedPreviewHandler.#Microsoft.WindowsAPICodePack.Shell.Interop.IInitializeWithItem.Initialize(System.IntPtr,Microsoft.WindowsAPICodePack.Shell.AccessModes)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.ThumbnailProviders.ThumbnailProvider.#Microsoft.WindowsAPICodePack.Shell.Interop.IThumbnailProvider.GetThumbnail(System.UInt32,System.IntPtr&,System.UInt32&)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.ReadOnlyIStreamStream.#Read(System.Byte[],System.Int32,System.Int32)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.ReadOnlyIStreamStream.#Seek(System.Int64,System.IO.SeekOrigin)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.ThumbnailProviders.ShellItemBasedThumbnailProvider.#Microsoft.WindowsAPICodePack.Shell.Interop.IInitializeWithItem.Initialize(System.IntPtr,Microsoft.WindowsAPICodePack.Shell.AccessMode)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.PreviewHandlers.ShellObjectBasedPreviewHandler.#Microsoft.WindowsAPICodePack.Shell.Interop.IInitializeWithItem.Initialize(System.IntPtr,Microsoft.WindowsAPICodePack.Shell.AccessMode)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellExtensions.ThumbnailProvider.#Microsoft.WindowsAPICodePack.Shell.Interop.IThumbnailProvider.GetThumbnail(System.UInt32,System.IntPtr&,System.UInt32&)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.MessageListenerWindow.#Initialize()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.MessageListenerWindow.#.ctor()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectWatcher.ShellObjectWatcher.#ProcessChangeNotificationEvent(Microsoft.WindowsAPICodePack.Shell.WindowsMessageEventArgs)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectWatcher.ShellObjectWatcher.#ProcessParentChangeNotificationEvent(Microsoft.WindowsAPICodePack.Shell.WindowsMessageEventArgs)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectWatcher.#ProcessChangeNotificationEvent(Microsoft.WindowsAPICodePack.Shell.WindowsMessageEventArgs)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectWatcher.#StartWatching()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectWatcher.#ProcessParentChangeNotificationEvent(Microsoft.WindowsAPICodePack.Shell.WindowsMessageEventArgs)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectWatcher.ShellObjectWatcher.#StartWatching()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperty`1.#FormatForDisplay(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyDescriptionFormatOptions)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperty`1.#TryFormatForDisplay(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyDescriptionFormatOptions,System.String&)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsForms.CommandLink.#CreateParams")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialog.#AddPlace(System.String,Microsoft.WindowsAPICodePack.Shell.FileDialogAddPlaceLocation)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.CommonSaveFileDialog.#SetCollectedPropertyKeys(System.Boolean,Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey[])")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification =" Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser.#GetFolderView2()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser.#GetItemsArray()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser.#GetSelectedItemsArray()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser.#Items")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser.#SelectedItems")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.ExplorerBrowserContentOptions.#ThumbnailSize")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "MS.WindowsAPICodePack.Internal.ExplorerBrowserViewEvents.#DisconnectFromView()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.FileSystemKnownFolder.#Dispose(System.Boolean)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassForm.#WndProc(System.Windows.Forms.Message&)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassWindow.#SetAeroGlassTransparency()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.JumpList.#RemoveCustomCategoryItem(Microsoft.WindowsAPICodePack.Shell.IShellItem)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.JumpListLink.#Dispose(System.Boolean)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.JumpListLink.#NativeShellLink")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.JumpListSeparator.#Dispose(System.Boolean)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.JumpListSeparator.#NativeShellLink")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.KnownFolders.#GetAllFolders()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.KnownFolderSettings.#GetFolderProperties(Microsoft.WindowsAPICodePack.Shell.IKnownFolderNative)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.NonFileSystemKnownFolder.#Dispose(System.Boolean)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchCondition.#Dispose(System.Boolean)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchCondition.#GetSubConditions()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory.#CreateAndOrCondition(Microsoft.WindowsAPICodePack.Shell.SearchConditionType,System.Boolean,Microsoft.WindowsAPICodePack.Shell.SearchCondition[])")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory.#CreateLeafCondition(System.String,MS.WindowsAPICodePack.Internal.PropVariant,System.String,Microsoft.WindowsAPICodePack.Shell.SearchConditionOperation)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory.#CreateNotCondition(Microsoft.WindowsAPICodePack.Shell.SearchCondition,System.Boolean)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.SearchConditionFactory.#ParseStructuredQuery(System.String,System.Globalization.CultureInfo)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellContainer.#Dispose(System.Boolean)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellHelper.#GetParsingName(Microsoft.WindowsAPICodePack.Shell.IShellItem)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellHelper.#PidlFromShellItem(Microsoft.WindowsAPICodePack.Shell.IShellItem)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellLibrary.#GetFolders()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObject.#Dispose(System.Boolean)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObject.#GetHashCode()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObject.#Name")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObject.#NativeShellItem2")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectCollection.#BuildShellIDList()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectCollection.#.ctor(Microsoft.WindowsAPICodePack.Shell.IShellItemArray,System.Boolean)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellObjectFactory.#Create(System.String)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties.#CreateTypedProperty(System.String)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperty`1.#FormatForDisplay(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyDescriptionFormat)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperty`1.#GetImageReference()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperty`1.#StorePropVariantValue(MS.WindowsAPICodePack.Internal.PropVariant)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperty`1.#TryFormatForDisplay(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyDescriptionFormat,System.String&)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperty`1.#ValueAsObject")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyCollection.#Dispose(System.Boolean)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyCollection.#.ctor(Microsoft.WindowsAPICodePack.Shell.ShellObject)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.#DisplayName")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.#Dispose(System.Boolean)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.#EditInvitation")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.#GetSortDescriptionLabel(System.Boolean)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyWriter.#Close()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyWriter.#.ctor(Microsoft.WindowsAPICodePack.Shell.ShellObject)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyWriter.#WriteProperty(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey,System.Object,System.Boolean)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyWriter.#WriteProperty(System.String,System.Object,System.Boolean)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellSearchFolder.#SetStacks(System.String[])")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellSearchFolder.#SetVisibleColumns(Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey[])")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellSearchFolder.#SortColumns(Microsoft.WindowsAPICodePack.Shell.SortColumn[])")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellThumbnail.#ExtraLargeIcon")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellThumbnail.#GetHBitmap(System.Windows.Size)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellThumbnail.#Icon")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellThumbnail.#LargeIcon")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellThumbnail.#MediumIcon")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.ShellThumbnail.#SmallIcon")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.StockIcon.#GetHIcon()")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties.#GetPropertyDescription(System.String)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnail.#SetImage(System.Drawing.Bitmap)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnail.#SetImage(System.Windows.Media.Imaging.BitmapSource)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailManager.#SetThumbnailClip(System.IntPtr,System.Nullable`1<System.Drawing.Rectangle>)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailNativeMethods.#EnableCustomWindowPreview(System.IntPtr,System.Boolean)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailScreenCapture.#GrabWindowBitmap(System.IntPtr,System.Drawing.Size)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TabbedThumbnailScreenCapture.#GrabWindowBitmap(System.Windows.UIElement,System.Int32,System.Int32,System.Int32,System.Int32)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.#OwnerHandle")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarNativeMethods.#GetWindowPropertyStore(System.IntPtr)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.TaskbarNativeMethods.#SetWindowProperty(System.IntPtr,Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey,System.String)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolbarProxyWindow.#.ctor(System.IntPtr,Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolBarButton[])")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolbarProxyWindow.#.ctor(System.Windows.UIElement,Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolBarButton[])")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Suppressed all LinkDemand related warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolbarProxyWindow.#WindowToTellTaskbarAbout")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase", Justification = "Suppressed all LinkDemand relaged warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsForms.CommandLink.#CreateParams")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase", Justification = "Suppressed all LinkDemand relaged warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.GlassForm.#WndProc(System.Windows.Forms.Message&)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase", Justification = "Suppressed all LinkDemand relaged warnings.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser.#System.Windows.Forms.IMessageFilter.PreFilterMessage(System.Windows.Forms.Message&)")]
+#endregion
+
+#region CA2201 - Reserved Exception Types - Investigate and fix these
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes", Justification = "These can throw an exception deriving from ExternalException, which is reserved.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Dialogs.Controls.CommonFileDialogRadioButtonList.#Attach(Microsoft.WindowsAPICodePack.Dialogs.IFileDialogCustomize)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes", Justification = "These can throw an exception deriving from ExternalException, which is reserved.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyCollection.#Item[System.String]")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes", Justification = "These can throw an exception deriving from ExternalException, which is reserved.", Scope = "member", Target = "Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyCollection.#Item[Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertyKey]")]
+#endregion
+
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/IntPtrExtensions.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/IntPtrExtensions.cs
new file mode 100644
index 0000000000..967cff9df7
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/IntPtrExtensions.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ internal static class IntPtrExtensions
+ {
+ public static T MarshalAs<T>(this IntPtr ptr)
+ {
+ return (T)Marshal.PtrToStructure(ptr, typeof(T));
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/ShellCOMClasses.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/ShellCOMClasses.cs
new file mode 100644
index 0000000000..58a00219fa
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/ShellCOMClasses.cs
@@ -0,0 +1,22 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ [ComImport,
+ Guid(ShellIIDGuid.IShellLibrary),
+ CoClass(typeof(ShellLibraryCoClass))]
+ internal interface INativeShellLibrary : IShellLibrary
+ {
+ }
+
+ [ComImport,
+ ClassInterface(ClassInterfaceType.None),
+ TypeLibType(TypeLibTypeFlags.FCanCreate),
+ Guid(ShellCLSIDGuid.ShellLibrary)]
+ internal class ShellLibraryCoClass
+ {
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/ShellCOMGuids.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/ShellCOMGuids.cs
new file mode 100644
index 0000000000..484b13f075
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/ShellCOMGuids.cs
@@ -0,0 +1,85 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ internal static class ShellIIDGuid
+ {
+
+ // IID GUID strings for relevant Shell COM interfaces.
+ internal const string IModalWindow = "B4DB1657-70D7-485E-8E3E-6FCB5A5C1802";
+ internal const string IFileDialog = "42F85136-DB7E-439C-85F1-E4075D135FC8";
+ internal const string IFileOpenDialog = "D57C7288-D4AD-4768-BE02-9D969532D960";
+ internal const string IFileSaveDialog = "84BCCD23-5FDE-4CDB-AEA4-AF64B83D78AB";
+ internal const string IFileDialogEvents = "973510DB-7D7F-452B-8975-74A85828D354";
+ internal const string IFileDialogControlEvents = "36116642-D713-4B97-9B83-7484A9D00433";
+ internal const string IFileDialogCustomize = "E6FDD21A-163F-4975-9C8C-A69F1BA37034";
+
+ internal const string IShellItem = "43826D1E-E718-42EE-BC55-A1E261C37BFE";
+ internal const string IShellItem2 = "7E9FB0D3-919F-4307-AB2E-9B1860310C93";
+ internal const string IShellItemArray = "B63EA76D-1F85-456F-A19C-48159EFA858B";
+ internal const string IShellLibrary = "11A66EFA-382E-451A-9234-1E0E12EF3085";
+ internal const string IThumbnailCache = "F676C15D-596A-4ce2-8234-33996F445DB1";
+ internal const string ISharedBitmap = "091162a4-bc96-411f-aae8-c5122cd03363";
+ internal const string IShellFolder = "000214E6-0000-0000-C000-000000000046";
+ internal const string IShellFolder2 = "93F2F68C-1D1B-11D3-A30E-00C04F79ABD1";
+ internal const string IEnumIDList = "000214F2-0000-0000-C000-000000000046";
+ internal const string IShellLinkW = "000214F9-0000-0000-C000-000000000046";
+ internal const string CShellLink = "00021401-0000-0000-C000-000000000046";
+
+ internal const string IPropertyStore = "886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99";
+ internal const string IPropertyStoreCache = "3017056d-9a91-4e90-937d-746c72abbf4f";
+ internal const string IPropertyDescription = "6F79D558-3E96-4549-A1D1-7D75D2288814";
+ internal const string IPropertyDescription2 = "57D2EDED-5062-400E-B107-5DAE79FE57A6";
+ internal const string IPropertyDescriptionList = "1F9FC1D0-C39B-4B26-817F-011967D3440E";
+ internal const string IPropertyEnumType = "11E1FBF9-2D56-4A6B-8DB3-7CD193A471F2";
+ internal const string IPropertyEnumType2 = "9B6E051C-5DDD-4321-9070-FE2ACB55E794";
+ internal const string IPropertyEnumTypeList = "A99400F4-3D84-4557-94BA-1242FB2CC9A6";
+ internal const string IPropertyStoreCapabilities = "c8e2d566-186e-4d49-bf41-6909ead56acc";
+
+ internal const string ICondition = "0FC988D4-C935-4b97-A973-46282EA175C8";
+ internal const string ISearchFolderItemFactory = "a0ffbc28-5482-4366-be27-3e81e78e06c2";
+ internal const string IConditionFactory = "A5EFE073-B16F-474f-9F3E-9F8B497A3E08";
+ internal const string IRichChunk = "4FDEF69C-DBC9-454e-9910-B34F3C64B510";
+ internal const string IPersistStream = "00000109-0000-0000-C000-000000000046";
+ internal const string IPersist = "0000010c-0000-0000-C000-000000000046";
+ internal const string IEnumUnknown = "00000100-0000-0000-C000-000000000046";
+ internal const string IQuerySolution = "D6EBC66B-8921-4193-AFDD-A1789FB7FF57";
+ internal const string IQueryParser = "2EBDEE67-3505-43f8-9946-EA44ABC8E5B0";
+ internal const string IQueryParserManager = "A879E3C4-AF77-44fb-8F37-EBD1487CF920";
+ }
+
+ internal static class ShellCLSIDGuid
+ {
+
+ // CLSID GUID strings for relevant coclasses.
+ internal const string FileOpenDialog = "DC1C5A9C-E88A-4DDE-A5A1-60F82A20AEF7";
+ internal const string FileSaveDialog = "C0B4E2F3-BA21-4773-8DBA-335EC946EB8B";
+ internal const string KnownFolderManager = "4DF0C730-DF9D-4AE3-9153-AA6B82E9795A";
+ internal const string ShellLibrary = "D9B3211D-E57F-4426-AAEF-30A806ADD397";
+ internal const string SearchFolderItemFactory = "14010e02-bbbd-41f0-88e3-eda371216584";
+ internal const string ConditionFactory = "E03E85B0-7BE3-4000-BA98-6C13DE9FA486";
+ internal const string QueryParserManager = "5088B39A-29B4-4d9d-8245-4EE289222F66";
+ }
+
+ internal static class ShellKFIDGuid
+ {
+
+ internal const string ComputerFolder = "0AC0837C-BBF8-452A-850D-79D08E667CA7";
+ internal const string Favorites = "1777F761-68AD-4D8A-87BD-30B759FA33DD";
+ internal const string Documents = "FDD39AD0-238F-46AF-ADB4-6C85480369C7";
+ internal const string Profile = "5E6C858F-0E22-4760-9AFE-EA3317B67173";
+
+ internal const string GenericLibrary = "5c4f28b5-f869-4e84-8e60-f11db97c5cc7";
+ internal const string DocumentsLibrary = "7d49d726-3c21-4f05-99aa-fdc2c9474656";
+ internal const string MusicLibrary = "94d6ddcc-4a68-4175-a374-bd584a510b78";
+ internal const string PicturesLibrary = "b3690e58-e961-423b-b687-386ebfd83239";
+ internal const string VideosLibrary = "5fa96407-7e77-483c-ac93-691d05850de8";
+
+ internal const string Libraries = "1B3EA5DC-B587-4786-B4EF-BD1DC332AEAE";
+ }
+
+ internal static class ShellBHIDGuid
+ {
+ internal const string ShellFolderObject = "3981e224-f559-11d3-8e3a-00c04f6837d5";
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/ShellCOMInterfaces.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/ShellCOMInterfaces.cs
new file mode 100644
index 0000000000..78e1bad2a2
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/ShellCOMInterfaces.cs
@@ -0,0 +1,880 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.InteropServices.ComTypes;
+using System.Text;
+using Microsoft.WindowsAPICodePack.Shell.PropertySystem;
+using Microsoft.WindowsAPICodePack.Taskbar;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ internal enum SICHINTF
+ {
+ SICHINT_DISPLAY = 0x00000000,
+ SICHINT_CANONICAL = 0x10000000,
+ SICHINT_TEST_FILESYSPATH_IF_NOT_EQUAL = 0x20000000,
+ SICHINT_ALLFIELDS = unchecked((int)0x80000000)
+ }
+
+ // Disable warning if a method declaration hides another inherited from a parent COM interface
+ // To successfully import a COM interface, all inherited methods need to be declared again with
+ // the exception of those already declared in "IUnknown"
+#pragma warning disable 108
+
+ #region COM Interfaces
+
+ [ComImport(),
+ Guid(ShellIIDGuid.IModalWindow),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IModalWindow
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime),
+ PreserveSig]
+ int Show([In] IntPtr parent);
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.IShellItem),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IShellItem
+ {
+ // Not supported: IBindCtx.
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult BindToHandler(
+ [In] IntPtr pbc,
+ [In] ref Guid bhid,
+ [In] ref Guid riid,
+ [Out, MarshalAs(UnmanagedType.Interface)] out IShellFolder ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetParent([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetDisplayName(
+ [In] ShellNativeMethods.ShellItemDesignNameOptions sigdnName,
+ out IntPtr ppszName);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetAttributes([In] ShellNativeMethods.ShellFileGetAttributesOptions sfgaoMask, out ShellNativeMethods.ShellFileGetAttributesOptions psfgaoAttribs);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult Compare(
+ [In, MarshalAs(UnmanagedType.Interface)] IShellItem psi,
+ [In] SICHINTF hint,
+ out int piOrder);
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.IShellItem2),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IShellItem2 : IShellItem
+ {
+ // Not supported: IBindCtx.
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult BindToHandler(
+ [In] IntPtr pbc,
+ [In] ref Guid bhid,
+ [In] ref Guid riid,
+ [Out, MarshalAs(UnmanagedType.Interface)] out IShellFolder ppv);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetParent([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetDisplayName(
+ [In] ShellNativeMethods.ShellItemDesignNameOptions sigdnName,
+ [MarshalAs(UnmanagedType.LPWStr)] out string ppszName);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetAttributes([In] ShellNativeMethods.ShellFileGetAttributesOptions sfgaoMask, out ShellNativeMethods.ShellFileGetAttributesOptions psfgaoAttribs);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void Compare(
+ [In, MarshalAs(UnmanagedType.Interface)] IShellItem psi,
+ [In] uint hint,
+ out int piOrder);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), PreserveSig]
+ int GetPropertyStore(
+ [In] ShellNativeMethods.GetPropertyStoreOptions Flags,
+ [In] ref Guid riid,
+ [Out, MarshalAs(UnmanagedType.Interface)] out IPropertyStore ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetPropertyStoreWithCreateObject([In] ShellNativeMethods.GetPropertyStoreOptions Flags, [In, MarshalAs(UnmanagedType.IUnknown)] object punkCreateObject, [In] ref Guid riid, out IntPtr ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetPropertyStoreForKeys([In] ref PropertyKey rgKeys, [In] uint cKeys, [In] ShellNativeMethods.GetPropertyStoreOptions Flags, [In] ref Guid riid, [Out, MarshalAs(UnmanagedType.IUnknown)] out IPropertyStore ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetPropertyDescriptionList([In] ref PropertyKey keyType, [In] ref Guid riid, out IntPtr ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult Update([In, MarshalAs(UnmanagedType.Interface)] IBindCtx pbc);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetProperty([In] ref PropertyKey key, [Out] PropVariant ppropvar);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetCLSID([In] ref PropertyKey key, out Guid pclsid);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetFileTime([In] ref PropertyKey key, out System.Runtime.InteropServices.ComTypes.FILETIME pft);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetInt32([In] ref PropertyKey key, out int pi);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetString([In] ref PropertyKey key, [MarshalAs(UnmanagedType.LPWStr)] out string ppsz);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetUInt32([In] ref PropertyKey key, out uint pui);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetUInt64([In] ref PropertyKey key, out ulong pull);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetBool([In] ref PropertyKey key, out int pf);
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.IShellItemArray),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IShellItemArray
+ {
+ // Not supported: IBindCtx.
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult BindToHandler(
+ [In, MarshalAs(UnmanagedType.Interface)] IntPtr pbc,
+ [In] ref Guid rbhid,
+ [In] ref Guid riid,
+ out IntPtr ppvOut);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetPropertyStore(
+ [In] int Flags,
+ [In] ref Guid riid,
+ out IntPtr ppv);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetPropertyDescriptionList(
+ [In] ref PropertyKey keyType,
+ [In] ref Guid riid,
+ out IntPtr ppv);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetAttributes(
+ [In] ShellNativeMethods.ShellItemAttributeOptions dwAttribFlags,
+ [In] ShellNativeMethods.ShellFileGetAttributesOptions sfgaoMask,
+ out ShellNativeMethods.ShellFileGetAttributesOptions psfgaoAttribs);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetCount(out uint pdwNumItems);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetItemAt(
+ [In] uint dwIndex,
+ [MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
+
+ // Not supported: IEnumShellItems (will use GetCount and GetItemAt instead).
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult EnumItems([MarshalAs(UnmanagedType.Interface)] out IntPtr ppenumShellItems);
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.IShellLibrary),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IShellLibrary
+ {
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult LoadLibraryFromItem(
+ [In, MarshalAs(UnmanagedType.Interface)] IShellItem library,
+ [In] AccessModes grfMode);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void LoadLibraryFromKnownFolder(
+ [In] ref Guid knownfidLibrary,
+ [In] AccessModes grfMode);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void AddFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem location);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void RemoveFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem location);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetFolders(
+ [In] ShellNativeMethods.LibraryFolderFilter lff,
+ [In] ref Guid riid,
+ [MarshalAs(UnmanagedType.Interface)] out IShellItemArray ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void ResolveFolder(
+ [In, MarshalAs(UnmanagedType.Interface)] IShellItem folderToResolve,
+ [In] uint timeout,
+ [In] ref Guid riid,
+ [MarshalAs(UnmanagedType.Interface)] out IShellItem ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetDefaultSaveFolder(
+ [In] ShellNativeMethods.DefaultSaveFolderType dsft,
+ [In] ref Guid riid,
+ [MarshalAs(UnmanagedType.Interface)] out IShellItem ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetDefaultSaveFolder(
+ [In] ShellNativeMethods.DefaultSaveFolderType dsft,
+ [In, MarshalAs(UnmanagedType.Interface)] IShellItem si);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetOptions(
+ out ShellNativeMethods.LibraryOptions lofOptions);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetOptions(
+ [In] ShellNativeMethods.LibraryOptions lofMask,
+ [In] ShellNativeMethods.LibraryOptions lofOptions);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetFolderType(out Guid ftid);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetFolderType([In] ref Guid ftid);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetIcon([MarshalAs(UnmanagedType.LPWStr)] out string icon);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetIcon([In, MarshalAs(UnmanagedType.LPWStr)] string icon);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void Commit();
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void Save(
+ [In, MarshalAs(UnmanagedType.Interface)] IShellItem folderToSaveIn,
+ [In, MarshalAs(UnmanagedType.LPWStr)] string libraryName,
+ [In] ShellNativeMethods.LibrarySaveOptions lsf,
+ [MarshalAs(UnmanagedType.Interface)] out IShellItem2 savedTo);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SaveInKnownFolder(
+ [In] ref Guid kfidToSaveIn,
+ [In, MarshalAs(UnmanagedType.LPWStr)] string libraryName,
+ [In] ShellNativeMethods.LibrarySaveOptions lsf,
+ [MarshalAs(UnmanagedType.Interface)] out IShellItem2 savedTo);
+ };
+
+ [ComImportAttribute()]
+ [GuidAttribute("bcc18b79-ba16-442f-80c4-8a59c30c463b")]
+ [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
+ interface IShellItemImageFactory
+ {
+ [PreserveSig]
+ HResult GetImage(
+ [In, MarshalAs(UnmanagedType.Struct)] CoreNativeMethods.Size size,
+ [In] ShellNativeMethods.SIIGBF flags,
+ [Out] out IntPtr phbm);
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.IThumbnailCache),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ interface IThumbnailCache
+ {
+ void GetThumbnail([In] IShellItem pShellItem,
+ [In] uint cxyRequestedThumbSize,
+ [In] Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.ThumbnailOptions flags,
+ [Out] out ISharedBitmap ppvThumb,
+ [Out] out Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.ThumbnailCacheOptions pOutFlags,
+ [Out] Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.ThumbnailId pThumbnailID);
+
+ void GetThumbnailByID([In] Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.ThumbnailId thumbnailID,
+ [In] uint cxyRequestedThumbSize,
+ [Out] out ISharedBitmap ppvThumb,
+ [Out] out Microsoft.WindowsAPICodePack.Shell.ShellNativeMethods.ThumbnailCacheOptions pOutFlags);
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.ISharedBitmap),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ interface ISharedBitmap
+ {
+ void GetSharedBitmap([Out] out IntPtr phbm);
+ void GetSize([Out] out CoreNativeMethods.Size pSize);
+ void GetFormat([Out] out ThumbnailAlphaType pat);
+ void InitializeBitmap([In] IntPtr hbm, [In] ThumbnailAlphaType wtsAT);
+ void Detach([Out] out IntPtr phbm);
+ }
+ [ComImport,
+ Guid(ShellIIDGuid.IShellFolder),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
+ ComConversionLoss]
+ internal interface IShellFolder
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void ParseDisplayName(IntPtr hwnd, [In, MarshalAs(UnmanagedType.Interface)] IBindCtx pbc, [In, MarshalAs(UnmanagedType.LPWStr)] string pszDisplayName, [In, Out] ref uint pchEaten, [Out] IntPtr ppidl, [In, Out] ref uint pdwAttributes);
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult EnumObjects([In] IntPtr hwnd, [In] ShellNativeMethods.ShellFolderEnumerationOptions grfFlags, [MarshalAs(UnmanagedType.Interface)] out IEnumIDList ppenumIDList);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult BindToObject([In] IntPtr pidl, /*[In, MarshalAs(UnmanagedType.Interface)] IBindCtx*/ IntPtr pbc, [In] ref Guid riid, [Out, MarshalAs(UnmanagedType.Interface)] out IShellFolder ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void BindToStorage([In] ref IntPtr pidl, [In, MarshalAs(UnmanagedType.Interface)] IBindCtx pbc, [In] ref Guid riid, out IntPtr ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void CompareIDs([In] IntPtr lParam, [In] ref IntPtr pidl1, [In] ref IntPtr pidl2);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void CreateViewObject([In] IntPtr hwndOwner, [In] ref Guid riid, out IntPtr ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetAttributesOf([In] uint cidl, [In] IntPtr apidl, [In, Out] ref uint rgfInOut);
+
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetUIObjectOf([In] IntPtr hwndOwner, [In] uint cidl, [In] IntPtr apidl, [In] ref Guid riid, [In, Out] ref uint rgfReserved, out IntPtr ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetDisplayNameOf([In] ref IntPtr pidl, [In] uint uFlags, out IntPtr pName);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetNameOf([In] IntPtr hwnd, [In] ref IntPtr pidl, [In, MarshalAs(UnmanagedType.LPWStr)] string pszName, [In] uint uFlags, [Out] IntPtr ppidlOut);
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.IShellFolder2),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
+ ComConversionLoss]
+ internal interface IShellFolder2 : IShellFolder
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void ParseDisplayName([In] IntPtr hwnd, [In, MarshalAs(UnmanagedType.Interface)] IBindCtx pbc, [In, MarshalAs(UnmanagedType.LPWStr)] string pszDisplayName, [In, Out] ref uint pchEaten, [Out] IntPtr ppidl, [In, Out] ref uint pdwAttributes);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void EnumObjects([In] IntPtr hwnd, [In] ShellNativeMethods.ShellFolderEnumerationOptions grfFlags, [MarshalAs(UnmanagedType.Interface)] out IEnumIDList ppenumIDList);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void BindToObject([In] IntPtr pidl, /*[In, MarshalAs(UnmanagedType.Interface)] IBindCtx*/ IntPtr pbc, [In] ref Guid riid, [Out, MarshalAs(UnmanagedType.Interface)] out IShellFolder ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void BindToStorage([In] ref IntPtr pidl, [In, MarshalAs(UnmanagedType.Interface)] IBindCtx pbc, [In] ref Guid riid, out IntPtr ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void CompareIDs([In] IntPtr lParam, [In] ref IntPtr pidl1, [In] ref IntPtr pidl2);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void CreateViewObject([In] IntPtr hwndOwner, [In] ref Guid riid, out IntPtr ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetAttributesOf([In] uint cidl, [In] IntPtr apidl, [In, Out] ref uint rgfInOut);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetUIObjectOf([In] IntPtr hwndOwner, [In] uint cidl, [In] IntPtr apidl, [In] ref Guid riid, [In, Out] ref uint rgfReserved, out IntPtr ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetDisplayNameOf([In] ref IntPtr pidl, [In] uint uFlags, out IntPtr pName);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetNameOf([In] IntPtr hwnd, [In] ref IntPtr pidl, [In, MarshalAs(UnmanagedType.LPWStr)] string pszName, [In] uint uFlags, [Out] IntPtr ppidlOut);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetDefaultSearchGUID(out Guid pguid);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void EnumSearches([Out] out IntPtr ppenum);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetDefaultColumn([In] uint dwRes, out uint pSort, out uint pDisplay);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetDefaultColumnState([In] uint iColumn, out uint pcsFlags);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetDetailsEx([In] ref IntPtr pidl, [In] ref PropertyKey pscid, [MarshalAs(UnmanagedType.Struct)] out object pv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetDetailsOf([In] ref IntPtr pidl, [In] uint iColumn, out IntPtr psd);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void MapColumnToSCID([In] uint iColumn, out PropertyKey pscid);
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.IEnumIDList),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IEnumIDList
+ {
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult Next(uint celt, out IntPtr rgelt, out uint pceltFetched);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult Skip([In] uint celt);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult Reset();
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult Clone([MarshalAs(UnmanagedType.Interface)] out IEnumIDList ppenum);
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.IShellLinkW),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IShellLinkW
+ {
+ void GetPath(
+ [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile,
+ int cchMaxPath,
+ //ref _WIN32_FIND_DATAW pfd,
+ IntPtr pfd,
+ uint fFlags);
+ void GetIDList(out IntPtr ppidl);
+ void SetIDList(IntPtr pidl);
+ void GetDescription(
+ [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile,
+ int cchMaxName);
+ void SetDescription(
+ [MarshalAs(UnmanagedType.LPWStr)] string pszName);
+ void GetWorkingDirectory(
+ [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszDir,
+ int cchMaxPath
+ );
+ void SetWorkingDirectory(
+ [MarshalAs(UnmanagedType.LPWStr)] string pszDir);
+ void GetArguments(
+ [Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszArgs,
+ int cchMaxPath);
+ void SetArguments(
+ [MarshalAs(UnmanagedType.LPWStr)] string pszArgs);
+ void GetHotKey(out short wHotKey);
+ void SetHotKey(short wHotKey);
+ void GetShowCmd(out uint iShowCmd);
+ void SetShowCmd(uint iShowCmd);
+ void GetIconLocation(
+ [Out(), MarshalAs(UnmanagedType.LPWStr)] out StringBuilder pszIconPath,
+ int cchIconPath,
+ out int iIcon);
+ void SetIconLocation(
+ [MarshalAs(UnmanagedType.LPWStr)] string pszIconPath,
+ int iIcon);
+ void SetRelativePath(
+ [MarshalAs(UnmanagedType.LPWStr)] string pszPathRel,
+ uint dwReserved);
+ void Resolve(IntPtr hwnd, uint fFlags);
+ void SetPath(
+ [MarshalAs(UnmanagedType.LPWStr)] string pszFile);
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.CShellLink),
+ ClassInterface(ClassInterfaceType.None)]
+ internal class CShellLink { }
+
+ // Summary:
+ // Provides the managed definition of the IPersistStream interface, with functionality
+ // from IPersist.
+ [ComImport]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ [Guid("00000109-0000-0000-C000-000000000046")]
+ internal interface IPersistStream
+ {
+ // Summary:
+ // Retrieves the class identifier (CLSID) of an object.
+ //
+ // Parameters:
+ // pClassID:
+ // When this method returns, contains a reference to the CLSID. This parameter
+ // is passed uninitialized.
+ [PreserveSig]
+ void GetClassID(out Guid pClassID);
+ //
+ // Summary:
+ // Checks an object for changes since it was last saved to its current file.
+ //
+ // Returns:
+ // S_OK if the file has changed since it was last saved; S_FALSE if the file
+ // has not changed since it was last saved.
+ [PreserveSig]
+ HResult IsDirty();
+
+ [PreserveSig]
+ HResult Load([In, MarshalAs(UnmanagedType.Interface)] IStream stm);
+
+ [PreserveSig]
+ HResult Save([In, MarshalAs(UnmanagedType.Interface)] IStream stm, bool fRemember);
+
+ [PreserveSig]
+ HResult GetSizeMax(out ulong cbSize);
+ }
+
+ [ComImport(),
+ Guid(ShellIIDGuid.ICondition),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface ICondition : IPersistStream
+ {
+ // Summary:
+ // Retrieves the class identifier (CLSID) of an object.
+ //
+ // Parameters:
+ // pClassID:
+ // When this method returns, contains a reference to the CLSID. This parameter
+ // is passed uninitialized.
+ [PreserveSig]
+ void GetClassID(out Guid pClassID);
+ //
+ // Summary:
+ // Checks an object for changes since it was last saved to its current file.
+ //
+ // Returns:
+ // S_OK if the file has changed since it was last saved; S_FALSE if the file
+ // has not changed since it was last saved.
+ [PreserveSig]
+ HResult IsDirty();
+
+ [PreserveSig]
+ HResult Load([In, MarshalAs(UnmanagedType.Interface)] IStream stm);
+
+ [PreserveSig]
+ HResult Save([In, MarshalAs(UnmanagedType.Interface)] IStream stm, bool fRemember);
+
+ [PreserveSig]
+ HResult GetSizeMax(out ulong cbSize);
+
+ // For any node, return what kind of node it is.
+ [PreserveSig]
+ HResult GetConditionType([Out()] out SearchConditionType pNodeType);
+
+ // riid must be IID_IEnumUnknown, IID_IEnumVARIANT or IID_IObjectArray, or in the case of a negation node IID_ICondition.
+ // If this is a leaf node, E_FAIL will be returned.
+ // If this is a negation node, then if riid is IID_ICondition, *ppv will be set to a single ICondition, otherwise an enumeration of one.
+ // If this is a conjunction or a disjunction, *ppv will be set to an enumeration of the subconditions.
+ [PreserveSig]
+ HResult GetSubConditions([In] ref Guid riid, [Out, MarshalAs(UnmanagedType.Interface)] out object ppv);
+
+ // If this is not a leaf node, E_FAIL will be returned.
+ // Retrieve the property name, operation and value from the leaf node.
+ // Any one of ppszPropertyName, pcop and ppropvar may be NULL.
+ [PreserveSig]
+ HResult GetComparisonInfo(
+ [Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszPropertyName,
+ [Out] out SearchConditionOperation pcop,
+ [Out] PropVariant ppropvar);
+
+ // If this is not a leaf node, E_FAIL will be returned.
+ // *ppszValueTypeName will be set to the semantic type of the value, or to NULL if this is not meaningful.
+ [PreserveSig]
+ HResult GetValueType([Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszValueTypeName);
+
+ // If this is not a leaf node, E_FAIL will be returned.
+ // If the value of the leaf node is VT_EMPTY, *ppszNormalization will be set to an empty string.
+ // If the value is a string (VT_LPWSTR, VT_BSTR or VT_LPSTR), then *ppszNormalization will be set to a
+ // character-normalized form of the value.
+ // Otherwise, *ppszNormalization will be set to some (character-normalized) string representation of the value.
+ [PreserveSig]
+ HResult GetValueNormalization([Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszNormalization);
+
+ // Return information about what parts of the input produced the property, the operation and the value.
+ // Any one of ppPropertyTerm, ppOperationTerm and ppValueTerm may be NULL.
+ // For a leaf node returned by the parser, the position information of each IRichChunk identifies the tokens that
+ // contributed the property/operation/value, the string value is the corresponding part of the input string, and
+ // the PROPVARIANT is VT_EMPTY.
+ [PreserveSig]
+ HResult GetInputTerms([Out] out IRichChunk ppPropertyTerm, [Out] out IRichChunk ppOperationTerm, [Out] out IRichChunk ppValueTerm);
+
+ // Make a deep copy of this ICondition.
+ [PreserveSig]
+ HResult Clone([Out()] out ICondition ppc);
+ };
+
+ [ComImport,
+ Guid(ShellIIDGuid.IRichChunk),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IRichChunk
+ {
+ // The position *pFirstPos is zero-based.
+ // Any one of pFirstPos, pLength, ppsz and pValue may be NULL.
+ [PreserveSig]
+ HResult GetData(/*[out, annotation("__out_opt")] ULONG* pFirstPos, [out, annotation("__out_opt")] ULONG* pLength, [out, annotation("__deref_opt_out_opt")] LPWSTR* ppsz, [out, annotation("__out_opt")] PROPVARIANT* pValue*/);
+ }
+
+ [ComImport]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ [Guid(ShellIIDGuid.IEnumUnknown)]
+ internal interface IEnumUnknown
+ {
+ [PreserveSig]
+ HResult Next(UInt32 requestedNumber, ref IntPtr buffer, ref UInt32 fetchedNumber);
+ [PreserveSig]
+ HResult Skip(UInt32 number);
+ [PreserveSig]
+ HResult Reset();
+ [PreserveSig]
+ HResult Clone(out IEnumUnknown result);
+ }
+
+
+ [ComImport,
+ Guid(ShellIIDGuid.IConditionFactory),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IConditionFactory
+ {
+ [PreserveSig]
+ HResult MakeNot([In] ICondition pcSub, [In] bool fSimplify, [Out] out ICondition ppcResult);
+
+ [PreserveSig]
+ HResult MakeAndOr([In] SearchConditionType ct, [In] IEnumUnknown peuSubs, [In] bool fSimplify, [Out] out ICondition ppcResult);
+
+ [PreserveSig]
+ HResult MakeLeaf(
+ [In, MarshalAs(UnmanagedType.LPWStr)] string pszPropertyName,
+ [In] SearchConditionOperation cop,
+ [In, MarshalAs(UnmanagedType.LPWStr)] string pszValueType,
+ [In] PropVariant ppropvar,
+ IRichChunk richChunk1,
+ IRichChunk richChunk2,
+ IRichChunk richChunk3,
+ [In] bool fExpand,
+ [Out] out ICondition ppcResult);
+
+ [PreserveSig]
+ HResult Resolve(/*[In] ICondition pc, [In] STRUCTURED_QUERY_RESOLVE_OPTION sqro, [In] ref SYSTEMTIME pstReferenceTime, [Out] out ICondition ppcResolved*/);
+
+ };
+
+ [ComImport,
+ Guid(ShellIIDGuid.IConditionFactory),
+ CoClass(typeof(ConditionFactoryCoClass))]
+ internal interface INativeConditionFactory : IConditionFactory
+ {
+ }
+
+ [ComImport,
+ ClassInterface(ClassInterfaceType.None),
+ TypeLibType(TypeLibTypeFlags.FCanCreate),
+ Guid(ShellCLSIDGuid.ConditionFactory)]
+ internal class ConditionFactoryCoClass
+ {
+ }
+
+
+
+ [ComImport,
+ Guid(ShellIIDGuid.ISearchFolderItemFactory),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface ISearchFolderItemFactory
+ {
+ [PreserveSig]
+ HResult SetDisplayName([In, MarshalAs(UnmanagedType.LPWStr)] string pszDisplayName);
+
+ [PreserveSig]
+ HResult SetFolderTypeID([In] Guid ftid);
+
+ [PreserveSig]
+ HResult SetFolderLogicalViewMode([In] FolderLogicalViewMode flvm);
+
+ [PreserveSig]
+ HResult SetIconSize([In] int iIconSize);
+
+ [PreserveSig]
+ HResult SetVisibleColumns([In] uint cVisibleColumns, [In, MarshalAs(UnmanagedType.LPArray)] PropertyKey[] rgKey);
+
+ [PreserveSig]
+ HResult SetSortColumns([In] uint cSortColumns, [In, MarshalAs(UnmanagedType.LPArray)] SortColumn[] rgSortColumns);
+
+ [PreserveSig]
+ HResult SetGroupColumn([In] ref PropertyKey keyGroup);
+
+ [PreserveSig]
+ HResult SetStacks([In] uint cStackKeys, [In, MarshalAs(UnmanagedType.LPArray)] PropertyKey[] rgStackKeys);
+
+ [PreserveSig]
+ HResult SetScope([In, MarshalAs(UnmanagedType.Interface)] IShellItemArray ppv);
+
+ [PreserveSig]
+ HResult SetCondition([In] ICondition pCondition);
+
+ [PreserveSig]
+ int GetShellItem(ref Guid riid, [Out, MarshalAs(UnmanagedType.Interface)] out IShellItem ppv);
+
+ [PreserveSig]
+ HResult GetIDList([Out] IntPtr ppidl);
+ };
+
+ [ComImport,
+ Guid(ShellIIDGuid.ISearchFolderItemFactory),
+ CoClass(typeof(SearchFolderItemFactoryCoClass))]
+ internal interface INativeSearchFolderItemFactory : ISearchFolderItemFactory
+ {
+ }
+
+ [ComImport,
+ ClassInterface(ClassInterfaceType.None),
+ TypeLibType(TypeLibTypeFlags.FCanCreate),
+ Guid(ShellCLSIDGuid.SearchFolderItemFactory)]
+ internal class SearchFolderItemFactoryCoClass
+ {
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.IQuerySolution),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ interface IQuerySolution : IConditionFactory
+ {
+ [PreserveSig]
+ HResult MakeNot([In] ICondition pcSub, [In] bool fSimplify, [Out] out ICondition ppcResult);
+
+ [PreserveSig]
+ HResult MakeAndOr([In] SearchConditionType ct, [In] IEnumUnknown peuSubs, [In] bool fSimplify, [Out] out ICondition ppcResult);
+
+ [PreserveSig]
+ HResult MakeLeaf(
+ [In, MarshalAs(UnmanagedType.LPWStr)] string pszPropertyName,
+ [In] SearchConditionOperation cop,
+ [In, MarshalAs(UnmanagedType.LPWStr)] string pszValueType,
+ [In] PropVariant ppropvar,
+ IRichChunk richChunk1,
+ IRichChunk richChunk2,
+ IRichChunk richChunk3,
+ [In] bool fExpand,
+ [Out] out ICondition ppcResult);
+
+ [PreserveSig]
+ HResult Resolve(/*[In] ICondition pc, [In] int sqro, [In] ref SYSTEMTIME pstReferenceTime, [Out] out ICondition ppcResolved*/);
+
+ // Retrieve the condition tree and the "main type" of the solution.
+ // ppQueryNode and ppMainType may be NULL.
+ [PreserveSig]
+ HResult GetQuery([Out, MarshalAs(UnmanagedType.Interface)] out ICondition ppQueryNode, [Out, MarshalAs(UnmanagedType.Interface)] out IEntity ppMainType);
+
+ // Identify parts of the input string not accounted for.
+ // Each parse error is represented by an IRichChunk where the position information
+ // reflect token counts, the string is NULL and the value is a VT_I4
+ // where lVal is from the ParseErrorType enumeration. The valid
+ // values for riid are IID_IEnumUnknown and IID_IEnumVARIANT.
+ [PreserveSig]
+ HResult GetErrors([In] ref Guid riid, [Out] out /* void** */ IntPtr ppParseErrors);
+
+ // Report the query string, how it was tokenized and what LCID and word breaker were used (for recognizing keywords).
+ // ppszInputString, ppTokens, pLocale and ppWordBreaker may be NULL.
+ [PreserveSig]
+ HResult GetLexicalData([MarshalAs(UnmanagedType.LPWStr)] out string ppszInputString, [Out] /* ITokenCollection** */ out IntPtr ppTokens, [Out] out uint plcid, [Out] /* IUnknown** */ out IntPtr ppWordBreaker);
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.IQueryParser),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IQueryParser
+ {
+ // Parse parses an input string, producing a query solution.
+ // pCustomProperties should be an enumeration of IRichChunk objects, one for each custom property
+ // the application has recognized. pCustomProperties may be NULL, equivalent to an empty enumeration.
+ // For each IRichChunk, the position information identifies the character span of the custom property,
+ // the string value should be the name of an actual property, and the PROPVARIANT is completely ignored.
+ [PreserveSig]
+ HResult Parse([In, MarshalAs(UnmanagedType.LPWStr)] string pszInputString, [In] IEnumUnknown pCustomProperties, [Out] out IQuerySolution ppSolution);
+
+ // Set a single option. See STRUCTURED_QUERY_SINGLE_OPTION above.
+ [PreserveSig]
+ HResult SetOption([In] StructuredQuerySingleOption option, [In] PropVariant pOptionValue);
+
+ [PreserveSig]
+ HResult GetOption([In] StructuredQuerySingleOption option, [Out] PropVariant pOptionValue);
+
+ // Set a multi option. See STRUCTURED_QUERY_MULTIOPTION above.
+ [PreserveSig]
+ HResult SetMultiOption([In] StructuredQueryMultipleOption option, [In, MarshalAs(UnmanagedType.LPWStr)] string pszOptionKey, [In] PropVariant pOptionValue);
+
+ // Get a schema provider for browsing the currently loaded schema.
+ [PreserveSig]
+ HResult GetSchemaProvider([Out] out /*ISchemaProvider*/ IntPtr ppSchemaProvider);
+
+ // Restate a condition as a query string according to the currently selected syntax.
+ // The parameter fUseEnglish is reserved for future use; must be FALSE.
+ [PreserveSig]
+ HResult RestateToString([In] ICondition pCondition, [In] bool fUseEnglish, [Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszQueryString);
+
+ // Parse a condition for a given property. It can be anything that would go after 'PROPERTY:' in an AQS expession.
+ [PreserveSig]
+ HResult ParsePropertyValue([In, MarshalAs(UnmanagedType.LPWStr)] string pszPropertyName, [In, MarshalAs(UnmanagedType.LPWStr)] string pszInputString, [Out] out IQuerySolution ppSolution);
+
+ // Restate a condition for a given property. If the condition contains a leaf with any other property name, or no property name at all,
+ // E_INVALIDARG will be returned.
+ [PreserveSig]
+ HResult RestatePropertyValueToString([In] ICondition pCondition, [In] bool fUseEnglish, [Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszPropertyName, [Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszQueryString);
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.IQueryParserManager),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IQueryParserManager
+ {
+ // Create a query parser loaded with the schema for a certain catalog localize to a certain language, and initialized with
+ // standard defaults. One valid value for riid is IID_IQueryParser.
+ [PreserveSig]
+ HResult CreateLoadedParser([In, MarshalAs(UnmanagedType.LPWStr)] string pszCatalog, [In] ushort langidForKeywords, [In] ref Guid riid, [Out] out IQueryParser ppQueryParser);
+
+ // In addition to setting AQS/NQS and automatic wildcard for the given query parser, this sets up standard named entity handlers and
+ // sets the keyboard locale as locale for word breaking.
+ [PreserveSig]
+ HResult InitializeOptions([In] bool fUnderstandNQS, [In] bool fAutoWildCard, [In] IQueryParser pQueryParser);
+
+ // Change one of the settings for the query parser manager, such as the name of the schema binary, or the location of the localized and unlocalized
+ // schema binaries. By default, the settings point to the schema binaries used by Windows Shell.
+ [PreserveSig]
+ HResult SetOption([In] QueryParserManagerOption option, [In] PropVariant pOptionValue);
+
+ };
+
+ [ComImport,
+ Guid(ShellIIDGuid.IQueryParserManager),
+ CoClass(typeof(QueryParserManagerCoClass))]
+ internal interface INativeQueryParserManager : IQueryParserManager
+ {
+ }
+
+ [ComImport,
+ ClassInterface(ClassInterfaceType.None),
+ TypeLibType(TypeLibTypeFlags.FCanCreate),
+ Guid(ShellCLSIDGuid.QueryParserManager)]
+ internal class QueryParserManagerCoClass
+ {
+ }
+
+ [ComImport,
+ Guid("24264891-E80B-4fd3-B7CE-4FF2FAE8931F"),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IEntity
+ {
+ // TODO
+ }
+ #endregion
+
+#pragma warning restore 108
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/ShellNativeMethods.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/ShellNativeMethods.cs
new file mode 100644
index 0000000000..6130eb287e
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/ShellNativeMethods.cs
@@ -0,0 +1,690 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ internal static class ShellNativeMethods
+ {
+ #region Shell Enums
+
+ [Flags]
+ internal enum FileOpenOptions
+ {
+ OverwritePrompt = 0x00000002,
+ StrictFileTypes = 0x00000004,
+ NoChangeDirectory = 0x00000008,
+ PickFolders = 0x00000020,
+ // Ensure that items returned are filesystem items.
+ ForceFilesystem = 0x00000040,
+ // Allow choosing items that have no storage.
+ AllNonStorageItems = 0x00000080,
+ NoValidate = 0x00000100,
+ AllowMultiSelect = 0x00000200,
+ PathMustExist = 0x00000800,
+ FileMustExist = 0x00001000,
+ CreatePrompt = 0x00002000,
+ ShareAware = 0x00004000,
+ NoReadOnlyReturn = 0x00008000,
+ NoTestFileCreate = 0x00010000,
+ HideMruPlaces = 0x00020000,
+ HidePinnedPlaces = 0x00040000,
+ NoDereferenceLinks = 0x00100000,
+ DontAddToRecent = 0x02000000,
+ ForceShowHidden = 0x10000000,
+ DefaultNoMiniMode = 0x20000000
+ }
+ internal enum ControlState
+ {
+ Inactive = 0x00000000,
+ Enable = 0x00000001,
+ Visible = 0x00000002
+ }
+ internal enum ShellItemDesignNameOptions
+ {
+ Normal = 0x00000000, // SIGDN_NORMAL
+ ParentRelativeParsing = unchecked((int)0x80018001), // SIGDN_INFOLDER | SIGDN_FORPARSING
+ DesktopAbsoluteParsing = unchecked((int)0x80028000), // SIGDN_FORPARSING
+ ParentRelativeEditing = unchecked((int)0x80031001), // SIGDN_INFOLDER | SIGDN_FOREDITING
+ DesktopAbsoluteEditing = unchecked((int)0x8004c000), // SIGDN_FORPARSING | SIGDN_FORADDRESSBAR
+ FileSystemPath = unchecked((int)0x80058000), // SIGDN_FORPARSING
+ Url = unchecked((int)0x80068000), // SIGDN_FORPARSING
+ ParentRelativeForAddressBar = unchecked((int)0x8007c001), // SIGDN_INFOLDER | SIGDN_FORPARSING | SIGDN_FORADDRESSBAR
+ ParentRelative = unchecked((int)0x80080001) // SIGDN_INFOLDER
+ }
+
+ /// <summary>
+ /// Indicate flags that modify the property store object retrieved by methods
+ /// that create a property store, such as IShellItem2::GetPropertyStore or
+ /// IPropertyStoreFactory::GetPropertyStore.
+ /// </summary>
+ [Flags]
+ internal enum GetPropertyStoreOptions
+ {
+ /// <summary>
+ /// Meaning to a calling process: Return a read-only property store that contains all
+ /// properties. Slow items (offline files) are not opened.
+ /// Combination with other flags: Can be overridden by other flags.
+ /// </summary>
+ Default = 0,
+
+ /// <summary>
+ /// Meaning to a calling process: Include only properties directly from the property
+ /// handler, which opens the file on the disk, network, or device. Meaning to a file
+ /// folder: Only include properties directly from the handler.
+ ///
+ /// Meaning to other folders: When delegating to a file folder, pass this flag on
+ /// to the file folder; do not do any multiplexing (MUX). When not delegating to a
+ /// file folder, ignore this flag instead of returning a failure code.
+ ///
+ /// Combination with other flags: Cannot be combined with GPS_TEMPORARY,
+ /// GPS_FASTPROPERTIESONLY, or GPS_BESTEFFORT.
+ /// </summary>
+ HandlePropertiesOnly = 0x1,
+
+ /// <summary>
+ /// Meaning to a calling process: Can write properties to the item.
+ /// Note: The store may contain fewer properties than a read-only store.
+ ///
+ /// Meaning to a file folder: ReadWrite.
+ ///
+ /// Meaning to other folders: ReadWrite. Note: When using default MUX,
+ /// return a single unmultiplexed store because the default MUX does not support ReadWrite.
+ ///
+ /// Combination with other flags: Cannot be combined with GPS_TEMPORARY, GPS_FASTPROPERTIESONLY,
+ /// GPS_BESTEFFORT, or GPS_DELAYCREATION. Implies GPS_HANDLERPROPERTIESONLY.
+ /// </summary>
+ ReadWrite = 0x2,
+
+ /// <summary>
+ /// Meaning to a calling process: Provides a writable store, with no initial properties,
+ /// that exists for the lifetime of the Shell item instance; basically, a property bag
+ /// attached to the item instance.
+ ///
+ /// Meaning to a file folder: Not applicable. Handled by the Shell item.
+ ///
+ /// Meaning to other folders: Not applicable. Handled by the Shell item.
+ ///
+ /// Combination with other flags: Cannot be combined with any other flag. Implies GPS_READWRITE
+ /// </summary>
+ Temporary = 0x4,
+
+ /// <summary>
+ /// Meaning to a calling process: Provides a store that does not involve reading from the
+ /// disk or network. Note: Some values may be different, or missing, compared to a store
+ /// without this flag.
+ ///
+ /// Meaning to a file folder: Include the "innate" and "fallback" stores only. Do not load the handler.
+ ///
+ /// Meaning to other folders: Include only properties that are available in memory or can
+ /// be computed very quickly (no properties from disk, network, or peripheral IO devices).
+ /// This is normally only data sources from the IDLIST. When delegating to other folders, pass this flag on to them.
+ ///
+ /// Combination with other flags: Cannot be combined with GPS_TEMPORARY, GPS_READWRITE,
+ /// GPS_HANDLERPROPERTIESONLY, or GPS_DELAYCREATION.
+ /// </summary>
+ FastPropertiesOnly = 0x8,
+
+ /// <summary>
+ /// Meaning to a calling process: Open a slow item (offline file) if necessary.
+ /// Meaning to a file folder: Retrieve a file from offline storage, if necessary.
+ /// Note: Without this flag, the handler is not created for offline files.
+ ///
+ /// Meaning to other folders: Do not return any properties that are very slow.
+ ///
+ /// Combination with other flags: Cannot be combined with GPS_TEMPORARY or GPS_FASTPROPERTIESONLY.
+ /// </summary>
+ OpensLowItem = 0x10,
+
+ /// <summary>
+ /// Meaning to a calling process: Delay memory-intensive operations, such as file access, until
+ /// a property is requested that requires such access.
+ ///
+ /// Meaning to a file folder: Do not create the handler until needed; for example, either
+ /// GetCount/GetAt or GetValue, where the innate store does not satisfy the request.
+ /// Note: GetValue might fail due to file access problems.
+ ///
+ /// Meaning to other folders: If the folder has memory-intensive properties, such as
+ /// delegating to a file folder or network access, it can optimize performance by
+ /// supporting IDelayedPropertyStoreFactory and splitting up its properties into a
+ /// fast and a slow store. It can then use delayed MUX to recombine them.
+ ///
+ /// Combination with other flags: Cannot be combined with GPS_TEMPORARY or
+ /// GPS_READWRITE
+ /// </summary>
+ DelayCreation = 0x20,
+
+ /// <summary>
+ /// Meaning to a calling process: Succeed at getting the store, even if some
+ /// properties are not returned. Note: Some values may be different, or missing,
+ /// compared to a store without this flag.
+ ///
+ /// Meaning to a file folder: Succeed and return a store, even if the handler or
+ /// innate store has an error during creation. Only fail if substores fail.
+ ///
+ /// Meaning to other folders: Succeed on getting the store, even if some properties
+ /// are not returned.
+ ///
+ /// Combination with other flags: Cannot be combined with GPS_TEMPORARY,
+ /// GPS_READWRITE, or GPS_HANDLERPROPERTIESONLY.
+ /// </summary>
+ BestEffort = 0x40,
+
+ /// <summary>
+ /// Mask for valid GETPROPERTYSTOREFLAGS values.
+ /// </summary>
+ MaskValid = 0xff,
+ }
+
+ internal enum ShellItemAttributeOptions
+ {
+ // if multiple items and the attirbutes together.
+ And = 0x00000001,
+ // if multiple items or the attributes together.
+ Or = 0x00000002,
+ // Call GetAttributes directly on the
+ // ShellFolder for multiple attributes.
+ AppCompat = 0x00000003,
+
+ // A mask for SIATTRIBFLAGS_AND, SIATTRIBFLAGS_OR, and SIATTRIBFLAGS_APPCOMPAT. Callers normally do not use this value.
+ Mask = 0x00000003,
+
+ // Windows 7 and later. Examine all items in the array to compute the attributes.
+ // Note that this can result in poor performance over large arrays and therefore it
+ // should be used only when needed. Cases in which you pass this flag should be extremely rare.
+ AllItems = 0x00004000
+ }
+
+ internal enum FileDialogEventShareViolationResponse
+ {
+ Default = 0x00000000,
+ Accept = 0x00000001,
+ Refuse = 0x00000002
+ }
+ internal enum FileDialogEventOverwriteResponse
+ {
+ Default = 0x00000000,
+ Accept = 0x00000001,
+ Refuse = 0x00000002
+ }
+ internal enum FileDialogAddPlacement
+ {
+ Bottom = 0x00000000,
+ Top = 0x00000001,
+ }
+
+ [Flags]
+ internal enum SIIGBF
+ {
+ ResizeToFit = 0x00,
+ BiggerSizeOk = 0x01,
+ MemoryOnly = 0x02,
+ IconOnly = 0x04,
+ ThumbnailOnly = 0x08,
+ InCacheOnly = 0x10,
+ }
+
+ [Flags]
+ internal enum ThumbnailOptions
+ {
+ Extract = 0x00000000,
+ InCacheOnly = 0x00000001,
+ FastExtract = 0x00000002,
+ ForceExtraction = 0x00000004,
+ SlowReclaim = 0x00000008,
+ ExtractDoNotCache = 0x00000020
+ }
+
+ [Flags]
+ internal enum ThumbnailCacheOptions
+ {
+ Default = 0x00000000,
+ LowQuality = 0x00000001,
+ Cached = 0x00000002,
+ }
+
+ [Flags]
+ internal enum ShellFileGetAttributesOptions
+ {
+ /// <summary>
+ /// The specified items can be copied.
+ /// </summary>
+ CanCopy = 0x00000001,
+
+ /// <summary>
+ /// The specified items can be moved.
+ /// </summary>
+ CanMove = 0x00000002,
+
+ /// <summary>
+ /// Shortcuts can be created for the specified items. This flag has the same value as DROPEFFECT.
+ /// The normal use of this flag is to add a Create Shortcut item to the shortcut menu that is displayed
+ /// during drag-and-drop operations. However, SFGAO_CANLINK also adds a Create Shortcut item to the Microsoft
+ /// Windows Explorer's File menu and to normal shortcut menus.
+ /// If this item is selected, your application's IContextMenu::InvokeCommand is invoked with the lpVerb
+ /// member of the CMINVOKECOMMANDINFO structure set to "link." Your application is responsible for creating the link.
+ /// </summary>
+ CanLink = 0x00000004,
+
+ /// <summary>
+ /// The specified items can be bound to an IStorage interface through IShellFolder::BindToObject.
+ /// </summary>
+ Storage = 0x00000008,
+
+ /// <summary>
+ /// The specified items can be renamed.
+ /// </summary>
+ CanRename = 0x00000010,
+
+ /// <summary>
+ /// The specified items can be deleted.
+ /// </summary>
+ CanDelete = 0x00000020,
+
+ /// <summary>
+ /// The specified items have property sheets.
+ /// </summary>
+ HasPropertySheet = 0x00000040,
+
+ /// <summary>
+ /// The specified items are drop targets.
+ /// </summary>
+ DropTarget = 0x00000100,
+
+ /// <summary>
+ /// This flag is a mask for the capability flags.
+ /// </summary>
+ CapabilityMask = 0x00000177,
+
+ /// <summary>
+ /// Windows 7 and later. The specified items are system items.
+ /// </summary>
+ System = 0x00001000,
+
+ /// <summary>
+ /// The specified items are encrypted.
+ /// </summary>
+ Encrypted = 0x00002000,
+
+ /// <summary>
+ /// Indicates that accessing the object = through IStream or other storage interfaces,
+ /// is a slow operation.
+ /// Applications should avoid accessing items flagged with SFGAO_ISSLOW.
+ /// </summary>
+ IsSlow = 0x00004000,
+
+ /// <summary>
+ /// The specified items are ghosted icons.
+ /// </summary>
+ Ghosted = 0x00008000,
+
+ /// <summary>
+ /// The specified items are shortcuts.
+ /// </summary>
+ Link = 0x00010000,
+
+ /// <summary>
+ /// The specified folder objects are shared.
+ /// </summary>
+ Share = 0x00020000,
+
+ /// <summary>
+ /// The specified items are read-only. In the case of folders, this means
+ /// that new items cannot be created in those folders.
+ /// </summary>
+ ReadOnly = 0x00040000,
+
+ /// <summary>
+ /// The item is hidden and should not be displayed unless the
+ /// Show hidden files and folders option is enabled in Folder Settings.
+ /// </summary>
+ Hidden = 0x00080000,
+
+ /// <summary>
+ /// This flag is a mask for the display attributes.
+ /// </summary>
+ DisplayAttributeMask = 0x000FC000,
+
+ /// <summary>
+ /// The specified folders contain one or more file system folders.
+ /// </summary>
+ FileSystemAncestor = 0x10000000,
+
+ /// <summary>
+ /// The specified items are folders.
+ /// </summary>
+ Folder = 0x20000000,
+
+ /// <summary>
+ /// The specified folders or file objects are part of the file system
+ /// that is, they are files, directories, or root directories).
+ /// </summary>
+ FileSystem = 0x40000000,
+
+ /// <summary>
+ /// The specified folders have subfolders = and are, therefore,
+ /// expandable in the left pane of Windows Explorer).
+ /// </summary>
+ HasSubFolder = unchecked((int)0x80000000),
+
+ /// <summary>
+ /// This flag is a mask for the contents attributes.
+ /// </summary>
+ ContentsMask = unchecked((int)0x80000000),
+
+ /// <summary>
+ /// When specified as input, SFGAO_VALIDATE instructs the folder to validate that the items
+ /// pointed to by the contents of apidl exist. If one or more of those items do not exist,
+ /// IShellFolder::GetAttributesOf returns a failure code.
+ /// When used with the file system folder, SFGAO_VALIDATE instructs the folder to discard cached
+ /// properties retrieved by clients of IShellFolder2::GetDetailsEx that may
+ /// have accumulated for the specified items.
+ /// </summary>
+ Validate = 0x01000000,
+
+ /// <summary>
+ /// The specified items are on removable media or are themselves removable devices.
+ /// </summary>
+ Removable = 0x02000000,
+
+ /// <summary>
+ /// The specified items are compressed.
+ /// </summary>
+ Compressed = 0x04000000,
+
+ /// <summary>
+ /// The specified items can be browsed in place.
+ /// </summary>
+ Browsable = 0x08000000,
+
+ /// <summary>
+ /// The items are nonenumerated items.
+ /// </summary>
+ Nonenumerated = 0x00100000,
+
+ /// <summary>
+ /// The objects contain new content.
+ /// </summary>
+ NewContent = 0x00200000,
+
+ /// <summary>
+ /// It is possible to create monikers for the specified file objects or folders.
+ /// </summary>
+ CanMoniker = 0x00400000,
+
+ /// <summary>
+ /// Not supported.
+ /// </summary>
+ HasStorage = 0x00400000,
+
+ /// <summary>
+ /// Indicates that the item has a stream associated with it that can be accessed
+ /// by a call to IShellFolder::BindToObject with IID_IStream in the riid parameter.
+ /// </summary>
+ Stream = 0x00400000,
+
+ /// <summary>
+ /// Children of this item are accessible through IStream or IStorage.
+ /// Those children are flagged with SFGAO_STORAGE or SFGAO_STREAM.
+ /// </summary>
+ StorageAncestor = 0x00800000,
+
+ /// <summary>
+ /// This flag is a mask for the storage capability attributes.
+ /// </summary>
+ StorageCapabilityMask = 0x70C50008,
+
+ /// <summary>
+ /// Mask used by PKEY_SFGAOFlags to remove certain values that are considered
+ /// to cause slow calculations or lack context.
+ /// Equal to SFGAO_VALIDATE | SFGAO_ISSLOW | SFGAO_HASSUBFOLDER.
+ /// </summary>
+ PkeyMask = unchecked((int)0x81044000),
+ }
+
+ [Flags]
+ internal enum ShellFolderEnumerationOptions : ushort
+ {
+ CheckingForChildren = 0x0010,
+ Folders = 0x0020,
+ NonFolders = 0x0040,
+ IncludeHidden = 0x0080,
+ InitializeOnFirstNext = 0x0100,
+ NetPrinterSearch = 0x0200,
+ Shareable = 0x0400,
+ Storage = 0x0800,
+ NavigationEnum = 0x1000,
+ FastItems = 0x2000,
+ FlatList = 0x4000,
+ EnableAsync = 0x8000
+ }
+
+ #endregion
+
+ #region Shell Structs
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
+ internal struct FilterSpec
+ {
+ [MarshalAs(UnmanagedType.LPWStr)]
+ internal string Name;
+ [MarshalAs(UnmanagedType.LPWStr)]
+ internal string Spec;
+
+ internal FilterSpec(string name, string spec)
+ {
+ Name = name;
+ Spec = spec;
+ }
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
+ internal struct ThumbnailId
+ {
+ [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 16)]
+ byte rgbKey;
+ }
+
+ #endregion
+
+ #region Shell Helper Methods
+
+ [DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static extern int SHCreateShellItemArrayFromDataObject(
+ System.Runtime.InteropServices.ComTypes.IDataObject pdo,
+ ref Guid riid,
+ [MarshalAs(UnmanagedType.Interface)] out IShellItemArray iShellItemArray);
+
+ [DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static extern int SHCreateItemFromParsingName(
+ [MarshalAs(UnmanagedType.LPWStr)] string path,
+ // The following parameter is not used - binding context.
+ IntPtr pbc,
+ ref Guid riid,
+ [MarshalAs(UnmanagedType.Interface)] out IShellItem2 shellItem);
+
+ [DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static extern int SHCreateItemFromParsingName(
+ [MarshalAs(UnmanagedType.LPWStr)] string path,
+ // The following parameter is not used - binding context.
+ IntPtr pbc,
+ ref Guid riid,
+ [MarshalAs(UnmanagedType.Interface)] out IShellItem shellItem);
+
+ [DllImport("shlwapi.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static extern int PathParseIconLocation(
+ [MarshalAs(UnmanagedType.LPWStr)] ref string pszIconFile);
+
+
+ [DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static extern int SHCreateItemFromIDList(
+ /*PCIDLIST_ABSOLUTE*/ IntPtr pidl,
+ ref Guid riid,
+ [MarshalAs(UnmanagedType.Interface)] out IShellItem2 ppv);
+
+ [DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static extern int SHParseDisplayName(
+ [MarshalAs(UnmanagedType.LPWStr)] string pszName,
+ IntPtr pbc,
+ out IntPtr ppidl,
+ ShellFileGetAttributesOptions sfgaoIn,
+ out ShellFileGetAttributesOptions psfgaoOut
+ );
+
+ [DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static extern int SHGetIDListFromObject(IntPtr iUnknown,
+ out IntPtr ppidl
+ );
+
+ [DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static extern int SHGetDesktopFolder(
+ [MarshalAs(UnmanagedType.Interface)] out IShellFolder ppshf
+ );
+
+ [DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static extern int SHCreateShellItem(
+ IntPtr pidlParent,
+ [In, MarshalAs(UnmanagedType.Interface)] IShellFolder psfParent,
+ IntPtr pidl,
+ [MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi
+ );
+
+ [DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static extern uint ILGetSize(IntPtr pidl);
+
+ [DllImport("shell32.dll", CharSet = CharSet.None)]
+ public static extern void ILFree(IntPtr pidl);
+
+ [DllImport("gdi32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool DeleteObject(IntPtr hObject);
+
+ #endregion
+
+ #region Shell Library Enums
+
+ internal enum LibraryFolderFilter
+ {
+ ForceFileSystem = 1,
+ StorageItems = 2,
+ AllItems = 3
+ };
+
+ [Flags]
+ internal enum LibraryOptions
+ {
+ Default = 0,
+ PinnedToNavigationPane = 0x1,
+ MaskAll = 0x1
+ };
+
+ internal enum DefaultSaveFolderType
+ {
+ Detect = 1,
+ Private = 2,
+ Public = 3
+ };
+
+ internal enum LibrarySaveOptions
+ {
+ FailIfThere = 0,
+ OverrideExisting = 1,
+ MakeUniqueName = 2
+ };
+
+ internal enum LibraryManageDialogOptions
+ {
+ Default = 0,
+ NonIndexableLocationWarning = 1
+ };
+
+
+ #endregion
+
+ #region Shell Library Helper Methods
+
+ [DllImport("Shell32", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
+ internal static extern int SHShowManageLibraryUI(
+ [In, MarshalAs(UnmanagedType.Interface)] IShellItem library,
+ [In] IntPtr hwndOwner,
+ [In] string title,
+ [In] string instruction,
+ [In] LibraryManageDialogOptions lmdOptions);
+
+ #endregion
+
+ #region Command Link Definitions
+
+ internal const int CommandLink = 0x0000000E;
+ internal const uint SetNote = 0x00001609;
+ internal const uint GetNote = 0x0000160A;
+ internal const uint GetNoteLength = 0x0000160B;
+ internal const uint SetShield = 0x0000160C;
+
+ #endregion
+
+ #region Shell notification definitions
+ internal const int MaxPath = 260;
+
+ [DllImport("shell32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool SHGetPathFromIDListW(IntPtr pidl, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszPath);
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct ShellNotifyStruct
+ {
+ internal IntPtr item1;
+ internal IntPtr item2;
+ };
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SHChangeNotifyEntry
+ {
+ internal IntPtr pIdl;
+
+ [MarshalAs(UnmanagedType.Bool)]
+ internal bool recursively;
+ }
+
+ [DllImport("shell32.dll")]
+ internal static extern uint SHChangeNotifyRegister(
+ IntPtr windowHandle,
+ ShellChangeNotifyEventSource sources,
+ ShellObjectChangeTypes events,
+ uint message,
+ int entries,
+ ref SHChangeNotifyEntry changeNotifyEntry);
+
+ [DllImport("shell32.dll")]
+ internal static extern IntPtr SHChangeNotification_Lock(
+ IntPtr windowHandle,
+ int processId,
+ out IntPtr pidl,
+ out uint lEvent);
+
+ [DllImport("shell32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern Boolean SHChangeNotification_Unlock(IntPtr hLock);
+
+ [DllImport("shell32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern Boolean SHChangeNotifyDeregister(uint hNotify);
+
+ [Flags]
+ internal enum ShellChangeNotifyEventSource
+ {
+ InterruptLevel = 0x0001,
+ ShellLevel = 0x0002,
+ RecursiveInterrupt = 0x1000,
+ NewDelivery = 0x8000
+ }
+
+
+
+ #endregion
+
+ internal const int InPlaceStringTruncated = 0x00401A0;
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/ShellNativeStructs.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/ShellNativeStructs.cs
new file mode 100644
index 0000000000..46d7f4d4a1
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/ShellNativeStructs.cs
@@ -0,0 +1,129 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// The STGM constants are flags that indicate
+ /// conditions for creating and deleting the object and access modes
+ /// for the object.
+ ///
+ /// You can combine these flags, but you can only choose one flag
+ /// from each group of related flags. Typically one flag from each
+ /// of the access and sharing groups must be specified for all
+ /// functions and methods which use these constants.
+ /// </summary>
+ [Flags]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Justification="Follows native api.")]
+ public enum AccessModes
+ {
+ /// <summary>
+ /// Indicates that, in direct mode, each change to a storage
+ /// or stream element is written as it occurs.
+ /// </summary>
+ Direct = 0x00000000,
+
+ /// <summary>
+ /// Indicates that, in transacted mode, changes are buffered
+ /// and written only if an explicit commit operation is called.
+ /// </summary>
+ Transacted = 0x00010000,
+
+ /// <summary>
+ /// Provides a faster implementation of a compound file
+ /// in a limited, but frequently used, case.
+ /// </summary>
+ Simple = 0x08000000,
+
+ /// <summary>
+ /// Indicates that the object is read-only,
+ /// meaning that modifications cannot be made.
+ /// </summary>
+ Read = 0x00000000,
+
+ /// <summary>
+ /// Enables you to save changes to the object,
+ /// but does not permit access to its data.
+ /// </summary>
+ Write = 0x00000001,
+
+ /// <summary>
+ /// Enables access and modification of object data.
+ /// </summary>
+ ReadWrite = 0x00000002,
+
+ /// <summary>
+ /// Specifies that subsequent openings of the object are
+ /// not denied read or write access.
+ /// </summary>
+ ShareDenyNone = 0x00000040,
+
+ /// <summary>
+ /// Prevents others from subsequently opening the object in Read mode.
+ /// </summary>
+ ShareDenyRead = 0x00000030,
+
+ /// <summary>
+ /// Prevents others from subsequently opening the object
+ /// for Write or ReadWrite access.
+ /// </summary>
+ ShareDenyWrite = 0x00000020,
+
+ /// <summary>
+ /// Prevents others from subsequently opening the object in any mode.
+ /// </summary>
+ ShareExclusive = 0x00000010,
+
+ /// <summary>
+ /// Opens the storage object with exclusive access to the most
+ /// recently committed version.
+ /// </summary>
+ Priority = 0x00040000,
+
+ /// <summary>
+ /// Indicates that the underlying file is to be automatically destroyed when the root
+ /// storage object is released. This feature is most useful for creating temporary files.
+ /// </summary>
+ DeleteOnRelease = 0x04000000,
+
+ /// <summary>
+ /// Indicates that, in transacted mode, a temporary scratch file is usually used
+ /// to save modifications until the Commit method is called.
+ /// Specifying NoScratch permits the unused portion of the original file
+ /// to be used as work space instead of creating a new file for that purpose.
+ /// </summary>
+ NoScratch = 0x00100000,
+
+ /// <summary>
+ /// Indicates that an existing storage object
+ /// or stream should be removed before the new object replaces it.
+ /// </summary>
+ Create = 0x00001000,
+
+ /// <summary>
+ /// Creates the new object while preserving existing data in a stream named "Contents".
+ /// </summary>
+ Convert = 0x00020000,
+
+ /// <summary>
+ /// Causes the create operation to fail if an existing object with the specified name exists.
+ /// </summary>
+ FailIfThere = 0x00000000,
+
+ /// <summary>
+ /// This flag is used when opening a storage object with Transacted
+ /// and without ShareExclusive or ShareDenyWrite.
+ /// In this case, specifying NoSnapshot prevents the system-provided
+ /// implementation from creating a snapshot copy of the file.
+ /// Instead, changes to the file are written to the end of the file.
+ /// </summary>
+ NoSnapshot = 0x00200000,
+
+ /// <summary>
+ /// Supports direct mode for single-writer, multireader file operations.
+ /// </summary>
+ DirectSingleWriterMultipleReader = 0x00400000
+ };
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/WindowUtilities.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/WindowUtilities.cs
new file mode 100644
index 0000000000..30a7c4a5bf
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Common/WindowUtilities.cs
@@ -0,0 +1,222 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using Microsoft.WindowsAPICodePack.Taskbar;
+using MS.WindowsAPICodePack.Internal;
+using Microsoft.WindowsAPICodePack.Shell.Interop;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+
+ internal static class WindowUtilities
+ {
+ internal static System.Drawing.Point GetParentOffsetOfChild(IntPtr hwnd, IntPtr hwndParent)
+ {
+ var childScreenCoord = new NativePoint();
+
+ TabbedThumbnailNativeMethods.ClientToScreen(hwnd, ref childScreenCoord);
+
+ var parentScreenCoord = new NativePoint();
+
+ TabbedThumbnailNativeMethods.ClientToScreen(hwndParent, ref parentScreenCoord);
+
+ System.Drawing.Point offset = new System.Drawing.Point(
+ childScreenCoord.X - parentScreenCoord.X,
+ childScreenCoord.Y - parentScreenCoord.Y);
+
+ return offset;
+ }
+
+ internal static System.Drawing.Size GetNonClientArea(IntPtr hwnd)
+ {
+ var c = new NativePoint();
+
+ TabbedThumbnailNativeMethods.ClientToScreen(hwnd, ref c);
+
+ var r = new NativeRect();
+
+ TabbedThumbnailNativeMethods.GetWindowRect(hwnd, ref r);
+
+ return new System.Drawing.Size(c.X - r.Left, c.Y - r.Top);
+ }
+ }
+
+ [Flags]
+ internal enum WindowStyles
+ {
+ /// <summary>
+ /// The window has a thin-line border.
+ /// </summary>
+ Border = 0x00800000,
+
+ /// <summary>
+ /// The window has a title bar (includes the WS_BORDER style).
+ /// </summary>
+ Caption = 0x00C00000,
+
+ /// <summary>
+ /// The window is a child window.
+ /// A window with this style cannot have a menu bar.
+ /// This style cannot be used with the WS_POPUP style.
+ /// </summary>
+ Child = 0x40000000,
+
+ /// <summary>
+ /// Same as the WS_CHILD style.
+ /// </summary>
+ ChildWindow = 0x40000000,
+
+ /// <summary>
+ /// Excludes the area occupied by child windows when drawing occurs within the parent window.
+ /// This style is used when creating the parent window.
+ /// </summary>
+ ClipChildren = 0x02000000,
+
+ /// <summary>
+ /// Clips child windows relative to each other;
+ /// that is, when a particular child window receives a WM_PAINT message,
+ /// the WS_CLIPSIBLINGS style clips all other overlapping child windows out of the region of the child window to be updated.
+ /// If WS_CLIPSIBLINGS is not specified and child windows overlap, it is possible,
+ /// when drawing within the client area of a child window, to draw within the client area of a neighboring child window.
+ /// </summary>
+ ClipSiblings = 0x04000000,
+
+ /// <summary>
+ /// The window is initially disabled. A disabled window cannot receive input from the user.
+ /// To change this after a window has been created, use the EnableWindow function.
+ /// </summary>
+ Disabled = 0x08000000,
+
+ /// <summary>
+ /// The window has a border of a style typically used with dialog boxes.
+ /// A window with this style cannot have a title bar.
+ /// </summary>
+ DialogFrame = 0x0040000,
+
+ /// <summary>
+ /// The window is the first control of a group of controls.
+ /// The group consists of this first control and all controls defined after it, up to the next control with the WS_GROUP style.
+ /// The first control in each group usually has the WS_TABSTOP style so that the user can move from group to group.
+ /// The user can subsequently change the keyboard focus from one control in the group to the next control
+ /// in the group by using the direction keys.
+ ///
+ /// You can turn this style on and off to change dialog box navigation.
+ /// To change this style after a window has been created, use the SetWindowLong function.
+ /// </summary>
+ Group = 0x00020000,
+
+ /// <summary>
+ /// The window has a horizontal scroll bar.
+ /// </summary>
+ HorizontalScroll = 0x00100000,
+
+ /// <summary>
+ /// The window is initially minimized.
+ /// Same as the WS_MINIMIZE style.
+ /// </summary>
+ Iconic = 0x20000000,
+
+ /// <summary>
+ /// The window is initially maximized.
+ /// </summary>
+ Maximize = 0x01000000,
+
+ /// <summary>
+ /// The window has a maximize button.
+ /// Cannot be combined with the WS_EX_CONTEXTHELP style.
+ /// The WS_SYSMENU style must also be specifie
+ /// </summary>
+ MaximizeBox = 0x00010000,
+
+ /// <summary>
+ /// The window is initially minimized.
+ /// Same as the WS_ICONIC style.
+ /// </summary>
+ Minimize = 0x20000000,
+
+ /// <summary>
+ /// The window has a minimize button.
+ /// Cannot be combined with the WS_EX_CONTEXTHELP style.
+ /// The WS_SYSMENU style must also be specified.
+ /// </summary>
+ MinimizeBox = 0x00020000,
+
+ /// <summary>
+ /// The window is an overlapped window.
+ /// An overlapped window has a title bar and a border.
+ /// Same as the WS_TILED style.
+ /// </summary>
+ Overlapped = 0x00000000,
+
+ /// <summary>
+ /// The windows is a pop-up window.
+ /// This style cannot be used with the WS_CHILD style.
+ /// </summary>
+ Popup = unchecked((int)0x80000000),
+
+ /// <summary>
+ /// The window has a sizing border.
+ /// Same as the WS_THICKFRAME style.
+ /// </summary>
+ SizeBox = 0x00040000,
+
+ /// <summary>
+ /// The window has a window menu on its title bar.
+ /// The WS_CAPTION style must also be specified.
+ /// </summary>
+ SystemMenu = 0x00080000,
+
+ /// <summary>
+ /// The window is a control that can receive the keyboard focus when the user presses the TAB key.
+ /// Pressing the TAB key changes the keyboard focus to the next control with the WS_TABSTOP style.
+ ///
+ /// You can turn this style on and off to change dialog box navigation.
+ /// To change this style after a window has been created, use the SetWindowLong function.
+ /// For user-created windows and modeless dialogs to work with tab stops,
+ /// alter the message loop to call the IsDialogMessage function.
+ /// </summary>
+ Tabstop = 0x00010000,
+
+ /// <summary>
+ /// The window has a sizing border.
+ /// Same as the WS_SIZEBOX style.
+ /// </summary>
+ ThickFrame = 0x00040000,
+
+ /// <summary>
+ /// The window is an overlapped window.
+ /// An overlapped window has a title bar and a border.
+ /// Same as the WS_OVERLAPPED style.
+ /// </summary>
+ Tiled = 0x00000000,
+
+ /// <summary>
+ /// The window is initially visible.
+ ///
+ /// This style can be turned on and off by using the ShowWindow or SetWindowPos function.
+ /// </summary>
+ Visible = 0x10000000,
+
+ /// <summary>
+ /// The window has a vertical scroll bar.
+ /// </summary>
+ VerticalScroll = 0x00200000,
+
+ /// <summary>
+ /// The window is an overlapped window.
+ /// Same as the WS_OVERLAPPEDWINDOW style.
+ /// </summary>
+ TiledWindowMask = Overlapped | Caption | SystemMenu | ThickFrame | MinimizeBox | MaximizeBox,
+
+ /// <summary>
+ /// The window is a pop-up window.
+ /// The WS_CAPTION and WS_POPUPWINDOW styles must be combined to make the window menu visible.
+ /// </summary>
+ PopupWindowMask = Popup | Border | SystemMenu,
+
+ /// <summary>
+ /// The window is an overlapped window. Same as the WS_TILEDWINDOW style.
+ /// </summary>
+ OverlappedWindowMask = Overlapped | Caption | SystemMenu | ThickFrame | MinimizeBox | MaximizeBox,
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Dialogs/DialogsCOMClasses.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Dialogs/DialogsCOMClasses.cs
new file mode 100644
index 0000000000..cc35d9169a
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Dialogs/DialogsCOMClasses.cs
@@ -0,0 +1,51 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Shell;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+
+ // Dummy base interface for CommonFileDialog coclasses.
+ internal interface NativeCommonFileDialog
+ {
+ }
+
+ // Coclass interfaces - designed to "look like" the object
+ // in the API, so that the 'new' operator can be used in a
+ // straightforward way. Behind the scenes, the C# compiler
+ // morphs all 'new CoClass()' calls to 'new CoClassWrapper()'.
+
+ [ComImport,
+ Guid(ShellIIDGuid.IFileOpenDialog),
+ CoClass(typeof(FileOpenDialogRCW))]
+ internal interface NativeFileOpenDialog : IFileOpenDialog
+ {
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.IFileSaveDialog),
+ CoClass(typeof(FileSaveDialogRCW))]
+ internal interface NativeFileSaveDialog : IFileSaveDialog
+ {
+ }
+
+ // .NET classes representing runtime callable wrappers.
+ [ComImport,
+ ClassInterface(ClassInterfaceType.None),
+ TypeLibType(TypeLibTypeFlags.FCanCreate),
+ Guid(ShellCLSIDGuid.FileOpenDialog)]
+ internal class FileOpenDialogRCW
+ {
+ }
+
+ [ComImport,
+ ClassInterface(ClassInterfaceType.None),
+ TypeLibType(TypeLibTypeFlags.FCanCreate),
+ Guid(ShellCLSIDGuid.FileSaveDialog)]
+ internal class FileSaveDialogRCW
+ {
+ }
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Dialogs/DialogsCOMInterfaces.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Dialogs/DialogsCOMInterfaces.cs
new file mode 100644
index 0000000000..9d07efd143
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Dialogs/DialogsCOMInterfaces.cs
@@ -0,0 +1,507 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Shell;
+using Microsoft.WindowsAPICodePack.Shell.PropertySystem;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Dialogs
+{
+ // Disable warning if a method declaration hides another inherited from a parent COM interface
+ // To successfully import a COM interface, all inherited methods need to be declared again with
+ // the exception of those already declared in "IUnknown"
+#pragma warning disable 0108
+
+ [ComImport(),
+ Guid(ShellIIDGuid.IFileDialog),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IFileDialog : IModalWindow
+ {
+ // Defined on IModalWindow - repeated here due to requirements of COM interop layer.
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime),
+ PreserveSig]
+ int Show([In] IntPtr parent);
+
+ // IFileDialog-Specific interface members.
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetFileTypes(
+ [In] uint cFileTypes,
+ [In, MarshalAs(UnmanagedType.LPArray)] ShellNativeMethods.FilterSpec[] rgFilterSpec);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetFileTypeIndex([In] uint iFileType);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetFileTypeIndex(out uint piFileType);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void Advise(
+ [In, MarshalAs(UnmanagedType.Interface)] IFileDialogEvents pfde,
+ out uint pdwCookie);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void Unadvise([In] uint dwCookie);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetOptions([In] ShellNativeMethods.FileOpenOptions fos);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetOptions(out ShellNativeMethods.FileOpenOptions pfos);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetDefaultFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetFolder([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetCurrentSelection([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetFileName([In, MarshalAs(UnmanagedType.LPWStr)] string pszName);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetFileName([MarshalAs(UnmanagedType.LPWStr)] out string pszName);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetTitle([In, MarshalAs(UnmanagedType.LPWStr)] string pszTitle);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetOkButtonLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszText);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetFileNameLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetResult([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void AddPlace([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, ShellNativeMethods.FileDialogAddPlacement fdap);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetDefaultExtension([In, MarshalAs(UnmanagedType.LPWStr)] string pszDefaultExtension);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void Close([MarshalAs(UnmanagedType.Error)] int hr);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetClientGuid([In] ref Guid guid);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void ClearClientData();
+
+ // Not supported: IShellItemFilter is not defined, converting to IntPtr.
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetFilter([MarshalAs(UnmanagedType.Interface)] IntPtr pFilter);
+ }
+
+ [ComImport(),
+ Guid(ShellIIDGuid.IFileOpenDialog),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IFileOpenDialog : IFileDialog
+ {
+ // Defined on IModalWindow - repeated here due to requirements of COM interop layer.
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime),
+ PreserveSig]
+ int Show([In] IntPtr parent);
+
+ // Defined on IFileDialog - repeated here due to requirements of COM interop layer.
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetFileTypes([In] uint cFileTypes, [In] ref ShellNativeMethods.FilterSpec rgFilterSpec);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetFileTypeIndex([In] uint iFileType);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetFileTypeIndex(out uint piFileType);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void Advise(
+ [In, MarshalAs(UnmanagedType.Interface)] IFileDialogEvents pfde,
+ out uint pdwCookie);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void Unadvise([In] uint dwCookie);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetOptions([In] ShellNativeMethods.FileOpenOptions fos);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetOptions(out ShellNativeMethods.FileOpenOptions pfos);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetDefaultFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetFolder([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetCurrentSelection([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetFileName([In, MarshalAs(UnmanagedType.LPWStr)] string pszName);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetFileName([MarshalAs(UnmanagedType.LPWStr)] out string pszName);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetTitle([In, MarshalAs(UnmanagedType.LPWStr)] string pszTitle);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetOkButtonLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszText);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetFileNameLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetResult([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void AddPlace([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, ShellNativeMethods.FileDialogAddPlacement fdap);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetDefaultExtension([In, MarshalAs(UnmanagedType.LPWStr)] string pszDefaultExtension);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void Close([MarshalAs(UnmanagedType.Error)] int hr);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetClientGuid([In] ref Guid guid);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void ClearClientData();
+
+ // Not supported: IShellItemFilter is not defined, converting to IntPtr.
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetFilter([MarshalAs(UnmanagedType.Interface)] IntPtr pFilter);
+
+ // Defined by IFileOpenDialog.
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetResults([MarshalAs(UnmanagedType.Interface)] out IShellItemArray ppenum);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetSelectedItems([MarshalAs(UnmanagedType.Interface)] out IShellItemArray ppsai);
+ }
+
+ [ComImport(),
+ Guid(ShellIIDGuid.IFileSaveDialog),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IFileSaveDialog : IFileDialog
+ {
+ // Defined on IModalWindow - repeated here due to requirements of COM interop layer.
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime),
+ PreserveSig]
+ int Show([In] IntPtr parent);
+
+ // Defined on IFileDialog - repeated here due to requirements of COM interop layer.
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetFileTypes(
+ [In] uint cFileTypes,
+ [In] ref ShellNativeMethods.FilterSpec rgFilterSpec);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetFileTypeIndex([In] uint iFileType);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetFileTypeIndex(out uint piFileType);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void Advise(
+ [In, MarshalAs(UnmanagedType.Interface)] IFileDialogEvents pfde,
+ out uint pdwCookie);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void Unadvise([In] uint dwCookie);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetOptions([In] ShellNativeMethods.FileOpenOptions fos);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetOptions(out ShellNativeMethods.FileOpenOptions pfos);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetDefaultFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetFolder([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetCurrentSelection([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetFileName([In, MarshalAs(UnmanagedType.LPWStr)] string pszName);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetFileName([MarshalAs(UnmanagedType.LPWStr)] out string pszName);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetTitle([In, MarshalAs(UnmanagedType.LPWStr)] string pszTitle);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetOkButtonLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszText);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetFileNameLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetResult([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void AddPlace(
+ [In, MarshalAs(UnmanagedType.Interface)] IShellItem psi,
+ ShellNativeMethods.FileDialogAddPlacement fdap);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetDefaultExtension([In, MarshalAs(UnmanagedType.LPWStr)] string pszDefaultExtension);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void Close([MarshalAs(UnmanagedType.Error)] int hr);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetClientGuid([In] ref Guid guid);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void ClearClientData();
+
+ // Not supported: IShellItemFilter is not defined, converting to IntPtr.
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetFilter([MarshalAs(UnmanagedType.Interface)] IntPtr pFilter);
+
+ // Defined by IFileSaveDialog interface.
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetSaveAsItem([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi);
+
+ // Not currently supported: IPropertyStore.
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetProperties([In, MarshalAs(UnmanagedType.Interface)] IntPtr pStore);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ int SetCollectedProperties(
+ [In] IPropertyDescriptionList pList,
+ [In] bool fAppendDefault);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ [PreserveSig]
+ HResult GetProperties(out IPropertyStore ppStore);
+
+ // Not currently supported: IPropertyStore, IFileOperationProgressSink.
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void ApplyProperties(
+ [In, MarshalAs(UnmanagedType.Interface)] IShellItem psi,
+ [In, MarshalAs(UnmanagedType.Interface)] IntPtr pStore,
+ [In, ComAliasName("ShellObjects.wireHWND")] ref IntPtr hwnd,
+ [In, MarshalAs(UnmanagedType.Interface)] IntPtr pSink);
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.IFileDialogEvents),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IFileDialogEvents
+ {
+ // NOTE: some of these callbacks are cancelable - returning S_FALSE means that
+ // the dialog should not proceed (e.g. with closing, changing folder); to
+ // support this, we need to use the PreserveSig attribute to enable us to return
+ // the proper HRESULT.
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime),
+ PreserveSig]
+ HResult OnFileOk([In, MarshalAs(UnmanagedType.Interface)] IFileDialog pfd);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime),
+ PreserveSig]
+ HResult OnFolderChanging(
+ [In, MarshalAs(UnmanagedType.Interface)] IFileDialog pfd,
+ [In, MarshalAs(UnmanagedType.Interface)] IShellItem psiFolder);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void OnFolderChange([In, MarshalAs(UnmanagedType.Interface)] IFileDialog pfd);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void OnSelectionChange([In, MarshalAs(UnmanagedType.Interface)] IFileDialog pfd);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void OnShareViolation(
+ [In, MarshalAs(UnmanagedType.Interface)] IFileDialog pfd,
+ [In, MarshalAs(UnmanagedType.Interface)] IShellItem psi,
+ out ShellNativeMethods.FileDialogEventShareViolationResponse pResponse);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void OnTypeChange([In, MarshalAs(UnmanagedType.Interface)] IFileDialog pfd);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void OnOverwrite([In, MarshalAs(UnmanagedType.Interface)] IFileDialog pfd,
+ [In, MarshalAs(UnmanagedType.Interface)] IShellItem psi,
+ out ShellNativeMethods.FileDialogEventOverwriteResponse pResponse);
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.IFileDialogCustomize),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IFileDialogCustomize
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void EnableOpenDropDown([In] int dwIDCtl);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void AddMenu(
+ [In] int dwIDCtl,
+ [In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void AddPushButton(
+ [In] int dwIDCtl,
+ [In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void AddComboBox([In] int dwIDCtl);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void AddRadioButtonList([In] int dwIDCtl);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void AddCheckButton(
+ [In] int dwIDCtl,
+ [In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel,
+ [In] bool bChecked);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void AddEditBox(
+ [In] int dwIDCtl,
+ [In, MarshalAs(UnmanagedType.LPWStr)] string pszText);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void AddSeparator([In] int dwIDCtl);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void AddText(
+ [In] int dwIDCtl,
+ [In, MarshalAs(UnmanagedType.LPWStr)] string pszText);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetControlLabel(
+ [In] int dwIDCtl,
+ [In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetControlState(
+ [In] int dwIDCtl,
+ [Out] out ShellNativeMethods.ControlState pdwState);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetControlState(
+ [In] int dwIDCtl,
+ [In] ShellNativeMethods.ControlState dwState);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetEditBoxText(
+ [In] int dwIDCtl,
+ [MarshalAs(UnmanagedType.LPWStr)] out string ppszText);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetEditBoxText(
+ [In] int dwIDCtl,
+ [In, MarshalAs(UnmanagedType.LPWStr)] string pszText);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetCheckButtonState(
+ [In] int dwIDCtl,
+ [Out] out bool pbChecked);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetCheckButtonState(
+ [In] int dwIDCtl,
+ [In] bool bChecked);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void AddControlItem(
+ [In] int dwIDCtl,
+ [In] int dwIDItem,
+ [In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void RemoveControlItem(
+ [In] int dwIDCtl,
+ [In] int dwIDItem);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void RemoveAllControlItems([In] int dwIDCtl);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetControlItemState(
+ [In] int dwIDCtl,
+ [In] int dwIDItem,
+ [Out] out ShellNativeMethods.ControlState pdwState);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetControlItemState(
+ [In] int dwIDCtl,
+ [In] int dwIDItem,
+ [In] ShellNativeMethods.ControlState dwState);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetSelectedControlItem(
+ [In] int dwIDCtl,
+ [Out] out int pdwIDItem);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetSelectedControlItem(
+ [In] int dwIDCtl,
+ [In] int dwIDItem); // Not valid for OpenDropDown.
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void StartVisualGroup(
+ [In] int dwIDCtl,
+ [In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void EndVisualGroup();
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void MakeProminent([In] int dwIDCtl);
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.IFileDialogControlEvents),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IFileDialogControlEvents
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void OnItemSelected(
+ [In, MarshalAs(UnmanagedType.Interface)] IFileDialogCustomize pfdc,
+ [In] int dwIDCtl,
+ [In] int dwIDItem);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void OnButtonClicked(
+ [In, MarshalAs(UnmanagedType.Interface)] IFileDialogCustomize pfdc,
+ [In] int dwIDCtl);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void OnCheckButtonToggled(
+ [In, MarshalAs(UnmanagedType.Interface)] IFileDialogCustomize pfdc,
+ [In] int dwIDCtl,
+ [In] bool bChecked);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void OnControlActivating(
+ [In, MarshalAs(UnmanagedType.Interface)] IFileDialogCustomize pfdc,
+ [In] int dwIDCtl);
+ }
+ // Restore the warning
+#pragma warning restore 0108
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/ExplorerBrowser/ExplorerBrowserCOMGuids.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/ExplorerBrowser/ExplorerBrowserCOMGuids.cs
new file mode 100644
index 0000000000..7b389fcaef
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/ExplorerBrowser/ExplorerBrowserCOMGuids.cs
@@ -0,0 +1,51 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Controls
+{
+ internal static class ExplorerBrowserIIDGuid
+ {
+ // IID GUID strings for relevant Shell COM interfaces.
+ internal const string IExplorerBrowser = "DFD3B6B5-C10C-4BE9-85F6-A66969F402F6";
+ internal const string IKnownFolderManager = "8BE2D872-86AA-4d47-B776-32CCA40C7018";
+ internal const string IFolderView = "cde725b0-ccc9-4519-917e-325d72fab4ce";
+ internal const string IFolderView2 = "1af3a467-214f-4298-908e-06b03e0b39f9";
+ internal const string IServiceProvider = "6d5140c1-7436-11ce-8034-00aa006009fa";
+ internal const string IExplorerPaneVisibility = "e07010ec-bc17-44c0-97b0-46c7c95b9edc";
+ internal const string IExplorerBrowserEvents = "361bbdc7-e6ee-4e13-be58-58e2240c810f";
+ internal const string IInputObject = "68284fAA-6A48-11D0-8c78-00C04fd918b4";
+ internal const string IShellView = "000214E3-0000-0000-C000-000000000046";
+ internal const string IDispatch = "00020400-0000-0000-C000-000000000046";
+ internal const string DShellFolderViewEvents = "62112AA2-EBE4-11cf-A5FB-0020AFE7292D";
+
+ internal const string ICommDlgBrowser = "000214F1-0000-0000-C000-000000000046";
+ internal const string ICommDlgBrowser2 = "10339516-2894-11d2-9039-00C04F8EEB3E";
+ internal const string ICommDlgBrowser3 = "c8ad25a1-3294-41ee-8165-71174bd01c57";
+
+ }
+
+ internal static class ExplorerBrowserViewPanes
+ {
+ internal const string Navigation = "cb316b22-25f7-42b8-8a09-540d23a43c2f";
+ internal const string Commands = "d9745868-ca5f-4a76-91cd-f5a129fbb076";
+ internal const string CommandsOrganize = "72e81700-e3ec-4660-bf24-3c3b7b648806";
+ internal const string CommandsView = "21f7c32d-eeaa-439b-bb51-37b96fd6a943";
+ internal const string Details = "43abf98b-89b8-472d-b9ce-e69b8229f019";
+ internal const string Preview = "893c63d1-45c8-4d17-be19-223be71be365";
+ internal const string Query = "65bcde4f-4f07-4f27-83a7-1afca4df7ddd";
+ internal const string AdvancedQuery = "b4e9db8b-34ba-4c39-b5cc-16a1bd2c411c";
+ }
+
+ internal static class ExplorerBrowserCLSIDGuid
+ {
+ // CLSID GUID strings for relevant coclasses.
+ internal const string ExplorerBrowser = "71F96385-DDD6-48D3-A0C1-AE06E8B055FB";
+ }
+
+ internal static class ExplorerBrowserViewDispatchIds
+ {
+ internal const int SelectionChanged = 200;
+ internal const int ContentsChanged = 207;
+ internal const int FileListEnumDone = 201;
+ internal const int SelectedItemChanged = 220;
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/ExplorerBrowser/ExplorerBrowserCOMInterfaces.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/ExplorerBrowser/ExplorerBrowserCOMInterfaces.cs
new file mode 100644
index 0000000000..03a37bef0c
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/ExplorerBrowser/ExplorerBrowserCOMInterfaces.cs
@@ -0,0 +1,796 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Shell;
+using MS.WindowsAPICodePack.Internal;
+using System.Text;
+using Microsoft.WindowsAPICodePack.Shell.Interop;
+
+namespace Microsoft.WindowsAPICodePack.Controls
+{
+
+ internal enum ShellViewGetItemObject
+ {
+ Background = 0x00000000,
+ Selection = 0x00000001,
+ AllView = 0x00000002,
+ Checked = 0x00000003,
+ TypeMask = 0x0000000F,
+ ViewOrderFlag = unchecked((int)0x80000000)
+ }
+
+ [Flags]
+ internal enum FolderOptions
+ {
+ AutoArrange = 0x00000001,
+ AbbreviatedNames = 0x00000002,
+ SnapToGrid = 0x00000004,
+ OwnerData = 0x00000008,
+ BestFitWindow = 0x00000010,
+ Desktop = 0x00000020,
+ SingleSelection = 0x00000040,
+ NoSubfolders = 0x00000080,
+ Transparent = 0x00000100,
+ NoClientEdge = 0x00000200,
+ NoScroll = 0x00000400,
+ AlignLeft = 0x00000800,
+ NoIcons = 0x00001000,
+ ShowSelectionAlways = 0x00002000,
+ NoVisible = 0x00004000,
+ SingleClickActivate = 0x00008000,
+ NoWebView = 0x00010000,
+ HideFilenames = 0x00020000,
+ CheckSelect = 0x00040000,
+ NoEnumRefresh = 0x00080000,
+ NoGrouping = 0x00100000,
+ FullRowSelect = 0x00200000,
+ NoFilters = 0x00400000,
+ NoColumnHeaders = 0x00800000,
+ NoHeaderInAllViews = 0x01000000,
+ ExtendedTiles = 0x02000000,
+ TriCheckSelect = 0x04000000,
+ AutoCheckSelect = 0x08000000,
+ NoBrowserViewState = 0x10000000,
+ SubsetGroups = 0x20000000,
+ UseSearchFolders = 0x40000000,
+ AllowRightToLeftReading = unchecked((int)0x80000000)
+ }
+
+ internal enum FolderViewMode
+ {
+ Auto = -1,
+ First = 1,
+ Icon = 1,
+ SmallIcon = 2,
+ List = 3,
+ Details = 4,
+ Thumbnail = 5,
+ Tile = 6,
+ Thumbstrip = 7,
+ Content = 8,
+ Last = 8
+ }
+
+ internal enum ExplorerPaneState
+ {
+ DoNotCare = 0x00000000,
+ DefaultOn = 0x00000001,
+ DefaultOff = 0x00000002,
+ StateMask = 0x0000ffff,
+ InitialState = 0x00010000,
+ Force = 0x00020000
+ }
+
+ [StructLayout(LayoutKind.Sequential, Pack = 4)]
+ internal class FolderSettings
+ {
+ public FolderViewMode ViewMode;
+ public FolderOptions Options;
+ }
+
+ [Flags]
+ internal enum ExplorerBrowserOptions
+ {
+ NavigateOnce = 0x00000001,
+ ShowFrames = 0x00000002,
+ AlwaysNavigate = 0x00000004,
+ NoTravelLog = 0x00000008,
+ NoWrapperWindow = 0x00000010,
+ HtmlSharepointView = 0x00000020
+ }
+
+ internal enum CommDlgBrowserStateChange
+ {
+ SetFocus = 0,
+ KillFocus = 1,
+ SelectionChange = 2,
+ Rename = 3,
+ StateChange = 4
+ }
+
+ internal enum CommDlgBrowserNotifyType
+ {
+ Done = 1,
+ Start = 2
+ }
+
+ internal enum CommDlgBrowser2ViewFlags
+ {
+ ShowAllFiles = 0x00000001,
+ IsFileSave = 0x00000002,
+ AllowPreviewPane = 0x00000004,
+ NoSelectVerb = 0x00000008,
+ NoIncludeItem = 0x00000010,
+ IsFolderPicker = 0x00000020
+ }
+
+ // Disable warning if a method declaration hides another inherited from a parent COM interface
+ // To successfully import a COM interface, all inherited methods need to be declared again with
+ // the exception of those already declared in "IUnknown"
+#pragma warning disable 108
+
+
+ [ComImport,
+ TypeLibType(TypeLibTypeFlags.FCanCreate),
+ ClassInterface(ClassInterfaceType.None),
+ Guid(ExplorerBrowserCLSIDGuid.ExplorerBrowser)]
+ internal class ExplorerBrowserClass : IExplorerBrowser
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void Initialize(IntPtr hwndParent, [In]ref NativeRect prc, [In] FolderSettings pfs);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void Destroy();
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void SetRect([In, Out] ref IntPtr phdwp, NativeRect rcBrowser);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void SetPropertyBag([MarshalAs(UnmanagedType.LPWStr)] string pszPropertyBag);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void SetEmptyText([MarshalAs(UnmanagedType.LPWStr)] string pszEmptyText);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern HResult SetFolderSettings(FolderSettings pfs);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern HResult Advise(IntPtr psbe, out uint pdwCookie);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern HResult Unadvise(uint dwCookie);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void SetOptions([In]ExplorerBrowserOptions dwFlag);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void GetOptions(out ExplorerBrowserOptions pdwFlag);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void BrowseToIDList(IntPtr pidl, uint uFlags);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern HResult BrowseToObject([MarshalAs(UnmanagedType.IUnknown)] object punk, uint uFlags);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void FillFromObject([MarshalAs(UnmanagedType.IUnknown)] object punk, int dwFlags);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void RemoveAll();
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern HResult GetCurrentView(ref Guid riid, out IntPtr ppv);
+ }
+
+
+ [ComImport,
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
+ Guid(ExplorerBrowserIIDGuid.IExplorerBrowser)]
+ internal interface IExplorerBrowser
+ {
+ /// <summary>
+ /// Prepares the browser to be navigated.
+ /// </summary>
+ /// <param name="hwndParent">A handle to the owner window or control.</param>
+ /// <param name="prc">A pointer to a RECT containing the coordinates of the bounding rectangle
+ /// the browser will occupy. The coordinates are relative to hwndParent. If this parameter is NULL,
+ /// then method IExplorerBrowser::SetRect should subsequently be called.</param>
+ /// <param name="pfs">A pointer to a FOLDERSETTINGS structure that determines how the folder will be
+ /// displayed in the view. If this parameter is NULL, then method IExplorerBrowser::SetFolderSettings
+ /// should be called, otherwise, the default view settings for the folder are used.</param>
+ /// <returns></returns>
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void Initialize(IntPtr hwndParent, [In] ref NativeRect prc, [In] FolderSettings pfs);
+
+ /// <summary>
+ /// Destroys the browser.
+ /// </summary>
+ /// <returns></returns>
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void Destroy();
+
+ /// <summary>
+ /// Sets the size and position of the view windows created by the browser.
+ /// </summary>
+ /// <param name="phdwp">A pointer to a DeferWindowPos handle. This paramater can be NULL.</param>
+ /// <param name="rcBrowser">The coordinates that the browser will occupy.</param>
+ /// <returns></returns>
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetRect([In, Out] ref IntPtr phdwp, NativeRect rcBrowser);
+
+ /// <summary>
+ /// Sets the name of the property bag.
+ /// </summary>
+ /// <param name="pszPropertyBag">A pointer to a constant, null-terminated, Unicode string that contains
+ /// the name of the property bag. View state information that is specific to the application of the
+ /// client is stored (persisted) using this name.</param>
+ /// <returns></returns>
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetPropertyBag([MarshalAs(UnmanagedType.LPWStr)] string pszPropertyBag);
+
+ /// <summary>
+ /// Sets the default empty text.
+ /// </summary>
+ /// <param name="pszEmptyText">A pointer to a constant, null-terminated, Unicode string that contains
+ /// the empty text.</param>
+ /// <returns></returns>
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetEmptyText([MarshalAs(UnmanagedType.LPWStr)] string pszEmptyText);
+
+ /// <summary>
+ /// Sets the folder settings for the current view.
+ /// </summary>
+ /// <param name="pfs">A pointer to a FOLDERSETTINGS structure that contains the folder settings
+ /// to be applied.</param>
+ /// <returns></returns>
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult SetFolderSettings(FolderSettings pfs);
+
+ /// <summary>
+ /// Initiates a connection with IExplorerBrowser for event callbacks.
+ /// </summary>
+ /// <param name="psbe">A pointer to the IExplorerBrowserEvents interface of the object to be
+ /// advised of IExplorerBrowser events</param>
+ /// <param name="pdwCookie">When this method returns, contains a token that uniquely identifies
+ /// the event listener. This allows several event listeners to be subscribed at a time.</param>
+ /// <returns></returns>
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult Advise(IntPtr psbe, out uint pdwCookie);
+
+ /// <summary>
+ /// Terminates an advisory connection.
+ /// </summary>
+ /// <param name="dwCookie">A connection token previously returned from IExplorerBrowser::Advise.
+ /// Identifies the connection to be terminated.</param>
+ /// <returns></returns>
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult Unadvise([In] uint dwCookie);
+
+ /// <summary>
+ /// Sets the current browser options.
+ /// </summary>
+ /// <param name="dwFlag">One or more EXPLORER_BROWSER_OPTIONS flags to be set.</param>
+ /// <returns></returns>
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetOptions([In]ExplorerBrowserOptions dwFlag);
+
+ /// <summary>
+ /// Gets the current browser options.
+ /// </summary>
+ /// <param name="pdwFlag">When this method returns, contains the current EXPLORER_BROWSER_OPTIONS
+ /// for the browser.</param>
+ /// <returns></returns>
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetOptions(out ExplorerBrowserOptions pdwFlag);
+
+ /// <summary>
+ /// Browses to a pointer to an item identifier list (PIDL)
+ /// </summary>
+ /// <param name="pidl">A pointer to a const ITEMIDLIST (item identifier list) that specifies an object's
+ /// location as the destination to navigate to. This parameter can be NULL.</param>
+ /// <param name="uFlags">A flag that specifies the category of the pidl. This affects how
+ /// navigation is accomplished</param>
+ /// <returns></returns>
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void BrowseToIDList(IntPtr pidl, uint uFlags);
+
+ /// <summary>
+ /// Browse to an object
+ /// </summary>
+ /// <param name="punk">A pointer to an object to browse to. If the object cannot be browsed,
+ /// an error value is returned.</param>
+ /// <param name="uFlags">A flag that specifies the category of the pidl. This affects how
+ /// navigation is accomplished. </param>
+ /// <returns></returns>
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult BrowseToObject([MarshalAs(UnmanagedType.IUnknown)] object punk, uint uFlags);
+
+ /// <summary>
+ /// Creates a results folder and fills it with items.
+ /// </summary>
+ /// <param name="punk">An interface pointer on the source object that will fill the IResultsFolder</param>
+ /// <param name="dwFlags">One of the EXPLORER_BROWSER_FILL_FLAGS</param>
+ /// <returns></returns>
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void FillFromObject([MarshalAs(UnmanagedType.IUnknown)] object punk, int dwFlags);
+
+ /// <summary>
+ /// Removes all items from the results folder.
+ /// </summary>
+ /// <returns></returns>
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void RemoveAll();
+
+ /// <summary>
+ /// Gets an interface for the current view of the browser.
+ /// </summary>
+ /// <param name="riid">A reference to the desired interface ID.</param>
+ /// <param name="ppv">When this method returns, contains the interface pointer requested in riid.
+ /// This will typically be IShellView or IShellView2. </param>
+ /// <returns></returns>
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetCurrentView(ref Guid riid, out IntPtr ppv);
+ }
+
+ [ComImport,
+ Guid(ExplorerBrowserIIDGuid.IServiceProvider),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IServiceProvider
+ {
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ HResult QueryService(ref Guid guidService, ref Guid riid, out IntPtr ppvObject);
+ };
+
+ [ComImport,
+ Guid(ExplorerBrowserIIDGuid.IFolderView),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IFolderView
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetCurrentViewMode([Out] out uint pViewMode);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetCurrentViewMode(uint ViewMode);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetFolder(ref Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void Item(int iItemIndex, out IntPtr ppidl);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void ItemCount(uint uFlags, out int pcItems);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void Items(uint uFlags, ref Guid riid, [Out, MarshalAs(UnmanagedType.IUnknown)] out object ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetSelectionMarkedItem(out int piItem);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetFocusedItem(out int piItem);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetItemPosition(IntPtr pidl, out NativePoint ppt);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetSpacing([Out] out NativePoint ppt);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetDefaultSpacing(out NativePoint ppt);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetAutoArrange();
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SelectItem(int iItem, uint dwFlags);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SelectAndPositionItems(uint cidl, IntPtr apidl, ref NativePoint apt, uint dwFlags);
+ }
+
+ [ComImport,
+ Guid(ExplorerBrowserIIDGuid.IFolderView2),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IFolderView2 : IFolderView
+ {
+ // IFolderView
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetCurrentViewMode(out uint pViewMode);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetCurrentViewMode(uint ViewMode);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetFolder(ref Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void Item(int iItemIndex, out IntPtr ppidl);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult ItemCount(uint uFlags, out int pcItems);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult Items(uint uFlags, ref Guid riid, [Out, MarshalAs(UnmanagedType.IUnknown)] out object ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetSelectionMarkedItem(out int piItem);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetFocusedItem(out int piItem);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetItemPosition(IntPtr pidl, out NativePoint ppt);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetSpacing([Out] out NativePoint ppt);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetDefaultSpacing(out NativePoint ppt);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetAutoArrange();
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SelectItem(int iItem, uint dwFlags);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SelectAndPositionItems(uint cidl, IntPtr apidl, ref NativePoint apt, uint dwFlags);
+
+ // IFolderView2
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetGroupBy(IntPtr key, bool fAscending);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetGroupBy(ref IntPtr pkey, ref bool pfAscending);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetViewProperty(IntPtr pidl, IntPtr propkey, object propvar);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetViewProperty(IntPtr pidl, IntPtr propkey, out object ppropvar);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetTileViewProperties(IntPtr pidl, [MarshalAs(UnmanagedType.LPWStr)] string pszPropList);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetExtendedTileViewProperties(IntPtr pidl, [MarshalAs(UnmanagedType.LPWStr)] string pszPropList);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetText(int iType, [MarshalAs(UnmanagedType.LPWStr)] string pwszText);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetCurrentFolderFlags(uint dwMask, uint dwFlags);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetCurrentFolderFlags(out uint pdwFlags);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetSortColumnCount(out int pcColumns);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetSortColumns(IntPtr rgSortColumns, int cColumns);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetSortColumns(out IntPtr rgSortColumns, int cColumns);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetItem(int iItem, ref Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetVisibleItem(int iStart, bool fPrevious, out int piItem);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetSelectedItem(int iStart, out int piItem);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetSelection(bool fNoneImpliesFolder, out IShellItemArray ppsia);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetSelectionState(IntPtr pidl, out uint pdwFlags);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void InvokeVerbOnSelection([In, MarshalAs(UnmanagedType.LPWStr)] string pszVerb);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult SetViewModeAndIconSize(int uViewMode, int iImageSize);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetViewModeAndIconSize(out int puViewMode, out int piImageSize);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetGroupSubsetCount(uint cVisibleRows);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetGroupSubsetCount(out uint pcVisibleRows);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void SetRedraw(bool fRedrawOn);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void IsMoveInSameFolder();
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void DoRename();
+ }
+
+ [ComImport,
+ Guid(ExplorerBrowserIIDGuid.IExplorerPaneVisibility),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IExplorerPaneVisibility
+ {
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetPaneState(ref Guid explorerPane, out ExplorerPaneState peps);
+ };
+
+ [ComImport,
+ Guid(ExplorerBrowserIIDGuid.IExplorerBrowserEvents),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IExplorerBrowserEvents
+ {
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult OnNavigationPending(IntPtr pidlFolder);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult OnViewCreated([MarshalAs(UnmanagedType.IUnknown)] object psv);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult OnNavigationComplete(IntPtr pidlFolder);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult OnNavigationFailed(IntPtr pidlFolder);
+ }
+
+ #region Unused - Keeping for debugging bug #885228
+
+ //[ComImport,
+ // Guid(ExplorerBrowserIIDGuid.ICommDlgBrowser),
+ // InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ //internal interface ICommDlgBrowser
+ //{
+ // [PreserveSig]
+ // [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ // HResult OnDefaultCommand(IntPtr ppshv);
+
+ // [PreserveSig]
+ // [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ // HResult OnStateChange(
+ // IntPtr ppshv,
+ // CommDlgBrowserStateChange uChange);
+
+ // [PreserveSig]
+ // [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ // HResult IncludeObject(
+ // IntPtr ppshv,
+ // IntPtr pidl);
+ //}
+
+ //[ComImport,
+ // Guid(ExplorerBrowserIIDGuid.ICommDlgBrowser2),
+ // InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ //internal interface ICommDlgBrowser2
+ //{
+ // // dlg
+
+ // [PreserveSig]
+ // [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ // HResult OnDefaultCommand(IntPtr ppshv);
+
+ // [PreserveSig]
+ // [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ // HResult OnStateChange(
+ // IntPtr ppshv,
+ // CommDlgBrowserStateChange uChange);
+
+ // [PreserveSig]
+ // [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ // HResult IncludeObject(
+ // IntPtr ppshv,
+ // IntPtr pidl);
+
+ // // dlg2
+
+ // [PreserveSig]
+ // [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ // HResult GetDefaultMenuText(
+ // [In] IShellView shellView,
+ // StringBuilder buffer, //A pointer to a buffer that is used by the Shell browser to return the default shortcut menu text.
+ // [In] int bufferMaxLength); //should be max size = 260?
+
+ // [PreserveSig]
+ // [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ // HResult GetViewFlags(CommDlgBrowser2ViewFlags pdwFlags);
+
+
+ // [PreserveSig]
+ // [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ // HResult Notify(
+ // IntPtr pshv,
+ // CommDlgBrowserNotifyType notifyType);
+ //}
+
+ #endregion
+
+ [ComImport,
+ Guid(ExplorerBrowserIIDGuid.ICommDlgBrowser3),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface ICommDlgBrowser3
+ {
+ // dlg1
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult OnDefaultCommand(IntPtr ppshv);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult OnStateChange(
+ IntPtr ppshv,
+ CommDlgBrowserStateChange uChange);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult IncludeObject(
+ IntPtr ppshv,
+ IntPtr pidl);
+
+ // dlg2
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetDefaultMenuText(
+ IShellView shellView,
+ IntPtr buffer, //A pointer to a buffer that is used by the Shell browser to return the default shortcut menu text.
+ int bufferMaxLength); //should be max size = 260?
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetViewFlags(
+ [Out] out uint pdwFlags); // CommDlgBrowser2ViewFlags
+
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult Notify(
+ IntPtr pshv, CommDlgBrowserNotifyType notifyType);
+
+ // dlg3
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetCurrentFilter(
+ StringBuilder pszFileSpec,
+ int cchFileSpec);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult OnColumnClicked(
+ IShellView ppshv,
+ int iColumn);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult OnPreViewCreated(IShellView ppshv);
+ }
+
+ [ComImport,
+ Guid(ExplorerBrowserIIDGuid.IInputObject),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IInputObject
+ {
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult UIActivateIO(bool fActivate, ref System.Windows.Forms.Message pMsg);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult HasFocusIO();
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult TranslateAcceleratorIO(ref System.Windows.Forms.Message pMsg);
+
+ };
+
+ [ComImport,
+ Guid(ExplorerBrowserIIDGuid.IShellView),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IShellView
+ {
+ // IOleWindow
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetWindow(
+ out IntPtr phwnd);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult ContextSensitiveHelp(
+ bool fEnterMode);
+
+ // IShellView
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult TranslateAccelerator(
+ IntPtr pmsg);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult EnableModeless(
+ bool fEnable);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult UIActivate(
+ uint uState);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult Refresh();
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult CreateViewWindow(
+ [MarshalAs(UnmanagedType.IUnknown)] object psvPrevious,
+ IntPtr pfs,
+ [MarshalAs(UnmanagedType.IUnknown)] object psb,
+ IntPtr prcView,
+ out IntPtr phWnd);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult DestroyViewWindow();
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetCurrentInfo(
+ out IntPtr pfs);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult AddPropertySheetPages(
+ uint dwReserved,
+ IntPtr pfn,
+ uint lparam);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult SaveViewState();
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult SelectItem(
+ IntPtr pidlItem,
+ uint uFlags);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetItemObject(
+ ShellViewGetItemObject uItem,
+ ref Guid riid,
+ [MarshalAs(UnmanagedType.IUnknown)] out object ppv);
+ }
+
+#pragma warning restore 108
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/ExplorerBrowser/ExplorerBrowserNativeMethods.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/ExplorerBrowser/ExplorerBrowserNativeMethods.cs
new file mode 100644
index 0000000000..430d3ef97f
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/ExplorerBrowser/ExplorerBrowserNativeMethods.cs
@@ -0,0 +1,33 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using System.Security;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Controls
+{
+ /// <summary>
+ /// Internal class that contains interop declarations for
+ /// functions that are not benign and are performance critical.
+ /// </summary>
+ [SuppressUnmanagedCodeSecurity]
+ internal static class ExplorerBrowserNativeMethods
+ {
+ [DllImport("SHLWAPI.DLL", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static extern HResult IUnknown_SetSite(
+ [In, MarshalAs(UnmanagedType.IUnknown)] object punk,
+ [In, MarshalAs(UnmanagedType.IUnknown)] object punkSite);
+
+
+ [DllImport("SHLWAPI.DLL", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static extern HResult ConnectToConnectionPoint(
+ [In, MarshalAs(UnmanagedType.IUnknown)] object punk,
+ ref Guid riidEvent,
+ [MarshalAs(UnmanagedType.Bool)] bool fConnect,
+ [In, MarshalAs(UnmanagedType.IUnknown)] object punkTarget,
+ ref uint pdwCookie,
+ ref IntPtr ppcpOut);
+
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/KnownFolders/KnownFoldersCOMGuids.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/KnownFolders/KnownFoldersCOMGuids.cs
new file mode 100644
index 0000000000..a0d6564841
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/KnownFolders/KnownFoldersCOMGuids.cs
@@ -0,0 +1,25 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ internal static class KnownFoldersIIDGuid
+ {
+ // IID GUID strings for relevant Shell COM interfaces.
+ internal const string IKnownFolder = "3AA7AF7E-9B36-420c-A8E3-F77D4674A488";
+ internal const string IKnownFolderManager = "8BE2D872-86AA-4d47-B776-32CCA40C7018";
+ }
+
+ internal static class KnownFoldersCLSIDGuid
+ {
+ // CLSID GUID strings for relevant coclasses.
+ internal const string KnownFolderManager = "4df0c730-df9d-4ae3-9153-aa6b82e9795a";
+ }
+
+ internal static class KnownFoldersKFIDGuid
+ {
+ internal const string ComputerFolder = "0AC0837C-BBF8-452A-850D-79D08E667CA7";
+ internal const string Favorites = "1777F761-68AD-4D8A-87BD-30B759FA33DD";
+ internal const string Documents = "FDD39AD0-238F-46AF-ADB4-6C85480369C7";
+ internal const string Profile = "5E6C858F-0E22-4760-9AFE-EA3317B67173";
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/KnownFolders/KnownFoldersCOMInterfaces.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/KnownFolders/KnownFoldersCOMInterfaces.cs
new file mode 100644
index 0000000000..04c9fef9d7
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/KnownFolders/KnownFoldersCOMInterfaces.cs
@@ -0,0 +1,185 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ // Disable warning if a method declaration hides another inherited from a parent COM interface
+ // To successfully import a COM interface, all inherited methods need to be declared again with
+ // the exception of those already declared in "IUnknown"
+#pragma warning disable 0108
+
+ [ComImport,
+ Guid(KnownFoldersIIDGuid.IKnownFolder),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IKnownFolderNative
+ {
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ Guid GetId();
+
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ FolderCategory GetCategory();
+
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ [PreserveSig]
+ HResult GetShellItem([In] int i,
+ ref Guid interfaceGuid,
+ [Out, MarshalAs(UnmanagedType.Interface)] out IShellItem2 shellItem);
+
+ [return: MarshalAs(UnmanagedType.LPWStr)]
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ string GetPath([In] int option);
+
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ void SetPath([In] int i, [In] string path);
+
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ void GetIDList([In] int i,
+ [Out] out IntPtr itemIdentifierListPointer);
+
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ Guid GetFolderType();
+
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ RedirectionCapability GetRedirectionCapabilities();
+
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ void GetFolderDefinition(
+ [Out, MarshalAs(UnmanagedType.Struct)] out KnownFoldersSafeNativeMethods.NativeFolderDefinition definition);
+
+ }
+
+ [ComImport,
+ Guid(KnownFoldersIIDGuid.IKnownFolderManager),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IKnownFolderManager
+ {
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ void FolderIdFromCsidl(int csidl,
+ [Out] out Guid knownFolderID);
+
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ void FolderIdToCsidl([In, MarshalAs(UnmanagedType.LPStruct)] Guid id,
+ [Out] out int csidl);
+
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ void GetFolderIds([Out] out IntPtr folders,
+ [Out] out UInt32 count);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetFolder([In, MarshalAs(UnmanagedType.LPStruct)] Guid id,
+ [Out, MarshalAs(UnmanagedType.Interface)] out IKnownFolderNative knownFolder);
+
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ void GetFolderByName(string canonicalName,
+ [Out, MarshalAs(UnmanagedType.Interface)] out IKnownFolderNative knownFolder);
+
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ void RegisterFolder(
+ [In, MarshalAs(UnmanagedType.LPStruct)] Guid knownFolderGuid,
+ [In] ref KnownFoldersSafeNativeMethods.NativeFolderDefinition knownFolderDefinition);
+
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ void UnregisterFolder(
+ [In, MarshalAs(UnmanagedType.LPStruct)] Guid knownFolderGuid);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void FindFolderFromPath(
+ [In, MarshalAs(UnmanagedType.LPWStr)] string path,
+ [In] int mode,
+ [Out, MarshalAs(UnmanagedType.Interface)] out IKnownFolderNative knownFolder);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ HResult FindFolderFromIDList(IntPtr pidl, [Out, MarshalAs(UnmanagedType.Interface)] out IKnownFolderNative knownFolder);
+
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ void Redirect();
+ }
+
+ [ComImport]
+ [Guid("4df0c730-df9d-4ae3-9153-aa6b82e9795a")]
+ internal class KnownFolderManagerClass : IKnownFolderManager
+ {
+
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void FolderIdFromCsidl(int csidl,
+ [Out] out Guid knownFolderID);
+
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void FolderIdToCsidl(
+ [In, MarshalAs(UnmanagedType.LPStruct)] Guid id,
+ [Out] out int csidl);
+
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void GetFolderIds(
+ [Out] out IntPtr folders,
+ [Out] out UInt32 count);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern HResult GetFolder(
+ [In, MarshalAs(UnmanagedType.LPStruct)] Guid id,
+ [Out, MarshalAs(UnmanagedType.Interface)]
+ out IKnownFolderNative knownFolder);
+
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void GetFolderByName(
+ string canonicalName,
+ [Out, MarshalAs(UnmanagedType.Interface)] out IKnownFolderNative knownFolder);
+
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void RegisterFolder(
+ [In, MarshalAs(UnmanagedType.LPStruct)] Guid knownFolderGuid,
+ [In] ref KnownFoldersSafeNativeMethods.NativeFolderDefinition knownFolderDefinition);
+
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void UnregisterFolder(
+ [In, MarshalAs(UnmanagedType.LPStruct)] Guid knownFolderGuid);
+
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void FindFolderFromPath(
+ [In, MarshalAs(UnmanagedType.LPWStr)] string path,
+ [In] int mode,
+ [Out, MarshalAs(UnmanagedType.Interface)] out IKnownFolderNative knownFolder);
+
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern HResult FindFolderFromIDList(IntPtr pidl, [Out, MarshalAs(UnmanagedType.Interface)] out IKnownFolderNative knownFolder);
+
+ [MethodImpl(MethodImplOptions.InternalCall,
+ MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void Redirect();
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/KnownFolders/KnownFoldersNativeMethods.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/KnownFolders/KnownFoldersNativeMethods.cs
new file mode 100644
index 0000000000..a63a55747f
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/KnownFolders/KnownFoldersNativeMethods.cs
@@ -0,0 +1,43 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using System.Security;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Internal class that contains interop declarations for
+ /// functions that are considered benign but that
+ /// are performance critical.
+ /// </summary>
+ /// <remarks>
+ /// Functions that are benign but not performance critical
+ /// should be located in the NativeMethods class.
+ /// </remarks>
+ [SuppressUnmanagedCodeSecurity]
+ internal static class KnownFoldersSafeNativeMethods
+ {
+ #region KnownFolders
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct NativeFolderDefinition
+ {
+ internal FolderCategory category;
+ internal IntPtr name;
+ internal IntPtr description;
+ internal Guid parentId;
+ internal IntPtr relativePath;
+ internal IntPtr parsingName;
+ internal IntPtr tooltip;
+ internal IntPtr localizedName;
+ internal IntPtr icon;
+ internal IntPtr security;
+ internal UInt32 attributes;
+ internal DefinitionOptions definitionOptions;
+ internal Guid folderTypeId;
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/PropertySystem/PropertySystemCOMInterfaces.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/PropertySystem/PropertySystemCOMInterfaces.cs
new file mode 100644
index 0000000000..14d84f78e6
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/PropertySystem/PropertySystemCOMInterfaces.cs
@@ -0,0 +1,345 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem
+{
+ // Disable warning if a method declaration hides another inherited from a parent COM interface
+ // To successfully import a COM interface, all inherited methods need to be declared again with
+ // the exception of those already declared in "IUnknown"
+#pragma warning disable 108
+
+ #region Property System COM Interfaces
+
+ [ComImport]
+ [Guid(ShellIIDGuid.IPropertyStoreCapabilities)]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ interface IPropertyStoreCapabilities
+ {
+ HResult IsPropertyWritable([In]ref PropertyKey propertyKey);
+ }
+
+ /// <summary>
+ /// An in-memory property store cache
+ /// </summary>
+ [ComImport]
+ [Guid(ShellIIDGuid.IPropertyStoreCache)]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ interface IPropertyStoreCache
+ {
+ /// <summary>
+ /// Gets the state of a property stored in the cache
+ /// </summary>
+ /// <param name="key"></param>
+ /// <param name="state"></param>
+ /// <returns></returns>
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetState(ref PropertyKey key, [Out] out PropertyStoreCacheState state);
+
+ /// <summary>
+ /// Gets the valeu and state of a property in the cache
+ /// </summary>
+ /// <param name="propKey"></param>
+ /// <param name="pv"></param>
+ /// <param name="state"></param>
+ /// <returns></returns>
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetValueAndState(ref PropertyKey propKey, [Out] PropVariant pv, [Out] out PropertyStoreCacheState state);
+
+ /// <summary>
+ /// Sets the state of a property in the cache.
+ /// </summary>
+ /// <param name="propKey"></param>
+ /// <param name="state"></param>
+ /// <returns></returns>
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult SetState(ref PropertyKey propKey, PropertyStoreCacheState state);
+
+ /// <summary>
+ /// Sets the value and state in the cache.
+ /// </summary>
+ /// <param name="propKey"></param>
+ /// <param name="pv"></param>
+ /// <param name="state"></param>
+ /// <returns></returns>
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult SetValueAndState(ref PropertyKey propKey, [In] PropVariant pv, PropertyStoreCacheState state);
+ }
+
+ /// <summary>
+ /// A property store
+ /// </summary>
+ [ComImport]
+ [Guid(ShellIIDGuid.IPropertyStore)]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ interface IPropertyStore
+ {
+ /// <summary>
+ /// Gets the number of properties contained in the property store.
+ /// </summary>
+ /// <param name="propertyCount"></param>
+ /// <returns></returns>
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetCount([Out] out uint propertyCount);
+
+ /// <summary>
+ /// Get a property key located at a specific index.
+ /// </summary>
+ /// <param name="propertyIndex"></param>
+ /// <param name="key"></param>
+ /// <returns></returns>
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetAt([In] uint propertyIndex, out PropertyKey key);
+
+ /// <summary>
+ /// Gets the value of a property from the store
+ /// </summary>
+ /// <param name="key"></param>
+ /// <param name="pv"></param>
+ /// <returns></returns>
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetValue([In] ref PropertyKey key, [Out] PropVariant pv);
+
+ /// <summary>
+ /// Sets the value of a property in the store
+ /// </summary>
+ /// <param name="key"></param>
+ /// <param name="pv"></param>
+ /// <returns></returns>
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), PreserveSig]
+ HResult SetValue([In] ref PropertyKey key, [In] PropVariant pv);
+
+ /// <summary>
+ /// Commits the changes.
+ /// </summary>
+ /// <returns></returns>
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult Commit();
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.IPropertyDescriptionList),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IPropertyDescriptionList
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetCount(out uint pcElem);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetAt([In] uint iElem, [In] ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out IPropertyDescription ppv);
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.IPropertyDescription),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IPropertyDescription
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetPropertyKey(out PropertyKey pkey);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetCanonicalName([MarshalAs(UnmanagedType.LPWStr)] out string ppszName);
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetPropertyType(out VarEnum pvartype);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime),
+ PreserveSig]
+ HResult GetDisplayName(out IntPtr ppszName);
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetEditInvitation(out IntPtr ppszInvite);
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetTypeFlags([In] PropertyTypeOptions mask, out PropertyTypeOptions ppdtFlags);
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetViewFlags(out PropertyViewOptions ppdvFlags);
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetDefaultColumnWidth(out uint pcxChars);
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetDisplayType(out PropertyDisplayType pdisplaytype);
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetColumnState(out PropertyColumnStateOptions pcsFlags);
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetGroupingRange(out PropertyGroupingRange pgr);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetRelativeDescriptionType(out PropertySystemNativeMethods.RelativeDescriptionType prdt);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetRelativeDescription([In] PropVariant propvar1, [In] PropVariant propvar2, [MarshalAs(UnmanagedType.LPWStr)] out string ppszDesc1, [MarshalAs(UnmanagedType.LPWStr)] out string ppszDesc2);
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetSortDescription(out PropertySortDescription psd);
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetSortDescriptionLabel([In] bool fDescending, out IntPtr ppszDescription);
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetAggregationType(out PropertyAggregationType paggtype);
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetConditionType(out PropertyConditionType pcontype, out PropertyConditionOperation popDefault);
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult GetEnumTypeList([In] ref Guid riid, [Out, MarshalAs(UnmanagedType.Interface)] out IPropertyEnumTypeList ppv);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void CoerceToCanonicalValue([In, Out] PropVariant propvar);
+ [PreserveSig]
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] // Note: this method signature may be wrong, but it is not used.
+ HResult FormatForDisplay([In] PropVariant propvar, [In] ref PropertyDescriptionFormatOptions pdfFlags, [MarshalAs(UnmanagedType.LPWStr)] out string ppszDisplay);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult IsValueCanonical([In] PropVariant propvar);
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.IPropertyDescription2),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IPropertyDescription2 : IPropertyDescription
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetPropertyKey(out PropertyKey pkey);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetCanonicalName([MarshalAs(UnmanagedType.LPWStr)] out string ppszName);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetPropertyType(out VarEnum pvartype);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetDisplayName([MarshalAs(UnmanagedType.LPWStr)] out string ppszName);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetEditInvitation([MarshalAs(UnmanagedType.LPWStr)] out string ppszInvite);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetTypeFlags([In] PropertyTypeOptions mask, out PropertyTypeOptions ppdtFlags);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetViewFlags(out PropertyViewOptions ppdvFlags);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetDefaultColumnWidth(out uint pcxChars);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetDisplayType(out PropertyDisplayType pdisplaytype);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetColumnState(out uint pcsFlags);
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetGroupingRange(out PropertyGroupingRange pgr);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetRelativeDescriptionType(out PropertySystemNativeMethods.RelativeDescriptionType prdt);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetRelativeDescription(
+ [In] PropVariant propvar1,
+ [In] PropVariant propvar2,
+ [MarshalAs(UnmanagedType.LPWStr)] out string ppszDesc1,
+ [MarshalAs(UnmanagedType.LPWStr)] out string ppszDesc2);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetSortDescription(out PropertySortDescription psd);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetSortDescriptionLabel([In] int fDescending, [MarshalAs(UnmanagedType.LPWStr)] out string ppszDescription);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetAggregationType(out PropertyAggregationType paggtype);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetConditionType(
+ out PropertyConditionType pcontype,
+ out PropertyConditionOperation popDefault);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetEnumTypeList([In] ref Guid riid, out IntPtr ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void CoerceToCanonicalValue([In, Out] PropVariant ppropvar);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void FormatForDisplay([In] PropVariant propvar, [In] ref PropertyDescriptionFormatOptions pdfFlags, [MarshalAs(UnmanagedType.LPWStr)] out string ppszDisplay);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ HResult IsValueCanonical([In] PropVariant propvar);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetImageReferenceForValue(
+ [In] PropVariant propvar,
+ [Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszImageRes);
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.IPropertyEnumType),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IPropertyEnumType
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetEnumType([Out] out PropEnumType penumtype);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetValue([Out] PropVariant ppropvar);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetRangeMinValue([Out] PropVariant ppropvar);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetRangeSetValue([Out] PropVariant ppropvar);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetDisplayText([Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszDisplay);
+ }
+
+ [ComImport,
+ Guid(ShellIIDGuid.IPropertyEnumType2),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IPropertyEnumType2 : IPropertyEnumType
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetEnumType([Out] out PropEnumType penumtype);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetValue([Out] PropVariant ppropvar);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetRangeMinValue([Out] PropVariant ppropvar);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetRangeSetValue([Out] PropVariant ppropvar);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetDisplayText([Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszDisplay);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetImageReference([Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszImageRes);
+ }
+
+
+ [ComImport,
+ Guid(ShellIIDGuid.IPropertyEnumTypeList),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IPropertyEnumTypeList
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetCount([Out] out uint pctypes);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetAt(
+ [In] uint itype,
+ [In] ref Guid riid, // riid may be IID_IPropertyEnumType
+ [Out, MarshalAs(UnmanagedType.Interface)] out IPropertyEnumType ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void GetConditionAt(
+ [In] uint index,
+ [In] ref Guid riid,
+ out IntPtr ppv);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ void FindMatchingIndex(
+ [In] PropVariant propvarCmp,
+ [Out] out uint pnIndex);
+ }
+
+ #endregion
+
+#pragma warning restore 108
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/PropertySystem/PropertySystemNativeMethods.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/PropertySystem/PropertySystemNativeMethods.cs
new file mode 100644
index 0000000000..12ffa7079b
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/PropertySystem/PropertySystemNativeMethods.cs
@@ -0,0 +1,62 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem
+{
+ internal static class PropertySystemNativeMethods
+ {
+ #region Property Definitions
+
+ internal enum RelativeDescriptionType
+ {
+ General,
+ Date,
+ Size,
+ Count,
+ Revision,
+ Length,
+ Duration,
+ Speed,
+ Rate,
+ Rating,
+ Priority
+ }
+
+ #endregion
+
+ #region Property System Helpers
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static extern int PSGetNameFromPropertyKey(
+ ref PropertyKey propkey,
+ [Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszCanonicalName
+ );
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static extern HResult PSGetPropertyDescription(
+ ref PropertyKey propkey,
+ ref Guid riid,
+ [Out, MarshalAs(UnmanagedType.Interface)] out IPropertyDescription ppv
+ );
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static extern int PSGetPropertyKeyFromName(
+ [In, MarshalAs(UnmanagedType.LPWStr)] string pszCanonicalName,
+ out PropertyKey propkey
+ );
+
+ [DllImport("propsys.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static extern int PSGetPropertyDescriptionListFromString(
+ [In, MarshalAs(UnmanagedType.LPWStr)] string pszPropList,
+ [In] ref Guid riid,
+ out IPropertyDescriptionList ppv
+ );
+
+
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/ShellExtensions/HandlerNativeMethods.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/ShellExtensions/HandlerNativeMethods.cs
new file mode 100644
index 0000000000..7acf53182f
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/ShellExtensions/HandlerNativeMethods.cs
@@ -0,0 +1,226 @@
+using System;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using System.Runtime.InteropServices.ComTypes;
+
+namespace Microsoft.WindowsAPICodePack.Shell.Interop
+{
+ internal static class HandlerNativeMethods
+ {
+ [DllImport("user32.dll")]
+ internal static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
+
+ [DllImport("user32.dll", CharSet = CharSet.Auto)]
+ internal static extern IntPtr GetFocus();
+
+ internal static readonly Guid PreviewHandlerGuid = new Guid("{8895b1c6-b41f-4c1c-a562-0d564250836f}");
+ internal static readonly Guid ThumbnailProviderGuid = new Guid("{e357fccd-a995-4576-b01f-234630154e96}");
+ }
+
+ #region Interfaces
+
+ /// <summary>
+ /// ComVisible interface for native IThumbnailProvider
+ /// </summary>
+ [ComVisible(true)]
+ [Guid("e357fccd-a995-4576-b01f-234630154e96")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IThumbnailProvider
+ {
+ /// <summary>
+ /// Gets a pointer to a bitmap to display as a thumbnail
+ /// </summary>
+ /// <param name="squareLength"></param>
+ /// <param name="bitmapHandle"></param>
+ /// <param name="bitmapType"></param>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId = "2#"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId = "1#")]
+ void GetThumbnail(uint squareLength, out IntPtr bitmapHandle, out UInt32 bitmapType);
+ }
+
+ /// <summary>
+ /// Provides means by which to intiailze with a file.
+ /// </summary>
+ [ComImport]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ [Guid("b7d14566-0509-4cce-a71f-0a554233bd9b")]
+ public interface IInitializeWithFile
+ {
+ /// <summary>
+ /// Initializes with a file.
+ /// </summary>
+ /// <param name="filePath"></param>
+ /// <param name="fileMode"></param>
+ void Initialize([MarshalAs(UnmanagedType.LPWStr)] string filePath, AccessModes fileMode);
+ }
+
+ /// <summary>
+ /// Provides means by which to initialize with a stream.
+ /// </summary>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
+ [ComVisible(true)]
+ [Guid("b824b49d-22ac-4161-ac8a-9916e8fa3f7f")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IInitializeWithStream
+ {
+ /// <summary>
+ /// Initializes with a stream.
+ /// </summary>
+ /// <param name="stream"></param>
+ /// <param name="fileMode"></param>
+ void Initialize(IStream stream, AccessModes fileMode);
+ }
+
+ /// <summary>
+ /// Provides means by which to initialize with a ShellObject
+ /// </summary>
+ [ComImport]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ [Guid("7f73be3f-fb79-493c-a6c7-7ee14e245841")]
+ public interface IInitializeWithItem
+ {
+ /// <summary>
+ /// Initializes with ShellItem
+ /// </summary>
+ /// <param name="shellItem"></param>
+ /// <param name="accessMode"></param>
+ void Initialize(IntPtr shellItem, AccessModes accessMode);
+ }
+
+ [ComImport]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ [Guid("fc4801a3-2ba9-11cf-a229-00aa003d7352")]
+ interface IObjectWithSite
+ {
+ void SetSite([In, MarshalAs(UnmanagedType.IUnknown)] object pUnkSite);
+ void GetSite(ref Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppvSite);
+ }
+
+ [ComImport]
+ [Guid("00000114-0000-0000-C000-000000000046")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ interface IOleWindow
+ {
+ void GetWindow(out IntPtr phwnd);
+ void ContextSensitiveHelp([MarshalAs(UnmanagedType.Bool)] bool fEnterMode);
+ }
+
+ [ComImport]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ [Guid("8895b1c6-b41f-4c1c-a562-0d564250836f")]
+ interface IPreviewHandler
+ {
+ void SetWindow(IntPtr hwnd, ref RECT rect);
+ void SetRect(ref RECT rect);
+ void DoPreview();
+ void Unload();
+ void SetFocus();
+ void QueryFocus(out IntPtr phwnd);
+ [PreserveSig]
+ uint TranslateAccelerator(ref MSG pmsg);
+ }
+
+ [ComImport]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ [Guid("fec87aaf-35f9-447a-adb7-20234491401a")]
+ interface IPreviewHandlerFrame
+ {
+ void GetWindowContext(IntPtr pinfo);
+ [PreserveSig]
+ uint TranslateAccelerator(ref MSG pmsg);
+ };
+
+ [ComImport]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ [Guid("8327b13c-b63f-4b24-9b8a-d010dcc3f599")]
+ interface IPreviewHandlerVisuals
+ {
+ void SetBackgroundColor(COLORREF color);
+ void SetFont(ref LogFont plf);
+ void SetTextColor(COLORREF color);
+ }
+ #endregion
+
+ #region Structs
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
+ internal class LogFont
+ {
+ internal int height;
+ internal int width;
+ internal int escapement;
+ internal int orientation;
+ internal int weight;
+ internal byte italic;
+ internal byte underline;
+ internal byte strikeOut;
+ internal byte charSet;
+ internal byte outPrecision;
+ internal byte clipPrecision;
+ internal byte quality;
+ internal byte pitchAndFamily;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
+ internal string lfFaceName = string.Empty;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct COLORREF
+ {
+ public uint Dword;
+ public Color Color
+ {
+ get
+ {
+ return Color.FromArgb(
+ (int)(0x000000FFU & Dword),
+ (int)(0x0000FF00U & Dword) >> 8,
+ (int)(0x00FF0000U & Dword) >> 16);
+ }
+ }
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct MSG
+ {
+ public IntPtr hwnd;
+ public int message;
+ public IntPtr wParam;
+ public IntPtr lParam;
+ public int time;
+ public int pt_x;
+ public int pt_y;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct RECT
+ {
+ public readonly int left;
+ public readonly int top;
+ public readonly int right;
+ public readonly int bottom;
+ public Rectangle ToRectangle() { return Rectangle.FromLTRB(left, top, right, bottom); }
+ }
+
+ #endregion
+
+ /// <summary>
+ /// Thumbnail Alpha Types
+ /// </summary>
+ public enum ThumbnailAlphaType
+ {
+ /// <summary>
+ /// Let the system decide.
+ /// </summary>
+ Unknown = 0,
+
+ /// <summary>
+ /// No transparency
+ /// </summary>
+ NoAlphaChannel = 1,
+
+ /// <summary>
+ /// Has transparency
+ /// </summary>
+ HasAlphaChannel = 2,
+ }
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/ShellObjectWatcher/ShellObjectWatcherNativeMethods.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/ShellObjectWatcher/ShellObjectWatcherNativeMethods.cs
new file mode 100644
index 0000000000..bc74d737cf
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/ShellObjectWatcher/ShellObjectWatcherNativeMethods.cs
@@ -0,0 +1,198 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using MS.WindowsAPICodePack.Internal;
+using System.Runtime.InteropServices;
+using System.Runtime.InteropServices.ComTypes;
+
+namespace Microsoft.WindowsAPICodePack.Shell.Interop
+{
+
+ internal static class ShellObjectWatcherNativeMethods
+ {
+ [DllImport("Ole32.dll")]
+ public static extern HResult CreateBindCtx(
+ int reserved, // must be 0
+ [Out] out IBindCtx bindCtx);
+
+ [DllImport("User32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ public static extern uint RegisterClassEx(
+ ref WindowClassEx windowClass
+ );
+
+ [DllImport("User32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ public static extern IntPtr CreateWindowEx(
+ int extendedStyle,
+ [MarshalAs(UnmanagedType.LPWStr)]
+ string className, //string className, //optional
+ [MarshalAs(UnmanagedType.LPWStr)]
+ string windowName, //window name
+ int style,
+ int x,
+ int y,
+ int width,
+ int height,
+ IntPtr parentHandle,
+ IntPtr menuHandle,
+ IntPtr instanceHandle,
+ IntPtr additionalData);
+
+ [DllImport("User32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ public static extern bool GetMessage(
+ [Out] out Message message,
+ IntPtr windowHandle,
+ uint filterMinMessage,
+ uint filterMaxMessage);
+
+ [DllImport("User32.dll")]
+ public static extern int DefWindowProc(
+ IntPtr hwnd,
+ uint msg,
+ IntPtr wparam,
+ IntPtr lparam);
+
+ [DllImport("User32.dll")]
+ public static extern void DispatchMessage([In] ref Message message);
+
+ public delegate int WndProcDelegate(IntPtr hwnd, uint msg, IntPtr wparam, IntPtr lparam);
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+ internal struct WindowClassEx
+ {
+ internal uint Size;
+ internal uint Style;
+
+ internal ShellObjectWatcherNativeMethods.WndProcDelegate WndProc;
+
+ internal int ExtraClassBytes;
+ internal int ExtraWindowBytes;
+ internal IntPtr InstanceHandle;
+ internal IntPtr IconHandle;
+ internal IntPtr CursorHandle;
+ internal IntPtr BackgroundBrushHandle;
+
+ internal string MenuName;
+ internal string ClassName;
+
+ internal IntPtr SmallIconHandle;
+ }
+
+ /// <summary>
+ /// Wraps the native Windows MSG structure.
+ /// </summary>
+ public struct Message
+ {
+ private IntPtr windowHandle;
+ private uint msg;
+ private IntPtr wparam;
+ private IntPtr lparam;
+ private int time;
+ private NativePoint point;
+
+ /// <summary>
+ /// Gets the window handle
+ /// </summary>
+ public IntPtr WindowHandle { get { return windowHandle; } }
+
+ /// <summary>
+ /// Gets the window message
+ /// </summary>
+ public uint Msg { get { return msg; } }
+
+ /// <summary>
+ /// Gets the WParam
+ /// </summary>
+ public IntPtr WParam { get { return wparam; } }
+
+ /// <summary>
+ /// Gets the LParam
+ /// </summary>
+ public IntPtr LParam { get { return lparam; } }
+
+ /// <summary>
+ /// Gets the time
+ /// </summary>
+ public int Time { get { return time; } }
+
+ /// <summary>
+ /// Gets the point
+ /// </summary>
+ public NativePoint Point { get { return point; } }
+
+ /// <summary>
+ /// Creates a new instance of the Message struct
+ /// </summary>
+ /// <param name="windowHandle">Window handle</param>
+ /// <param name="msg">Message</param>
+ /// <param name="wparam">WParam</param>
+ /// <param name="lparam">LParam</param>
+ /// <param name="time">Time</param>
+ /// <param name="point">Point</param>
+ internal Message(IntPtr windowHandle, uint msg, IntPtr wparam, IntPtr lparam, int time, NativePoint point)
+ : this()
+ {
+ this.windowHandle = windowHandle;
+ this.msg = msg;
+ this.wparam = wparam;
+ this.lparam = lparam;
+ this.time = time;
+ this.point = point;
+ }
+
+ /// <summary>
+ /// Determines if two messages are equal.
+ /// </summary>
+ /// <param name="first">First message</param>
+ /// <param name="second">Second message</param>
+ /// <returns>True if first and second message are equal; false otherwise.</returns>
+ public static bool operator ==(Message first, Message second)
+ {
+ return first.WindowHandle == second.WindowHandle
+ && first.Msg == second.Msg
+ && first.WParam == second.WParam
+ && first.LParam == second.LParam
+ && first.Time == second.Time
+ && first.Point == second.Point;
+ }
+
+ /// <summary>
+ /// Determines if two messages are not equal.
+ /// </summary>
+ /// <param name="first">First message</param>
+ /// <param name="second">Second message</param>
+ /// <returns>True if first and second message are not equal; false otherwise.</returns>
+ public static bool operator !=(Message first, Message second)
+ {
+ return !(first == second);
+ }
+
+ /// <summary>
+ /// Determines if this message is equal to another.
+ /// </summary>
+ /// <param name="obj">Another message</param>
+ /// <returns>True if this message is equal argument; false otherwise.</returns>
+ public override bool Equals(object obj)
+ {
+ return (obj != null && obj is Message) ? this == (Message)obj : false;
+ }
+
+ /// <summary>
+ /// Gets a hash code for the message.
+ /// </summary>
+ /// <returns>Hash code for this message.</returns>
+ public override int GetHashCode()
+ {
+ int hash = WindowHandle.GetHashCode();
+ hash = hash * 31 + Msg.GetHashCode();
+ hash = hash * 31 + WParam.GetHashCode();
+ hash = hash * 31 + LParam.GetHashCode();
+ hash = hash * 31 + Time.GetHashCode();
+ hash = hash * 31 + Point.GetHashCode();
+ return hash;
+ }
+ }
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/StockIcons/StockIconsNativeMethods.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/StockIcons/StockIconsNativeMethods.cs
new file mode 100644
index 0000000000..0ffd3361f6
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/StockIcons/StockIconsNativeMethods.cs
@@ -0,0 +1,83 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ internal static class StockIconsNativeMethods
+ {
+ #region StockIcon declarations
+
+ /// <summary>
+ /// Specifies options for the appearance of the
+ /// stock icon.
+ /// </summary>
+ [Flags]
+ internal enum StockIconOptions
+ {
+ /// <summary>
+ /// Retrieve the small version of the icon, as specified by
+ /// SM_CXICON and SM_CYICON system metrics.
+ /// </summary>
+ Large = 0x000000000,
+
+ /// <summary>
+ /// Retrieve the small version of the icon, as specified by
+ /// SM_CXSMICON and SM_CYSMICON system metrics.
+ /// </summary>
+ Small = 0x000000001,
+
+ /// <summary>
+ /// Retrieve the shell-sized icons (instead of the
+ /// size specified by the system metrics).
+ /// </summary>
+ ShellSize = 0x000000004,
+
+ /// <summary>
+ /// Specified that the hIcon member of the SHSTOCKICONINFO
+ /// structure receives a handle to the specified icon.
+ /// </summary>
+ Handle = 0x000000100,
+
+ /// <summary>
+ /// Specifies that the iSysImageImage member of the SHSTOCKICONINFO
+ /// structure receives the index of the specified
+ /// icon in the system imagelist.
+ /// </summary>
+ SystemIndex = 0x000004000,
+
+ /// <summary>
+ /// Adds the link overlay to the icon.
+ /// </summary>
+ LinkOverlay = 0x000008000,
+
+ ///<summary>
+ /// Adds the system highlight color to the icon.
+ /// </summary>
+ Selected = 0x000010000
+ }
+
+ [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+ internal struct StockIconInfo
+ {
+ internal UInt32 StuctureSize;
+ internal IntPtr Handle;
+ internal Int32 ImageIndex;
+ internal Int32 Identifier;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
+ internal string Path;
+ }
+
+ [PreserveSig]
+ [DllImport("Shell32.dll", CharSet = CharSet.Unicode,
+ ExactSpelling = true, SetLastError = false)]
+ internal static extern HResult SHGetStockIconInfo(
+ StockIconIdentifier identifier,
+ StockIconOptions flags,
+ ref StockIconInfo info);
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Taskbar/TabbedThumbnailNativeMethods.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Taskbar/TabbedThumbnailNativeMethods.cs
new file mode 100644
index 0000000000..9c10ad4208
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Taskbar/TabbedThumbnailNativeMethods.cs
@@ -0,0 +1,210 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using MS.WindowsAPICodePack.Internal;
+using Microsoft.WindowsAPICodePack.Shell.Interop;
+using Microsoft.WindowsAPICodePack.Shell;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ internal static class TabbedThumbnailNativeMethods
+ {
+ internal const int DisplayFrame = 0x00000001;
+
+ internal const int ForceIconicRepresentation = 7;
+ internal const int HasIconicBitmap = 10;
+
+ internal const uint WmDwmSendIconicThumbnail = 0x0323;
+ internal const uint WmDwmSendIconicLivePreviewBitmap = 0x0326;
+
+ internal const uint WaActive = 1;
+ internal const uint WaClickActive = 2;
+
+ internal const int ScClose = 0xF060;
+ internal const int ScMaximize = 0xF030;
+ internal const int ScMinimize = 0xF020;
+
+ internal const uint MsgfltAdd = 1;
+ internal const uint MsgfltRemove = 2;
+
+ [DllImport("dwmapi.dll")]
+ internal static extern int DwmSetIconicThumbnail(
+ IntPtr hwnd, IntPtr hbitmap, uint flags);
+
+ [DllImport("dwmapi.dll")]
+ internal static extern int DwmInvalidateIconicBitmaps(IntPtr hwnd);
+
+ [DllImport("dwmapi.dll")]
+ internal static extern int DwmSetIconicLivePreviewBitmap(
+ IntPtr hwnd,
+ IntPtr hbitmap,
+ ref NativePoint ptClient,
+ uint flags);
+
+ [DllImport("dwmapi.dll")]
+ internal static extern int DwmSetIconicLivePreviewBitmap(
+ IntPtr hwnd, IntPtr hbitmap, IntPtr ptClient, uint flags);
+
+ [DllImport("dwmapi.dll", PreserveSig = true)]
+ internal static extern int DwmSetWindowAttribute(
+ IntPtr hwnd,
+ //DWMWA_* values.
+ uint dwAttributeToSet,
+ IntPtr pvAttributeValue,
+ uint cbAttribute);
+
+ [DllImport("user32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool GetWindowRect(IntPtr hwnd, ref NativeRect rect);
+
+ [DllImport("user32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool GetClientRect(IntPtr hwnd, ref NativeRect rect);
+
+ internal static bool GetClientSize(IntPtr hwnd, out System.Drawing.Size size)
+ {
+ NativeRect rect = new NativeRect();
+ if (!GetClientRect(hwnd, ref rect))
+ {
+ size = new System.Drawing.Size(-1, -1);
+ return false;
+ }
+ size = new System.Drawing.Size(rect.Right, rect.Bottom);
+ return true;
+ }
+
+ [DllImport("user32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool ClientToScreen(
+ IntPtr hwnd,
+ ref NativePoint point);
+
+
+ [DllImport("gdi32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool StretchBlt(
+ IntPtr hDestDC, int destX, int destY, int destWidth, int destHeight,
+ IntPtr hSrcDC, int srcX, int srcY, int srcWidth, int srcHeight,
+ uint operation);
+
+ [DllImport("user32.dll")]
+ internal static extern IntPtr GetWindowDC(IntPtr hwnd);
+
+ [DllImport("user32.dll")]
+ internal static extern int ReleaseDC(IntPtr hwnd, IntPtr hdc);
+
+ [DllImport("user32.dll", SetLastError = true)]
+ internal static extern IntPtr ChangeWindowMessageFilter(uint message, uint dwFlag);
+
+ /// <summary>
+ /// Sets the specified iconic thumbnail for the specified window.
+ /// This is typically done in response to a DWM message.
+ /// </summary>
+ /// <param name="hwnd">The window handle.</param>
+ /// <param name="hBitmap">The thumbnail bitmap.</param>
+ internal static void SetIconicThumbnail(IntPtr hwnd, IntPtr hBitmap)
+ {
+ int rc = DwmSetIconicThumbnail(
+ hwnd,
+ hBitmap,
+ DisplayFrame);
+ if (rc != 0)
+ {
+ throw Marshal.GetExceptionForHR(rc);
+ }
+ }
+
+ /// <summary>
+ /// Sets the specified peek (live preview) bitmap for the specified
+ /// window. This is typically done in response to a DWM message.
+ /// </summary>
+ /// <param name="hwnd">The window handle.</param>
+ /// <param name="bitmap">The thumbnail bitmap.</param>
+ /// <param name="displayFrame">Whether to display a standard window
+ /// frame around the bitmap.</param>
+ internal static void SetPeekBitmap(IntPtr hwnd, IntPtr bitmap, bool displayFrame)
+ {
+ int rc = DwmSetIconicLivePreviewBitmap(
+ hwnd,
+ bitmap,
+ IntPtr.Zero,
+ displayFrame ? DisplayFrame : (uint)0);
+ if (rc != 0)
+ {
+ throw Marshal.GetExceptionForHR(rc);
+ }
+ }
+
+ /// <summary>
+ /// Sets the specified peek (live preview) bitmap for the specified
+ /// window. This is typically done in response to a DWM message.
+ /// </summary>
+ /// <param name="hwnd">The window handle.</param>
+ /// <param name="bitmap">The thumbnail bitmap.</param>
+ /// <param name="offset">The client area offset at which to display
+ /// the specified bitmap. The rest of the parent window will be
+ /// displayed as "remembered" by the DWM.</param>
+ /// <param name="displayFrame">Whether to display a standard window
+ /// frame around the bitmap.</param>
+ internal static void SetPeekBitmap(IntPtr hwnd, IntPtr bitmap, System.Drawing.Point offset, bool displayFrame)
+ {
+ var nativePoint = new NativePoint(offset.X, offset.Y);
+ int rc = DwmSetIconicLivePreviewBitmap(
+ hwnd,
+ bitmap,
+ ref nativePoint,
+ displayFrame ? DisplayFrame : (uint)0);
+
+ if (rc != 0)
+ {
+ Exception e = Marshal.GetExceptionForHR(rc);
+
+ if (e is ArgumentException)
+ {
+ // Ignore argument exception as it's not really recommended to be throwing
+ // exception when rendering the peek bitmap. If it's some other kind of exception,
+ // then throw it.
+ }
+ else
+ {
+ throw e;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Call this method to either enable custom previews on the taskbar (second argument as true)
+ /// or to disable (second argument as false). If called with True, the method will call DwmSetWindowAttribute
+ /// for the specific window handle and let DWM know that we will be providing a custom bitmap for the thumbnail
+ /// as well as Aero peek.
+ /// </summary>
+ /// <param name="hwnd"></param>
+ /// <param name="enable"></param>
+ internal static void EnableCustomWindowPreview(IntPtr hwnd, bool enable)
+ {
+ IntPtr t = Marshal.AllocHGlobal(4);
+ Marshal.WriteInt32(t, enable ? 1 : 0);
+
+ try
+ {
+ int rc = DwmSetWindowAttribute(hwnd, HasIconicBitmap, t, 4);
+ if (rc != 0)
+ {
+ throw Marshal.GetExceptionForHR(rc);
+ }
+
+ rc = DwmSetWindowAttribute(hwnd, ForceIconicRepresentation, t, 4);
+ if (rc != 0)
+ {
+ throw Marshal.GetExceptionForHR(rc);
+ }
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(t);
+ }
+ }
+
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Taskbar/TaskbarCOMInterfaces.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Taskbar/TaskbarCOMInterfaces.cs
new file mode 100644
index 0000000000..96ef577417
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Taskbar/TaskbarCOMInterfaces.cs
@@ -0,0 +1,154 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ [ComImportAttribute()]
+ [GuidAttribute("6332DEBF-87B5-4670-90C0-5E57B408A49E")]
+ [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface ICustomDestinationList
+ {
+ void SetAppID(
+ [MarshalAs(UnmanagedType.LPWStr)] string pszAppID);
+ [PreserveSig]
+ HResult BeginList(
+ out uint cMaxSlots,
+ ref Guid riid,
+ [Out(), MarshalAs(UnmanagedType.Interface)] out object ppvObject);
+ [PreserveSig]
+ HResult AppendCategory(
+ [MarshalAs(UnmanagedType.LPWStr)] string pszCategory,
+ [MarshalAs(UnmanagedType.Interface)] IObjectArray poa);
+ void AppendKnownCategory(
+ [MarshalAs(UnmanagedType.I4)] KnownDestinationCategory category);
+ [PreserveSig]
+ HResult AddUserTasks(
+ [MarshalAs(UnmanagedType.Interface)] IObjectArray poa);
+ void CommitList();
+ void GetRemovedDestinations(
+ ref Guid riid,
+ [Out(), MarshalAs(UnmanagedType.Interface)] out object ppvObject);
+ void DeleteList(
+ [MarshalAs(UnmanagedType.LPWStr)] string pszAppID);
+ void AbortList();
+ }
+
+ [GuidAttribute("77F10CF0-3DB5-4966-B520-B7C54FD35ED6")]
+ [ClassInterfaceAttribute(ClassInterfaceType.None)]
+ [ComImportAttribute()]
+ internal class CDestinationList { }
+
+ [ComImportAttribute()]
+ [GuidAttribute("92CA9DCD-5622-4BBA-A805-5E9F541BD8C9")]
+ [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IObjectArray
+ {
+ void GetCount(out uint cObjects);
+ void GetAt(
+ uint iIndex,
+ ref Guid riid,
+ [Out(), MarshalAs(UnmanagedType.Interface)] out object ppvObject);
+ }
+
+ [ComImportAttribute()]
+ [GuidAttribute("5632B1A4-E38A-400A-928A-D4CD63230295")]
+ [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface IObjectCollection
+ {
+ // IObjectArray
+ [PreserveSig]
+ void GetCount(out uint cObjects);
+ [PreserveSig]
+ void GetAt(
+ uint iIndex,
+ ref Guid riid,
+ [Out(), MarshalAs(UnmanagedType.Interface)] out object ppvObject);
+
+ // IObjectCollection
+ void AddObject(
+ [MarshalAs(UnmanagedType.Interface)] object pvObject);
+ void AddFromArray(
+ [MarshalAs(UnmanagedType.Interface)] IObjectArray poaSource);
+ void RemoveObject(uint uiIndex);
+ void Clear();
+ }
+
+ [GuidAttribute("2D3468C1-36A7-43B6-AC24-D3F02FD9607A")]
+ [ClassInterfaceAttribute(ClassInterfaceType.None)]
+ [ComImportAttribute()]
+ internal class CEnumerableObjectCollection { }
+
+ [ComImportAttribute()]
+ [GuidAttribute("c43dc798-95d1-4bea-9030-bb99e2983a1a")]
+ [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
+ internal interface ITaskbarList4
+ {
+ // ITaskbarList
+ [PreserveSig]
+ void HrInit();
+ [PreserveSig]
+ void AddTab(IntPtr hwnd);
+ [PreserveSig]
+ void DeleteTab(IntPtr hwnd);
+ [PreserveSig]
+ void ActivateTab(IntPtr hwnd);
+ [PreserveSig]
+ void SetActiveAlt(IntPtr hwnd);
+
+ // ITaskbarList2
+ [PreserveSig]
+ void MarkFullscreenWindow(
+ IntPtr hwnd,
+ [MarshalAs(UnmanagedType.Bool)] bool fFullscreen);
+
+ // ITaskbarList3
+ [PreserveSig]
+ void SetProgressValue(IntPtr hwnd, UInt64 ullCompleted, UInt64 ullTotal);
+ [PreserveSig]
+ void SetProgressState(IntPtr hwnd, TaskbarProgressBarStatus tbpFlags);
+ [PreserveSig]
+ void RegisterTab(IntPtr hwndTab, IntPtr hwndMDI);
+ [PreserveSig]
+ void UnregisterTab(IntPtr hwndTab);
+ [PreserveSig]
+ void SetTabOrder(IntPtr hwndTab, IntPtr hwndInsertBefore);
+ [PreserveSig]
+ void SetTabActive(IntPtr hwndTab, IntPtr hwndInsertBefore, uint dwReserved);
+ [PreserveSig]
+ HResult ThumbBarAddButtons(
+ IntPtr hwnd,
+ uint cButtons,
+ [MarshalAs(UnmanagedType.LPArray)] ThumbButton[] pButtons);
+ [PreserveSig]
+ HResult ThumbBarUpdateButtons(
+ IntPtr hwnd,
+ uint cButtons,
+ [MarshalAs(UnmanagedType.LPArray)] ThumbButton[] pButtons);
+ [PreserveSig]
+ void ThumbBarSetImageList(IntPtr hwnd, IntPtr himl);
+ [PreserveSig]
+ void SetOverlayIcon(
+ IntPtr hwnd,
+ IntPtr hIcon,
+ [MarshalAs(UnmanagedType.LPWStr)] string pszDescription);
+ [PreserveSig]
+ void SetThumbnailTooltip(
+ IntPtr hwnd,
+ [MarshalAs(UnmanagedType.LPWStr)] string pszTip);
+ [PreserveSig]
+ void SetThumbnailClip(
+ IntPtr hwnd,
+ IntPtr prcClip);
+
+ // ITaskbarList4
+ void SetTabProperties(IntPtr hwndTab, SetTabPropertiesOption stpFlags);
+ }
+
+ [GuidAttribute("56FDF344-FD6D-11d0-958A-006097C9A090")]
+ [ClassInterfaceAttribute(ClassInterfaceType.None)]
+ [ComImportAttribute()]
+ internal class CTaskbarList { }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Taskbar/TaskbarNativeMethods.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Taskbar/TaskbarNativeMethods.cs
new file mode 100644
index 0000000000..b5ae1251e8
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Interop/Taskbar/TaskbarNativeMethods.cs
@@ -0,0 +1,210 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Shell;
+using Microsoft.WindowsAPICodePack.Shell.PropertySystem;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ #region Enums
+ internal enum KnownDestinationCategory
+ {
+ Frequent = 1,
+ Recent
+ }
+
+ internal enum ShellAddToRecentDocs
+ {
+ Pidl = 0x1,
+ PathA = 0x2,
+ PathW = 0x3,
+ AppIdInfo = 0x4, // indicates the data type is a pointer to a SHARDAPPIDINFO structure
+ AppIdInfoIdList = 0x5, // indicates the data type is a pointer to a SHARDAPPIDINFOIDLIST structure
+ Link = 0x6, // indicates the data type is a pointer to an IShellLink instance
+ AppIdInfoLink = 0x7, // indicates the data type is a pointer to a SHARDAPPIDINFOLINK structure
+ }
+
+ internal enum TaskbarProgressBarStatus
+ {
+ NoProgress = 0,
+ Indeterminate = 0x1,
+ Normal = 0x2,
+ Error = 0x4,
+ Paused = 0x8
+ }
+
+ internal enum TaskbarActiveTabSetting
+ {
+ UseMdiThumbnail = 0x1,
+ UseMdiLivePreview = 0x2
+ }
+
+ internal enum ThumbButtonMask
+ {
+ Bitmap = 0x1,
+ Icon = 0x2,
+ Tooltip = 0x4,
+ THB_FLAGS = 0x8
+ }
+
+ [Flags]
+ internal enum ThumbButtonOptions
+ {
+ Enabled = 0x00000000,
+ Disabled = 0x00000001,
+ DismissOnClick = 0x00000002,
+ NoBackground = 0x00000004,
+ Hidden = 0x00000008,
+ NonInteractive = 0x00000010
+ }
+
+ internal enum SetTabPropertiesOption
+ {
+ None = 0x0,
+ UseAppThumbnailAlways = 0x1,
+ UseAppThumbnailWhenActive = 0x2,
+ UseAppPeekAlways = 0x4,
+ UseAppPeekWhenActive = 0x8
+ }
+
+ #endregion
+
+ #region Structs
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
+ internal struct ThumbButton
+ {
+ /// <summary>
+ /// WPARAM value for a THUMBBUTTON being clicked.
+ /// </summary>
+ internal const int Clicked = 0x1800;
+
+ [MarshalAs(UnmanagedType.U4)]
+ internal ThumbButtonMask Mask;
+ internal uint Id;
+ internal uint Bitmap;
+ internal IntPtr Icon;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
+ internal string Tip;
+ [MarshalAs(UnmanagedType.U4)]
+ internal ThumbButtonOptions Flags;
+ }
+ #endregion;
+
+ internal static class TaskbarNativeMethods
+ {
+ internal static class TaskbarGuids
+ {
+ internal static Guid IObjectArray = new Guid("92CA9DCD-5622-4BBA-A805-5E9F541BD8C9");
+ internal static Guid IUnknown = new Guid("00000000-0000-0000-C000-000000000046");
+ }
+
+ internal const int WmCommand = 0x0111;
+
+ // Register Window Message used by Shell to notify that the corresponding taskbar button has been added to the taskbar.
+ internal static readonly uint WmTaskbarButtonCreated = RegisterWindowMessage("TaskbarButtonCreated");
+
+ internal const uint WmDwmSendIconThumbnail = 0x0323;
+ internal const uint WmDwmSendIconicLivePreviewBitmap = 0x0326;
+
+ #region Methods
+
+ [DllImport("shell32.dll")]
+ internal static extern void SetCurrentProcessExplicitAppUserModelID(
+ [MarshalAs(UnmanagedType.LPWStr)] string AppID);
+
+ [DllImport("shell32.dll")]
+ internal static extern void GetCurrentProcessExplicitAppUserModelID(
+ [Out(), MarshalAs(UnmanagedType.LPWStr)] out string AppID);
+
+ [DllImport("shell32.dll")]
+ internal static extern void SHAddToRecentDocs(
+ ShellAddToRecentDocs flags,
+ [MarshalAs(UnmanagedType.LPWStr)] string path);
+
+ internal static void SHAddToRecentDocs(string path)
+ {
+ SHAddToRecentDocs(ShellAddToRecentDocs.PathW, path);
+ }
+
+ [DllImport("user32.dll", EntryPoint = "RegisterWindowMessage", SetLastError = true, CharSet = CharSet.Unicode)]
+ internal static extern uint RegisterWindowMessage([MarshalAs(UnmanagedType.LPWStr)] string lpString);
+
+
+ [DllImport("shell32.dll")]
+ public static extern int SHGetPropertyStoreForWindow(
+ IntPtr hwnd,
+ ref Guid iid /*IID_IPropertyStore*/,
+ [Out(), MarshalAs(UnmanagedType.Interface)]out IPropertyStore propertyStore);
+
+ /// <summary>
+ /// Sets the window's application id by its window handle.
+ /// </summary>
+ /// <param name="hwnd">The window handle.</param>
+ /// <param name="appId">The application id.</param>
+ internal static void SetWindowAppId(IntPtr hwnd, string appId)
+ {
+ SetWindowProperty(hwnd, SystemProperties.System.AppUserModel.ID, appId);
+ }
+
+ internal static void SetWindowProperty(IntPtr hwnd, PropertyKey propkey, string value)
+ {
+ // Get the IPropertyStore for the given window handle
+ IPropertyStore propStore = GetWindowPropertyStore(hwnd);
+
+ // Set the value
+ using (PropVariant pv = new PropVariant(value))
+ {
+ HResult result = propStore.SetValue(ref propkey, pv);
+ if (!CoreErrorHelper.Succeeded(result))
+ {
+ throw new ShellException(result);
+ }
+ }
+
+
+ // Dispose the IPropertyStore and PropVariant
+ Marshal.ReleaseComObject(propStore);
+ }
+
+ internal static IPropertyStore GetWindowPropertyStore(IntPtr hwnd)
+ {
+ IPropertyStore propStore;
+ Guid guid = new Guid(ShellIIDGuid.IPropertyStore);
+ int rc = SHGetPropertyStoreForWindow(
+ hwnd,
+ ref guid,
+ out propStore);
+ if (rc != 0)
+ {
+ throw Marshal.GetExceptionForHR(rc);
+ }
+ return propStore;
+ }
+
+ #endregion
+ }
+
+ /// <summary>
+ /// Thumbnail Alpha Types
+ /// </summary>
+ public enum ThumbnailAlphaType
+ {
+ /// <summary>
+ /// Let the system decide.
+ /// </summary>
+ Unknown = 0,
+
+ /// <summary>
+ /// No transparency
+ /// </summary>
+ NoAlphaChannel = 1,
+
+ /// <summary>
+ /// Has transparency
+ /// </summary>
+ HasAlphaChannel = 2,
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/DefinitionOptions.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/DefinitionOptions.cs
new file mode 100644
index 0000000000..b66c1749e0
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/DefinitionOptions.cs
@@ -0,0 +1,32 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Specifies behaviors for known folders.
+ /// </summary>
+ [Flags]
+ public enum DefinitionOptions
+ {
+ /// <summary>
+ /// No behaviors are defined.
+ /// </summary>
+ None = 0x0,
+ /// <summary>
+ /// Prevents a per-user known folder from being
+ /// redirected to a network location.
+ /// </summary>
+ LocalRedirectOnly = 0x2,
+
+ /// <summary>
+ /// The known folder can be roamed through PC-to-PC synchronization.
+ /// </summary>
+ Roamable = 0x4,
+
+ /// <summary>
+ /// Creates the known folder when the user first logs on.
+ /// </summary>
+ Precreate = 0x8
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/FileSystemKnownFolder.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/FileSystemKnownFolder.cs
new file mode 100644
index 0000000000..6f5fd0d751
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/FileSystemKnownFolder.cs
@@ -0,0 +1,282 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Represents a registered file system Known Folder
+ /// </summary>
+ public class FileSystemKnownFolder : ShellFileSystemFolder, IKnownFolder, IDisposable
+ {
+ #region Private Fields
+
+ private IKnownFolderNative knownFolderNative;
+ private KnownFolderSettings knownFolderSettings;
+
+ #endregion
+
+ #region Internal Constructors
+
+ internal FileSystemKnownFolder(IShellItem2 shellItem) : base(shellItem) { }
+
+ internal FileSystemKnownFolder(IKnownFolderNative kf)
+ {
+ Debug.Assert(kf != null);
+ knownFolderNative = kf;
+
+ // Set the native shell item
+ // and set it on the base class (ShellObject)
+ Guid guid = new Guid(ShellIIDGuid.IShellItem2);
+ knownFolderNative.GetShellItem(0, ref guid, out nativeShellItem);
+ }
+
+ #endregion
+
+ #region Private Members
+
+ private KnownFolderSettings KnownFolderSettings
+ {
+ get
+ {
+ if (knownFolderNative == null)
+ {
+ // We need to get the PIDL either from the NativeShellItem,
+ // or from base class's property (if someone already set it on us).
+ // Need to use the PIDL to get the native IKnownFolder interface.
+
+ // Get the PIDL for the ShellItem
+ if (nativeShellItem != null && base.PIDL == IntPtr.Zero)
+ {
+ base.PIDL = ShellHelper.PidlFromShellItem(nativeShellItem);
+ }
+
+ // If we have a valid PIDL, get the native IKnownFolder
+ if (base.PIDL != IntPtr.Zero)
+ {
+ knownFolderNative = KnownFolderHelper.FromPIDL(base.PIDL);
+ }
+
+ Debug.Assert(knownFolderNative != null);
+ }
+
+ // If this is the first time this property is being called,
+ // get the native Folder Defination (KnownFolder properties)
+ if (knownFolderSettings == null)
+ {
+ knownFolderSettings = new KnownFolderSettings(knownFolderNative);
+ }
+
+ return knownFolderSettings;
+ }
+ }
+
+ #endregion
+
+ #region IKnownFolder Members
+
+ /// <summary>
+ /// Gets the path for this known folder.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public override string Path
+ {
+ get { return KnownFolderSettings.Path; }
+ }
+
+ /// <summary>
+ /// Gets the category designation for this known folder.
+ /// </summary>
+ /// <value>A <see cref="FolderCategory"/> value.</value>
+ public FolderCategory Category
+ {
+ get { return KnownFolderSettings.Category; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's canonical name.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string CanonicalName
+ {
+ get { return KnownFolderSettings.CanonicalName; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's description.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string Description
+ {
+ get { return KnownFolderSettings.Description; }
+ }
+
+ /// <summary>
+ /// Gets the unique identifier for this known folder's parent folder.
+ /// </summary>
+ /// <value>A <see cref="System.Guid"/> value.</value>
+ public Guid ParentId
+ {
+ get { return KnownFolderSettings.ParentId; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's relative path.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string RelativePath
+ {
+ get { return KnownFolderSettings.RelativePath; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's parsing name.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public override string ParsingName
+ {
+ get { return base.ParsingName; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's tool tip text.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string Tooltip
+ {
+ get { return KnownFolderSettings.Tooltip; }
+ }
+ /// <summary>
+ /// Gets the resource identifier for this
+ /// known folder's tool tip text.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string TooltipResourceId
+ {
+ get { return KnownFolderSettings.TooltipResourceId; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's localized name.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string LocalizedName
+ {
+ get { return KnownFolderSettings.LocalizedName; }
+ }
+ /// <summary>
+ /// Gets the resource identifier for this
+ /// known folder's localized name.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string LocalizedNameResourceId
+ {
+ get { return KnownFolderSettings.LocalizedNameResourceId; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's security attributes.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string Security
+ {
+ get { return KnownFolderSettings.Security; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's file attributes,
+ /// such as "read-only".
+ /// </summary>
+ /// <value>A <see cref="System.IO.FileAttributes"/> value.</value>
+ public System.IO.FileAttributes FileAttributes
+ {
+ get { return KnownFolderSettings.FileAttributes; }
+ }
+
+ /// <summary>
+ /// Gets an value that describes this known folder's behaviors.
+ /// </summary>
+ /// <value>A <see cref="DefinitionOptions"/> value.</value>
+ public DefinitionOptions DefinitionOptions
+ {
+ get { return KnownFolderSettings.DefinitionOptions; }
+ }
+
+ /// <summary>
+ /// Gets the unique identifier for this known folder's type.
+ /// </summary>
+ /// <value>A <see cref="System.Guid"/> value.</value>
+ public Guid FolderTypeId
+ {
+ get { return KnownFolderSettings.FolderTypeId; }
+ }
+
+ /// <summary>
+ /// Gets a string representation of this known folder's type.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string FolderType
+ {
+ get { return KnownFolderSettings.FolderType; }
+ }
+ /// <summary>
+ /// Gets the unique identifier for this known folder.
+ /// </summary>
+ /// <value>A <see cref="System.Guid"/> value.</value>
+ public Guid FolderId
+ {
+ get { return KnownFolderSettings.FolderId; }
+ }
+
+ /// <summary>
+ /// Gets a value that indicates whether this known folder's path exists on the computer.
+ /// </summary>
+ /// <value>A bool<see cref="System.Boolean"/> value.</value>
+ /// <remarks>If this property value is <b>false</b>,
+ /// the folder might be a virtual folder (<see cref="Category"/> property will
+ /// be <see cref="FolderCategory.Virtual"/> for virtual folders)</remarks>
+ public bool PathExists
+ {
+ get { return KnownFolderSettings.PathExists; }
+ }
+
+ /// <summary>
+ /// Gets a value that states whether this known folder
+ /// can have its path set to a new value,
+ /// including any restrictions on the redirection.
+ /// </summary>
+ /// <value>A <see cref="RedirectionCapability"/> value.</value>
+ public RedirectionCapability Redirection
+ {
+ get { return KnownFolderSettings.Redirection; }
+ }
+
+ #endregion
+
+ #region IDisposable Members
+
+ /// <summary>
+ /// Release resources
+ /// </summary>
+ /// <param name="disposing">Indicates that this mothod is being called from Dispose() rather than the finalizer.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ knownFolderSettings = null;
+ }
+
+ if (knownFolderNative != null)
+ {
+ Marshal.ReleaseComObject(knownFolderNative);
+ knownFolderNative = null;
+ }
+
+ base.Dispose(disposing);
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/FolderCategory.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/FolderCategory.cs
new file mode 100644
index 0000000000..762cffa06b
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/FolderCategory.cs
@@ -0,0 +1,45 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Specifies the categories for known folders.
+ /// </summary>
+ public enum FolderCategory
+ {
+ /// <summary>
+ /// The folder category is not specified.
+ /// </summary>
+ None = 0x00,
+ /// <summary>
+ /// The folder is a virtual folder. Virtual folders are not part
+ /// of the file system. For example, Control Panel and
+ /// Printers are virtual folders. A number of properties
+ /// such as folder path and redirection do not apply to this category.
+ /// </summary>
+ Virtual = 0x1,
+ /// <summary>
+ /// The folder is fixed. Fixed file system folders are not
+ /// managed by the Shell and are usually given a permanent
+ /// path when the system is installed. For example, the
+ /// Windows and Program Files folders are fixed folders.
+ /// A number of properties such as redirection do not apply
+ /// to this category.
+ /// </summary>
+ Fixed = 0x2,
+ /// <summary>
+ /// The folder is a common folder. Common folders are
+ /// used for sharing data and settings
+ /// accessible by all users of a system. For example,
+ /// all users share a common Documents folder as well
+ /// as their per-user Documents folder.
+ /// </summary>
+ Common = 0x3,
+ /// <summary>
+ /// Each user has their own copy of the folder. Per-user folders
+ /// are those stored under each user's profile and
+ /// accessible only by that user.
+ /// </summary>
+ PerUser = 0x4
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/FolderProperties.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/FolderProperties.cs
new file mode 100644
index 0000000000..aeb9ddccd9
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/FolderProperties.cs
@@ -0,0 +1,43 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using System.Windows.Media.Imaging;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Structure used internally to store property values for
+ /// a known folder. This structure holds the information
+ /// returned in the FOLDER_DEFINITION structure, and
+ /// resources referenced by fields in NativeFolderDefinition,
+ /// such as icon and tool tip.
+ /// </summary>
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct FolderProperties
+ {
+ internal string name;
+ internal FolderCategory category;
+ internal string canonicalName;
+ internal string description;
+ internal Guid parentId;
+ internal string parent;
+ internal string relativePath;
+ internal string parsingName;
+ internal string tooltipResourceId;
+ internal string tooltip;
+ internal string localizedName;
+ internal string localizedNameResourceId;
+ internal string iconResourceId;
+ internal BitmapSource icon;
+ internal DefinitionOptions definitionOptions;
+ internal System.IO.FileAttributes fileAttributes;
+ internal Guid folderTypeId;
+ internal string folderType;
+ internal Guid folderId;
+ internal string path;
+ internal bool pathExists;
+ internal RedirectionCapability redirection;
+ internal string security;
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/FolderTypes.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/FolderTypes.cs
new file mode 100644
index 0000000000..a8050d6fd9
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/FolderTypes.cs
@@ -0,0 +1,227 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// The FolderTypes values represent a view template applied to a folder,
+ /// usually based on its intended use and contents.
+ /// </summary>
+ internal static class FolderTypes
+ {
+ /// <summary>
+ /// No particular content type has been detected or specified. This value is not supported in Windows 7 and later systems.
+ /// </summary>
+ internal static Guid NotSpecified = new Guid(
+ 0x5c4f28b5, 0xf869, 0x4e84, 0x8e, 0x60, 0xf1, 0x1d, 0xb9, 0x7c, 0x5c, 0xc7);
+
+ /// <summary>
+ /// The folder is invalid. There are several things that can cause this judgement: hard disk errors, file system errors, and compression errors among them.
+ /// </summary>
+ internal static Guid Invalid = new Guid(
+ 0x57807898, 0x8c4f, 0x4462, 0xbb, 0x63, 0x71, 0x04, 0x23, 0x80, 0xb1, 0x09);
+
+ /// <summary>
+ /// The folder contains document files. These can be of mixed format—.doc, .txt, and others.
+ /// </summary>
+ internal static Guid Documents = new Guid(
+ 0x7d49d726, 0x3c21, 0x4f05, 0x99, 0xaa, 0xfd, 0xc2, 0xc9, 0x47, 0x46, 0x56);
+
+ /// <summary>
+ /// Image files, such as .jpg, .tif, or .png files.
+ /// </summary>
+ internal static Guid Pictures = new Guid(
+ 0xb3690e58, 0xe961, 0x423b, 0xb6, 0x87, 0x38, 0x6e, 0xbf, 0xd8, 0x32, 0x39);
+
+ /// <summary>
+ /// Windows 7 and later. The folder contains audio files, such as .mp3 and .wma files.
+ /// </summary>
+ internal static Guid Music = new Guid(
+ 0xaf9c03d6, 0x7db9, 0x4a15, 0x94, 0x64, 0x13, 0xbf, 0x9f, 0xb6, 0x9a, 0x2a);
+
+ /// <summary>
+ /// A list of music files displayed in Icons view. This value is not supported in Windows 7 and later systems.
+ /// </summary>
+ internal static Guid MusicIcons = new Guid(
+ 0x0b7467fb, 0x84ba, 0x4aae, 0xa0, 0x9b, 0x15, 0xb7, 0x10, 0x97, 0xaf, 0x9e);
+
+ /// <summary>
+ /// The folder is the Games folder found in the Start menu.
+ /// </summary>
+ internal static Guid Games = new Guid(
+ 0xb689b0d0, 0x76d3, 0x4cbb, 0x87, 0xf7, 0x58, 0x5d, 0x0e, 0x0c, 0xe0, 0x70);
+
+ /// <summary>
+ /// The Control Panel in category view. This is a virtual folder.
+ /// </summary>
+ internal static Guid ControlPanelCategory = new Guid(
+ 0xde4f0660, 0xfa10, 0x4b8f, 0xa4, 0x94, 0x06, 0x8b, 0x20, 0xb2, 0x23, 0x07);
+
+ /// <summary>
+ /// The Control Panel in classic view. This is a virtual folder.
+ /// </summary>
+ internal static Guid ControlPanelClassic = new Guid(
+ 0x0c3794f3, 0xb545, 0x43aa, 0xa3, 0x29, 0xc3, 0x74, 0x30, 0xc5, 0x8d, 0x2a);
+
+ /// <summary>
+ /// Printers that have been added to the system. This is a virtual folder.
+ /// </summary>
+ internal static Guid Printers = new Guid(
+ 0x2c7bbec6, 0xc844, 0x4a0a, 0x91, 0xfa, 0xce, 0xf6, 0xf5, 0x9c, 0xfd, 0xa1);
+
+ /// <summary>
+ /// The Recycle Bin. This is a virtual folder.
+ /// </summary>
+ internal static Guid RecycleBin = new Guid(
+ 0xd6d9e004, 0xcd87, 0x442b, 0x9d, 0x57, 0x5e, 0x0a, 0xeb, 0x4f, 0x6f, 0x72);
+
+ /// <summary>
+ /// The software explorer window used by the Add or Remove Programs control panel icon.
+ /// </summary>
+ internal static Guid SoftwareExplorer = new Guid(
+ 0xd674391b, 0x52d9, 0x4e07, 0x83, 0x4e, 0x67, 0xc9, 0x86, 0x10, 0xf3, 0x9d);
+
+ /// <summary>
+ /// The folder is a compressed archive, such as a compressed file with a .zip file name extension.
+ /// </summary>
+ internal static Guid CompressedFolder = new Guid(
+ 0x80213e82, 0xbcfd, 0x4c4f, 0x88, 0x17, 0xbb, 0x27, 0x60, 0x12, 0x67, 0xa9);
+
+ /// <summary>
+ /// An e-mail-related folder that contains contact information.
+ /// </summary>
+ internal static Guid Contacts = new Guid(
+ 0xde2b70ec, 0x9bf7, 0x4a93, 0xbd, 0x3d, 0x24, 0x3f, 0x78, 0x81, 0xd4, 0x92);
+
+ /// <summary>
+ /// A default library view without a more specific template. This value is not supported in Windows 7 and later systems.
+ /// </summary>
+ internal static Guid Library = new Guid(
+ 0x4badfc68, 0xc4ac, 0x4716, 0xa0, 0xa0, 0x4d, 0x5d, 0xaa, 0x6b, 0x0f, 0x3e);
+
+ /// <summary>
+ /// The Network Explorer folder.
+ /// </summary>
+ internal static Guid NetworkExplorer = new Guid(
+ 0x25cc242b, 0x9a7c, 0x4f51, 0x80, 0xe0, 0x7a, 0x29, 0x28, 0xfe, 0xbe, 0x42);
+
+ /// <summary>
+ /// The folder is the FOLDERID_UsersFiles folder.
+ /// </summary>
+ internal static Guid UserFiles = new Guid(
+ 0xcd0fc69b, 0x71e2, 0x46e5, 0x96, 0x90, 0x5b, 0xcd, 0x9f, 0x57, 0xaa, 0xb3);
+
+ /// <summary>
+ /// Windows 7 and later. The folder contains search results, but they are of mixed or no specific type.
+ /// </summary>
+ internal static Guid GenericSearchResults = new Guid(
+ 0x7fde1a1e, 0x8b31, 0x49a5, 0x93, 0xb8, 0x6b, 0xe1, 0x4c, 0xfa, 0x49, 0x43);
+
+ /// <summary>
+ /// Windows 7 and later. The folder is a library, but of no specified type.
+ /// </summary>
+ internal static Guid GenericLibrary = new Guid(
+ 0x5f4eab9a, 0x6833, 0x4f61, 0x89, 0x9d, 0x31, 0xcf, 0x46, 0x97, 0x9d, 0x49);
+
+ /// <summary>
+ /// Windows 7 and later. The folder contains video files. These can be of mixed format—.wmv, .mov, and others.
+ /// </summary>
+ internal static Guid Videos = new Guid(
+ 0x5fa96407, 0x7e77, 0x483c, 0xac, 0x93, 0x69, 0x1d, 0x05, 0x85, 0x0d, 0xe8);
+
+ /// <summary>
+ /// Windows 7 and later. The view shown when the user clicks the Windows Explorer button on the taskbar.
+ /// </summary>
+ internal static Guid UsersLibraries = new Guid(
+ 0xc4d98f09, 0x6124, 0x4fe0, 0x99, 0x42, 0x82, 0x64, 0x16, 0x8, 0x2d, 0xa9);
+
+ /// <summary>
+ /// Windows 7 and later. The homegroup view.
+ /// </summary>
+ internal static Guid OtherUsers = new Guid(
+ 0xb337fd00, 0x9dd5, 0x4635, 0xa6, 0xd4, 0xda, 0x33, 0xfd, 0x10, 0x2b, 0x7a);
+
+ /// <summary>
+ /// Windows 7 and later. A folder that contains communication-related files such as e-mails, calendar information, and contact information.
+ /// </summary>
+ internal static Guid Communications = new Guid(
+ 0x91475fe5, 0x586b, 0x4eba, 0x8d, 0x75, 0xd1, 0x74, 0x34, 0xb8, 0xcd, 0xf6);
+
+ /// <summary>
+ /// Windows 7 and later. The folder contains recorded television broadcasts.
+ /// </summary>
+ internal static Guid RecordedTV = new Guid(
+ 0x5557a28f, 0x5da6, 0x4f83, 0x88, 0x09, 0xc2, 0xc9, 0x8a, 0x11, 0xa6, 0xfa);
+
+ /// <summary>
+ /// Windows 7 and later. The folder contains saved game states.
+ /// </summary>
+ internal static Guid SavedGames = new Guid(
+ 0xd0363307, 0x28cb, 0x4106, 0x9f, 0x23, 0x29, 0x56, 0xe3, 0xe5, 0xe0, 0xe7);
+
+ /// <summary>
+ /// Windows 7 and later. The folder contains federated search OpenSearch results.
+ /// </summary>
+ internal static Guid OpenSearch = new Guid(
+ 0x8faf9629, 0x1980, 0x46ff, 0x80, 0x23, 0x9d, 0xce, 0xab, 0x9c, 0x3e, 0xe3);
+
+ /// <summary>
+ /// Windows 7 and later. Before you search.
+ /// </summary>
+ internal static Guid SearchConnector = new Guid(
+ 0x982725ee, 0x6f47, 0x479e, 0xb4, 0x47, 0x81, 0x2b, 0xfa, 0x7d, 0x2e, 0x8f);
+
+ /// <summary>
+ /// Windows 7 and later. A user's Searches folder, normally found at C:\Users\username\Searches.
+ /// </summary>
+ internal static Guid Searches = new Guid(
+ 0x0b0ba2e3, 0x405f, 0x415e, 0xa6, 0xee, 0xca, 0xd6, 0x25, 0x20, 0x78, 0x53);
+
+
+ static Dictionary<Guid, string> types;
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")]
+ static FolderTypes()
+ {
+ types = new Dictionary<Guid, string>();
+ // Review: These Localized messages could probably be a reflected value of the field's name.
+ types.Add(NotSpecified, LocalizedMessages.FolderTypeNotSpecified);
+ types.Add(Invalid, LocalizedMessages.FolderTypeInvalid);
+ types.Add(Communications, LocalizedMessages.FolderTypeCommunications);
+ types.Add(CompressedFolder, LocalizedMessages.FolderTypeCompressedFolder);
+ types.Add(Contacts, LocalizedMessages.FolderTypeContacts);
+ types.Add(ControlPanelCategory, LocalizedMessages.FolderTypeCategory);
+ types.Add(ControlPanelClassic, LocalizedMessages.FolderTypeClassic);
+ types.Add(Documents, LocalizedMessages.FolderTypeDocuments);
+ types.Add(Games, LocalizedMessages.FolderTypeGames);
+ types.Add(GenericSearchResults, LocalizedMessages.FolderTypeSearchResults);
+ types.Add(GenericLibrary, LocalizedMessages.FolderTypeGenericLibrary);
+ types.Add(Library, LocalizedMessages.FolderTypeLibrary);
+ types.Add(Music, LocalizedMessages.FolderTypeMusic);
+ types.Add(MusicIcons, LocalizedMessages.FolderTypeMusicIcons);
+ types.Add(NetworkExplorer, LocalizedMessages.FolderTypeNetworkExplorer);
+ types.Add(OtherUsers, LocalizedMessages.FolderTypeOtherUsers);
+ types.Add(OpenSearch, LocalizedMessages.FolderTypeOpenSearch);
+ types.Add(Pictures, LocalizedMessages.FolderTypePictures);
+ types.Add(Printers, LocalizedMessages.FolderTypePrinters);
+ types.Add(RecycleBin, LocalizedMessages.FolderTypeRecycleBin);
+ types.Add(RecordedTV, LocalizedMessages.FolderTypeRecordedTV);
+ types.Add(SoftwareExplorer, LocalizedMessages.FolderTypeSoftwareExplorer);
+ types.Add(SavedGames, LocalizedMessages.FolderTypeSavedGames);
+ types.Add(SearchConnector, LocalizedMessages.FolderTypeSearchConnector);
+ types.Add(Searches, LocalizedMessages.FolderTypeSearches);
+ types.Add(UsersLibraries, LocalizedMessages.FolderTypeUserLibraries);
+ types.Add(UserFiles, LocalizedMessages.FolderTypeUserFiles);
+ types.Add(Videos, LocalizedMessages.FolderTypeVideos);
+ }
+
+ internal static string GetFolderType(Guid typeId)
+ {
+ string type;
+ return types.TryGetValue(typeId, out type) ? type : string.Empty;
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/FoldersIdentifiers.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/FoldersIdentifiers.cs
new file mode 100644
index 0000000000..fa40974b0c
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/FoldersIdentifiers.cs
@@ -0,0 +1,592 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Contains the GUID identifiers for well-known folders.
+ /// </summary>
+ internal static class FolderIdentifiers
+ {
+ private static Dictionary<Guid, string> folders;
+
+ static FolderIdentifiers()
+ {
+ folders = new Dictionary<Guid, string>();
+ Type folderIDs = typeof(FolderIdentifiers);
+
+ FieldInfo[] fields = folderIDs.GetFields(BindingFlags.NonPublic | BindingFlags.Static);
+ foreach (FieldInfo f in fields)
+ {
+ // Ignore dictionary field.
+ if (f.FieldType == typeof(Guid))
+ {
+ Guid id = (Guid)f.GetValue(null);
+ string name = f.Name;
+ folders.Add(id, name);
+ }
+ }
+ }
+ /// <summary>
+ /// Returns the friendly name for a specified folder.
+ /// </summary>
+ /// <param name="folderId">The Guid identifier for a known folder.</param>
+ /// <returns>A <see cref="T:System.String"/> value.</returns>
+ internal static string NameForGuid(Guid folderId)
+ {
+ string folder;
+ if (!folders.TryGetValue(folderId, out folder))
+ {
+ throw new ArgumentException(LocalizedMessages.FolderIdsUnknownGuid, "folderId");
+ }
+ return folder;
+ }
+ /// <summary>
+ /// Returns a sorted list of name, guid pairs for
+ /// all known folders.
+ /// </summary>
+ /// <returns></returns>
+ internal static SortedList<string, Guid> GetAllFolders()
+ {
+ // Make a copy of the dictionary
+ // because the Keys and Values collections
+ // are mutable.
+ ICollection<Guid> keys = folders.Keys;
+
+ SortedList<string, Guid> slist = new SortedList<string, Guid>();
+ foreach (Guid g in keys)
+ {
+ slist.Add(folders[g], g);
+ }
+
+ return slist;
+ }
+
+ #region KnownFolder Guids
+
+ /// <summary>
+ /// Computer
+ /// </summary>
+ internal static Guid Computer = new Guid(0x0AC0837C, 0xBBF8, 0x452A, 0x85, 0x0D, 0x79, 0xD0, 0x8E, 0x66, 0x7C, 0xA7);
+
+ /// <summary>
+ /// Conflicts
+ /// </summary>
+ internal static Guid Conflict = new Guid(0x4bfefb45, 0x347d, 0x4006, 0xa5, 0xbe, 0xac, 0x0c, 0xb0, 0x56, 0x71, 0x92);
+
+ /// <summary>
+ /// Control Panel
+ /// </summary>
+ internal static Guid ControlPanel = new Guid(0x82A74AEB, 0xAEB4, 0x465C, 0xA0, 0x14, 0xD0, 0x97, 0xEE, 0x34, 0x6D, 0x63);
+
+ /// <summary>
+ /// Desktop
+ /// </summary>
+ internal static Guid Desktop = new Guid(0xB4BFCC3A, 0xDB2C, 0x424C, 0xB0, 0x29, 0x7F, 0xE9, 0x9A, 0x87, 0xC6, 0x41);
+
+ /// <summary>
+ /// Internet Explorer
+ /// </summary>
+ internal static Guid Internet = new Guid(0x4D9F7874, 0x4E0C, 0x4904, 0x96, 0x7B, 0x40, 0xB0, 0xD2, 0x0C, 0x3E, 0x4B);
+
+ /// <summary>
+ /// Network
+ /// </summary>
+ internal static Guid Network = new Guid(0xD20BEEC4, 0x5CA8, 0x4905, 0xAE, 0x3B, 0xBF, 0x25, 0x1E, 0xA0, 0x9B, 0x53);
+
+ /// <summary>
+ /// Printers
+ /// </summary>
+ internal static Guid Printers = new Guid(0x76FC4E2D, 0xD6AD, 0x4519, 0xA6, 0x63, 0x37, 0xBD, 0x56, 0x06, 0x81, 0x85);
+
+ /// <summary>
+ /// Sync Center
+ /// </summary>
+ internal static Guid SyncManager = new Guid(0x43668BF8, 0xC14E, 0x49B2, 0x97, 0xC9, 0x74, 0x77, 0x84, 0xD7, 0x84, 0xB7);
+
+ /// <summary>
+ /// Network Connections
+ /// </summary>
+ internal static Guid Connections = new Guid(0x6F0CD92B, 0x2E97, 0x45D1, 0x88, 0xFF, 0xB0, 0xD1, 0x86, 0xB8, 0xDE, 0xDD);
+
+ /// <summary>
+ /// Sync Setup
+ /// </summary>
+ internal static Guid SyncSetup = new Guid(0xf214138, 0xb1d3, 0x4a90, 0xbb, 0xa9, 0x27, 0xcb, 0xc0, 0xc5, 0x38, 0x9a);
+
+ /// <summary>
+ /// Sync Results
+ /// </summary>
+ internal static Guid SyncResults = new Guid(0x289a9a43, 0xbe44, 0x4057, 0xa4, 0x1b, 0x58, 0x7a, 0x76, 0xd7, 0xe7, 0xf9);
+
+ /// <summary>
+ /// Recycle Bin
+ /// </summary>
+ internal static Guid RecycleBin = new Guid(0xB7534046, 0x3ECB, 0x4C18, 0xBE, 0x4E, 0x64, 0xCD, 0x4C, 0xB7, 0xD6, 0xAC);
+
+ /// <summary>
+ /// Fonts
+ /// </summary>
+ internal static Guid Fonts = new Guid(0xFD228CB7, 0xAE11, 0x4AE3, 0x86, 0x4C, 0x16, 0xF3, 0x91, 0x0A, 0xB8, 0xFE);
+
+ /// <summary>
+ /// Startup
+ /// </summary>
+ internal static Guid Startup = new Guid(0xB97D20BB, 0xF46A, 0x4C97, 0xBA, 0x10, 0x5E, 0x36, 0x08, 0x43, 0x08, 0x54);
+
+ /// <summary>
+ /// Programs
+ /// </summary>
+ internal static Guid Programs = new Guid(0xA77F5D77, 0x2E2B, 0x44C3, 0xA6, 0xA2, 0xAB, 0xA6, 0x01, 0x05, 0x4A, 0x51);
+
+ /// <summary>
+ /// Start Menu
+ /// </summary>
+ internal static Guid StartMenu = new Guid(0x625B53C3, 0xAB48, 0x4EC1, 0xBA, 0x1F, 0xA1, 0xEF, 0x41, 0x46, 0xFC, 0x19);
+
+ /// <summary>
+ /// Recent Items
+ /// </summary>
+ internal static Guid Recent = new Guid(0xAE50C081, 0xEBD2, 0x438A, 0x86, 0x55, 0x8A, 0x09, 0x2E, 0x34, 0x98, 0x7A);
+
+ /// <summary>
+ /// SendTo
+ /// </summary>
+ internal static Guid SendTo = new Guid(0x8983036C, 0x27C0, 0x404B, 0x8F, 0x08, 0x10, 0x2D, 0x10, 0xDC, 0xFD, 0x74);
+
+ /// <summary>
+ /// Documents
+ /// </summary>
+ internal static Guid Documents = new Guid(0xFDD39AD0, 0x238F, 0x46AF, 0xAD, 0xB4, 0x6C, 0x85, 0x48, 0x03, 0x69, 0xC7);
+
+ /// <summary>
+ /// Favorites
+ /// </summary>
+ internal static Guid Favorites = new Guid(0x1777F761, 0x68AD, 0x4D8A, 0x87, 0xBD, 0x30, 0xB7, 0x59, 0xFA, 0x33, 0xDD);
+
+ /// <summary>
+ /// Network Shortcuts
+ /// </summary>
+ internal static Guid NetHood = new Guid(0xC5ABBF53, 0xE17F, 0x4121, 0x89, 0x00, 0x86, 0x62, 0x6F, 0xC2, 0xC9, 0x73);
+
+ /// <summary>
+ /// Printer Shortcuts
+ /// </summary>
+ internal static Guid PrintHood = new Guid(0x9274BD8D, 0xCFD1, 0x41C3, 0xB3, 0x5E, 0xB1, 0x3F, 0x55, 0xA7, 0x58, 0xF4);
+
+ /// <summary>
+ /// Templates
+ /// </summary>
+ internal static Guid Templates = new Guid(0xA63293E8, 0x664E, 0x48DB, 0xA0, 0x79, 0xDF, 0x75, 0x9E, 0x05, 0x09, 0xF7);
+
+ /// <summary>
+ /// Startup
+ /// </summary>
+ internal static Guid CommonStartup = new Guid(0x82A5EA35, 0xD9CD, 0x47C5, 0x96, 0x29, 0xE1, 0x5D, 0x2F, 0x71, 0x4E, 0x6E);
+
+ /// <summary>
+ /// Programs
+ /// </summary>
+ internal static Guid CommonPrograms = new Guid(0x0139D44E, 0x6AFE, 0x49F2, 0x86, 0x90, 0x3D, 0xAF, 0xCA, 0xE6, 0xFF, 0xB8);
+
+ /// <summary>
+ /// Start Menu
+ /// </summary>
+ internal static Guid CommonStartMenu = new Guid(0xA4115719, 0xD62E, 0x491D, 0xAA, 0x7C, 0xE7, 0x4B, 0x8B, 0xE3, 0xB0, 0x67);
+
+ /// <summary>
+ /// Public Desktop
+ /// </summary>
+ internal static Guid PublicDesktop = new Guid(0xC4AA340D, 0xF20F, 0x4863, 0xAF, 0xEF, 0xF8, 0x7E, 0xF2, 0xE6, 0xBA, 0x25);
+
+ /// <summary>
+ /// ProgramData
+ /// </summary>
+ internal static Guid ProgramData = new Guid(0x62AB5D82, 0xFDC1, 0x4DC3, 0xA9, 0xDD, 0x07, 0x0D, 0x1D, 0x49, 0x5D, 0x97);
+
+ /// <summary>
+ /// Templates
+ /// </summary>
+ internal static Guid CommonTemplates = new Guid(0xB94237E7, 0x57AC, 0x4347, 0x91, 0x51, 0xB0, 0x8C, 0x6C, 0x32, 0xD1, 0xF7);
+
+ /// <summary>
+ /// Public Documents
+ /// </summary>
+ internal static Guid PublicDocuments = new Guid(0xED4824AF, 0xDCE4, 0x45A8, 0x81, 0xE2, 0xFC, 0x79, 0x65, 0x08, 0x36, 0x34);
+
+ /// <summary>
+ /// Roaming
+ /// </summary>
+ internal static Guid RoamingAppData = new Guid(0x3EB685DB, 0x65F9, 0x4CF6, 0xA0, 0x3A, 0xE3, 0xEF, 0x65, 0x72, 0x9F, 0x3D);
+
+ /// <summary>
+ /// Local
+ /// </summary>
+ internal static Guid LocalAppData = new Guid(0xF1B32785, 0x6FBA, 0x4FCF, 0x9D, 0x55, 0x7B, 0x8E, 0x7F, 0x15, 0x70, 0x91);
+
+ /// <summary>
+ /// LocalLow
+ /// </summary>
+ internal static Guid LocalAppDataLow = new Guid(0xA520A1A4, 0x1780, 0x4FF6, 0xBD, 0x18, 0x16, 0x73, 0x43, 0xC5, 0xAF, 0x16);
+
+ /// <summary>
+ /// Temporary Internet Files
+ /// </summary>
+ internal static Guid InternetCache = new Guid(0x352481E8, 0x33BE, 0x4251, 0xBA, 0x85, 0x60, 0x07, 0xCA, 0xED, 0xCF, 0x9D);
+
+ /// <summary>
+ /// Cookies
+ /// </summary>
+ internal static Guid Cookies = new Guid(0x2B0F765D, 0xC0E9, 0x4171, 0x90, 0x8E, 0x08, 0xA6, 0x11, 0xB8, 0x4F, 0xF6);
+
+ /// <summary>
+ /// History
+ /// </summary>
+ internal static Guid History = new Guid(0xD9DC8A3B, 0xB784, 0x432E, 0xA7, 0x81, 0x5A, 0x11, 0x30, 0xA7, 0x59, 0x63);
+
+ /// <summary>
+ /// System32
+ /// </summary>
+ internal static Guid System = new Guid(0x1AC14E77, 0x02E7, 0x4E5D, 0xB7, 0x44, 0x2E, 0xB1, 0xAE, 0x51, 0x98, 0xB7);
+
+ /// <summary>
+ /// System32
+ /// </summary>
+ internal static Guid SystemX86 = new Guid(0xD65231B0, 0xB2F1, 0x4857, 0xA4, 0xCE, 0xA8, 0xE7, 0xC6, 0xEA, 0x7D, 0x27);
+
+ /// <summary>
+ /// Windows
+ /// </summary>
+ internal static Guid Windows = new Guid(0xF38BF404, 0x1D43, 0x42F2, 0x93, 0x05, 0x67, 0xDE, 0x0B, 0x28, 0xFC, 0x23);
+
+ /// <summary>
+ /// The user's username (%USERNAME%)
+ /// </summary>
+ internal static Guid Profile = new Guid(0x5E6C858F, 0x0E22, 0x4760, 0x9A, 0xFE, 0xEA, 0x33, 0x17, 0xB6, 0x71, 0x73);
+
+ /// <summary>
+ /// Pictures
+ /// </summary>
+ internal static Guid Pictures = new Guid(0x33E28130, 0x4E1E, 0x4676, 0x83, 0x5A, 0x98, 0x39, 0x5C, 0x3B, 0xC3, 0xBB);
+
+ /// <summary>
+ /// Program Files
+ /// </summary>
+ internal static Guid ProgramFilesX86 = new Guid(0x7C5A40EF, 0xA0FB, 0x4BFC, 0x87, 0x4A, 0xC0, 0xF2, 0xE0, 0xB9, 0xFA, 0x8E);
+
+ /// <summary>
+ /// Common Files
+ /// </summary>
+ internal static Guid ProgramFilesCommonX86 = new Guid(0xDE974D24, 0xD9C6, 0x4D3E, 0xBF, 0x91, 0xF4, 0x45, 0x51, 0x20, 0xB9, 0x17);
+
+ /// <summary>
+ /// Program Files
+ /// </summary>
+ internal static Guid ProgramFilesX64 = new Guid(0x6d809377, 0x6af0, 0x444b, 0x89, 0x57, 0xa3, 0x77, 0x3f, 0x02, 0x20, 0x0e);
+
+ /// <summary>
+ /// Common Files
+ /// </summary>
+ internal static Guid ProgramFilesCommonX64 = new Guid(0x6365d5a7, 0xf0d, 0x45e5, 0x87, 0xf6, 0xd, 0xa5, 0x6b, 0x6a, 0x4f, 0x7d);
+
+ /// <summary>
+ /// Program Files
+ /// </summary>
+ internal static Guid ProgramFiles = new Guid(0x905e63b6, 0xc1bf, 0x494e, 0xb2, 0x9c, 0x65, 0xb7, 0x32, 0xd3, 0xd2, 0x1a);
+
+ /// <summary>
+ /// Common Files
+ /// </summary>
+ internal static Guid ProgramFilesCommon = new Guid(0xF7F1ED05, 0x9F6D, 0x47A2, 0xAA, 0xAE, 0x29, 0xD3, 0x17, 0xC6, 0xF0, 0x66);
+
+ /// <summary>
+ /// Administrative Tools
+ /// </summary>
+ internal static Guid AdminTools = new Guid(0x724EF170, 0xA42D, 0x4FEF, 0x9F, 0x26, 0xB6, 0x0E, 0x84, 0x6F, 0xBA, 0x4F);
+
+ /// <summary>
+ /// Administrative Tools
+ /// </summary>
+ internal static Guid CommonAdminTools = new Guid(0xD0384E7D, 0xBAC3, 0x4797, 0x8F, 0x14, 0xCB, 0xA2, 0x29, 0xB3, 0x92, 0xB5);
+
+ /// <summary>
+ /// Music
+ /// </summary>
+ internal static Guid Music = new Guid(0x4BD8D571, 0x6D19, 0x48D3, 0xBE, 0x97, 0x42, 0x22, 0x20, 0x08, 0x0E, 0x43);
+
+ /// <summary>
+ /// Videos
+ /// </summary>
+ internal static Guid Videos = new Guid(0x18989B1D, 0x99B5, 0x455B, 0x84, 0x1C, 0xAB, 0x7C, 0x74, 0xE4, 0xDD, 0xFC);
+
+ /// <summary>
+ /// Public Pictures
+ /// </summary>
+ internal static Guid PublicPictures = new Guid(0xB6EBFB86, 0x6907, 0x413C, 0x9A, 0xF7, 0x4F, 0xC2, 0xAB, 0xF0, 0x7C, 0xC5);
+
+ /// <summary>
+ /// Public Music
+ /// </summary>
+ internal static Guid PublicMusic = new Guid(0x3214FAB5, 0x9757, 0x4298, 0xBB, 0x61, 0x92, 0xA9, 0xDE, 0xAA, 0x44, 0xFF);
+
+ /// <summary>
+ /// Public Videos
+ /// </summary>
+ internal static Guid PublicVideos = new Guid(0x2400183A, 0x6185, 0x49FB, 0xA2, 0xD8, 0x4A, 0x39, 0x2A, 0x60, 0x2B, 0xA3);
+
+ /// <summary>
+ /// Resources
+ /// </summary>
+ internal static Guid ResourceDir = new Guid(0x8AD10C31, 0x2ADB, 0x4296, 0xA8, 0xF7, 0xE4, 0x70, 0x12, 0x32, 0xC9, 0x72);
+
+ /// <summary>
+ /// None
+ /// </summary>
+ internal static Guid LocalizedResourcesDir = new Guid(0x2A00375E, 0x224C, 0x49DE, 0xB8, 0xD1, 0x44, 0x0D, 0xF7, 0xEF, 0x3D, 0xDC);
+
+ /// <summary>
+ /// OEM Links
+ /// </summary>
+ internal static Guid CommonOEMLinks = new Guid(0xC1BAE2D0, 0x10DF, 0x4334, 0xBE, 0xDD, 0x7A, 0xA2, 0x0B, 0x22, 0x7A, 0x9D);
+
+ /// <summary>
+ /// Temporary Burn Folder
+ /// </summary>
+ internal static Guid CDBurning = new Guid(0x9E52AB10, 0xF80D, 0x49DF, 0xAC, 0xB8, 0x43, 0x30, 0xF5, 0x68, 0x78, 0x55);
+
+ /// <summary>
+ /// Users
+ /// </summary>
+ internal static Guid UserProfiles = new Guid(0x0762D272, 0xC50A, 0x4BB0, 0xA3, 0x82, 0x69, 0x7D, 0xCD, 0x72, 0x9B, 0x80);
+
+ /// <summary>
+ /// Playlists
+ /// </summary>
+ internal static Guid Playlists = new Guid(0xDE92C1C7, 0x837F, 0x4F69, 0xA3, 0xBB, 0x86, 0xE6, 0x31, 0x20, 0x4A, 0x23);
+
+ /// <summary>
+ /// Sample Playlists
+ /// </summary>
+ internal static Guid SamplePlaylists = new Guid(0x15CA69B3, 0x30EE, 0x49C1, 0xAC, 0xE1, 0x6B, 0x5E, 0xC3, 0x72, 0xAF, 0xB5);
+
+ /// <summary>
+ /// Sample Music
+ /// </summary>
+ internal static Guid SampleMusic = new Guid(0xB250C668, 0xF57D, 0x4EE1, 0xA6, 0x3C, 0x29, 0x0E, 0xE7, 0xD1, 0xAA, 0x1F);
+
+ /// <summary>
+ /// Sample Pictures
+ /// </summary>
+ internal static Guid SamplePictures = new Guid(0xC4900540, 0x2379, 0x4C75, 0x84, 0x4B, 0x64, 0xE6, 0xFA, 0xF8, 0x71, 0x6B);
+
+ /// <summary>
+ /// Sample Videos
+ /// </summary>
+ internal static Guid SampleVideos = new Guid(0x859EAD94, 0x2E85, 0x48AD, 0xA7, 0x1A, 0x09, 0x69, 0xCB, 0x56, 0xA6, 0xCD);
+
+ /// <summary>
+ /// Slide Shows
+ /// </summary>
+ internal static Guid PhotoAlbums = new Guid(0x69D2CF90, 0xFC33, 0x4FB7, 0x9A, 0x0C, 0xEB, 0xB0, 0xF0, 0xFC, 0xB4, 0x3C);
+
+ /// <summary>
+ /// Public
+ /// </summary>
+ internal static Guid Public = new Guid(0xDFDF76A2, 0xC82A, 0x4D63, 0x90, 0x6A, 0x56, 0x44, 0xAC, 0x45, 0x73, 0x85);
+
+ /// <summary>
+ /// Programs and Features
+ /// </summary>
+ internal static Guid ChangeRemovePrograms = new Guid(0xdf7266ac, 0x9274, 0x4867, 0x8d, 0x55, 0x3b, 0xd6, 0x61, 0xde, 0x87, 0x2d);
+
+ /// <summary>
+ /// Installed Updates
+ /// </summary>
+ internal static Guid AppUpdates = new Guid(0xa305ce99, 0xf527, 0x492b, 0x8b, 0x1a, 0x7e, 0x76, 0xfa, 0x98, 0xd6, 0xe4);
+
+ /// <summary>
+ /// Get Programs
+ /// </summary>
+ internal static Guid AddNewPrograms = new Guid(0xde61d971, 0x5ebc, 0x4f02, 0xa3, 0xa9, 0x6c, 0x82, 0x89, 0x5e, 0x5c, 0x04);
+
+ /// <summary>
+ /// Downloads
+ /// </summary>
+ internal static Guid Downloads = new Guid(0x374de290, 0x123f, 0x4565, 0x91, 0x64, 0x39, 0xc4, 0x92, 0x5e, 0x46, 0x7b);
+
+ /// <summary>
+ /// Public Downloads
+ /// </summary>
+ internal static Guid PublicDownloads = new Guid(0x3d644c9b, 0x1fb8, 0x4f30, 0x9b, 0x45, 0xf6, 0x70, 0x23, 0x5f, 0x79, 0xc0);
+
+ /// <summary>
+ /// Searches
+ /// </summary>
+ internal static Guid SavedSearches = new Guid(0x7d1d3a04, 0xdebb, 0x4115, 0x95, 0xcf, 0x2f, 0x29, 0xda, 0x29, 0x20, 0xda);
+
+ /// <summary>
+ /// Quick Launch
+ /// </summary>
+ internal static Guid QuickLaunch = new Guid(0x52a4f021, 0x7b75, 0x48a9, 0x9f, 0x6b, 0x4b, 0x87, 0xa2, 0x10, 0xbc, 0x8f);
+
+ /// <summary>
+ /// Contacts
+ /// </summary>
+ internal static Guid Contacts = new Guid(0x56784854, 0xc6cb, 0x462b, 0x81, 0x69, 0x88, 0xe3, 0x50, 0xac, 0xb8, 0x82);
+
+ /// <summary>
+ /// Gadgets
+ /// </summary>
+ internal static Guid SidebarParts = new Guid(0xa75d362e, 0x50fc, 0x4fb7, 0xac, 0x2c, 0xa8, 0xbe, 0xaa, 0x31, 0x44, 0x93);
+
+ /// <summary>
+ /// Gadgets
+ /// </summary>
+ internal static Guid SidebarDefaultParts = new Guid(0x7b396e54, 0x9ec5, 0x4300, 0xbe, 0xa, 0x24, 0x82, 0xeb, 0xae, 0x1a, 0x26);
+
+ /// <summary>
+ /// Tree property value folder
+ /// </summary>
+ internal static Guid TreeProperties = new Guid(0x5b3749ad, 0xb49f, 0x49c1, 0x83, 0xeb, 0x15, 0x37, 0x0f, 0xbd, 0x48, 0x82);
+
+ /// <summary>
+ /// GameExplorer
+ /// </summary>
+ internal static Guid PublicGameTasks = new Guid(0xdebf2536, 0xe1a8, 0x4c59, 0xb6, 0xa2, 0x41, 0x45, 0x86, 0x47, 0x6a, 0xea);
+
+ /// <summary>
+ /// GameExplorer
+ /// </summary>
+ internal static Guid GameTasks = new Guid(0x54fae61, 0x4dd8, 0x4787, 0x80, 0xb6, 0x9, 0x2, 0x20, 0xc4, 0xb7, 0x0);
+
+ /// <summary>
+ /// Saved Games
+ /// </summary>
+ internal static Guid SavedGames = new Guid(0x4c5c32ff, 0xbb9d, 0x43b0, 0xb5, 0xb4, 0x2d, 0x72, 0xe5, 0x4e, 0xaa, 0xa4);
+
+ /// <summary>
+ /// Games
+ /// </summary>
+ internal static Guid Games = new Guid(0xcac52c1a, 0xb53d, 0x4edc, 0x92, 0xd7, 0x6b, 0x2e, 0x8a, 0xc1, 0x94, 0x34);
+
+ /// <summary>
+ /// Recorded TV
+ /// </summary>
+ internal static Guid RecordedTV = new Guid(0xbd85e001, 0x112e, 0x431e, 0x98, 0x3b, 0x7b, 0x15, 0xac, 0x09, 0xff, 0xf1);
+
+ /// <summary>
+ /// Microsoft Office Outlook
+ /// </summary>
+ internal static Guid SearchMapi = new Guid(0x98ec0e18, 0x2098, 0x4d44, 0x86, 0x44, 0x66, 0x97, 0x93, 0x15, 0xa2, 0x81);
+
+ /// <summary>
+ /// Offline Files
+ /// </summary>
+ internal static Guid SearchCsc = new Guid(0xee32e446, 0x31ca, 0x4aba, 0x81, 0x4f, 0xa5, 0xeb, 0xd2, 0xfd, 0x6d, 0x5e);
+
+ /// <summary>
+ /// Links
+ /// </summary>
+ internal static Guid Links = new Guid(0xbfb9d5e0, 0xc6a9, 0x404c, 0xb2, 0xb2, 0xae, 0x6d, 0xb6, 0xaf, 0x49, 0x68);
+
+ /// <summary>
+ /// The user's full name (for instance, Jean Philippe Bagel) entered when the user account was created.
+ /// </summary>
+ internal static Guid UsersFiles = new Guid(0xf3ce0f7c, 0x4901, 0x4acc, 0x86, 0x48, 0xd5, 0xd4, 0x4b, 0x04, 0xef, 0x8f);
+
+ /// <summary>
+ /// Search home
+ /// </summary>
+ internal static Guid SearchHome = new Guid(0x190337d1, 0xb8ca, 0x4121, 0xa6, 0x39, 0x6d, 0x47, 0x2d, 0x16, 0x97, 0x2a);
+
+ /// <summary>
+ /// Original Images
+ /// </summary>
+ internal static Guid OriginalImages = new Guid(0x2C36C0AA, 0x5812, 0x4b87, 0xbf, 0xd0, 0x4c, 0xd0, 0xdf, 0xb1, 0x9b, 0x39);
+
+ #endregion
+
+ #region Win7 KnownFolders Guids
+
+ /// <summary>
+ /// UserProgramFiles
+ /// </summary>
+ internal static Guid UserProgramFiles = new Guid(0x5cd7aee2, 0x2219, 0x4a67, 0xb8, 0x5d, 0x6c, 0x9c, 0xe1, 0x56, 0x60, 0xcb);
+
+ /// <summary>
+ /// UserProgramFilesCommon
+ /// </summary>
+ internal static Guid UserProgramFilesCommon = new Guid(0xbcbd3057, 0xca5c, 0x4622, 0xb4, 0x2d, 0xbc, 0x56, 0xdb, 0x0a, 0xe5, 0x16);
+
+ /// <summary>
+ /// Ringtones
+ /// </summary>
+ internal static Guid Ringtones = new Guid(0xC870044B, 0xF49E, 0x4126, 0xA9, 0xC3, 0xB5, 0x2A, 0x1F, 0xF4, 0x11, 0xE8);
+
+ /// <summary>
+ /// PublicRingtones
+ /// </summary>
+ internal static Guid PublicRingtones = new Guid(0xE555AB60, 0x153B, 0x4D17, 0x9F, 0x04, 0xA5, 0xFE, 0x99, 0xFC, 0x15, 0xEC);
+
+ /// <summary>
+ /// UsersLibraries
+ /// </summary>
+ internal static Guid UsersLibraries = new Guid(0xa302545d, 0xdeff, 0x464b, 0xab, 0xe8, 0x61, 0xc8, 0x64, 0x8d, 0x93, 0x9b);
+
+ /// <summary>
+ /// DocumentsLibrary
+ /// </summary>
+ internal static Guid DocumentsLibrary = new Guid(0x7b0db17d, 0x9cd2, 0x4a93, 0x97, 0x33, 0x46, 0xcc, 0x89, 0x02, 0x2e, 0x7c);
+
+ /// <summary>
+ /// MusicLibrary
+ /// </summary>
+ internal static Guid MusicLibrary = new Guid(0x2112ab0a, 0xc86a, 0x4ffe, 0xa3, 0x68, 0xd, 0xe9, 0x6e, 0x47, 0x1, 0x2e);
+
+ /// <summary>
+ /// PicturesLibrary
+ /// </summary>
+ internal static Guid PicturesLibrary = new Guid(0xa990ae9f, 0xa03b, 0x4e80, 0x94, 0xbc, 0x99, 0x12, 0xd7, 0x50, 0x41, 0x4);
+
+ /// <summary>
+ /// VideosLibrary
+ /// </summary>
+ internal static Guid VideosLibrary = new Guid(0x491e922f, 0x5643, 0x4af4, 0xa7, 0xeb, 0x4e, 0x7a, 0x13, 0x8d, 0x81, 0x74);
+
+ /// <summary>
+ /// RecordedTVLibrary
+ /// </summary>
+ internal static Guid RecordedTVLibrary = new Guid(0x1a6fdba2, 0xf42d, 0x4358, 0xa7, 0x98, 0xb7, 0x4d, 0x74, 0x59, 0x26, 0xc5);
+
+ /// <summary>
+ /// OtherUsers
+ /// </summary>
+ internal static Guid OtherUsers = new Guid(0x52528a6b, 0xb9e3, 0x4add, 0xb6, 0xd, 0x58, 0x8c, 0x2d, 0xba, 0x84, 0x2d);
+
+ /// <summary>
+ /// DeviceMetadataStore
+ /// </summary>
+ internal static Guid DeviceMetadataStore = new Guid(0x5ce4a5e9, 0xe4eb, 0x479d, 0xb8, 0x9f, 0x13, 0x0c, 0x02, 0x88, 0x61, 0x55);
+
+ /// <summary>
+ /// Libraries
+ /// </summary>
+ internal static Guid Libraries = new Guid(0x1b3ea5dc, 0xb587, 0x4786, 0xb4, 0xef, 0xbd, 0x1d, 0xc3, 0x32, 0xae, 0xae);
+
+ /// <summary>
+ /// UserPinned
+ /// </summary>
+ internal static Guid UserPinned = new Guid(0x9e3995ab, 0x1f9c, 0x4f13, 0xb8, 0x27, 0x48, 0xb2, 0x4b, 0x6c, 0x71, 0x74);
+
+ /// <summary>
+ /// ImplicitAppShortcuts
+ /// </summary>
+ internal static Guid ImplicitAppShortcuts = new Guid(0xbcb5256f, 0x79f6, 0x4cee, 0xb7, 0x25, 0xdc, 0x34, 0xe4, 0x2, 0xfd, 0x46);
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/IKnownFolder.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/IKnownFolder.cs
new file mode 100644
index 0000000000..9c73084ac1
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/IKnownFolder.cs
@@ -0,0 +1,117 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Represents a registered or known folder in the system.
+ /// </summary>
+ public interface IKnownFolder : IDisposable, IEnumerable<ShellObject>
+ {
+ /// <summary>
+ /// Gets the path for this known folder.
+ /// </summary>
+ string Path { get; }
+
+ /// <summary>
+ /// Gets the category designation for this known folder.
+ /// </summary>
+ FolderCategory Category { get; }
+
+ /// <summary>
+ /// Gets this known folder's canonical name.
+ /// </summary>
+ string CanonicalName { get; }
+
+ /// <summary>
+ /// Gets this known folder's description.
+ /// </summary>
+ string Description { get; }
+
+ /// <summary>
+ /// Gets the unique identifier for this known folder's parent folder.
+ /// </summary>
+ Guid ParentId { get; }
+
+ /// <summary>
+ /// Gets this known folder's relative path.
+ /// </summary>
+ string RelativePath { get; }
+
+ /// <summary>
+ /// Gets this known folder's parsing name.
+ /// </summary>
+ string ParsingName { get; }
+
+ /// <summary>
+ /// Gets this known folder's tool tip text.
+ /// </summary>
+ string Tooltip { get; }
+
+ /// <summary>
+ /// Gets the resource identifier for this
+ /// known folder's tool tip text.
+ /// </summary>
+ string TooltipResourceId { get; }
+
+ /// <summary>
+ /// Gets this known folder's localized name.
+ /// </summary>
+ string LocalizedName { get; }
+
+ /// <summary>
+ /// Gets the resource identifier for this
+ /// known folder's localized name.
+ /// </summary>
+ string LocalizedNameResourceId { get; }
+
+ /// <summary>
+ /// Gets this known folder's security attributes.
+ /// </summary>
+ string Security { get; }
+
+ /// <summary>
+ /// Gets this known folder's file attributes,
+ /// such as "read-only".
+ /// </summary>
+ FileAttributes FileAttributes { get; }
+
+ /// <summary>
+ /// Gets an value that describes this known folder's behaviors.
+ /// </summary>
+ DefinitionOptions DefinitionOptions { get; }
+
+ /// <summary>
+ /// Gets the unique identifier for this known folder's type.
+ /// </summary>
+ Guid FolderTypeId { get; }
+
+ /// <summary>
+ /// Gets a string representation of this known folder's type.
+ /// </summary>
+ string FolderType { get; }
+
+ /// <summary>
+ /// Gets the unique identifier for this known folder.
+ /// </summary>
+ Guid FolderId { get; }
+
+ /// <summary>
+ /// Gets a value that indicates whether this known folder's path exists on the computer.
+ /// </summary>
+ /// <remarks>If this property value is <b>false</b>,
+ /// the folder might be a virtual folder (<see cref="Category"/> property will
+ /// be <see cref="FolderCategory.Virtual"/> for virtual folders)</remarks>
+ bool PathExists { get; }
+
+ /// <summary>
+ /// Gets a value that states whether this known folder
+ /// can have its path set to a new value,
+ /// including any restrictions on the redirection.
+ /// </summary>
+ RedirectionCapability Redirection { get; }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/KnownFolderHelper.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/KnownFolderHelper.cs
new file mode 100644
index 0000000000..c038a7d8c3
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/KnownFolderHelper.cs
@@ -0,0 +1,204 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Diagnostics;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Creates the helper class for known folders.
+ /// </summary>
+ public static class KnownFolderHelper
+ {
+ /// <summary>
+ /// Returns the native known folder (IKnownFolderNative) given a PID list
+ /// </summary>
+ /// <param name="pidl"></param>
+ /// <returns></returns>
+ internal static IKnownFolderNative FromPIDL(IntPtr pidl)
+ {
+ KnownFolderManagerClass knownFolderManager = new KnownFolderManagerClass();
+
+ IKnownFolderNative knownFolder;
+ HResult hr = knownFolderManager.FindFolderFromIDList(pidl, out knownFolder);
+
+ return (hr == HResult.Ok) ? knownFolder : null;
+ }
+
+ /// <summary>
+ /// Returns a known folder given a globally unique identifier.
+ /// </summary>
+ /// <param name="knownFolderId">A GUID for the requested known folder.</param>
+ /// <returns>A known folder representing the specified name.</returns>
+ /// <exception cref="System.ArgumentException">Thrown if the given Known Folder ID is invalid.</exception>
+ public static IKnownFolder FromKnownFolderId(Guid knownFolderId)
+ {
+ IKnownFolderNative knownFolderNative;
+ KnownFolderManagerClass knownFolderManager = new KnownFolderManagerClass();
+
+ HResult hr = knownFolderManager.GetFolder(knownFolderId, out knownFolderNative);
+ if (hr != HResult.Ok) { throw new ShellException(hr); }
+
+ IKnownFolder kf = GetKnownFolder(knownFolderNative);
+ if (kf == null)
+ {
+ throw new ArgumentException(LocalizedMessages.KnownFolderInvalidGuid, "knownFolderId");
+ }
+ return kf;
+ }
+
+ /// <summary>
+ /// Returns a known folder given a globally unique identifier.
+ /// </summary>
+ /// <param name="knownFolderId">A GUID for the requested known folder.</param>
+ /// <returns>A known folder representing the specified name. Returns null if Known Folder is not found or could not be created.</returns>
+ internal static IKnownFolder FromKnownFolderIdInternal(Guid knownFolderId)
+ {
+ IKnownFolderNative knownFolderNative;
+ IKnownFolderManager knownFolderManager = (IKnownFolderManager)new KnownFolderManagerClass();
+
+ HResult hr = knownFolderManager.GetFolder(knownFolderId, out knownFolderNative);
+
+ return (hr == HResult.Ok) ? GetKnownFolder(knownFolderNative) : null;
+ }
+
+ /// <summary>
+ /// Given a native KnownFolder (IKnownFolderNative), create the right type of
+ /// IKnownFolder object (FileSystemKnownFolder or NonFileSystemKnownFolder)
+ /// </summary>
+ /// <param name="knownFolderNative">Native Known Folder</param>
+ /// <returns></returns>
+ private static IKnownFolder GetKnownFolder(IKnownFolderNative knownFolderNative)
+ {
+ Debug.Assert(knownFolderNative != null, "Native IKnownFolder should not be null.");
+
+ // Get the native IShellItem2 from the native IKnownFolder
+ IShellItem2 shellItem;
+ Guid guid = new Guid(ShellIIDGuid.IShellItem2);
+ HResult hr = knownFolderNative.GetShellItem(0, ref guid, out shellItem);
+
+ if (!CoreErrorHelper.Succeeded(hr)) { return null; }
+
+ bool isFileSystem = false;
+
+ // If we have a valid IShellItem, try to get the FileSystem attribute.
+ if (shellItem != null)
+ {
+ ShellNativeMethods.ShellFileGetAttributesOptions sfgao;
+ shellItem.GetAttributes(ShellNativeMethods.ShellFileGetAttributesOptions.FileSystem, out sfgao);
+
+ // Is this item a FileSystem item?
+ isFileSystem = (sfgao & ShellNativeMethods.ShellFileGetAttributesOptions.FileSystem) != 0;
+ }
+
+ // If it's FileSystem, create a FileSystemKnownFolder, else NonFileSystemKnownFolder
+ if (isFileSystem)
+ {
+ FileSystemKnownFolder kf = new FileSystemKnownFolder(knownFolderNative);
+ return kf;
+ }
+
+ NonFileSystemKnownFolder knownFsFolder = new NonFileSystemKnownFolder(knownFolderNative);
+ return knownFsFolder;
+ }
+
+ /// <summary>
+ /// Returns the known folder given its canonical name.
+ /// </summary>
+ /// <param name="canonicalName">A non-localized canonical name for the known folder, such as MyComputer.</param>
+ /// <returns>A known folder representing the specified name.</returns>
+ /// <exception cref="System.ArgumentException">Thrown if the given canonical name is invalid or if the KnownFolder could not be created.</exception>
+ public static IKnownFolder FromCanonicalName(string canonicalName)
+ {
+ IKnownFolderNative knownFolderNative;
+ IKnownFolderManager knownFolderManager = (IKnownFolderManager)new KnownFolderManagerClass();
+
+ knownFolderManager.GetFolderByName(canonicalName, out knownFolderNative);
+ IKnownFolder kf = KnownFolderHelper.GetKnownFolder(knownFolderNative);
+
+ if (kf == null)
+ {
+ throw new ArgumentException(LocalizedMessages.ShellInvalidCanonicalName, "canonicalName");
+ }
+ return kf;
+ }
+
+ /// <summary>
+ /// Returns a known folder given its shell path, such as <c>C:\users\public\documents</c> or
+ /// <c>::{645FF040-5081-101B-9F08-00AA002F954E}</c> for the Recycle Bin.
+ /// </summary>
+ /// <param name="path">The path for the requested known folder; either a physical path or a virtual path.</param>
+ /// <returns>A known folder representing the specified name.</returns>
+ public static IKnownFolder FromPath(string path)
+ {
+ return KnownFolderHelper.FromParsingName(path);
+ }
+
+ /// <summary>
+ /// Returns a known folder given its shell namespace parsing name, such as
+ /// <c>::{645FF040-5081-101B-9F08-00AA002F954E}</c> for the Recycle Bin.
+ /// </summary>
+ /// <param name="parsingName">The parsing name (or path) for the requested known folder.</param>
+ /// <returns>A known folder representing the specified name.</returns>
+ /// <exception cref="System.ArgumentException">Thrown if the given parsing name is invalid.</exception>
+ public static IKnownFolder FromParsingName(string parsingName)
+ {
+ if (parsingName == null)
+ {
+ throw new ArgumentNullException("parsingName");
+ }
+
+ IntPtr pidl = IntPtr.Zero;
+ IntPtr pidl2 = IntPtr.Zero;
+
+ try
+ {
+ pidl = ShellHelper.PidlFromParsingName(parsingName);
+
+ if (pidl == IntPtr.Zero)
+ {
+ throw new ArgumentException(LocalizedMessages.KnownFolderParsingName, "parsingName");
+ }
+
+ // It's probably a special folder, try to get it
+ IKnownFolderNative knownFolderNative = KnownFolderHelper.FromPIDL(pidl);
+ if (knownFolderNative != null)
+ {
+ IKnownFolder kf = KnownFolderHelper.GetKnownFolder(knownFolderNative);
+ if (kf == null)
+ {
+ throw new ArgumentException(LocalizedMessages.KnownFolderParsingName, "parsingName");
+ }
+ return kf;
+ }
+
+ // No physical storage was found for this known folder
+ // We'll try again with a different name
+
+ // try one more time with a trailing \0
+ pidl2 = ShellHelper.PidlFromParsingName(parsingName.PadRight(1, '\0'));
+
+ if (pidl2 == IntPtr.Zero)
+ {
+ throw new ArgumentException(LocalizedMessages.KnownFolderParsingName, "parsingName");
+ }
+
+ IKnownFolder kf2 = KnownFolderHelper.GetKnownFolder(KnownFolderHelper.FromPIDL(pidl));
+ if (kf2 == null)
+ {
+ throw new ArgumentException(LocalizedMessages.KnownFolderParsingName, "parsingName");
+ }
+
+ return kf2;
+ }
+ finally
+ {
+ ShellNativeMethods.ILFree(pidl);
+ ShellNativeMethods.ILFree(pidl2);
+ }
+
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/KnownFolderSettings.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/KnownFolderSettings.cs
new file mode 100644
index 0000000000..e1a2193524
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/KnownFolderSettings.cs
@@ -0,0 +1,295 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Internal class to represent the KnownFolder settings/properties
+ /// </summary>
+ internal class KnownFolderSettings
+ {
+ private FolderProperties knownFolderProperties;
+
+ internal KnownFolderSettings(IKnownFolderNative knownFolderNative)
+ {
+ GetFolderProperties(knownFolderNative);
+ }
+
+ #region Private Methods
+
+ /// <summary>
+ /// Populates a structure that contains
+ /// this known folder's properties.
+ /// </summary>
+ private void GetFolderProperties(IKnownFolderNative knownFolderNative)
+ {
+ Debug.Assert(knownFolderNative != null);
+
+ KnownFoldersSafeNativeMethods.NativeFolderDefinition nativeFolderDefinition;
+ knownFolderNative.GetFolderDefinition(out nativeFolderDefinition);
+
+ try
+ {
+ knownFolderProperties.category = nativeFolderDefinition.category;
+ knownFolderProperties.canonicalName = Marshal.PtrToStringUni(nativeFolderDefinition.name);
+ knownFolderProperties.description = Marshal.PtrToStringUni(nativeFolderDefinition.description);
+ knownFolderProperties.parentId = nativeFolderDefinition.parentId;
+ knownFolderProperties.relativePath = Marshal.PtrToStringUni(nativeFolderDefinition.relativePath);
+ knownFolderProperties.parsingName = Marshal.PtrToStringUni(nativeFolderDefinition.parsingName);
+ knownFolderProperties.tooltipResourceId = Marshal.PtrToStringUni(nativeFolderDefinition.tooltip);
+ knownFolderProperties.localizedNameResourceId = Marshal.PtrToStringUni(nativeFolderDefinition.localizedName);
+ knownFolderProperties.iconResourceId = Marshal.PtrToStringUni(nativeFolderDefinition.icon);
+ knownFolderProperties.security = Marshal.PtrToStringUni(nativeFolderDefinition.security);
+ knownFolderProperties.fileAttributes = (System.IO.FileAttributes)nativeFolderDefinition.attributes;
+ knownFolderProperties.definitionOptions = nativeFolderDefinition.definitionOptions;
+ knownFolderProperties.folderTypeId = nativeFolderDefinition.folderTypeId;
+ knownFolderProperties.folderType = FolderTypes.GetFolderType(knownFolderProperties.folderTypeId);
+
+ bool pathExists;
+ knownFolderProperties.path = GetPath(out pathExists, knownFolderNative);
+ knownFolderProperties.pathExists = pathExists;
+
+ knownFolderProperties.redirection = knownFolderNative.GetRedirectionCapabilities();
+
+ // Turn tooltip, localized name and icon resource IDs
+ // into the actual resources.
+ knownFolderProperties.tooltip = CoreHelpers.GetStringResource(knownFolderProperties.tooltipResourceId);
+ knownFolderProperties.localizedName = CoreHelpers.GetStringResource(knownFolderProperties.localizedNameResourceId);
+
+ knownFolderProperties.folderId = knownFolderNative.GetId();
+
+ }
+ finally
+ {
+ // Clean up memory.
+ Marshal.FreeCoTaskMem(nativeFolderDefinition.name);
+ Marshal.FreeCoTaskMem(nativeFolderDefinition.description);
+ Marshal.FreeCoTaskMem(nativeFolderDefinition.relativePath);
+ Marshal.FreeCoTaskMem(nativeFolderDefinition.parsingName);
+ Marshal.FreeCoTaskMem(nativeFolderDefinition.tooltip);
+ Marshal.FreeCoTaskMem(nativeFolderDefinition.localizedName);
+ Marshal.FreeCoTaskMem(nativeFolderDefinition.icon);
+ Marshal.FreeCoTaskMem(nativeFolderDefinition.security);
+ }
+ }
+
+ /// <summary>
+ /// Gets the path of this this known folder.
+ /// </summary>
+ /// <param name="fileExists">
+ /// Returns false if the folder is virtual, or a boolean
+ /// value that indicates whether this known folder exists.
+ /// </param>
+ /// <param name="knownFolderNative">Native IKnownFolder reference</param>
+ /// <returns>
+ /// A <see cref="System.String"/> containing the path, or <see cref="System.String.Empty"/> if this known folder does not exist.
+ /// </returns>
+ private string GetPath(out bool fileExists, IKnownFolderNative knownFolderNative)
+ {
+ Debug.Assert(knownFolderNative != null);
+
+ string kfPath = string.Empty;
+ fileExists = true;
+
+ // Virtual folders do not have path.
+ if (knownFolderProperties.category == FolderCategory.Virtual)
+ {
+ fileExists = false;
+ return kfPath;
+ }
+
+ try
+ {
+ kfPath = knownFolderNative.GetPath(0);
+ }
+ catch (System.IO.FileNotFoundException)
+ {
+ fileExists = false;
+ }
+ catch (System.IO.DirectoryNotFoundException)
+ {
+ fileExists = false;
+ }
+
+ return kfPath;
+ }
+
+ #endregion
+
+ #region KnownFolder Properties
+
+ /// <summary>
+ /// Gets the path for this known folder.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string Path
+ {
+ get { return knownFolderProperties.path; }
+ }
+
+
+ /// <summary>
+ /// Gets the category designation for this known folder.
+ /// </summary>
+ /// <value>A <see cref="FolderCategory"/> value.</value>
+ public FolderCategory Category
+ {
+ get { return knownFolderProperties.category; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's canonical name.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string CanonicalName
+ {
+ get { return knownFolderProperties.canonicalName; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's description.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string Description
+ {
+ get { return knownFolderProperties.description; }
+ }
+
+ /// <summary>
+ /// Gets the unique identifier for this known folder's parent folder.
+ /// </summary>
+ /// <value>A <see cref="System.Guid"/> value.</value>
+ public Guid ParentId
+ {
+ get { return knownFolderProperties.parentId; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's relative path.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string RelativePath
+ {
+ get { return knownFolderProperties.relativePath; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's tool tip text.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string Tooltip
+ {
+ get { return knownFolderProperties.tooltip; }
+ }
+ /// <summary>
+ /// Gets the resource identifier for this
+ /// known folder's tool tip text.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string TooltipResourceId
+ {
+ get { return knownFolderProperties.tooltipResourceId; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's localized name.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string LocalizedName
+ {
+ get { return knownFolderProperties.localizedName; }
+ }
+ /// <summary>
+ /// Gets the resource identifier for this
+ /// known folder's localized name.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string LocalizedNameResourceId
+ {
+ get { return knownFolderProperties.localizedNameResourceId; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's security attributes.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string Security
+ {
+ get { return knownFolderProperties.security; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's file attributes,
+ /// such as "read-only".
+ /// </summary>
+ /// <value>A <see cref="System.IO.FileAttributes"/> value.</value>
+ public System.IO.FileAttributes FileAttributes
+ {
+ get { return knownFolderProperties.fileAttributes; }
+ }
+
+ /// <summary>
+ /// Gets an value that describes this known folder's behaviors.
+ /// </summary>
+ /// <value>A <see cref="DefinitionOptions"/> value.</value>
+ public DefinitionOptions DefinitionOptions
+ {
+ get { return knownFolderProperties.definitionOptions; }
+ }
+
+ /// <summary>
+ /// Gets the unique identifier for this known folder's type.
+ /// </summary>
+ /// <value>A <see cref="System.Guid"/> value.</value>
+ public Guid FolderTypeId
+ {
+ get { return knownFolderProperties.folderTypeId; }
+ }
+
+ /// <summary>
+ /// Gets a string representation of this known folder's type.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string FolderType
+ {
+ get { return knownFolderProperties.folderType; }
+ }
+ /// <summary>
+ /// Gets the unique identifier for this known folder.
+ /// </summary>
+ /// <value>A <see cref="System.Guid"/> value.</value>
+ public Guid FolderId
+ {
+ get { return knownFolderProperties.folderId; }
+ }
+
+ /// <summary>
+ /// Gets a value that indicates whether this known folder's path exists on the computer.
+ /// </summary>
+ /// <value>A bool<see cref="System.Boolean"/> value.</value>
+ /// <remarks>If this property value is <b>false</b>,
+ /// the folder might be a virtual folder (<see cref="Category"/> property will
+ /// be <see cref="FolderCategory.Virtual"/> for virtual folders)</remarks>
+ public bool PathExists
+ {
+ get { return knownFolderProperties.pathExists; }
+ }
+
+ /// <summary>
+ /// Gets a value that states whether this known folder
+ /// can have its path set to a new value,
+ /// including any restrictions on the redirection.
+ /// </summary>
+ /// <value>A <see cref="RedirectionCapability"/> value.</value>
+ public RedirectionCapability Redirection
+ {
+ get { return knownFolderProperties.redirection; }
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/KnownFolders.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/KnownFolders.cs
new file mode 100644
index 0000000000..286afcd219
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/KnownFolders.cs
@@ -0,0 +1,1331 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Runtime.InteropServices;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Defines properties for known folders that identify the path of standard known folders.
+ /// </summary>
+ public static class KnownFolders
+ {
+ /// <summary>
+ /// Gets a strongly-typed read-only collection of all the registered known folders.
+ /// </summary>
+ public static ICollection<IKnownFolder> All
+ {
+ get
+ {
+ return GetAllFolders();
+ }
+ }
+
+ private static ReadOnlyCollection<IKnownFolder> GetAllFolders()
+ {
+ // Should this method be thread-safe?? (It'll take a while
+ // to get a list of all the known folders, create the managed wrapper
+ // and return the read-only collection.
+
+ IList<IKnownFolder> foldersList = new List<IKnownFolder>();
+ uint count;
+ IntPtr folders = IntPtr.Zero;
+
+ try
+ {
+
+ KnownFolderManagerClass knownFolderManager = new KnownFolderManagerClass();
+ knownFolderManager.GetFolderIds(out folders, out count);
+
+ if (count > 0 && folders != IntPtr.Zero)
+ {
+ // Loop through all the KnownFolderID elements
+ for (int i = 0; i < count; i++)
+ {
+ // Read the current pointer
+ IntPtr current = new IntPtr(folders.ToInt64() + (Marshal.SizeOf(typeof(Guid)) * i));
+
+ // Convert to Guid
+ Guid knownFolderID = (Guid)Marshal.PtrToStructure(current, typeof(Guid));
+
+ IKnownFolder kf = KnownFolderHelper.FromKnownFolderIdInternal(knownFolderID);
+
+ // Add to our collection if it's not null (some folders might not exist on the system
+ // or we could have an exception that resulted in the null return from above method call
+ if (kf != null) { foldersList.Add(kf); }
+ }
+ }
+ }
+ finally
+ {
+ if (folders != IntPtr.Zero) { Marshal.FreeCoTaskMem(folders); }
+ }
+
+ return new ReadOnlyCollection<IKnownFolder>(foldersList);
+ }
+
+ private static IKnownFolder GetKnownFolder(Guid guid)
+ {
+ return KnownFolderHelper.FromKnownFolderId(guid);
+ }
+
+ #region Default Known Folders
+
+ /// <summary>
+ /// Gets the metadata for the <b>Computer</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Computer
+ {
+ get
+ {
+ return GetKnownFolder(
+ FolderIdentifiers.Computer);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>Conflict</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Conflict
+ {
+ get
+ {
+ return GetKnownFolder(
+ FolderIdentifiers.Conflict);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>ControlPanel</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder ControlPanel
+ {
+ get
+ {
+ return GetKnownFolder(
+ FolderIdentifiers.ControlPanel);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>Desktop</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Desktop
+ {
+ get
+ {
+ return GetKnownFolder(
+ FolderIdentifiers.Desktop);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>Internet</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Internet
+ {
+ get
+ {
+ return GetKnownFolder(
+ FolderIdentifiers.Internet);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>Network</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Network
+ {
+ get
+ {
+ return GetKnownFolder(
+ FolderIdentifiers.Network);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>Printers</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Printers
+ {
+ get
+ {
+ return GetKnownFolder(
+ FolderIdentifiers.Printers);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>SyncManager</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder SyncManager
+ {
+ get
+ {
+ return GetKnownFolder(
+ FolderIdentifiers.SyncManager);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>Connections</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Connections
+ {
+ get
+ {
+ return GetKnownFolder(
+ FolderIdentifiers.Connections);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>SyncSetup</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder SyncSetup
+ {
+ get
+ {
+ return GetKnownFolder(
+ FolderIdentifiers.SyncSetup);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>SyncResults</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder SyncResults
+ {
+ get
+ {
+ return GetKnownFolder(
+ FolderIdentifiers.SyncResults);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>RecycleBin</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder RecycleBin
+ {
+ get
+ {
+ return GetKnownFolder(
+ FolderIdentifiers.RecycleBin);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>Fonts</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Fonts
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.Fonts);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>Startup</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Startup
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.Startup);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>Programs</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Programs
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.Programs);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the per-user <b>StartMenu</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder StartMenu
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.StartMenu);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the per-user <b>Recent</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Recent
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.Recent);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the per-user <b>SendTo</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder SendTo
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.SendTo);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the per-user <b>Documents</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Documents
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.Documents);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the per-user <b>Favorites</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Favorites
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.Favorites);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>NetHood</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder NetHood
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.NetHood);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>PrintHood</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder PrintHood
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.PrintHood);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>Templates</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Templates
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.Templates);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>CommonStartup</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder CommonStartup
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.CommonStartup);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>CommonPrograms</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder CommonPrograms
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.CommonPrograms);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>CommonStartMenu</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder CommonStartMenu
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.CommonStartMenu);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>PublicDesktop</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder PublicDesktop
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.PublicDesktop);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>ProgramData</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder ProgramData
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.ProgramData);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>CommonTemplates</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder CommonTemplates
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.CommonTemplates);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>PublicDocuments</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder PublicDocuments
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.PublicDocuments);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>RoamingAppData</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder RoamingAppData
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.RoamingAppData);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the per-user <b>LocalAppData</b>
+ /// folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder LocalAppData
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.LocalAppData);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>LocalAppDataLow</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder LocalAppDataLow
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.LocalAppDataLow);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>InternetCache</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder InternetCache
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.InternetCache);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>Cookies</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Cookies
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.Cookies);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>History</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder History
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.History);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>System</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder System
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.System);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>SystemX86</b>
+ /// folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder SystemX86
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.SystemX86);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>Windows</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Windows
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.Windows);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>Profile</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Profile
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.Profile);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the per-user <b>Pictures</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Pictures
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.Pictures);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>ProgramFilesX86</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder ProgramFilesX86
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.ProgramFilesX86);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>ProgramFilesCommonX86</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder ProgramFilesCommonX86
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.ProgramFilesCommonX86);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>ProgramsFilesX64</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder ProgramFilesX64
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.ProgramFilesX64);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b> ProgramFilesCommonX64</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder ProgramFilesCommonX64
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.ProgramFilesCommonX64);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>ProgramFiles</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder ProgramFiles
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.ProgramFiles);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>ProgramFilesCommon</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder ProgramFilesCommon
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.ProgramFilesCommon);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>AdminTools</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder AdminTools
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.AdminTools);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>CommonAdminTools</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder CommonAdminTools
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.CommonAdminTools);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the per-user <b>Music</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Music
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.Music);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>Videos</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Videos
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.Videos);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>PublicPictures</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder PublicPictures
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.PublicPictures);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>PublicMusic</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder PublicMusic
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.PublicMusic);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>PublicVideos</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder PublicVideos
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.PublicVideos);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>ResourceDir</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder ResourceDir
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.ResourceDir);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>LocalizedResourcesDir</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder LocalizedResourcesDir
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.LocalizedResourcesDir);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>CommonOEMLinks</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder CommonOemLinks
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.CommonOEMLinks);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>CDBurning</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder CDBurning
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.CDBurning);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>UserProfiles</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder UserProfiles
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.UserProfiles);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>Playlists</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Playlists
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.Playlists);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>SamplePlaylists</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder SamplePlaylists
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.SamplePlaylists);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>SampleMusic</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder SampleMusic
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.SampleMusic);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>SamplePictures</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder SamplePictures
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.SamplePictures);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>SampleVideos</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder SampleVideos
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.SampleVideos);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>PhotoAlbums</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder PhotoAlbums
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.PhotoAlbums);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>Public</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Public
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.Public);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>ChangeRemovePrograms</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder ChangeRemovePrograms
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.ChangeRemovePrograms);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>AppUpdates</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder AppUpdates
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.AppUpdates);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>AddNewPrograms</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder AddNewPrograms
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.AddNewPrograms);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the per-user <b>Downloads</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Downloads
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.Downloads);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>PublicDownloads</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder PublicDownloads
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.PublicDownloads);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the per-user <b>SavedSearches</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder SavedSearches
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.SavedSearches);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the per-user <b>QuickLaunch</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder QuickLaunch
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.QuickLaunch);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>Contacts</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Contacts
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.Contacts);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>SidebarParts</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder SidebarParts
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.SidebarParts);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>SidebarDefaultParts</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder SidebarDefaultParts
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.SidebarDefaultParts);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>TreeProperties</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder TreeProperties
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.TreeProperties);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>PublicGameTasks</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder PublicGameTasks
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.PublicGameTasks);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>GameTasks</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder GameTasks
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.GameTasks);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the per-user <b>SavedGames</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder SavedGames
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.SavedGames);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>Games</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Games
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.Games);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>RecordedTV</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ /// <remarks>This folder is not used.</remarks>
+ public static IKnownFolder RecordedTV
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.RecordedTV);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>SearchMapi</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder SearchMapi
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.SearchMapi);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>SearchCsc</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder SearchCsc
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.SearchCsc);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the per-user <b>Links</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder Links
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.Links);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>UsersFiles</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder UsersFiles
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.UsersFiles);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>SearchHome</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder SearchHome
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.SearchHome);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>OriginalImages</b> folder.
+ /// </summary>
+ /// <value>An <see cref="IKnownFolder"/> object.</value>
+ public static IKnownFolder OriginalImages
+ {
+ get
+ {
+ return GetKnownFolder(FolderIdentifiers.OriginalImages);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>UserProgramFiles</b> folder.
+ /// </summary>
+ public static IKnownFolder UserProgramFiles
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotWin7();
+ return GetKnownFolder(FolderIdentifiers.UserProgramFiles);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>UserProgramFilesCommon</b> folder.
+ /// </summary>
+ public static IKnownFolder UserProgramFilesCommon
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotWin7();
+ return GetKnownFolder(FolderIdentifiers.UserProgramFilesCommon);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>Ringtones</b> folder.
+ /// </summary>
+ public static IKnownFolder Ringtones
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotWin7();
+ return GetKnownFolder(FolderIdentifiers.Ringtones);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>PublicRingtones</b> folder.
+ /// </summary>
+ public static IKnownFolder PublicRingtones
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotWin7();
+ return GetKnownFolder(FolderIdentifiers.PublicRingtones);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>UsersLibraries</b> folder.
+ /// </summary>
+ public static IKnownFolder UsersLibraries
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotWin7();
+ return GetKnownFolder(FolderIdentifiers.UsersLibraries);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>DocumentsLibrary</b> folder.
+ /// </summary>
+ public static IKnownFolder DocumentsLibrary
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotWin7();
+ return GetKnownFolder(FolderIdentifiers.DocumentsLibrary);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>MusicLibrary</b> folder.
+ /// </summary>
+ public static IKnownFolder MusicLibrary
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotWin7();
+ return GetKnownFolder(FolderIdentifiers.MusicLibrary);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>PicturesLibrary</b> folder.
+ /// </summary>
+ public static IKnownFolder PicturesLibrary
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotWin7();
+ return GetKnownFolder(FolderIdentifiers.PicturesLibrary);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>VideosLibrary</b> folder.
+ /// </summary>
+ public static IKnownFolder VideosLibrary
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotWin7();
+ return GetKnownFolder(FolderIdentifiers.VideosLibrary);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>RecordedTVLibrary</b> folder.
+ /// </summary>
+ public static IKnownFolder RecordedTVLibrary
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotWin7();
+ return GetKnownFolder(FolderIdentifiers.RecordedTVLibrary);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>OtherUsers</b> folder.
+ /// </summary>
+ public static IKnownFolder OtherUsers
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotWin7();
+ return GetKnownFolder(FolderIdentifiers.OtherUsers);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>DeviceMetadataStore</b> folder.
+ /// </summary>
+ public static IKnownFolder DeviceMetadataStore
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotWin7();
+ return GetKnownFolder(FolderIdentifiers.DeviceMetadataStore);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>Libraries</b> folder.
+ /// </summary>
+ public static IKnownFolder Libraries
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotWin7();
+ return GetKnownFolder(FolderIdentifiers.Libraries);
+ }
+ }
+
+ /// <summary>
+ ///Gets the metadata for the <b>UserPinned</b> folder.
+ /// </summary>
+ public static IKnownFolder UserPinned
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotWin7();
+ return GetKnownFolder(FolderIdentifiers.UserPinned);
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata for the <b>ImplicitAppShortcuts</b> folder.
+ /// </summary>
+ public static IKnownFolder ImplicitAppShortcuts
+ {
+ get
+ {
+ CoreHelpers.ThrowIfNotWin7();
+ return GetKnownFolder(FolderIdentifiers.ImplicitAppShortcuts);
+ }
+ }
+
+ #endregion
+
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/NonFileSystemKnownFolder.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/NonFileSystemKnownFolder.cs
new file mode 100644
index 0000000000..60130f6ba0
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/NonFileSystemKnownFolder.cs
@@ -0,0 +1,282 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Represents a registered non file system Known Folder
+ /// </summary>
+ public class NonFileSystemKnownFolder : ShellNonFileSystemFolder, IKnownFolder, IDisposable
+ {
+ #region Private Fields
+
+ private IKnownFolderNative knownFolderNative;
+ private KnownFolderSettings knownFolderSettings;
+
+ #endregion
+
+ #region Internal Constructors
+
+ internal NonFileSystemKnownFolder(IShellItem2 shellItem) : base(shellItem) { }
+
+ internal NonFileSystemKnownFolder(IKnownFolderNative kf)
+ {
+ Debug.Assert(kf != null);
+ knownFolderNative = kf;
+
+ // Set the native shell item
+ // and set it on the base class (ShellObject)
+ Guid guid = new Guid(ShellIIDGuid.IShellItem2);
+ knownFolderNative.GetShellItem(0, ref guid, out nativeShellItem);
+ }
+
+ #endregion
+
+ #region Private Members
+
+ private KnownFolderSettings KnownFolderSettings
+ {
+ get
+ {
+ if (knownFolderNative == null)
+ {
+ // We need to get the PIDL either from the NativeShellItem,
+ // or from base class's property (if someone already set it on us).
+ // Need to use the PIDL to get the native IKnownFolder interface.
+
+ // Get teh PIDL for the ShellItem
+ if (nativeShellItem != null && base.PIDL == IntPtr.Zero)
+ {
+ base.PIDL = ShellHelper.PidlFromShellItem(nativeShellItem);
+ }
+
+ // If we have a valid PIDL, get the native IKnownFolder
+ if (base.PIDL != IntPtr.Zero)
+ {
+ knownFolderNative = KnownFolderHelper.FromPIDL(base.PIDL);
+ }
+
+ Debug.Assert(knownFolderNative != null);
+ }
+
+ // If this is the first time this property is being called,
+ // get the native Folder Defination (KnownFolder properties)
+ if (knownFolderSettings == null)
+ {
+ knownFolderSettings = new KnownFolderSettings(knownFolderNative);
+ }
+
+ return knownFolderSettings;
+ }
+ }
+
+ #endregion
+
+ #region IKnownFolder Members
+
+ /// <summary>
+ /// Gets the path for this known folder.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string Path
+ {
+ get { return KnownFolderSettings.Path; }
+ }
+
+ /// <summary>
+ /// Gets the category designation for this known folder.
+ /// </summary>
+ /// <value>A <see cref="FolderCategory"/> value.</value>
+ public FolderCategory Category
+ {
+ get { return KnownFolderSettings.Category; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's canonical name.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string CanonicalName
+ {
+ get { return KnownFolderSettings.CanonicalName; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's description.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string Description
+ {
+ get { return KnownFolderSettings.Description; }
+ }
+
+ /// <summary>
+ /// Gets the unique identifier for this known folder's parent folder.
+ /// </summary>
+ /// <value>A <see cref="System.Guid"/> value.</value>
+ public Guid ParentId
+ {
+ get { return KnownFolderSettings.ParentId; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's relative path.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string RelativePath
+ {
+ get { return KnownFolderSettings.RelativePath; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's parsing name.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public override string ParsingName
+ {
+ get { return base.ParsingName; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's tool tip text.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string Tooltip
+ {
+ get { return KnownFolderSettings.Tooltip; }
+ }
+ /// <summary>
+ /// Gets the resource identifier for this
+ /// known folder's tool tip text.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string TooltipResourceId
+ {
+ get { return KnownFolderSettings.TooltipResourceId; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's localized name.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string LocalizedName
+ {
+ get { return KnownFolderSettings.LocalizedName; }
+ }
+ /// <summary>
+ /// Gets the resource identifier for this
+ /// known folder's localized name.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string LocalizedNameResourceId
+ {
+ get { return KnownFolderSettings.LocalizedNameResourceId; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's security attributes.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string Security
+ {
+ get { return KnownFolderSettings.Security; }
+ }
+
+ /// <summary>
+ /// Gets this known folder's file attributes,
+ /// such as "read-only".
+ /// </summary>
+ /// <value>A <see cref="System.IO.FileAttributes"/> value.</value>
+ public System.IO.FileAttributes FileAttributes
+ {
+ get { return KnownFolderSettings.FileAttributes; }
+ }
+
+ /// <summary>
+ /// Gets an value that describes this known folder's behaviors.
+ /// </summary>
+ /// <value>A <see cref="DefinitionOptions"/> value.</value>
+ public DefinitionOptions DefinitionOptions
+ {
+ get { return KnownFolderSettings.DefinitionOptions; }
+ }
+
+ /// <summary>
+ /// Gets the unique identifier for this known folder's type.
+ /// </summary>
+ /// <value>A <see cref="System.Guid"/> value.</value>
+ public Guid FolderTypeId
+ {
+ get { return KnownFolderSettings.FolderTypeId; }
+ }
+
+ /// <summary>
+ /// Gets a string representation of this known folder's type.
+ /// </summary>
+ /// <value>A <see cref="System.String"/> object.</value>
+ public string FolderType
+ {
+ get { return KnownFolderSettings.FolderType; }
+ }
+ /// <summary>
+ /// Gets the unique identifier for this known folder.
+ /// </summary>
+ /// <value>A <see cref="System.Guid"/> value.</value>
+ public Guid FolderId
+ {
+ get { return KnownFolderSettings.FolderId; }
+ }
+
+ /// <summary>
+ /// Gets a value that indicates whether this known folder's path exists on the computer.
+ /// </summary>
+ /// <value>A bool<see cref="System.Boolean"/> value.</value>
+ /// <remarks>If this property value is <b>false</b>,
+ /// the folder might be a virtual folder (<see cref="Category"/> property will
+ /// be <see cref="FolderCategory.Virtual"/> for virtual folders)</remarks>
+ public bool PathExists
+ {
+ get { return KnownFolderSettings.PathExists; }
+ }
+
+ /// <summary>
+ /// Gets a value that states whether this known folder
+ /// can have its path set to a new value,
+ /// including any restrictions on the redirection.
+ /// </summary>
+ /// <value>A <see cref="RedirectionCapability"/> value.</value>
+ public RedirectionCapability Redirection
+ {
+ get { return KnownFolderSettings.Redirection; }
+ }
+
+ #endregion
+
+ #region IDisposable Members
+
+ /// <summary>
+ /// Release resources
+ /// </summary>
+ /// <param name="disposing">Indicates that this mothod is being called from Dispose() rather than the finalizer.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ knownFolderSettings = null;
+ }
+
+ if (knownFolderNative != null)
+ {
+ Marshal.ReleaseComObject(knownFolderNative);
+ knownFolderNative = null;
+ }
+
+ base.Dispose(disposing);
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/RedirectionCapabilities.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/RedirectionCapabilities.cs
new file mode 100644
index 0000000000..352b128188
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/RedirectionCapabilities.cs
@@ -0,0 +1,45 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Specifies the redirection capabilities for known folders.
+ /// </summary>
+ public enum RedirectionCapability
+ {
+ /// <summary>
+ /// Redirection capability is unknown.
+ /// </summary>
+ None = 0x00,
+ /// <summary>
+ /// The known folder can be redirected.
+ /// </summary>
+ AllowAll = 0xff,
+ /// <summary>
+ /// The known folder can be redirected.
+ /// Currently, redirection exists only for
+ /// common and user folders; fixed and virtual folders
+ /// cannot be redirected.
+ /// </summary>
+ Redirectable = 0x1,
+ /// <summary>
+ /// Redirection is not allowed.
+ /// </summary>
+ DenyAll = 0xfff00,
+ /// <summary>
+ /// The folder cannot be redirected because it is
+ /// already redirected by group policy.
+ /// </summary>
+ DenyPolicyRedirected = 0x100,
+ /// <summary>
+ /// The folder cannot be redirected because the policy
+ /// prohibits redirecting this folder.
+ /// </summary>
+ DenyPolicy = 0x200,
+ /// <summary>
+ /// The folder cannot be redirected because the calling
+ /// application does not have sufficient permissions.
+ /// </summary>
+ DenyPermissions = 0x400
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/RetrievalOptions.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/RetrievalOptions.cs
new file mode 100644
index 0000000000..4842a0d8cd
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/KnownFolders/RetrievalOptions.cs
@@ -0,0 +1,21 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Contains special retrieval options for known folders.
+ /// </summary>
+ internal enum RetrievalOptions
+ {
+ None = 0,
+ Create = 0x00008000,
+ DontVerify = 0x00004000,
+ DontUnexpand = 0x00002000,
+ NoAlias = 0x00001000,
+ Init = 0x00000800,
+ DefaultPath = 0x00000400,
+ NotParentRelative = 0x00000200
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Makefile.am b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Makefile.am
new file mode 100644
index 0000000000..24e07e9bf5
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Makefile.am
@@ -0,0 +1,5 @@
+include $(top_srcdir)/xbuild.include
+
+if ! ENABLE_WINDOWSPLATFORM
+SKIP=y
+endif
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Properties/AssemblyInfo.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..8e20e57dc8
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Properties/AssemblyInfo.cs
@@ -0,0 +1,44 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Security;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Microsoft.WindowsAPICodePack.Shell")]
+[assembly: AssemblyDescription("WindowsAPICodePack for Shell")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("Microsoft Windows API Code Pack for .NET Framework")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: InternalsVisibleTo("Microsoft.WindowsAPICodePack.ShellExtensions")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("48fe0672-7ff4-48fd-a3fd-83c8fa8c3506")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.1.0.0")]
+[assembly: AssemblyFileVersion("1.1.0.0")]
+
+[assembly: NeutralResourcesLanguageAttribute("en")]
+
+[assembly: InternalsVisibleTo("WindowsPlatform")]
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/IShellProperty.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/IShellProperty.cs
new file mode 100644
index 0000000000..fb185953e1
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/IShellProperty.cs
@@ -0,0 +1,59 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using Microsoft.WindowsAPICodePack.Shell;
+
+namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem
+{
+ /// <summary>
+ /// Defines the properties used by a Shell Property.
+ /// </summary>
+ public interface IShellProperty
+ {
+ /// <summary>
+ /// Gets the property key that identifies this property.
+ /// </summary>
+ PropertyKey PropertyKey { get; }
+
+ /// <summary>
+ /// Gets a formatted, Unicode string representation of a property value.
+ /// </summary>
+ /// <param name="format">One or more <c>PropertyDescriptionFormat</c> flags
+ /// chosen to produce the desired display format.</param>
+ /// <returns>The formatted value as a string.</returns>
+ string FormatForDisplay(PropertyDescriptionFormatOptions format);
+
+ /// <summary>
+ /// Get the property description object.
+ /// </summary>
+ ShellPropertyDescription Description { get; }
+
+ /// <summary>
+ /// Gets the case-sensitive name of the property as it is known to the system,
+ /// regardless of its localized name.
+ /// </summary>
+ string CanonicalName { get; }
+
+ /// <summary>
+ /// Gets the value for this property using the generic Object type.
+ /// </summary>
+ /// <remarks>
+ /// To obtain a specific type for this value, use the more strongly-typed
+ /// <c>Property&lt;T&gt;</c> class.
+ /// You can only set a value for this type using the <c>Property&lt;T&gt;</c>
+ /// class.
+ /// </remarks>
+ object ValueAsObject { get; }
+
+ /// <summary>
+ /// Gets the <c>System.Type</c> value for this property.
+ /// </summary>
+ Type ValueType { get; }
+
+ /// <summary>
+ /// Gets the image reference path and icon index associated with a property value.
+ /// This API is only available in Windows 7.
+ /// </summary>
+ IconReference IconReference { get; }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/PropertySystemException.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/PropertySystemException.cs
new file mode 100644
index 0000000000..ee079810ec
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/PropertySystemException.cs
@@ -0,0 +1,54 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem
+{
+
+ /// <summary>
+ /// An exception thrown when an error occurs while dealing with the Property System API.
+ /// </summary>
+ [Serializable]
+ public class PropertySystemException : ExternalException
+ {
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ public PropertySystemException() { }
+
+ /// <summary>
+ /// Initializes an excpetion with a custom message.
+ /// </summary>
+ /// <param name="message"></param>
+ public PropertySystemException(string message) : base(message) { }
+
+ /// <summary>
+ /// Initializes an exception with custom message and inner exception.
+ /// </summary>
+ /// <param name="message"></param>
+ /// <param name="innerException"></param>
+ public PropertySystemException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ /// <summary>
+ /// Initializes an exception with custom message and error code.
+ /// </summary>
+ /// <param name="message"></param>
+ /// <param name="errorCode"></param>
+ public PropertySystemException(string message, int errorCode) : base(message, errorCode) { }
+
+ /// <summary>
+ /// Initializes an exception from serialization info and a context.
+ /// </summary>
+ /// <param name="info"></param>
+ /// <param name="context"></param>
+ protected PropertySystemException(
+ System.Runtime.Serialization.SerializationInfo info,
+ System.Runtime.Serialization.StreamingContext context)
+ : base(info, context)
+ {
+ }
+
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellProperties.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellProperties.cs
new file mode 100644
index 0000000000..fdf9ae9bcd
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellProperties.cs
@@ -0,0 +1,168 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using System.Runtime.InteropServices.ComTypes;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem
+{
+ /// <summary>
+ /// Defines a partial class that implements helper methods for retrieving Shell properties
+ /// using a canonical name, property key, or a strongly-typed property. Also provides
+ /// access to all the strongly-typed system properties and default properties collections.
+ /// </summary>
+ public partial class ShellProperties : IDisposable
+ {
+ private ShellObject ParentShellObject { get; set; }
+ private ShellPropertyCollection defaultPropertyCollection;
+
+ internal ShellProperties(ShellObject parent)
+ {
+ ParentShellObject = parent;
+ }
+
+ /// <summary>
+ /// Returns a property available in the default property collection using
+ /// the given property key.
+ /// </summary>
+ /// <param name="key">The property key.</param>
+ /// <returns>An IShellProperty.</returns>
+ public IShellProperty GetProperty(PropertyKey key)
+ {
+ return CreateTypedProperty(key);
+ }
+
+ /// <summary>
+ /// Returns a property available in the default property collection using
+ /// the given canonical name.
+ /// </summary>
+ /// <param name="canonicalName">The canonical name.</param>
+ /// <returns>An IShellProperty.</returns>
+ public IShellProperty GetProperty(string canonicalName)
+ {
+ return CreateTypedProperty(canonicalName);
+ }
+
+ /// <summary>
+ /// Returns a strongly typed property available in the default property collection using
+ /// the given property key.
+ /// </summary>
+ /// <typeparam name="T">The type of property to retrieve.</typeparam>
+ /// <param name="key">The property key.</param>
+ /// <returns>A strongly-typed ShellProperty for the given property key.</returns>
+ public ShellProperty<T> GetProperty<T>(PropertyKey key)
+ {
+ return CreateTypedProperty(key) as ShellProperty<T>;
+ }
+
+ /// <summary>
+ /// Returns a strongly typed property available in the default property collection using
+ /// the given canonical name.
+ /// </summary>
+ /// <typeparam name="T">The type of property to retrieve.</typeparam>
+ /// <param name="canonicalName">The canonical name.</param>
+ /// <returns>A strongly-typed ShellProperty for the given canonical name.</returns>
+ public ShellProperty<T> GetProperty<T>(string canonicalName)
+ {
+ return CreateTypedProperty(canonicalName) as ShellProperty<T>;
+ }
+
+ private PropertySystem propertySystem;
+ /// <summary>
+ /// Gets all the properties for the system through an accessor.
+ /// </summary>
+ public PropertySystem System
+ {
+ get
+ {
+ if (propertySystem == null)
+ {
+ propertySystem = new PropertySystem(ParentShellObject);
+ }
+
+ return propertySystem;
+ }
+ }
+
+ /// <summary>
+ /// Gets the collection of all the default properties for this item.
+ /// </summary>
+ public ShellPropertyCollection DefaultPropertyCollection
+ {
+ get
+ {
+ if (defaultPropertyCollection == null)
+ {
+ defaultPropertyCollection = new ShellPropertyCollection(ParentShellObject);
+ }
+
+ return defaultPropertyCollection;
+ }
+ }
+
+ /// <summary>
+ /// Returns the shell property writer used when writing multiple properties.
+ /// </summary>
+ /// <returns>A ShellPropertyWriter.</returns>
+ /// <remarks>Use the Using pattern with the returned ShellPropertyWriter or
+ /// manually call the Close method on the writer to commit the changes
+ /// and dispose the writer</remarks>
+ public ShellPropertyWriter GetPropertyWriter()
+ {
+ return new ShellPropertyWriter(ParentShellObject);
+ }
+
+ internal IShellProperty CreateTypedProperty<T>(PropertyKey propKey)
+ {
+ ShellPropertyDescription desc = ShellPropertyDescriptionsCache.Cache.GetPropertyDescription(propKey);
+ return new ShellProperty<T>(propKey, desc, ParentShellObject);
+ }
+
+ internal IShellProperty CreateTypedProperty(PropertyKey propKey)
+ {
+ return ShellPropertyFactory.CreateShellProperty(propKey, ParentShellObject);
+ }
+
+ internal IShellProperty CreateTypedProperty(string canonicalName)
+ {
+ // Otherwise, call the native PropertyStore method
+ PropertyKey propKey;
+
+ int result = PropertySystemNativeMethods.PSGetPropertyKeyFromName(canonicalName, out propKey);
+
+ if (!CoreErrorHelper.Succeeded(result))
+ {
+ throw new ArgumentException(
+ LocalizedMessages.ShellInvalidCanonicalName,
+ Marshal.GetExceptionForHR(result));
+ }
+ return CreateTypedProperty(propKey);
+ }
+
+ #region IDisposable Members
+
+ /// <summary>
+ /// Cleans up memory
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Cleans up memory
+ /// </summary>
+ protected virtual void Dispose(bool disposed)
+ {
+ if (disposed && defaultPropertyCollection != null)
+ {
+ defaultPropertyCollection.Dispose();
+ }
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellProperty.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellProperty.cs
new file mode 100644
index 0000000000..ef4167876c
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellProperty.cs
@@ -0,0 +1,447 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Diagnostics;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem
+{
+ /// <summary>
+ /// Defines a strongly-typed property object.
+ /// All writable property objects must be of this type
+ /// to be able to call the value setter.
+ /// </summary>
+ /// <typeparam name="T">The type of this property's value.
+ /// Because a property value can be empty, only nullable types
+ /// are allowed.</typeparam>
+ public class ShellProperty<T> : IShellProperty
+ {
+ #region Private Fields
+
+ private PropertyKey propertyKey;
+ string imageReferencePath = null;
+ int? imageReferenceIconIndex;
+ private ShellPropertyDescription description = null;
+
+ #endregion
+
+ #region Private Methods
+
+ private ShellObject ParentShellObject { get; set; }
+
+ private IPropertyStore NativePropertyStore { get; set; }
+
+ private void GetImageReference()
+ {
+ IPropertyStore store = ShellPropertyCollection.CreateDefaultPropertyStore(ParentShellObject);
+
+ using (PropVariant propVar = new PropVariant())
+ {
+ store.GetValue(ref propertyKey, propVar);
+
+ Marshal.ReleaseComObject(store);
+ store = null;
+
+ string refPath;
+ ((IPropertyDescription2)Description.NativePropertyDescription).GetImageReferenceForValue(
+ propVar, out refPath);
+
+ if (refPath == null) { return; }
+
+ int index = ShellNativeMethods.PathParseIconLocation(ref refPath);
+ if (refPath != null)
+ {
+ imageReferencePath = refPath;
+ imageReferenceIconIndex = index;
+ }
+ }
+ }
+
+ private void StorePropVariantValue(PropVariant propVar)
+ {
+ Guid guid = new Guid(ShellIIDGuid.IPropertyStore);
+ IPropertyStore writablePropStore = null;
+ try
+ {
+ int hr = ParentShellObject.NativeShellItem2.GetPropertyStore(
+ ShellNativeMethods.GetPropertyStoreOptions.ReadWrite,
+ ref guid,
+ out writablePropStore);
+
+ if (!CoreErrorHelper.Succeeded(hr))
+ {
+ throw new PropertySystemException(LocalizedMessages.ShellPropertyUnableToGetWritableProperty,
+ Marshal.GetExceptionForHR(hr));
+ }
+
+ HResult result = writablePropStore.SetValue(ref propertyKey, propVar);
+
+ if (!AllowSetTruncatedValue && (int)result == ShellNativeMethods.InPlaceStringTruncated)
+ {
+ throw new ArgumentOutOfRangeException("propVar", LocalizedMessages.ShellPropertyValueTruncated);
+ }
+
+ if (!CoreErrorHelper.Succeeded(result))
+ {
+ throw new PropertySystemException(LocalizedMessages.ShellPropertySetValue, Marshal.GetExceptionForHR((int)result));
+ }
+
+ writablePropStore.Commit();
+
+ }
+ catch (InvalidComObjectException e)
+ {
+ throw new PropertySystemException(LocalizedMessages.ShellPropertyUnableToGetWritableProperty, e);
+ }
+ catch (InvalidCastException)
+ {
+ throw new PropertySystemException(LocalizedMessages.ShellPropertyUnableToGetWritableProperty);
+ }
+ finally
+ {
+ if (writablePropStore != null)
+ {
+ Marshal.ReleaseComObject(writablePropStore);
+ writablePropStore = null;
+ }
+ }
+ }
+
+ #endregion
+
+ #region Internal Constructor
+
+ /// <summary>
+ /// Constructs a new Property object
+ /// </summary>
+ /// <param name="propertyKey"></param>
+ /// <param name="description"></param>
+ /// <param name="parent"></param>
+ internal ShellProperty(
+ PropertyKey propertyKey,
+ ShellPropertyDescription description,
+ ShellObject parent)
+ {
+ this.propertyKey = propertyKey;
+ this.description = description;
+ ParentShellObject = parent;
+ AllowSetTruncatedValue = false;
+ }
+
+ /// <summary>
+ /// Constructs a new Property object
+ /// </summary>
+ /// <param name="propertyKey"></param>
+ /// <param name="description"></param>
+ /// <param name="propertyStore"></param>
+ internal ShellProperty(
+ PropertyKey propertyKey,
+ ShellPropertyDescription description,
+ IPropertyStore propertyStore)
+ {
+ this.propertyKey = propertyKey;
+ this.description = description;
+ NativePropertyStore = propertyStore;
+ AllowSetTruncatedValue = false;
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ /// <summary>
+ /// Gets or sets the strongly-typed value of this property.
+ /// The value of the property is cleared if the value is set to null.
+ /// </summary>
+ /// <exception cref="System.Runtime.InteropServices.COMException">
+ /// If the property value cannot be retrieved or updated in the Property System</exception>
+ /// <exception cref="NotSupportedException">If the type of this property is not supported; e.g. writing a binary object.</exception>
+ /// <exception cref="ArgumentOutOfRangeException">Thrown if <see cref="AllowSetTruncatedValue"/> is false, and either
+ /// a string value was truncated or a numeric value was rounded.</exception>
+ public T Value
+ {
+ get
+ {
+ // Make sure we load the correct type
+ Debug.Assert(ValueType == ShellPropertyFactory.VarEnumToSystemType(Description.VarEnumType));
+
+ using (PropVariant propVar = new PropVariant())
+ {
+ if (ParentShellObject.NativePropertyStore != null)
+ {
+ // If there is a valid property store for this shell object, then use it.
+ ParentShellObject.NativePropertyStore.GetValue(ref propertyKey, propVar);
+ }
+ else if (ParentShellObject != null)
+ {
+ // Use IShellItem2.GetProperty instead of creating a new property store
+ // The file might be locked. This is probably quicker, and sufficient for what we need
+ ParentShellObject.NativeShellItem2.GetProperty(ref propertyKey, propVar);
+ }
+ else if (NativePropertyStore != null)
+ {
+ NativePropertyStore.GetValue(ref propertyKey, propVar);
+ }
+
+ //Get the value
+ return propVar.Value != null ? (T)propVar.Value : default(T);
+ }
+ }
+ set
+ {
+ // Make sure we use the correct type
+ Debug.Assert(ValueType == ShellPropertyFactory.VarEnumToSystemType(Description.VarEnumType));
+
+ if (typeof(T) != ValueType)
+ {
+ throw new NotSupportedException(
+ string.Format(System.Globalization.CultureInfo.InvariantCulture,
+ LocalizedMessages.ShellPropertyWrongType, ValueType.Name));
+ }
+
+ if (value is Nullable)
+ {
+ Type t = typeof(T);
+ PropertyInfo pi = t.GetProperty("HasValue");
+ if (pi != null)
+ {
+ bool hasValue = (bool)pi.GetValue(value, null);
+ if (!hasValue)
+ {
+ ClearValue();
+ return;
+ }
+ }
+ }
+ else if (value == null)
+ {
+ ClearValue();
+ return;
+ }
+
+ if (ParentShellObject != null)
+ {
+ using (ShellPropertyWriter propertyWriter = ParentShellObject.Properties.GetPropertyWriter())
+ {
+ propertyWriter.WriteProperty<T>(this, value, AllowSetTruncatedValue);
+ }
+ }
+ else if (NativePropertyStore != null)
+ {
+ throw new InvalidOperationException(LocalizedMessages.ShellPropertyCannotSetProperty);
+ }
+ }
+ }
+
+
+ #endregion
+
+ #region IProperty Members
+
+ /// <summary>
+ /// Gets the property key identifying this property.
+ /// </summary>
+ public PropertyKey PropertyKey
+ {
+ get
+ {
+ return propertyKey;
+ }
+ }
+ /// <summary>
+ /// Returns a formatted, Unicode string representation of a property value.
+ /// </summary>
+ /// <param name="format">One or more of the PropertyDescriptionFormat flags
+ /// that indicate the desired format.</param>
+ /// <param name="formattedString">The formatted value as a string, or null if this property
+ /// cannot be formatted for display.</param>
+ /// <returns>True if the method successfully locates the formatted string; otherwise
+ /// False.</returns>
+ public bool TryFormatForDisplay(PropertyDescriptionFormatOptions format, out string formattedString)
+ {
+
+
+ if (Description == null || Description.NativePropertyDescription == null)
+ {
+ // We cannot do anything without a property description
+ formattedString = null;
+ return false;
+ }
+
+ IPropertyStore store = ShellPropertyCollection.CreateDefaultPropertyStore(ParentShellObject);
+
+ using (PropVariant propVar = new PropVariant())
+ {
+ store.GetValue(ref propertyKey, propVar);
+
+ // Release the Propertystore
+ Marshal.ReleaseComObject(store);
+ store = null;
+
+ HResult hr = Description.NativePropertyDescription.FormatForDisplay(propVar, ref format, out formattedString);
+
+ // Sometimes, the value cannot be displayed properly, such as for blobs
+ // or if we get argument exception
+ if (!CoreErrorHelper.Succeeded(hr))
+ {
+ formattedString = null;
+ return false;
+ }
+ return true;
+ }
+ }
+
+ /// <summary>
+ /// Returns a formatted, Unicode string representation of a property value.
+ /// </summary>
+ /// <param name="format">One or more of the PropertyDescriptionFormat flags
+ /// that indicate the desired format.</param>
+ /// <returns>The formatted value as a string, or null if this property
+ /// cannot be formatted for display.</returns>
+ public string FormatForDisplay(PropertyDescriptionFormatOptions format)
+ {
+ string formattedString;
+
+ if (Description == null || Description.NativePropertyDescription == null)
+ {
+ // We cannot do anything without a property description
+ return null;
+ }
+
+ IPropertyStore store = ShellPropertyCollection.CreateDefaultPropertyStore(ParentShellObject);
+
+ using (PropVariant propVar = new PropVariant())
+ {
+ store.GetValue(ref propertyKey, propVar);
+
+ // Release the Propertystore
+ Marshal.ReleaseComObject(store);
+ store = null;
+
+ HResult hr = Description.NativePropertyDescription.FormatForDisplay(propVar, ref format, out formattedString);
+
+ // Sometimes, the value cannot be displayed properly, such as for blobs
+ // or if we get argument exception
+ if (!CoreErrorHelper.Succeeded(hr))
+ throw new ShellException(hr);
+
+ return formattedString;
+ }
+ }
+
+ /// <summary>
+ /// Get the property description object.
+ /// </summary>
+ public ShellPropertyDescription Description
+ {
+ get
+ {
+ return description;
+ }
+ }
+
+ /// <summary>
+ /// Gets the case-sensitive name of a property as it is known to the system,
+ /// regardless of its localized name.
+ /// </summary>
+ public string CanonicalName
+ {
+ get
+ {
+ return Description.CanonicalName;
+ }
+ }
+
+ /// <summary>
+ /// Clears the value of the property.
+ /// </summary>
+ public void ClearValue()
+ {
+ using (PropVariant propVar = new PropVariant())
+ {
+ StorePropVariantValue(propVar);
+ }
+ }
+
+ /// <summary>
+ /// Gets the value for this property using the generic Object type.
+ /// To obtain a specific type for this value, use the more type strong
+ /// Property&lt;T&gt; class.
+ /// Also, you can only set a value for this type using Property&lt;T&gt;
+ /// </summary>
+ public object ValueAsObject
+ {
+ get
+ {
+ using (PropVariant propVar = new PropVariant())
+ {
+ if (ParentShellObject != null)
+ {
+
+ IPropertyStore store = ShellPropertyCollection.CreateDefaultPropertyStore(ParentShellObject);
+
+ store.GetValue(ref propertyKey, propVar);
+
+ Marshal.ReleaseComObject(store);
+ store = null;
+ }
+ else if (NativePropertyStore != null)
+ {
+ NativePropertyStore.GetValue(ref propertyKey, propVar);
+ }
+
+ return propVar != null ? propVar.Value : null;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets the associated runtime type.
+ /// </summary>
+ public Type ValueType
+ {
+ get
+ {
+ // The type for this object need to match that of the description
+ Debug.Assert(Description.ValueType == typeof(T));
+
+ return Description.ValueType;
+ }
+ }
+
+ /// <summary>
+ /// Gets the image reference path and icon index associated with a property value (Windows 7 only).
+ /// </summary>
+ public IconReference IconReference
+ {
+ get
+ {
+ if (!CoreHelpers.RunningOnWin7)
+ {
+ throw new PlatformNotSupportedException(LocalizedMessages.ShellPropertyWindows7);
+ }
+
+ GetImageReference();
+ int index = (imageReferenceIconIndex.HasValue ? imageReferenceIconIndex.Value : -1);
+
+ return new IconReference(imageReferencePath, index);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value that determines if a value can be truncated. The default for this property is false.
+ /// </summary>
+ /// <remarks>
+ /// An <see cref="ArgumentOutOfRangeException"/> will be thrown if
+ /// this property is not set to true, and a property value was set
+ /// but later truncated.
+ ///
+ /// </remarks>
+ public bool AllowSetTruncatedValue { get; set; }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyCollection.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyCollection.cs
new file mode 100644
index 0000000000..af3ba9c872
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyCollection.cs
@@ -0,0 +1,246 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Runtime.InteropServices.ComTypes;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem
+{
+ /// <summary>
+ /// Creates a readonly collection of IProperty objects.
+ /// </summary>
+ public class ShellPropertyCollection : ReadOnlyCollection<IShellProperty>, IDisposable
+ {
+ #region Internal Constructor
+
+ /// <summary>
+ /// Creates a new Property collection given an IPropertyStore object
+ /// </summary>
+ /// <param name="nativePropertyStore">IPropertyStore</param>
+ internal ShellPropertyCollection(IPropertyStore nativePropertyStore)
+ : base(new List<IShellProperty>())
+ {
+ NativePropertyStore = nativePropertyStore;
+ AddProperties(nativePropertyStore);
+ }
+
+ #endregion
+
+ #region Public Constructor
+
+ /// <summary>
+ /// Creates a new Property collection given an IShellItem2 native interface
+ /// </summary>
+ /// <param name="parent">Parent ShellObject</param>
+ public ShellPropertyCollection(ShellObject parent)
+ : base(new List<IShellProperty>())
+ {
+ ParentShellObject = parent;
+ IPropertyStore nativePropertyStore = null;
+ try
+ {
+ nativePropertyStore = CreateDefaultPropertyStore(ParentShellObject);
+ AddProperties(nativePropertyStore);
+ }
+ catch
+ {
+ if (parent != null)
+ {
+ parent.Dispose();
+ }
+ throw;
+ }
+ finally
+ {
+ if (nativePropertyStore != null)
+ {
+ Marshal.ReleaseComObject(nativePropertyStore);
+ nativePropertyStore = null;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Creates a new <c>ShellPropertyCollection</c> object with the specified file or folder path.
+ /// </summary>
+ /// <param name="path">The path to the file or folder.</param>
+ public ShellPropertyCollection(string path) : this(ShellObjectFactory.Create(path)) { }
+
+ #endregion
+
+ #region Private Methods
+
+ private ShellObject ParentShellObject { get; set; }
+
+ private IPropertyStore NativePropertyStore { get; set; }
+
+ private void AddProperties(IPropertyStore nativePropertyStore)
+ {
+ uint propertyCount;
+ PropertyKey propKey;
+
+ // Populate the property collection
+ nativePropertyStore.GetCount(out propertyCount);
+ for (uint i = 0; i < propertyCount; i++)
+ {
+ nativePropertyStore.GetAt(i, out propKey);
+
+ if (ParentShellObject != null)
+ {
+ Items.Add(ParentShellObject.Properties.CreateTypedProperty(propKey));
+ }
+ else
+ {
+ Items.Add(CreateTypedProperty(propKey, NativePropertyStore));
+ }
+ }
+ }
+
+ internal static IPropertyStore CreateDefaultPropertyStore(ShellObject shellObj)
+ {
+ IPropertyStore nativePropertyStore = null;
+
+ Guid guid = new Guid(ShellIIDGuid.IPropertyStore);
+ int hr = shellObj.NativeShellItem2.GetPropertyStore(
+ ShellNativeMethods.GetPropertyStoreOptions.BestEffort,
+ ref guid,
+ out nativePropertyStore);
+
+ // throw on failure
+ if (nativePropertyStore == null || !CoreErrorHelper.Succeeded(hr))
+ {
+ throw new ShellException(hr);
+ }
+
+ return nativePropertyStore;
+ }
+
+
+
+
+ #endregion
+
+ #region Collection Public Methods
+
+ /// <summary>
+ /// Checks if a property with the given canonical name is available.
+ /// </summary>
+ /// <param name="canonicalName">The canonical name of the property.</param>
+ /// <returns><B>True</B> if available, <B>false</B> otherwise.</returns>
+ public bool Contains(string canonicalName)
+ {
+ if (string.IsNullOrEmpty(canonicalName))
+ {
+ throw new ArgumentException(LocalizedMessages.PropertyCollectionNullCanonicalName, "canonicalName");
+ }
+
+ return Items.Any(p => p.CanonicalName == canonicalName);
+
+ }
+
+ /// <summary>
+ /// Checks if a property with the given property key is available.
+ /// </summary>
+ /// <param name="key">The property key.</param>
+ /// <returns><B>True</B> if available, <B>false</B> otherwise.</returns>
+ public bool Contains(PropertyKey key)
+ {
+ return Items.Any(p => p.PropertyKey == key);
+ }
+
+ /// <summary>
+ /// Gets the property associated with the supplied canonical name string.
+ /// The canonical name property is case-sensitive.
+ ///
+ /// </summary>
+ /// <param name="canonicalName">The canonical name.</param>
+ /// <returns>The property associated with the canonical name, if found.</returns>
+ /// <exception cref="IndexOutOfRangeException">Throws IndexOutOfRangeException
+ /// if no matching property is found.</exception>
+ public IShellProperty this[string canonicalName]
+ {
+ get
+ {
+ if (string.IsNullOrEmpty(canonicalName))
+ {
+ throw new ArgumentException(LocalizedMessages.PropertyCollectionNullCanonicalName, "canonicalName");
+ }
+
+ IShellProperty prop = Items.FirstOrDefault(p => p.CanonicalName == canonicalName);
+ if (prop == null)
+ {
+ throw new IndexOutOfRangeException(LocalizedMessages.PropertyCollectionCanonicalInvalidIndex);
+ }
+ return prop;
+ }
+ }
+
+ /// <summary>
+ /// Gets a property associated with the supplied property key.
+ ///
+ /// </summary>
+ /// <param name="key">The property key.</param>
+ /// <returns>The property associated with the property key, if found.</returns>
+ /// <exception cref="IndexOutOfRangeException">Throws IndexOutOfRangeException
+ /// if no matching property is found.</exception>
+ public IShellProperty this[PropertyKey key]
+ {
+ get
+ {
+ IShellProperty prop = Items.FirstOrDefault(p => p.PropertyKey == key);
+ if (prop != null) return prop;
+
+ throw new IndexOutOfRangeException(LocalizedMessages.PropertyCollectionInvalidIndex);
+ }
+ }
+
+ #endregion
+
+ // TODO - ShellProperties.cs also has a similar class that is used for creating
+ // a ShellObject specific IShellProperty. These 2 methods should be combined or moved to a
+ // common location.
+ internal static IShellProperty CreateTypedProperty(PropertyKey propKey, IPropertyStore NativePropertyStore)
+ {
+ return ShellPropertyFactory.CreateShellProperty(propKey, NativePropertyStore);
+ }
+
+ #region IDisposable Members
+
+ /// <summary>
+ /// Release the native and managed objects
+ /// </summary>
+ /// <param name="disposing">Indicates that this is being called from Dispose(), rather than the finalizer.</param>
+ protected virtual void Dispose(bool disposing)
+ {
+ if (NativePropertyStore != null)
+ {
+ Marshal.ReleaseComObject(NativePropertyStore);
+ NativePropertyStore = null;
+ }
+ }
+
+ /// <summary>
+ /// Release the native objects.
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Implement the finalizer.
+ /// </summary>
+ ~ShellPropertyCollection()
+ {
+ Dispose(false);
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyDescription.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyDescription.cs
new file mode 100644
index 0000000000..cce67e8014
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyDescription.cs
@@ -0,0 +1,565 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Runtime.InteropServices;
+using System.Runtime.InteropServices.ComTypes;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem
+{
+ /// <summary>
+ /// Defines the shell property description information for a property.
+ /// </summary>
+ public class ShellPropertyDescription : IDisposable
+ {
+ #region Private Fields
+
+ private IPropertyDescription nativePropertyDescription;
+ private string canonicalName;
+ private PropertyKey propertyKey;
+ private string displayName;
+ private string editInvitation;
+ private VarEnum? varEnumType = null;
+ private PropertyDisplayType? displayType;
+ private PropertyAggregationType? aggregationTypes;
+ private uint? defaultColumWidth;
+ private PropertyTypeOptions? propertyTypeFlags;
+ private PropertyViewOptions? propertyViewFlags;
+ private Type valueType;
+ private ReadOnlyCollection<ShellPropertyEnumType> propertyEnumTypes;
+ private PropertyColumnStateOptions? columnState;
+ private PropertyConditionType? conditionType;
+ private PropertyConditionOperation? conditionOperation;
+ private PropertyGroupingRange? groupingRange;
+ private PropertySortDescription? sortDescription;
+
+ #endregion
+
+ #region Public Properties
+
+ /// <summary>
+ /// Gets the case-sensitive name of a property as it is known to the system,
+ /// regardless of its localized name.
+ /// </summary>
+ public string CanonicalName
+ {
+ get
+ {
+ if (canonicalName == null)
+ {
+ PropertySystemNativeMethods.PSGetNameFromPropertyKey(ref propertyKey, out canonicalName);
+ }
+
+ return canonicalName;
+ }
+ }
+
+ /// <summary>
+ /// Gets the property key identifying the underlying property.
+ /// </summary>
+ public PropertyKey PropertyKey
+ {
+ get
+ {
+ return propertyKey;
+ }
+ }
+
+ /// <summary>
+ /// Gets the display name of the property as it is shown in any user interface (UI).
+ /// </summary>
+ public string DisplayName
+ {
+ get
+ {
+ if (NativePropertyDescription != null && displayName == null)
+ {
+ IntPtr dispNameptr = IntPtr.Zero;
+
+ HResult hr = NativePropertyDescription.GetDisplayName(out dispNameptr);
+
+ if (CoreErrorHelper.Succeeded(hr) && dispNameptr != IntPtr.Zero)
+ {
+ displayName = Marshal.PtrToStringUni(dispNameptr);
+
+ // Free the string
+ Marshal.FreeCoTaskMem(dispNameptr);
+ }
+ }
+
+ return displayName;
+ }
+ }
+
+ /// <summary>
+ /// Gets the text used in edit controls hosted in various dialog boxes.
+ /// </summary>
+ public string EditInvitation
+ {
+ get
+ {
+ if (NativePropertyDescription != null && editInvitation == null)
+ {
+ // EditInvitation can be empty, so ignore the HR value, but don't throw an exception
+ IntPtr ptr = IntPtr.Zero;
+
+ HResult hr = NativePropertyDescription.GetEditInvitation(out ptr);
+
+ if (CoreErrorHelper.Succeeded(hr) && ptr != IntPtr.Zero)
+ {
+ editInvitation = Marshal.PtrToStringUni(ptr);
+ // Free the string
+ Marshal.FreeCoTaskMem(ptr);
+ }
+ }
+
+ return editInvitation;
+ }
+ }
+
+ /// <summary>
+ /// Gets the VarEnum OLE type for this property.
+ /// </summary>
+ public VarEnum VarEnumType
+ {
+ get
+ {
+ if (NativePropertyDescription != null && varEnumType == null)
+ {
+ VarEnum tempType;
+
+ HResult hr = NativePropertyDescription.GetPropertyType(out tempType);
+
+ if (CoreErrorHelper.Succeeded(hr))
+ {
+ varEnumType = tempType;
+ }
+ }
+
+ return varEnumType.HasValue ? varEnumType.Value : default(VarEnum);
+ }
+ }
+
+ /// <summary>
+ /// Gets the .NET system type for a value of this property, or
+ /// null if the value is empty.
+ /// </summary>
+ public Type ValueType
+ {
+ get
+ {
+ if (valueType == null)
+ {
+ valueType = ShellPropertyFactory.VarEnumToSystemType(VarEnumType);
+ }
+
+ return valueType;
+ }
+ }
+
+ /// <summary>
+ /// Gets the current data type used to display the property.
+ /// </summary>
+ public PropertyDisplayType DisplayType
+ {
+ get
+ {
+ if (NativePropertyDescription != null && displayType == null)
+ {
+ PropertyDisplayType tempDisplayType;
+
+ HResult hr = NativePropertyDescription.GetDisplayType(out tempDisplayType);
+
+ if (CoreErrorHelper.Succeeded(hr))
+ {
+ displayType = tempDisplayType;
+ }
+ }
+
+ return displayType.HasValue ? displayType.Value : default(PropertyDisplayType);
+ }
+ }
+
+ /// <summary>
+ /// Gets the default user interface (UI) column width for this property.
+ /// </summary>
+ public uint DefaultColumWidth
+ {
+ get
+ {
+ if (NativePropertyDescription != null && !defaultColumWidth.HasValue)
+ {
+ uint tempDefaultColumWidth;
+
+ HResult hr = NativePropertyDescription.GetDefaultColumnWidth(out tempDefaultColumWidth);
+
+ if (CoreErrorHelper.Succeeded(hr))
+ {
+ defaultColumWidth = tempDefaultColumWidth;
+ }
+ }
+
+ return defaultColumWidth.HasValue ? defaultColumWidth.Value : default(uint);
+ }
+ }
+
+ /// <summary>
+ /// Gets a value that describes how the property values are displayed when
+ /// multiple items are selected in the user interface (UI).
+ /// </summary>
+ public PropertyAggregationType AggregationTypes
+ {
+ get
+ {
+ if (NativePropertyDescription != null && aggregationTypes == null)
+ {
+ PropertyAggregationType tempAggregationTypes;
+
+ HResult hr = NativePropertyDescription.GetAggregationType(out tempAggregationTypes);
+
+ if (CoreErrorHelper.Succeeded(hr))
+ {
+ aggregationTypes = tempAggregationTypes;
+ }
+ }
+
+ return aggregationTypes.HasValue ? aggregationTypes.Value : default(PropertyAggregationType);
+ }
+ }
+
+ /// <summary>
+ /// Gets a list of the possible values for this property.
+ /// </summary>
+ public ReadOnlyCollection<ShellPropertyEnumType> PropertyEnumTypes
+ {
+ get
+ {
+ if (NativePropertyDescription != null && propertyEnumTypes == null)
+ {
+ List<ShellPropertyEnumType> propEnumTypeList = new List<ShellPropertyEnumType>();
+
+ Guid guid = new Guid(ShellIIDGuid.IPropertyEnumTypeList);
+ IPropertyEnumTypeList nativeList;
+ HResult hr = NativePropertyDescription.GetEnumTypeList(ref guid, out nativeList);
+
+ if (nativeList != null && CoreErrorHelper.Succeeded(hr))
+ {
+
+ uint count;
+ nativeList.GetCount(out count);
+ guid = new Guid(ShellIIDGuid.IPropertyEnumType);
+
+ for (uint i = 0; i < count; i++)
+ {
+ IPropertyEnumType nativeEnumType;
+ nativeList.GetAt(i, ref guid, out nativeEnumType);
+ propEnumTypeList.Add(new ShellPropertyEnumType(nativeEnumType));
+ }
+ }
+
+ propertyEnumTypes = new ReadOnlyCollection<ShellPropertyEnumType>(propEnumTypeList);
+ }
+
+ return propertyEnumTypes;
+
+ }
+ }
+
+ /// <summary>
+ /// Gets the column state flag, which describes how the property
+ /// should be treated by interfaces or APIs that use this flag.
+ /// </summary>
+ public PropertyColumnStateOptions ColumnState
+ {
+ get
+ {
+ // If default/first value, try to get it again, otherwise used the cached one.
+ if (NativePropertyDescription != null && columnState == null)
+ {
+ PropertyColumnStateOptions state;
+
+ HResult hr = NativePropertyDescription.GetColumnState(out state);
+
+ if (CoreErrorHelper.Succeeded(hr))
+ {
+ columnState = state;
+ }
+ }
+
+ return columnState.HasValue ? columnState.Value : default(PropertyColumnStateOptions);
+ }
+ }
+
+ /// <summary>
+ /// Gets the condition type to use when displaying the property in
+ /// the query builder user interface (UI). This influences the list
+ /// of predicate conditions (for example, equals, less than, and
+ /// contains) that are shown for this property.
+ /// </summary>
+ /// <remarks>For more information, see the <c>conditionType</c> attribute
+ /// of the <c>typeInfo</c> element in the property's .propdesc file.</remarks>
+ public PropertyConditionType ConditionType
+ {
+ get
+ {
+ // If default/first value, try to get it again, otherwise used the cached one.
+ if (NativePropertyDescription != null && conditionType == null)
+ {
+ PropertyConditionType tempConditionType;
+ PropertyConditionOperation tempConditionOperation;
+
+ HResult hr = NativePropertyDescription.GetConditionType(out tempConditionType, out tempConditionOperation);
+
+ if (CoreErrorHelper.Succeeded(hr))
+ {
+ conditionOperation = tempConditionOperation;
+ conditionType = tempConditionType;
+ }
+ }
+
+ return conditionType.HasValue ? conditionType.Value : default(PropertyConditionType);
+ }
+ }
+
+ /// <summary>
+ /// Gets the default condition operation to use
+ /// when displaying the property in the query builder user
+ /// interface (UI). This influences the list of predicate conditions
+ /// (for example, equals, less than, and contains) that are shown
+ /// for this property.
+ /// </summary>
+ /// <remarks>For more information, see the <c>conditionType</c> attribute of the
+ /// <c>typeInfo</c> element in the property's .propdesc file.</remarks>
+ public PropertyConditionOperation ConditionOperation
+ {
+ get
+ {
+ // If default/first value, try to get it again, otherwise used the cached one.
+ if (NativePropertyDescription != null && conditionOperation == null)
+ {
+ PropertyConditionType tempConditionType;
+ PropertyConditionOperation tempConditionOperation;
+
+ HResult hr = NativePropertyDescription.GetConditionType(out tempConditionType, out tempConditionOperation);
+
+ if (CoreErrorHelper.Succeeded(hr))
+ {
+ conditionOperation = tempConditionOperation;
+ conditionType = tempConditionType;
+ }
+ }
+
+ return conditionOperation.HasValue ? conditionOperation.Value : default(PropertyConditionOperation);
+ }
+ }
+
+ /// <summary>
+ /// Gets the method used when a view is grouped by this property.
+ /// </summary>
+ /// <remarks>The information retrieved by this method comes from
+ /// the <c>groupingRange</c> attribute of the <c>typeInfo</c> element in the
+ /// property's .propdesc file.</remarks>
+ public PropertyGroupingRange GroupingRange
+ {
+ get
+ {
+ // If default/first value, try to get it again, otherwise used the cached one.
+ if (NativePropertyDescription != null && groupingRange == null)
+ {
+ PropertyGroupingRange tempGroupingRange;
+
+ HResult hr = NativePropertyDescription.GetGroupingRange(out tempGroupingRange);
+
+ if (CoreErrorHelper.Succeeded(hr))
+ {
+ groupingRange = tempGroupingRange;
+ }
+ }
+
+ return groupingRange.HasValue ? groupingRange.Value : default(PropertyGroupingRange);
+ }
+ }
+
+ /// <summary>
+ /// Gets the current sort description flags for the property,
+ /// which indicate the particular wordings of sort offerings.
+ /// </summary>
+ /// <remarks>The settings retrieved by this method are set
+ /// through the <c>sortDescription</c> attribute of the <c>labelInfo</c>
+ /// element in the property's .propdesc file.</remarks>
+ public PropertySortDescription SortDescription
+ {
+ get
+ {
+ // If default/first value, try to get it again, otherwise used the cached one.
+ if (NativePropertyDescription != null && sortDescription == null)
+ {
+ PropertySortDescription tempSortDescription;
+
+ HResult hr = NativePropertyDescription.GetSortDescription(out tempSortDescription);
+
+ if (CoreErrorHelper.Succeeded(hr))
+ {
+ sortDescription = tempSortDescription;
+ }
+ }
+
+ return sortDescription.HasValue ? sortDescription.Value : default(PropertySortDescription);
+ }
+ }
+
+ /// <summary>
+ /// Gets the localized display string that describes the current sort order.
+ /// </summary>
+ /// <param name="descending">Indicates the sort order should
+ /// reference the string "Z on top"; otherwise, the sort order should reference the string "A on top".</param>
+ /// <returns>The sort description for this property.</returns>
+ /// <remarks>The string retrieved by this method is determined by flags set in the
+ /// <c>sortDescription</c> attribute of the <c>labelInfo</c> element in the property's .propdesc file.</remarks>
+ public string GetSortDescriptionLabel(bool descending)
+ {
+ IntPtr ptr = IntPtr.Zero;
+ string label = string.Empty;
+
+ if (NativePropertyDescription != null)
+ {
+ HResult hr = NativePropertyDescription.GetSortDescriptionLabel(descending, out ptr);
+
+ if (CoreErrorHelper.Succeeded(hr) && ptr != IntPtr.Zero)
+ {
+ label = Marshal.PtrToStringUni(ptr);
+ // Free the string
+ Marshal.FreeCoTaskMem(ptr);
+ }
+ }
+
+ return label;
+ }
+
+ /// <summary>
+ /// Gets a set of flags that describe the uses and capabilities of the property.
+ /// </summary>
+ public PropertyTypeOptions TypeFlags
+ {
+ get
+ {
+ if (NativePropertyDescription != null && propertyTypeFlags == null)
+ {
+ PropertyTypeOptions tempFlags;
+
+ HResult hr = NativePropertyDescription.GetTypeFlags(PropertyTypeOptions.MaskAll, out tempFlags);
+
+ propertyTypeFlags = CoreErrorHelper.Succeeded(hr) ? tempFlags : default(PropertyTypeOptions);
+ }
+
+ return propertyTypeFlags.HasValue ? propertyTypeFlags.Value : default(PropertyTypeOptions);
+ }
+ }
+
+ /// <summary>
+ /// Gets the current set of flags governing the property's view.
+ /// </summary>
+ public PropertyViewOptions ViewFlags
+ {
+ get
+ {
+ if (NativePropertyDescription != null && propertyViewFlags == null)
+ {
+ PropertyViewOptions tempFlags;
+ HResult hr = NativePropertyDescription.GetViewFlags(out tempFlags);
+
+ propertyViewFlags = CoreErrorHelper.Succeeded(hr) ? tempFlags : default(PropertyViewOptions);
+ }
+
+ return propertyViewFlags.HasValue ? propertyViewFlags.Value : default(PropertyViewOptions);
+ }
+ }
+
+ /// <summary>
+ /// Gets a value that determines if the native property description is present on the system.
+ /// </summary>
+ public bool HasSystemDescription
+ {
+ get { return NativePropertyDescription != null; }
+ }
+
+ #endregion
+
+ #region Internal Constructor
+
+ internal ShellPropertyDescription(PropertyKey key)
+ {
+ this.propertyKey = key;
+ }
+
+ #endregion
+
+ #region Internal Methods
+
+ /// <summary>
+ /// Get the native property description COM interface
+ /// </summary>
+ internal IPropertyDescription NativePropertyDescription
+ {
+ get
+ {
+ if (nativePropertyDescription == null)
+ {
+ Guid guid = new Guid(ShellIIDGuid.IPropertyDescription);
+ PropertySystemNativeMethods.PSGetPropertyDescription(ref propertyKey, ref guid, out nativePropertyDescription);
+ }
+
+ return nativePropertyDescription;
+ }
+ }
+
+ #endregion
+
+ #region IDisposable Members
+
+ /// <summary>
+ /// Release the native objects
+ /// </summary>
+ /// <param name="disposing">Indicates that this is being called from Dispose(), rather than the finalizer.</param>
+ protected virtual void Dispose(bool disposing)
+ {
+ if (nativePropertyDescription != null)
+ {
+ Marshal.ReleaseComObject(nativePropertyDescription);
+ nativePropertyDescription = null;
+ }
+
+ if (disposing)
+ {
+ // and the managed ones
+ canonicalName = null;
+ displayName = null;
+ editInvitation = null;
+ defaultColumWidth = null;
+ valueType = null;
+ propertyEnumTypes = null;
+ }
+ }
+
+ /// <summary>
+ /// Release the native objects
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Release the native objects
+ /// </summary>
+ ~ShellPropertyDescription()
+ {
+ Dispose(false);
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyDescriptionsCache.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyDescriptionsCache.cs
new file mode 100644
index 0000000000..d97584380e
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyDescriptionsCache.cs
@@ -0,0 +1,39 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System.Collections.Generic;
+using Microsoft.WindowsAPICodePack.Shell;
+
+namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem
+{
+ internal class ShellPropertyDescriptionsCache
+ {
+ private ShellPropertyDescriptionsCache()
+ {
+ propsDictionary = new Dictionary<PropertyKey, ShellPropertyDescription>();
+ }
+
+ private IDictionary<PropertyKey, ShellPropertyDescription> propsDictionary;
+ private static ShellPropertyDescriptionsCache cacheInstance;
+
+ public static ShellPropertyDescriptionsCache Cache
+ {
+ get
+ {
+ if (cacheInstance == null)
+ {
+ cacheInstance = new ShellPropertyDescriptionsCache();
+ }
+ return cacheInstance;
+ }
+ }
+
+ public ShellPropertyDescription GetPropertyDescription(PropertyKey key)
+ {
+ if (!propsDictionary.ContainsKey(key))
+ {
+ propsDictionary.Add(key, new ShellPropertyDescription(key));
+ }
+ return propsDictionary[key];
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyEnumType.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyEnumType.cs
new file mode 100644
index 0000000000..fbe7b1c23c
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyEnumType.cs
@@ -0,0 +1,131 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem
+{
+ /// <summary>
+ /// Defines the enumeration values for a property type.
+ /// </summary>
+ public class ShellPropertyEnumType
+ {
+ #region Private Properties
+
+ private string displayText;
+ private PropEnumType? enumType;
+ private object minValue, setValue, enumerationValue;
+
+ private IPropertyEnumType NativePropertyEnumType
+ {
+ set;
+ get;
+ }
+
+ #endregion
+
+ #region Internal Constructor
+
+ internal ShellPropertyEnumType(IPropertyEnumType nativePropertyEnumType)
+ {
+ NativePropertyEnumType = nativePropertyEnumType;
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ /// <summary>
+ /// Gets display text from an enumeration information structure.
+ /// </summary>
+ public string DisplayText
+ {
+ get
+ {
+ if (displayText == null)
+ {
+ NativePropertyEnumType.GetDisplayText(out displayText);
+ }
+ return displayText;
+ }
+ }
+
+ /// <summary>
+ /// Gets an enumeration type from an enumeration information structure.
+ /// </summary>
+ public PropEnumType EnumType
+ {
+ get
+ {
+ if (!enumType.HasValue)
+ {
+ PropEnumType tempEnumType;
+ NativePropertyEnumType.GetEnumType(out tempEnumType);
+ enumType = tempEnumType;
+ }
+ return enumType.Value;
+ }
+ }
+
+ /// <summary>
+ /// Gets a minimum value from an enumeration information structure.
+ /// </summary>
+ public object RangeMinValue
+ {
+ get
+ {
+ if (minValue == null)
+ {
+ using (PropVariant propVar = new PropVariant())
+ {
+ NativePropertyEnumType.GetRangeMinValue(propVar);
+ minValue = propVar.Value;
+ }
+ }
+ return minValue;
+
+ }
+ }
+
+ /// <summary>
+ /// Gets a set value from an enumeration information structure.
+ /// </summary>
+ public object RangeSetValue
+ {
+ get
+ {
+ if (setValue == null)
+ {
+ using (PropVariant propVar = new PropVariant())
+ {
+ NativePropertyEnumType.GetRangeSetValue(propVar);
+ setValue = propVar.Value;
+ }
+ }
+ return setValue;
+
+ }
+ }
+
+ /// <summary>
+ /// Gets a value from an enumeration information structure.
+ /// </summary>
+ public object RangeValue
+ {
+ get
+ {
+ if (enumerationValue == null)
+ {
+ using (PropVariant propVar = new PropVariant())
+ {
+ NativePropertyEnumType.GetValue(propVar);
+ enumerationValue = propVar.Value;
+ }
+ }
+ return enumerationValue;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyEnums.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyEnums.cs
new file mode 100644
index 0000000000..99c4963997
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyEnums.cs
@@ -0,0 +1,737 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+
+namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem
+{
+ #region Property System Enumerations
+
+ /// <summary>
+ /// Property store cache state
+ /// </summary>
+ public enum PropertyStoreCacheState
+ {
+ /// <summary>
+ /// Contained in file, not updated.
+ /// </summary>
+ Normal = 0,
+
+ /// <summary>
+ /// Not contained in file.
+ /// </summary>
+ NotInSource = 1,
+
+ /// <summary>
+ /// Contained in file, has been updated since file was consumed.
+ /// </summary>
+ Dirty = 2
+ }
+
+ /// <summary>
+ /// Delineates the format of a property string.
+ /// </summary>
+ /// <remarks>
+ /// Typically use one, or a bitwise combination of
+ /// these flags, to specify the format. Some flags are mutually exclusive,
+ /// so combinations like <c>ShortTime | LongTime | HideTime</c> are not allowed.
+ /// </remarks>
+ [Flags]
+ public enum PropertyDescriptionFormatOptions
+ {
+ /// <summary>
+ /// The format settings specified in the property's .propdesc file.
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// The value preceded with the property's display name.
+ /// </summary>
+ /// <remarks>
+ /// This flag is ignored when the <c>hideLabelPrefix</c> attribute of the <c>labelInfo</c> element
+ /// in the property's .propinfo file is set to true.
+ /// </remarks>
+ PrefixName = 0x1,
+
+ /// <summary>
+ /// The string treated as a file name.
+ /// </summary>
+ FileName = 0x2,
+
+ /// <summary>
+ /// The sizes displayed in kilobytes (KB), regardless of size.
+ /// </summary>
+ /// <remarks>
+ /// This flag applies to properties of <c>Integer</c> types and aligns the values in the column.
+ /// </remarks>
+ AlwaysKB = 0x4,
+
+ /// <summary>
+ /// Reserved.
+ /// </summary>
+ RightToLeft = 0x8,
+
+ /// <summary>
+ /// The time displayed as 'hh:mm am/pm'.
+ /// </summary>
+ ShortTime = 0x10,
+
+ /// <summary>
+ /// The time displayed as 'hh:mm:ss am/pm'.
+ /// </summary>
+ LongTime = 0x20,
+
+ /// <summary>
+ /// The time portion of date/time hidden.
+ /// </summary>
+ HideTime = 64,
+
+ /// <summary>
+ /// The date displayed as 'MM/DD/YY'. For example, '3/21/04'.
+ /// </summary>
+ ShortDate = 0x80,
+
+ /// <summary>
+ /// The date displayed as 'DayOfWeek Month day, year'.
+ /// For example, 'Monday, March 21, 2004'.
+ /// </summary>
+ LongDate = 0x100,
+
+ /// <summary>
+ /// The date portion of date/time hidden.
+ /// </summary>
+ HideDate = 0x200,
+
+ /// <summary>
+ /// The friendly date descriptions, such as "Yesterday".
+ /// </summary>
+ RelativeDate = 0x400,
+
+ /// <summary>
+ /// The text displayed in a text box as a cue for the user, such as 'Enter your name'.
+ /// </summary>
+ /// <remarks>
+ /// The invitation text is returned if formatting failed or the value was empty.
+ /// Invitation text is text displayed in a text box as a cue for the user,
+ /// Formatting can fail if the data entered
+ /// is not of an expected type, such as putting alpha characters in
+ /// a phone number field.
+ /// </remarks>
+ UseEditInvitation = 0x800,
+
+ /// <summary>
+ /// This flag requires UseEditInvitation to also be specified. When the
+ /// formatting flags are ReadOnly | UseEditInvitation and the algorithm
+ /// would have shown invitation text, a string is returned that indicates
+ /// the value is "Unknown" instead of the invitation text.
+ /// </summary>
+ ReadOnly = 0x1000,
+
+ /// <summary>
+ /// The detection of the reading order is not automatic. Useful when converting
+ /// to ANSI to omit the Unicode reading order characters.
+ /// </summary>
+ NoAutoReadingOrder = 0x2000,
+
+ /// <summary>
+ /// Smart display of DateTime values
+ /// </summary>
+ SmartDateTime = 0x4000
+ }
+
+ /// <summary>
+ /// Specifies the display types for a property.
+ /// </summary>
+ public enum PropertyDisplayType
+ {
+ /// <summary>
+ /// The String Display. This is the default if the property doesn't specify a display type.
+ /// </summary>
+ String = 0,
+
+ /// <summary>
+ /// The Number Display.
+ /// </summary>
+ Number = 1,
+
+ /// <summary>
+ /// The Boolean Display.
+ /// </summary>
+ Boolean = 2,
+
+ /// <summary>
+ /// The DateTime Display.
+ /// </summary>
+ DateTime = 3,
+
+ /// <summary>
+ /// The Enumerated Display.
+ /// </summary>
+ Enumerated = 4
+ }
+
+ /// <summary>
+ /// Property Aggregation Type
+ /// </summary>
+ public enum PropertyAggregationType
+ {
+ /// <summary>
+ /// The string "Multiple Values" is displayed.
+ /// </summary>
+ Default = 0,
+
+ /// <summary>
+ /// The first value in the selection is displayed.
+ /// </summary>
+ First = 1,
+
+ /// <summary>
+ /// The sum of the selected values is displayed. This flag is never returned
+ /// for data types VT_LPWSTR, VT_BOOL, and VT_FILETIME.
+ /// </summary>
+ Sum = 2,
+
+ /// <summary>
+ /// The numerical average of the selected values is displayed. This flag
+ /// is never returned for data types VT_LPWSTR, VT_BOOL, and VT_FILETIME.
+ /// </summary>
+ Average = 3,
+
+ /// <summary>
+ /// The date range of the selected values is displayed. This flag is only
+ /// returned for values of the VT_FILETIME data type.
+ /// </summary>
+ DateRange = 4,
+
+ /// <summary>
+ /// A concatenated string of all the values is displayed. The order of
+ /// individual values in the string is undefined. The concatenated
+ /// string omits duplicate values; if a value occurs more than once,
+ /// it only appears a single time in the concatenated string.
+ /// </summary>
+ Union = 5,
+
+ /// <summary>
+ /// The highest of the selected values is displayed.
+ /// </summary>
+ Max = 6,
+
+ /// <summary>
+ /// The lowest of the selected values is displayed.
+ /// </summary>
+ Min = 7
+ }
+
+ /// <summary>
+ /// Property Enumeration Types
+ /// </summary>
+ public enum PropEnumType
+ {
+ /// <summary>
+ /// Use DisplayText and either RangeMinValue or RangeSetValue.
+ /// </summary>
+ DiscreteValue = 0,
+
+ /// <summary>
+ /// Use DisplayText and either RangeMinValue or RangeSetValue
+ /// </summary>
+ RangedValue = 1,
+
+ /// <summary>
+ /// Use DisplayText
+ /// </summary>
+ DefaultValue = 2,
+
+ /// <summary>
+ /// Use Value or RangeMinValue
+ /// </summary>
+ EndRange = 3
+ };
+
+ /// <summary>
+ /// Describes how a property should be treated for display purposes.
+ /// </summary>
+ [Flags]
+ public enum PropertyColumnStateOptions
+ {
+ /// <summary>
+ /// Default value
+ /// </summary>
+ None = 0x00000000,
+
+ /// <summary>
+ /// The value is displayed as a string.
+ /// </summary>
+ StringType = 0x00000001,
+
+ /// <summary>
+ /// The value is displayed as an integer.
+ /// </summary>
+ IntegerType = 0x00000002,
+
+ /// <summary>
+ /// The value is displayed as a date/time.
+ /// </summary>
+ DateType = 0x00000003,
+
+ /// <summary>
+ /// A mask for display type values StringType, IntegerType, and DateType.
+ /// </summary>
+ TypeMask = 0x0000000f,
+
+ /// <summary>
+ /// The column should be on by default in Details view.
+ /// </summary>
+ OnByDefault = 0x00000010,
+
+ /// <summary>
+ /// Will be slow to compute. Perform on a background thread.
+ /// </summary>
+ Slow = 0x00000020,
+
+ /// <summary>
+ /// Provided by a handler, not the folder.
+ /// </summary>
+ Extended = 0x00000040,
+
+ /// <summary>
+ /// Not displayed in the context menu, but is listed in the More... dialog.
+ /// </summary>
+ SecondaryUI = 0x00000080,
+
+ /// <summary>
+ /// Not displayed in the user interface (UI).
+ /// </summary>
+ Hidden = 0x00000100,
+
+ /// <summary>
+ /// VarCmp produces same result as IShellFolder::CompareIDs.
+ /// </summary>
+ PreferVariantCompare = 0x00000200,
+
+ /// <summary>
+ /// PSFormatForDisplay produces same result as IShellFolder::CompareIDs.
+ /// </summary>
+ PreferFormatForDisplay = 0x00000400,
+
+ /// <summary>
+ /// Do not sort folders separately.
+ /// </summary>
+ NoSortByFolders = 0x00000800,
+
+ /// <summary>
+ /// Only displayed in the UI.
+ /// </summary>
+ ViewOnly = 0x00010000,
+
+ /// <summary>
+ /// Marks columns with values that should be read in a batch.
+ /// </summary>
+ BatchRead = 0x00020000,
+
+ /// <summary>
+ /// Grouping is disabled for this column.
+ /// </summary>
+ NoGroupBy = 0x00040000,
+
+ /// <summary>
+ /// Can't resize the column.
+ /// </summary>
+ FixedWidth = 0x00001000,
+
+ /// <summary>
+ /// The width is the same in all dots per inch (dpi)s.
+ /// </summary>
+ NoDpiScale = 0x00002000,
+
+ /// <summary>
+ /// Fixed width and height ratio.
+ /// </summary>
+ FixedRatio = 0x00004000,
+
+ /// <summary>
+ /// Filters out new display flags.
+ /// </summary>
+ DisplayMask = 0x0000F000,
+ }
+
+ /// <summary>
+ /// Specifies the condition type to use when displaying the property in the query builder user interface (UI).
+ /// </summary>
+ public enum PropertyConditionType
+ {
+ /// <summary>
+ /// The default condition type.
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// The string type.
+ /// </summary>
+ String = 1,
+
+ /// <summary>
+ /// The size type.
+ /// </summary>
+ Size = 2,
+
+ /// <summary>
+ /// The date/time type.
+ /// </summary>
+ DateTime = 3,
+
+ /// <summary>
+ /// The Boolean type.
+ /// </summary>
+ Boolean = 4,
+
+ /// <summary>
+ /// The number type.
+ /// </summary>
+ Number = 5,
+ }
+
+ /// <summary>
+ /// Provides a set of flags to be used with IConditionFactory,
+ /// ICondition, and IConditionGenerator to indicate the operation.
+ /// </summary>
+ public enum PropertyConditionOperation
+ {
+ /// <summary>
+ /// The implicit comparison between the value of the property and the value of the constant.
+ /// </summary>
+ Implicit,
+
+ /// <summary>
+ /// The value of the property and the value of the constant must be equal.
+ /// </summary>
+ Equal,
+
+ /// <summary>
+ /// The value of the property and the value of the constant must not be equal.
+ /// </summary>
+ NotEqual,
+
+ /// <summary>
+ /// The value of the property must be less than the value of the constant.
+ /// </summary>
+ LessThan,
+
+ /// <summary>
+ /// The value of the property must be greater than the value of the constant.
+ /// </summary>
+ GreaterThan,
+
+ /// <summary>
+ /// The value of the property must be less than or equal to the value of the constant.
+ /// </summary>
+ LessThanOrEqual,
+
+ /// <summary>
+ /// The value of the property must be greater than or equal to the value of the constant.
+ /// </summary>
+ GreaterThanOrEqual,
+
+ /// <summary>
+ /// The value of the property must begin with the value of the constant.
+ /// </summary>
+ ValueStartsWith,
+
+ /// <summary>
+ /// The value of the property must end with the value of the constant.
+ /// </summary>
+ ValueEndsWith,
+
+ /// <summary>
+ /// The value of the property must contain the value of the constant.
+ /// </summary>
+ ValueContains,
+
+ /// <summary>
+ /// The value of the property must not contain the value of the constant.
+ /// </summary>
+ ValueNotContains,
+
+ /// <summary>
+ /// The value of the property must match the value of the constant, where '?' matches any single character and '*' matches any sequence of characters.
+ /// </summary>
+ DOSWildCards,
+
+ /// <summary>
+ /// The value of the property must contain a word that is the value of the constant.
+ /// </summary>
+ WordEqual,
+
+ /// <summary>
+ /// The value of the property must contain a word that begins with the value of the constant.
+ /// </summary>
+ WordStartsWith,
+
+ /// <summary>
+ /// The application is free to interpret this in any suitable way.
+ /// </summary>
+ ApplicationSpecific,
+ }
+
+ /// <summary>
+ /// Specifies the property description grouping ranges.
+ /// </summary>
+ public enum PropertyGroupingRange
+ {
+ /// <summary>
+ /// The individual values.
+ /// </summary>
+ Discrete = 0,
+
+ /// <summary>
+ /// The static alphanumeric ranges.
+ /// </summary>
+ Alphanumeric = 1,
+
+ /// <summary>
+ /// The static size ranges.
+ /// </summary>
+ Size = 2,
+
+ /// <summary>
+ /// The dynamically-created ranges.
+ /// </summary>
+ Dynamic = 3,
+
+ /// <summary>
+ /// The month and year groups.
+ /// </summary>
+ Date = 4,
+
+ /// <summary>
+ /// The percent groups.
+ /// </summary>
+ Percent = 5,
+
+ /// <summary>
+ /// The enumerated groups.
+ /// </summary>
+ Enumerated = 6,
+ }
+
+ /// <summary>
+ /// Describes the particular wordings of sort offerings.
+ /// </summary>
+ /// <remarks>
+ /// Note that the strings shown are English versions only;
+ /// localized strings are used for other locales.
+ /// </remarks>
+ public enum PropertySortDescription
+ {
+ /// <summary>
+ /// The default ascending or descending property sort, "Sort going up", "Sort going down".
+ /// </summary>
+ General,
+
+ /// <summary>
+ /// The alphabetical sort, "A on top", "Z on top".
+ /// </summary>
+ AToZ,
+
+ /// <summary>
+ /// The numerical sort, "Lowest on top", "Highest on top".
+ /// </summary>
+ LowestToHighest,
+
+ /// <summary>
+ /// The size sort, "Smallest on top", "Largest on top".
+ /// </summary>
+ SmallestToBiggest,
+
+ /// <summary>
+ /// The chronological sort, "Oldest on top", "Newest on top".
+ /// </summary>
+ OldestToNewest,
+ }
+
+ /// <summary>
+ /// Describes the attributes of the <c>typeInfo</c> element in the property's <c>.propdesc</c> file.
+ /// </summary>
+ [Flags]
+ public enum PropertyTypeOptions
+ {
+ /// <summary>
+ /// The property uses the default values for all attributes.
+ /// </summary>
+ None = 0x00000000,
+
+ /// <summary>
+ /// The property can have multiple values.
+ /// </summary>
+ /// <remarks>
+ /// These values are stored as a VT_VECTOR in the PROPVARIANT structure.
+ /// This value is set by the multipleValues attribute of the typeInfo element in the property's .propdesc file.
+ /// </remarks>
+ MultipleValues = 0x00000001,
+
+ /// <summary>
+ /// This property cannot be written to.
+ /// </summary>
+ /// <remarks>
+ /// This value is set by the isInnate attribute of the typeInfo element in the property's .propdesc file.
+ /// </remarks>
+ IsInnate = 0x00000002,
+
+ /// <summary>
+ /// The property is a group heading.
+ /// </summary>
+ /// <remarks>
+ /// This value is set by the isGroup attribute of the typeInfo element in the property's .propdesc file.
+ /// </remarks>
+ IsGroup = 0x00000004,
+
+ /// <summary>
+ /// The user can group by this property.
+ /// </summary>
+ /// <remarks>
+ /// This value is set by the canGroupBy attribute of the typeInfo element in the property's .propdesc file.
+ /// </remarks>
+ CanGroupBy = 0x00000008,
+
+ /// <summary>
+ /// The user can stack by this property.
+ /// </summary>
+ /// <remarks>
+ /// This value is set by the canStackBy attribute of the typeInfo element in the property's .propdesc file.
+ /// </remarks>
+ CanStackBy = 0x00000010,
+
+ /// <summary>
+ /// This property contains a hierarchy.
+ /// </summary>
+ /// <remarks>
+ /// This value is set by the isTreeProperty attribute of the typeInfo element in the property's .propdesc file.
+ /// </remarks>
+ IsTreeProperty = 0x00000020,
+
+ /// <summary>
+ /// Include this property in any full text query that is performed.
+ /// </summary>
+ /// <remarks>
+ /// This value is set by the includeInFullTextQuery attribute of the typeInfo element in the property's .propdesc file.
+ /// </remarks>
+ IncludeInFullTextQuery = 0x00000040,
+
+ /// <summary>
+ /// This property is meant to be viewed by the user.
+ /// </summary>
+ /// <remarks>
+ /// This influences whether the property shows up in the "Choose Columns" dialog, for example.
+ /// This value is set by the isViewable attribute of the typeInfo element in the property's .propdesc file.
+ /// </remarks>
+ IsViewable = 0x00000080,
+
+ /// <summary>
+ /// This property is included in the list of properties that can be queried.
+ /// </summary>
+ /// <remarks>
+ /// A queryable property must also be viewable.
+ /// This influences whether the property shows up in the query builder UI.
+ /// This value is set by the isQueryable attribute of the typeInfo element in the property's .propdesc file.
+ /// </remarks>
+ IsQueryable = 0x00000100,
+
+ /// <summary>
+ /// Used with an innate property (that is, a value calculated from other property values) to indicate that it can be deleted.
+ /// </summary>
+ /// <remarks>
+ /// Windows Vista with Service Pack 1 (SP1) and later.
+ /// This value is used by the Remove Properties user interface (UI) to determine whether to display a check box next to an property that allows that property to be selected for removal.
+ /// Note that a property that is not innate can always be purged regardless of the presence or absence of this flag.
+ /// </remarks>
+ CanBePurged = 0x00000200,
+
+ /// <summary>
+ /// This property is owned by the system.
+ /// </summary>
+ IsSystemProperty = unchecked((int)0x80000000),
+
+ /// <summary>
+ /// A mask used to retrieve all flags.
+ /// </summary>
+ MaskAll = unchecked((int)0x800001FF),
+ }
+
+ /// <summary>
+ /// Associates property names with property description list strings.
+ /// </summary>
+ [Flags]
+ public enum PropertyViewOptions
+ {
+ /// <summary>
+ /// The property is shown by default.
+ /// </summary>
+ None = 0x00000000,
+
+ /// <summary>
+ /// The property is centered.
+ /// </summary>
+ CenterAlign = 0x00000001,
+
+ /// <summary>
+ /// The property is right aligned.
+ /// </summary>
+ RightAlign = 0x00000002,
+
+ /// <summary>
+ /// The property is shown as the beginning of the next collection of properties in the view.
+ /// </summary>
+ BeginNewGroup = 0x00000004,
+
+ /// <summary>
+ /// The remainder of the view area is filled with the content of this property.
+ /// </summary>
+ FillArea = 0x00000008,
+
+ /// <summary>
+ /// The property is reverse sorted if it is a property in a list of sorted properties.
+ /// </summary>
+ SortDescending = 0x00000010,
+
+ /// <summary>
+ /// The property is only shown if it is present.
+ /// </summary>
+ ShowOnlyIfPresent = 0x00000020,
+
+ /// <summary>
+ /// The property is shown by default in a view (where applicable).
+ /// </summary>
+ ShowByDefault = 0x00000040,
+
+ /// <summary>
+ /// The property is shown by default in primary column selection user interface (UI).
+ /// </summary>
+ ShowInPrimaryList = 0x00000080,
+
+ /// <summary>
+ /// The property is shown by default in secondary column selection UI.
+ /// </summary>
+ ShowInSecondaryList = 0x00000100,
+
+ /// <summary>
+ /// The label is hidden if the view is normally inclined to show the label.
+ /// </summary>
+ HideLabel = 0x00000200,
+
+ /// <summary>
+ /// The property is not displayed as a column in the UI.
+ /// </summary>
+ Hidden = 0x00000800,
+
+ /// <summary>
+ /// The property is wrapped to the next row.
+ /// </summary>
+ CanWrap = 0x00001000,
+
+ /// <summary>
+ /// A mask used to retrieve all flags.
+ /// </summary>
+ MaskAll = 0x000003ff,
+ }
+
+ #endregion
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyFactory.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyFactory.cs
new file mode 100644
index 0000000000..f979537103
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyFactory.cs
@@ -0,0 +1,189 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Runtime.InteropServices.ComTypes;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem
+{
+
+ /// <summary>
+ /// Factory class for creating typed ShellProperties.
+ /// Generates/caches expressions to create generic ShellProperties.
+ /// </summary>
+ internal static class ShellPropertyFactory
+ {
+ // Constructor cache. It takes object as the third param so a single function will suffice for both constructors.
+ private static Dictionary<int, Func<PropertyKey, ShellPropertyDescription, object, IShellProperty>> _storeCache
+ = new Dictionary<int, Func<PropertyKey, ShellPropertyDescription, object, IShellProperty>>();
+
+ /// <summary>
+ /// Creates a generic ShellProperty.
+ /// </summary>
+ /// <param name="propKey">PropertyKey</param>
+ /// <param name="shellObject">Shell object from which to get property</param>
+ /// <returns>ShellProperty matching type of value in property.</returns>
+ public static IShellProperty CreateShellProperty(PropertyKey propKey, ShellObject shellObject)
+ {
+ return GenericCreateShellProperty(propKey, shellObject);
+ }
+
+ /// <summary>
+ /// Creates a generic ShellProperty.
+ /// </summary>
+ /// <param name="propKey">PropertyKey</param>
+ /// <param name="store">IPropertyStore from which to get property</param>
+ /// <returns>ShellProperty matching type of value in property.</returns>
+ public static IShellProperty CreateShellProperty(PropertyKey propKey, IPropertyStore store)
+ {
+ return GenericCreateShellProperty(propKey, store);
+ }
+
+ private static IShellProperty GenericCreateShellProperty<T>(PropertyKey propKey, T thirdArg)
+ {
+ Type thirdType = (thirdArg is ShellObject) ? typeof(ShellObject) : typeof(T);
+
+ ShellPropertyDescription propDesc = ShellPropertyDescriptionsCache.Cache.GetPropertyDescription(propKey);
+
+ // Get the generic type
+ Type type = typeof(ShellProperty<>).MakeGenericType(VarEnumToSystemType(propDesc.VarEnumType));
+
+ // The hash for the function is based off the generic type and which type (constructor) we're using.
+ int hash = GetTypeHash(type, thirdType);
+
+ Func<PropertyKey, ShellPropertyDescription, object, IShellProperty> ctor;
+ if (!_storeCache.TryGetValue(hash, out ctor))
+ {
+ Type[] argTypes = { typeof(PropertyKey), typeof(ShellPropertyDescription), thirdType };
+ ctor = ExpressConstructor(type, argTypes);
+ _storeCache.Add(hash, ctor);
+ }
+
+ return ctor(propKey, propDesc, thirdArg);
+ }
+
+ /// <summary>
+ /// Converts VarEnum to its associated .net Type.
+ /// </summary>
+ /// <param name="VarEnumType">VarEnum value</param>
+ /// <returns>Associated .net equivelent.</returns>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
+ public static Type VarEnumToSystemType(VarEnum VarEnumType)
+ {
+ switch (VarEnumType)
+ {
+ case (VarEnum.VT_EMPTY):
+ case (VarEnum.VT_NULL):
+ return typeof(Object);
+ case (VarEnum.VT_UI1):
+ return typeof(Byte?);
+ case (VarEnum.VT_I2):
+ return typeof(Int16?);
+ case (VarEnum.VT_UI2):
+ return typeof(UInt16?);
+ case (VarEnum.VT_I4):
+ return typeof(Int32?);
+ case (VarEnum.VT_UI4):
+ return typeof(UInt32?);
+ case (VarEnum.VT_I8):
+ return typeof(Int64?);
+ case (VarEnum.VT_UI8):
+ return typeof(UInt64?);
+ case (VarEnum.VT_R8):
+ return typeof(Double?);
+ case (VarEnum.VT_BOOL):
+ return typeof(Boolean?);
+ case (VarEnum.VT_FILETIME):
+ return typeof(DateTime?);
+ case (VarEnum.VT_CLSID):
+ return typeof(IntPtr?);
+ case (VarEnum.VT_CF):
+ return typeof(IntPtr?);
+ case (VarEnum.VT_BLOB):
+ return typeof(Byte[]);
+ case (VarEnum.VT_LPWSTR):
+ return typeof(String);
+ case (VarEnum.VT_UNKNOWN):
+ return typeof(IntPtr?);
+ case (VarEnum.VT_STREAM):
+ return typeof(IStream);
+ case (VarEnum.VT_VECTOR | VarEnum.VT_UI1):
+ return typeof(Byte[]);
+ case (VarEnum.VT_VECTOR | VarEnum.VT_I2):
+ return typeof(Int16[]);
+ case (VarEnum.VT_VECTOR | VarEnum.VT_UI2):
+ return typeof(UInt16[]);
+ case (VarEnum.VT_VECTOR | VarEnum.VT_I4):
+ return typeof(Int32[]);
+ case (VarEnum.VT_VECTOR | VarEnum.VT_UI4):
+ return typeof(UInt32[]);
+ case (VarEnum.VT_VECTOR | VarEnum.VT_I8):
+ return typeof(Int64[]);
+ case (VarEnum.VT_VECTOR | VarEnum.VT_UI8):
+ return typeof(UInt64[]);
+ case (VarEnum.VT_VECTOR | VarEnum.VT_R8):
+ return typeof(Double[]);
+ case (VarEnum.VT_VECTOR | VarEnum.VT_BOOL):
+ return typeof(Boolean[]);
+ case (VarEnum.VT_VECTOR | VarEnum.VT_FILETIME):
+ return typeof(DateTime[]);
+ case (VarEnum.VT_VECTOR | VarEnum.VT_CLSID):
+ return typeof(IntPtr[]);
+ case (VarEnum.VT_VECTOR | VarEnum.VT_CF):
+ return typeof(IntPtr[]);
+ case (VarEnum.VT_VECTOR | VarEnum.VT_LPWSTR):
+ return typeof(String[]);
+ default:
+ return typeof(Object);
+ }
+ }
+
+ #region Private static helper functions
+
+ // Creates an expression for the specific constructor of the given type.
+ private static Func<PropertyKey, ShellPropertyDescription, object, IShellProperty> ExpressConstructor(Type type, Type[] argTypes)
+ {
+ int typeHash = GetTypeHash(argTypes);
+
+ // Finds the correct constructor by matching the hash of the types.
+ ConstructorInfo ctorInfo = type.GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)
+ .FirstOrDefault(x => typeHash == GetTypeHash(x.GetParameters().Select(a => a.ParameterType)));
+
+ if (ctorInfo == null)
+ {
+ throw new ArgumentException(LocalizedMessages.ShellPropertyFactoryConstructorNotFound, "type");
+ }
+
+ var key = Expression.Parameter(argTypes[0], "propKey");
+ var desc = Expression.Parameter(argTypes[1], "desc");
+ var third = Expression.Parameter(typeof(object), "third"); //needs to be object to avoid casting later
+
+ var create = Expression.New(ctorInfo, key, desc,
+ Expression.Convert(third, argTypes[2]));
+
+ return Expression.Lambda<Func<PropertyKey, ShellPropertyDescription, object, IShellProperty>>(
+ create, key, desc, third).Compile();
+ }
+
+ private static int GetTypeHash(params Type[] types)
+ {
+ return GetTypeHash((IEnumerable<Type>)types);
+ }
+
+ // Creates a hash code, unique to the number and order of types.
+ private static int GetTypeHash(IEnumerable<Type> types)
+ {
+ int hash = 0;
+ foreach (Type type in types)
+ {
+ hash = hash * 31 + type.GetHashCode();
+ }
+ return hash;
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyWriter.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyWriter.cs
new file mode 100644
index 0000000000..d90379f711
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyWriter.cs
@@ -0,0 +1,251 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using MS.WindowsAPICodePack.Internal;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem
+{
+ /// <summary>
+ /// Creates a property writer capable of setting multiple properties for a given ShellObject.
+ /// </summary>
+ public class ShellPropertyWriter : IDisposable
+ {
+
+ private ShellObject parentShellObject;
+
+ // Reference to our writable PropertyStore
+ internal IPropertyStore writablePropStore;
+
+ internal ShellPropertyWriter(ShellObject parent)
+ {
+ ParentShellObject = parent;
+
+ // Open the property store for this shell object...
+ Guid guid = new Guid(ShellIIDGuid.IPropertyStore);
+
+ try
+ {
+ int hr = ParentShellObject.NativeShellItem2.GetPropertyStore(
+ ShellNativeMethods.GetPropertyStoreOptions.ReadWrite,
+ ref guid,
+ out writablePropStore);
+
+ if (!CoreErrorHelper.Succeeded(hr))
+ {
+ throw new PropertySystemException(LocalizedMessages.ShellPropertyUnableToGetWritableProperty,
+ Marshal.GetExceptionForHR(hr));
+ }
+ else
+ {
+ // If we succeed in creating a valid property store for this ShellObject,
+ // then set it on the parent shell object for others to use.
+ // Once this writer is closed/commited, we will set the
+ if (ParentShellObject.NativePropertyStore == null)
+ {
+ ParentShellObject.NativePropertyStore = writablePropStore;
+ }
+ }
+
+ }
+ catch (InvalidComObjectException e)
+ {
+ throw new PropertySystemException(LocalizedMessages.ShellPropertyUnableToGetWritableProperty, e);
+ }
+ catch (InvalidCastException)
+ {
+ throw new PropertySystemException(LocalizedMessages.ShellPropertyUnableToGetWritableProperty);
+ }
+ }
+
+ /// <summary>
+ /// Reference to parent ShellObject (associated with this writer)
+ /// </summary>
+ protected ShellObject ParentShellObject
+ {
+ get { return parentShellObject; }
+ private set { parentShellObject = value; }
+ }
+
+ /// <summary>
+ /// Writes the given property key and value.
+ /// </summary>
+ /// <param name="key">The property key.</param>
+ /// <param name="value">The value associated with the key.</param>
+ public void WriteProperty(PropertyKey key, object value)
+ {
+ WriteProperty(key, value, true);
+ }
+
+ /// <summary>
+ /// Writes the given property key and value. To allow truncation of the given value, set allowTruncatedValue
+ /// to true.
+ /// </summary>
+ /// <param name="key">The property key.</param>
+ /// <param name="value">The value associated with the key.</param>
+ /// <param name="allowTruncatedValue">True to allow truncation (default); otherwise False.</param>
+ /// <exception cref="System.InvalidOperationException">If the writable property store is already
+ /// closed.</exception>
+ /// <exception cref="System.ArgumentOutOfRangeException">If AllowTruncatedValue is set to false
+ /// and while setting the value on the property it had to be truncated in a string or rounded in
+ /// a numeric value.</exception>
+ public void WriteProperty(PropertyKey key, object value, bool allowTruncatedValue)
+ {
+ if (writablePropStore == null)
+ throw new InvalidOperationException("Writeable store has been closed.");
+
+ using (PropVariant propVar = PropVariant.FromObject(value))
+ {
+ HResult result = writablePropStore.SetValue(ref key, propVar);
+
+ if (!allowTruncatedValue && ((int)result == ShellNativeMethods.InPlaceStringTruncated))
+ {
+ // At this point we can't revert back the commit
+ // so don't commit, close the property store and throw an exception
+ // to let the user know.
+ Marshal.ReleaseComObject(writablePropStore);
+ writablePropStore = null;
+
+ throw new ArgumentOutOfRangeException("value", LocalizedMessages.ShellPropertyValueTruncated);
+ }
+
+ if (!CoreErrorHelper.Succeeded(result))
+ {
+ throw new PropertySystemException(LocalizedMessages.ShellPropertySetValue, Marshal.GetExceptionForHR((int)result));
+ }
+ }
+ }
+
+ /// <summary>
+ /// Writes the specified property given the canonical name and a value.
+ /// </summary>
+ /// <param name="canonicalName">The canonical name.</param>
+ /// <param name="value">The property value.</param>
+ public void WriteProperty(string canonicalName, object value)
+ {
+ WriteProperty(canonicalName, value, true);
+ }
+
+ /// <summary>
+ /// Writes the specified property given the canonical name and a value. To allow truncation of the given value, set allowTruncatedValue
+ /// to true.
+ /// </summary>
+ /// <param name="canonicalName">The canonical name.</param>
+ /// <param name="value">The property value.</param>
+ /// <param name="allowTruncatedValue">True to allow truncation (default); otherwise False.</param>
+ /// <exception cref="System.ArgumentException">If the given canonical name is not valid.</exception>
+ public void WriteProperty(string canonicalName, object value, bool allowTruncatedValue)
+ {
+ // Get the PropertyKey using the canonicalName passed in
+ PropertyKey propKey;
+
+ int result = PropertySystemNativeMethods.PSGetPropertyKeyFromName(canonicalName, out propKey);
+
+ if (!CoreErrorHelper.Succeeded(result))
+ {
+ throw new ArgumentException(
+ LocalizedMessages.ShellInvalidCanonicalName,
+ Marshal.GetExceptionForHR(result));
+ }
+
+ WriteProperty(propKey, value, allowTruncatedValue);
+ }
+
+ /// <summary>
+ /// Writes the specified property using an IShellProperty and a value.
+ /// </summary>
+ /// <param name="shellProperty">The property name.</param>
+ /// <param name="value">The property value.</param>
+ public void WriteProperty(IShellProperty shellProperty, object value)
+ {
+ WriteProperty(shellProperty, value, true);
+ }
+
+ /// <summary>
+ /// Writes the specified property given an IShellProperty and a value. To allow truncation of the given value, set allowTruncatedValue
+ /// to true.
+ /// </summary>
+ /// <param name="shellProperty">The property name.</param>
+ /// <param name="value">The property value.</param>
+ /// <param name="allowTruncatedValue">True to allow truncation (default); otherwise False.</param>
+ public void WriteProperty(IShellProperty shellProperty, object value, bool allowTruncatedValue)
+ {
+ if (shellProperty == null) { throw new ArgumentNullException("shellProperty"); }
+ WriteProperty(shellProperty.PropertyKey, value, allowTruncatedValue);
+ }
+
+ /// <summary>
+ /// Writes the specified property using a strongly-typed ShellProperty and a value.
+ /// </summary>
+ /// <typeparam name="T">The type of the property name.</typeparam>
+ /// <param name="shellProperty">The property name.</param>
+ /// <param name="value">The property value.</param>
+ public void WriteProperty<T>(ShellProperty<T> shellProperty, T value)
+ {
+ WriteProperty<T>(shellProperty, value, true);
+ }
+ /// <summary>
+ /// Writes the specified property given a strongly-typed ShellProperty and a value. To allow truncation of the given value, set allowTruncatedValue
+ /// to true.
+ /// </summary>
+ /// <typeparam name="T">The type of the property name.</typeparam>
+ /// <param name="shellProperty">The property name.</param>
+ /// <param name="value">The property value.</param>
+ /// <param name="allowTruncatedValue">True to allow truncation (default); otherwise False.</param>
+ public void WriteProperty<T>(ShellProperty<T> shellProperty, T value, bool allowTruncatedValue)
+ {
+ if (shellProperty == null) { throw new ArgumentNullException("shellProperty"); }
+ WriteProperty(shellProperty.PropertyKey, value, allowTruncatedValue);
+ }
+
+ #region IDisposable Members
+
+ /// <summary>
+ /// Release the native objects.
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ ~ShellPropertyWriter()
+ {
+ Dispose(false);
+ }
+
+ /// <summary>
+ /// Release the native and managed objects.
+ /// </summary>
+ /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.
+ /// </param>
+ protected virtual void Dispose(bool disposing)
+ {
+ Close();
+ }
+
+ /// <summary>
+ /// Call this method to commit the writes (calls to WriteProperty method)
+ /// and dispose off the writer.
+ /// </summary>
+ public void Close()
+ {
+ // Close the property writer (commit, etc)
+ if (writablePropStore != null)
+ {
+ writablePropStore.Commit();
+
+ Marshal.ReleaseComObject(writablePropStore);
+ writablePropStore = null;
+ }
+
+ ParentShellObject.NativePropertyStore = null;
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/StronglyTypedProperties.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/StronglyTypedProperties.cs
new file mode 100644
index 0000000000..77fe149f10
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/StronglyTypedProperties.cs
@@ -0,0 +1,16343 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections;
+using System.Runtime.InteropServices.ComTypes;
+
+namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem
+{
+
+ /// <summary>
+ /// Base class for all the strongly-typed properties
+ /// </summary>
+ public abstract class PropertyStoreItems
+ {
+ // Left empty for base class
+ }
+
+ // TODO: FIX THIS!!!
+ public partial class ShellProperties
+ {
+
+ /// <summary>
+ /// .System Properties
+ /// </summary>
+ public class PropertySystem : PropertyStoreItems
+ {
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystem(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.AcquisitionID -- PKEY_AcquisitionID</para>
+ /// <para>Description: Hash to determine acquisition session.
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {65A98875-3C80-40AB-ABBC-EFDAF77DBEE2}, 100</para>
+ /// </summary>
+ public ShellProperty<Int32?> AcquisitionID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.AcquisitionID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ApplicationName -- PKEY_ApplicationName</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR) Legacy code may treat this as VT_LPSTR.</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 18 (PIDSI_APPNAME)</para>
+ /// </summary>
+ public ShellProperty<String> ApplicationName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ApplicationName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Author -- PKEY_Author</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) Legacy code may treat this as VT_LPSTR.</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 4 (PIDSI_AUTHOR)</para>
+ /// </summary>
+ public ShellProperty<String[]> Author
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Author;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Capacity -- PKEY_Capacity</para>
+ /// <para>Description: The amount of total space in bytes.
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 3 (PID_VOLUME_CAPACITY) (Filesystem Volume Properties)</para>
+ /// </summary>
+ public ShellProperty<UInt64?> Capacity
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Capacity;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt64?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt64?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Category -- PKEY_Category</para>
+ /// <para>Description: Legacy code treats this as VT_LPSTR.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 2 (PIDDSI_CATEGORY)</para>
+ /// </summary>
+ public ShellProperty<String[]> Category
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Category;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Comment -- PKEY_Comment</para>
+ /// <para>Description: Comments.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR) Legacy code may treat this as VT_LPSTR.</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 6 (PIDSI_COMMENTS)</para>
+ /// </summary>
+ public ShellProperty<String> Comment
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Comment;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Company -- PKEY_Company</para>
+ /// <para>Description: The company or publisher.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 15 (PIDDSI_COMPANY)</para>
+ /// </summary>
+ public ShellProperty<String> Company
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Company;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ComputerName -- PKEY_ComputerName</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 5 (PID_COMPUTERNAME)</para>
+ /// </summary>
+ public ShellProperty<String> ComputerName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ComputerName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ContainedItems -- PKEY_ContainedItems</para>
+ /// <para>Description: The list of type of items, this item contains. For example, this item contains urls, attachments etc.
+ ///This is represented as a vector array of GUIDs where each GUID represents certain type.
+ ///</para>
+ /// <para>Type: Multivalue Guid -- VT_VECTOR | VT_CLSID (For variants: VT_ARRAY | VT_CLSID)</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 29</para>
+ /// </summary>
+ public ShellProperty<IntPtr[]> ContainedItems
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ContainedItems;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<IntPtr[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<IntPtr[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ContentStatus -- PKEY_ContentStatus</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 27</para>
+ /// </summary>
+ public ShellProperty<String> ContentStatus
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ContentStatus;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ContentType -- PKEY_ContentType</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 26</para>
+ /// </summary>
+ public ShellProperty<String> ContentType
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ContentType;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Copyright -- PKEY_Copyright</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 11 (PIDMSI_COPYRIGHT)</para>
+ /// </summary>
+ public ShellProperty<String> Copyright
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Copyright;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DateAccessed -- PKEY_DateAccessed</para>
+ /// <para>Description: The time of the last access to the item. The Indexing Service friendly name is 'access'.
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 16 (PID_STG_ACCESSTIME)</para>
+ /// </summary>
+ public ShellProperty<DateTime?> DateAccessed
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.DateAccessed;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DateAcquired -- PKEY_DateAcquired</para>
+ /// <para>Description: The time the file entered the system via acquisition. This is not the same as System.DateImported.
+ ///Examples are when pictures are acquired from a camera, or when music is purchased online.
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {2CBAA8F5-D81F-47CA-B17A-F8D822300131}, 100</para>
+ /// </summary>
+ public ShellProperty<DateTime?> DateAcquired
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.DateAcquired;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DateArchived -- PKEY_DateArchived</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {43F8D7B7-A444-4F87-9383-52271C9B915C}, 100</para>
+ /// </summary>
+ public ShellProperty<DateTime?> DateArchived
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.DateArchived;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DateCompleted -- PKEY_DateCompleted</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {72FAB781-ACDA-43E5-B155-B2434F85E678}, 100</para>
+ /// </summary>
+ public ShellProperty<DateTime?> DateCompleted
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.DateCompleted;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DateCreated -- PKEY_DateCreated</para>
+ /// <para>Description: The date and time the item was created. The Indexing Service friendly name is 'create'.
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 15 (PID_STG_CREATETIME)</para>
+ /// </summary>
+ public ShellProperty<DateTime?> DateCreated
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.DateCreated;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DateImported -- PKEY_DateImported</para>
+ /// <para>Description: The time the file is imported into a separate database. This is not the same as System.DateAcquired. (Eg, 2003:05:22 13:55:04)
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 18258</para>
+ /// </summary>
+ public ShellProperty<DateTime?> DateImported
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.DateImported;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DateModified -- PKEY_DateModified</para>
+ /// <para>Description: The date and time of the last write to the item. The Indexing Service friendly name is 'write'.
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 14 (PID_STG_WRITETIME)</para>
+ /// </summary>
+ public ShellProperty<DateTime?> DateModified
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.DateModified;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DescriptionID -- PKEY_DescriptionID</para>
+ /// <para>Description: The contents of a SHDESCRIPTIONID structure as a buffer of bytes.
+ ///</para>
+ /// <para>Type: Buffer -- VT_VECTOR | VT_UI1 (For variants: VT_ARRAY | VT_UI1)</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 2 (PID_DESCRIPTIONID)</para>
+ /// </summary>
+ public ShellProperty<Byte[]> DescriptionID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.DescriptionID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DueDate -- PKEY_DueDate</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {3F8472B5-E0AF-4DB2-8071-C53FE76AE7CE}, 100</para>
+ /// </summary>
+ public ShellProperty<DateTime?> DueDate
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.DueDate;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.EndDate -- PKEY_EndDate</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {C75FAA05-96FD-49E7-9CB4-9F601082D553}, 100</para>
+ /// </summary>
+ public ShellProperty<DateTime?> EndDate
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.EndDate;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FileAllocationSize -- PKEY_FileAllocationSize</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 18 (PID_STG_ALLOCSIZE)</para>
+ /// </summary>
+ public ShellProperty<UInt64?> FileAllocationSize
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.FileAllocationSize;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt64?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt64?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FileAttributes -- PKEY_FileAttributes</para>
+ /// <para>Description: This is the WIN32_FIND_DATA dwFileAttributes for the file-based item.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 13 (PID_STG_ATTRIBUTES)</para>
+ /// </summary>
+ public ShellProperty<UInt32?> FileAttributes
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.FileAttributes;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FileCount -- PKEY_FileCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 12</para>
+ /// </summary>
+ public ShellProperty<UInt64?> FileCount
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.FileCount;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt64?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt64?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FileDescription -- PKEY_FileDescription</para>
+ /// <para>Description: This is a user-friendly description of the file.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 3 (PIDVSI_FileDescription)</para>
+ /// </summary>
+ public ShellProperty<String> FileDescription
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.FileDescription;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FileExtension -- PKEY_FileExtension</para>
+ /// <para>Description: This is the file extension of the file based item, including the leading period.
+ ///
+ ///If System.FileName is VT_EMPTY, then this property should be too. Otherwise, it should be derived
+ ///appropriately by the data source from System.FileName. If System.FileName does not have a file
+ ///extension, this value should be VT_EMPTY.
+ ///
+ ///To obtain the type of any item (including an item that is not a file), use System.ItemType.
+ ///
+ ///Example values:
+ ///
+ /// If the path is... The property value is...
+ /// ----------------- ------------------------
+ /// "c:\foo\bar\hello.txt" ".txt"
+ /// "\\server\share\mydir\goodnews.doc" ".doc"
+ /// "\\server\share\numbers.xls" ".xls"
+ /// "\\server\share\folder" VT_EMPTY
+ /// "c:\foo\MyFolder" VT_EMPTY
+ /// [desktop] VT_EMPTY
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E4F10A3C-49E6-405D-8288-A23BD4EEAA6C}, 100</para>
+ /// </summary>
+ public ShellProperty<String> FileExtension
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.FileExtension;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FileFRN -- PKEY_FileFRN</para>
+ /// <para>Description: This is the unique file ID, also known as the File Reference Number. For a given file, this is the same value
+ ///as is found in the structure variable FILE_ID_BOTH_DIR_INFO.FileId, via GetFileInformationByHandleEx().
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 21 (PID_STG_FRN)</para>
+ /// </summary>
+ public ShellProperty<UInt64?> FileFRN
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.FileFRN;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt64?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt64?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FileName -- PKEY_FileName</para>
+ /// <para>Description: This is the file name (including extension) of the file.
+ ///
+ ///It is possible that the item might not exist on a filesystem (ie, it may not be opened
+ ///using CreateFile). Nonetheless, if the item is represented as a file from the logical sense
+ ///(and its name follows standard Win32 file-naming syntax), then the data source should emit this property.
+ ///
+ ///If an item is not a file, then the value for this property is VT_EMPTY. See
+ ///System.ItemNameDisplay.
+ ///
+ ///This has the same value as System.ParsingName for items that are provided by the Shell's file folder.
+ ///
+ ///Example values:
+ ///
+ /// If the path is... The property value is...
+ /// ----------------- ------------------------
+ /// "c:\foo\bar\hello.txt" "hello.txt"
+ /// "\\server\share\mydir\goodnews.doc" "goodnews.doc"
+ /// "\\server\share\numbers.xls" "numbers.xls"
+ /// "c:\foo\MyFolder" "MyFolder"
+ /// (email message) VT_EMPTY
+ /// (song on portable device) "song.wma"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {41CF5AE0-F75A-4806-BD87-59C7D9248EB9}, 100</para>
+ /// </summary>
+ public ShellProperty<String> FileName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.FileName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FileOwner -- PKEY_FileOwner</para>
+ /// <para>Description: This is the owner of the file, according to the file system.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_Misc) {9B174B34-40FF-11D2-A27E-00C04FC30871}, 4 (PID_MISC_OWNER)</para>
+ /// </summary>
+ public ShellProperty<String> FileOwner
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.FileOwner;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FileVersion -- PKEY_FileVersion</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 4 (PIDVSI_FileVersion)</para>
+ /// </summary>
+ public ShellProperty<String> FileVersion
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.FileVersion;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FindData -- PKEY_FindData</para>
+ /// <para>Description: WIN32_FIND_DATAW in buffer of bytes.
+ ///</para>
+ /// <para>Type: Buffer -- VT_VECTOR | VT_UI1 (For variants: VT_ARRAY | VT_UI1)</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 0 (PID_FINDDATA)</para>
+ /// </summary>
+ public ShellProperty<Byte[]> FindData
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.FindData;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FlagColor -- PKEY_FlagColor</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {67DF94DE-0CA7-4D6F-B792-053A3E4F03CF}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt16?> FlagColor
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.FlagColor;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt16?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt16?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FlagColorText -- PKEY_FlagColorText</para>
+ /// <para>Description: This is the user-friendly form of System.FlagColor. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {45EAE747-8E2A-40AE-8CBF-CA52ABA6152A}, 100</para>
+ /// </summary>
+ public ShellProperty<String> FlagColorText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.FlagColorText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FlagStatus -- PKEY_FlagStatus</para>
+ /// <para>Description: Status of Flag. Values: (0=none 1=white 2=Red). cdoPR_FLAG_STATUS
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 12</para>
+ /// </summary>
+ public ShellProperty<Int32?> FlagStatus
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.FlagStatus;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FlagStatusText -- PKEY_FlagStatusText</para>
+ /// <para>Description: This is the user-friendly form of System.FlagStatus. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {DC54FD2E-189D-4871-AA01-08C2F57A4ABC}, 100</para>
+ /// </summary>
+ public ShellProperty<String> FlagStatusText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.FlagStatusText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FreeSpace -- PKEY_FreeSpace</para>
+ /// <para>Description: The amount of free space in bytes.
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 2 (PID_VOLUME_FREE) (Filesystem Volume Properties)</para>
+ /// </summary>
+ public ShellProperty<UInt64?> FreeSpace
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.FreeSpace;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt64?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt64?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FullText -- PKEY_FullText</para>
+ /// <para>Description: This PKEY is used to specify search terms that should be applied as broadly as possible,
+ ///across all valid properties for the data source(s) being searched. It should not be
+ ///emitted from a data source.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {1E3EE840-BC2B-476C-8237-2ACD1A839B22}, 6</para>
+ /// </summary>
+ public ShellProperty<String> FullText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.FullText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Identity -- PKEY_Identity</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {A26F4AFC-7346-4299-BE47-EB1AE613139F}, 100</para>
+ /// </summary>
+ public ShellProperty<String> IdentityProperty
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.IdentityProperty;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ImageParsingName -- PKEY_ImageParsingName</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {D7750EE0-C6A4-48EC-B53E-B87B52E6D073}, 100</para>
+ /// </summary>
+ public ShellProperty<String[]> ImageParsingName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ImageParsingName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Importance -- PKEY_Importance</para>
+ /// <para>Description: </para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 11</para>
+ /// </summary>
+ public ShellProperty<Int32?> Importance
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Importance;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ImportanceText -- PKEY_ImportanceText</para>
+ /// <para>Description: This is the user-friendly form of System.Importance. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {A3B29791-7713-4E1D-BB40-17DB85F01831}, 100</para>
+ /// </summary>
+ public ShellProperty<String> ImportanceText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ImportanceText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.InfoTipText -- PKEY_InfoTipText</para>
+ /// <para>Description: The text (with formatted property values) to show in the infotip.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 17</para>
+ /// </summary>
+ public ShellProperty<String> InfoTipText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.InfoTipText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.InternalName -- PKEY_InternalName</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 5 (PIDVSI_InternalName)</para>
+ /// </summary>
+ public ShellProperty<String> InternalName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.InternalName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsAttachment -- PKEY_IsAttachment</para>
+ /// <para>Description: Identifies if this item is an attachment.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {F23F425C-71A1-4FA8-922F-678EA4A60408}, 100</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsAttachment
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.IsAttachment;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsDefaultNonOwnerSaveLocation -- PKEY_IsDefaultNonOwnerSaveLocation</para>
+ /// <para>Description: Identifies the default save location for a library for non-owners of the library
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 5</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsDefaultNonOwnerSaveLocation
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.IsDefaultNonOwnerSaveLocation;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsDefaultSaveLocation -- PKEY_IsDefaultSaveLocation</para>
+ /// <para>Description: Identifies the default save location for a library for the owner of the library
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 3</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsDefaultSaveLocation
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.IsDefaultSaveLocation;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsDeleted -- PKEY_IsDeleted</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {5CDA5FC8-33EE-4FF3-9094-AE7BD8868C4D}, 100</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsDeleted
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.IsDeleted;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsEncrypted -- PKEY_IsEncrypted</para>
+ /// <para>Description: Is the item encrypted?
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {90E5E14E-648B-4826-B2AA-ACAF790E3513}, 10</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsEncrypted
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.IsEncrypted;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsFlagged -- PKEY_IsFlagged</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {5DA84765-E3FF-4278-86B0-A27967FBDD03}, 100</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsFlagged
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.IsFlagged;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsFlaggedComplete -- PKEY_IsFlaggedComplete</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {A6F360D2-55F9-48DE-B909-620E090A647C}, 100</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsFlaggedComplete
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.IsFlaggedComplete;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsIncomplete -- PKEY_IsIncomplete</para>
+ /// <para>Description: Identifies if the message was not completely received for some error condition.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {346C8BD1-2E6A-4C45-89A4-61B78E8E700F}, 100</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsIncomplete
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.IsIncomplete;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsLocationSupported -- PKEY_IsLocationSupported</para>
+ /// <para>Description: A bool value to know if a location is supported (locally indexable, or remotely indexed).
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 8</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsLocationSupported
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.IsLocationSupported;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsPinnedToNameSpaceTree -- PKEY_IsPinnedToNameSpaceTree</para>
+ /// <para>Description: A bool value to know if a shell folder is pinned to the navigation pane
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 2</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsPinnedToNamespaceTree
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.IsPinnedToNamespaceTree;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsRead -- PKEY_IsRead</para>
+ /// <para>Description: Has the item been read?
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 10</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsRead
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.IsRead;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsSearchOnlyItem -- PKEY_IsSearchOnlyItem</para>
+ /// <para>Description: Identifies if a location or a library is search only
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 4</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsSearchOnlyItem
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.IsSearchOnlyItem;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsSendToTarget -- PKEY_IsSendToTarget</para>
+ /// <para>Description: Provided by certain shell folders. Return TRUE if the folder is a valid Send To target.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 33</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsSendToTarget
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.IsSendToTarget;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsShared -- PKEY_IsShared</para>
+ /// <para>Description: Is this item shared? This only checks for ACLs that are not inherited.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {EF884C5B-2BFE-41BB-AAE5-76EEDF4F9902}, 100</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsShared
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.IsShared;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemAuthors -- PKEY_ItemAuthors</para>
+ /// <para>Description: This is the generic list of authors associated with an item.
+ ///
+ ///For example, the artist name for a track is the item author.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {D0A04F0A-462A-48A4-BB2F-3706E88DBD7D}, 100</para>
+ /// </summary>
+ public ShellProperty<String[]> ItemAuthors
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ItemAuthors;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemClassType -- PKEY_ItemClassType</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {048658AD-2DB8-41A4-BBB6-AC1EF1207EB1}, 100</para>
+ /// </summary>
+ public ShellProperty<String> ItemClassType
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ItemClassType;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemDate -- PKEY_ItemDate</para>
+ /// <para>Description: This is the main date for an item. The date of interest.
+ ///
+ ///For example, for photos this maps to System.Photo.DateTaken.
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {F7DB74B4-4287-4103-AFBA-F1B13DCD75CF}, 100</para>
+ /// </summary>
+ public ShellProperty<DateTime?> ItemDate
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ItemDate;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemFolderNameDisplay -- PKEY_ItemFolderNameDisplay</para>
+ /// <para>Description: This is the user-friendly display name of the parent folder of an item.
+ ///
+ ///If System.ItemFolderPathDisplay is VT_EMPTY, then this property should be too. Otherwise, it
+ ///should be derived appropriately by the data source from System.ItemFolderPathDisplay.
+ ///
+ ///If the folder is a file folder, the value will be localized if a localized name is available.
+ ///
+ ///Example values:
+ ///
+ /// If the path is... The property value is...
+ /// ----------------- ------------------------
+ /// "c:\foo\bar\hello.txt" "bar"
+ /// "\\server\share\mydir\goodnews.doc" "mydir"
+ /// "\\server\share\numbers.xls" "share"
+ /// "c:\foo\MyFolder" "foo"
+ /// "/Mailbox Account/Inbox/'Re: Hello!'" "Inbox"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 2 (PID_STG_DIRECTORY)</para>
+ /// </summary>
+ public ShellProperty<String> ItemFolderNameDisplay
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ItemFolderNameDisplay;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemFolderPathDisplay -- PKEY_ItemFolderPathDisplay</para>
+ /// <para>Description: This is the user-friendly display path of the parent folder of an item.
+ ///
+ ///If System.ItemPathDisplay is VT_EMPTY, then this property should be too. Otherwise, it should
+ ///be derived appropriately by the data source from System.ItemPathDisplay.
+ ///
+ ///Example values:
+ ///
+ /// If the path is... The property value is...
+ /// ----------------- ------------------------
+ /// "c:\foo\bar\hello.txt" "c:\foo\bar"
+ /// "\\server\share\mydir\goodnews.doc" "\\server\share\mydir"
+ /// "\\server\share\numbers.xls" "\\server\share"
+ /// "c:\foo\MyFolder" "c:\foo"
+ /// "/Mailbox Account/Inbox/'Re: Hello!'" "/Mailbox Account/Inbox"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 6</para>
+ /// </summary>
+ public ShellProperty<String> ItemFolderPathDisplay
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ItemFolderPathDisplay;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemFolderPathDisplayNarrow -- PKEY_ItemFolderPathDisplayNarrow</para>
+ /// <para>Description: This is the user-friendly display path of the parent folder of an item. The format of the string
+ ///should be tailored such that the folder name comes first, to optimize for a narrow viewing column.
+ ///
+ ///If the folder is a file folder, the value includes localized names if they are present.
+ ///
+ ///If System.ItemFolderPathDisplay is VT_EMPTY, then this property should be too. Otherwise, it should
+ ///be derived appropriately by the data source from System.ItemFolderPathDisplay.
+ ///
+ ///Example values:
+ ///
+ /// If the path is... The property value is...
+ /// ----------------- ------------------------
+ /// "c:\foo\bar\hello.txt" "bar (c:\foo)"
+ /// "\\server\share\mydir\goodnews.doc" "mydir (\\server\share)"
+ /// "\\server\share\numbers.xls" "share (\\server)"
+ /// "c:\foo\MyFolder" "foo (c:\)"
+ /// "/Mailbox Account/Inbox/'Re: Hello!'" "Inbox (/Mailbox Account)"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {DABD30ED-0043-4789-A7F8-D013A4736622}, 100</para>
+ /// </summary>
+ public ShellProperty<String> ItemFolderPathDisplayNarrow
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ItemFolderPathDisplayNarrow;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemName -- PKEY_ItemName</para>
+ /// <para>Description: This is the base-name of the System.ItemNameDisplay.
+ ///
+ ///If the item is a file this property
+ ///includes the extension in all cases, and will be localized if a localized name is available.
+ ///
+ ///If the item is a message, then the value of this property does not include the forwarding or
+ ///reply prefixes (see System.ItemNamePrefix).
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {6B8DA074-3B5C-43BC-886F-0A2CDCE00B6F}, 100</para>
+ /// </summary>
+ public ShellProperty<String> ItemName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ItemName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemNameDisplay -- PKEY_ItemNameDisplay</para>
+ /// <para>Description: This is the display name in "most complete" form. This is the best effort unique representation
+ ///of the name of an item that makes sense for end users to read. It is the concatentation of
+ ///System.ItemNamePrefix and System.ItemName.
+ ///
+ ///If the item is a file this property
+ ///includes the extension in all cases, and will be localized if a localized name is available.
+ ///
+ ///There are acceptable cases when System.FileName is not VT_EMPTY, yet the value of this property
+ ///is completely different. Email messages are a key example. If the item is an email message,
+ ///the item name is likely the subject. In that case, the value must be the concatenation of the
+ ///System.ItemNamePrefix and System.ItemName. Since the value of System.ItemNamePrefix excludes
+ ///any trailing whitespace, the concatenation must include a whitespace when generating System.ItemNameDisplay.
+ ///
+ ///Note that this property is not guaranteed to be unique, but the idea is to promote the most likely
+ ///candidate that can be unique and also makes sense for end users. For example, for documents, you
+ ///might think about using System.Title as the System.ItemNameDisplay, but in practice the title of
+ ///the documents may not be useful or unique enough to be of value as the sole System.ItemNameDisplay.
+ ///Instead, providing the value of System.FileName as the value of System.ItemNameDisplay is a better
+ ///candidate. In Windows Mail, the emails are stored in the file system as .eml files and the
+ ///System.FileName for those files are not human-friendly as they contain GUIDs. In this example,
+ ///promoting System.Subject as System.ItemNameDisplay makes more sense.
+ ///
+ ///Compatibility notes:
+ ///
+ ///Shell folder implementations on Vista: use PKEY_ItemNameDisplay for the name column when
+ ///you want Explorer to call ISF::GetDisplayNameOf(SHGDN_NORMAL) to get the value of the name. Use
+ ///another PKEY (like PKEY_ItemName) when you want Explorer to call either the folder's property store or
+ ///ISF2::GetDetailsEx in order to get the value of the name.
+ ///
+ ///Shell folder implementations on XP: the first column needs to be the name column, and Explorer
+ ///will call ISF::GetDisplayNameOf to get the value of the name. The PKEY/SCID does not matter.
+ ///
+ ///Example values:
+ ///
+ /// File: "hello.txt"
+ /// Message: "Re: Let's talk about Tom's argyle socks!"
+ /// Device folder: "song.wma"
+ /// Folder: "Documents"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 10 (PID_STG_NAME)</para>
+ /// </summary>
+ public ShellProperty<String> ItemNameDisplay
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ItemNameDisplay;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemNamePrefix -- PKEY_ItemNamePrefix</para>
+ /// <para>Description: This is the prefix of an item, used for email messages.
+ ///where the subject begins with "Re:" which is the prefix.
+ ///
+ ///If the item is a file, then the value of this property is VT_EMPTY.
+ ///
+ ///If the item is a message, then the value of this property is the forwarding or reply
+ ///prefixes (including delimiting colon, but no whitespace), or VT_EMPTY if there is no prefix.
+ ///
+ ///Example values:
+ ///
+ ///System.ItemNamePrefix System.ItemName System.ItemNameDisplay
+ ///--------------------- ------------------- ----------------------
+ ///VT_EMPTY "Great day" "Great day"
+ ///"Re:" "Great day" "Re: Great day"
+ ///"Fwd: " "Monthly budget" "Fwd: Monthly budget"
+ ///VT_EMPTY "accounts.xls" "accounts.xls"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {D7313FF1-A77A-401C-8C99-3DBDD68ADD36}, 100</para>
+ /// </summary>
+ public ShellProperty<String> ItemNamePrefix
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ItemNamePrefix;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemParticipants -- PKEY_ItemParticipants</para>
+ /// <para>Description: This is the generic list of people associated with an item and who contributed
+ ///to the item.
+ ///
+ ///For example, this is the combination of people in the To list, Cc list and
+ ///sender of an email message.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {D4D0AA16-9948-41A4-AA85-D97FF9646993}, 100</para>
+ /// </summary>
+ public ShellProperty<String[]> ItemParticipants
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ItemParticipants;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemPathDisplay -- PKEY_ItemPathDisplay</para>
+ /// <para>Description: This is the user-friendly display path to the item.
+ ///
+ ///If the item is a file or folder this property
+ ///includes the extension in all cases, and will be localized if a localized name is available.
+ ///
+ ///For other items,this is the user-friendly equivalent, assuming the item exists in hierarchical storage.
+ ///
+ ///Unlike System.ItemUrl, this property value does not include the URL scheme.
+ ///
+ ///To parse an item path, use System.ItemUrl or System.ParsingPath. To reference shell
+ ///namespace items using shell APIs, use System.ParsingPath.
+ ///
+ ///Example values:
+ ///
+ /// If the path is... The property value is...
+ /// ----------------- ------------------------
+ /// "c:\foo\bar\hello.txt" "c:\foo\bar\hello.txt"
+ /// "\\server\share\mydir\goodnews.doc" "\\server\share\mydir\goodnews.doc"
+ /// "\\server\share\numbers.xls" "\\server\share\numbers.xls"
+ /// "c:\foo\MyFolder" "c:\foo\MyFolder"
+ /// "/Mailbox Account/Inbox/'Re: Hello!'" "/Mailbox Account/Inbox/'Re: Hello!'"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 7</para>
+ /// </summary>
+ public ShellProperty<String> ItemPathDisplay
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ItemPathDisplay;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemPathDisplayNarrow -- PKEY_ItemPathDisplayNarrow</para>
+ /// <para>Description: This is the user-friendly display path to the item. The format of the string should be
+ ///tailored such that the name comes first, to optimize for a narrow viewing column.
+ ///
+ ///If the item is a file, the value excludes the file extension, and includes localized names if they are present.
+ ///If the item is a message, the value includes the System.ItemNamePrefix.
+ ///
+ ///To parse an item path, use System.ItemUrl or System.ParsingPath.
+ ///
+ ///Example values:
+ ///
+ /// If the path is... The property value is...
+ /// ----------------- ------------------------
+ /// "c:\foo\bar\hello.txt" "hello (c:\foo\bar)"
+ /// "\\server\share\mydir\goodnews.doc" "goodnews (\\server\share\mydir)"
+ /// "\\server\share\folder" "folder (\\server\share)"
+ /// "c:\foo\MyFolder" "MyFolder (c:\foo)"
+ /// "/Mailbox Account/Inbox/'Re: Hello!'" "Re: Hello! (/Mailbox Account/Inbox)"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 8</para>
+ /// </summary>
+ public ShellProperty<String> ItemPathDisplayNarrow
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ItemPathDisplayNarrow;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemType -- PKEY_ItemType</para>
+ /// <para>Description: This is the canonical type of the item and is intended to be programmatically
+ ///parsed.
+ ///
+ ///If there is no canonical type, the value is VT_EMPTY.
+ ///
+ ///If the item is a file (ie, System.FileName is not VT_EMPTY), the value is the same as
+ ///System.FileExtension.
+ ///
+ ///Use System.ItemTypeText when you want to display the type to end users in a view. (If
+ /// the item is a file, passing the System.ItemType value to PSFormatForDisplay will
+ /// result in the same value as System.ItemTypeText.)
+ ///
+ ///Example values:
+ ///
+ /// If the path is... The property value is...
+ /// ----------------- ------------------------
+ /// "c:\foo\bar\hello.txt" ".txt"
+ /// "\\server\share\mydir\goodnews.doc" ".doc"
+ /// "\\server\share\folder" "Directory"
+ /// "c:\foo\MyFolder" "Directory"
+ /// [desktop] "Folder"
+ /// "/Mailbox Account/Inbox/'Re: Hello!'" "MAPI/IPM.Message"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 11</para>
+ /// </summary>
+ public ShellProperty<String> ItemType
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ItemType;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemTypeText -- PKEY_ItemTypeText</para>
+ /// <para>Description: This is the user friendly type name of the item. This is not intended to be
+ ///programmatically parsed.
+ ///
+ ///If System.ItemType is VT_EMPTY, the value of this property is also VT_EMPTY.
+ ///
+ ///If the item is a file, the value of this property is the same as if you passed the
+ ///file's System.ItemType value to PSFormatForDisplay.
+ ///
+ ///This property should not be confused with System.Kind, where System.Kind is a high-level
+ ///user friendly kind name. For example, for a document, System.Kind = "Document" and
+ ///System.Item.Type = ".doc" and System.Item.TypeText = "Microsoft Word Document"
+ ///
+ ///Example values:
+ ///
+ /// If the path is... The property value is...
+ /// ----------------- ------------------------
+ /// "c:\foo\bar\hello.txt" "Text File"
+ /// "\\server\share\mydir\goodnews.doc" "Microsoft Word Document"
+ /// "\\server\share\folder" "File Folder"
+ /// "c:\foo\MyFolder" "File Folder"
+ /// "/Mailbox Account/Inbox/'Re: Hello!'" "Outlook E-Mail Message"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 4 (PID_STG_STORAGETYPE)</para>
+ /// </summary>
+ public ShellProperty<String> ItemTypeText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ItemTypeText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemUrl -- PKEY_ItemUrl</para>
+ /// <para>Description: This always represents a well formed URL that points to the item.
+ ///
+ ///To reference shell namespace items using shell APIs, use System.ParsingPath.
+ ///
+ ///Example values:
+ ///
+ /// Files: "file:///c:/foo/bar/hello.txt"
+ /// "csc://{GUID}/..."
+ /// Messages: "mapi://..."
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_Query) {49691C90-7E17-101A-A91C-08002B2ECDA9}, 9 (DISPID_QUERY_VIRTUALPATH)</para>
+ /// </summary>
+ public ShellProperty<String> ItemUrl
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ItemUrl;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Keywords -- PKEY_Keywords</para>
+ /// <para>Description: The keywords for the item. Also referred to as tags.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) Legacy code may treat this as VT_LPSTR.</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 5 (PIDSI_KEYWORDS)</para>
+ /// </summary>
+ public ShellProperty<String[]> Keywords
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Keywords;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Kind -- PKEY_Kind</para>
+ /// <para>Description: System.Kind is used to map extensions to various .Search folders.
+ ///Extensions are mapped to Kinds at HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\KindMap
+ ///The list of kinds is not extensible.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {1E3EE840-BC2B-476C-8237-2ACD1A839B22}, 3</para>
+ /// </summary>
+ public ShellProperty<String[]> Kind
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Kind;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.KindText -- PKEY_KindText</para>
+ /// <para>Description: This is the user-friendly form of System.Kind. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {F04BEF95-C585-4197-A2B7-DF46FDC9EE6D}, 100</para>
+ /// </summary>
+ public ShellProperty<String> KindText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.KindText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Language -- PKEY_Language</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 28</para>
+ /// </summary>
+ public ShellProperty<String> Language
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Language;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.MileageInformation -- PKEY_MileageInformation</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {FDF84370-031A-4ADD-9E91-0D775F1C6605}, 100</para>
+ /// </summary>
+ public ShellProperty<String> MileageInformation
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.MileageInformation;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.MIMEType -- PKEY_MIMEType</para>
+ /// <para>Description: The MIME type. Eg, for EML files: 'message/rfc822'.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {0B63E350-9CCC-11D0-BCDB-00805FCCCE04}, 5</para>
+ /// </summary>
+ public ShellProperty<String> MIMEType
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.MIMEType;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.NamespaceCLSID -- PKEY_NamespaceCLSID</para>
+ /// <para>Description: The CLSID of the name space extension for an item, the object that implements IShellFolder for this item
+ ///</para>
+ /// <para>Type: Guid -- VT_CLSID</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 6</para>
+ /// </summary>
+ public ShellProperty<IntPtr?> NamespaceClsid
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.NamespaceClsid;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<IntPtr?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<IntPtr?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Null -- PKEY_Null</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {00000000-0000-0000-0000-000000000000}, 0</para>
+ /// </summary>
+ public ShellProperty<Object> Null
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Null;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.OfflineAvailability -- PKEY_OfflineAvailability</para>
+ /// <para>Description: </para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {A94688B6-7D9F-4570-A648-E3DFC0AB2B3F}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> OfflineAvailability
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.OfflineAvailability;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.OfflineStatus -- PKEY_OfflineStatus</para>
+ /// <para>Description: </para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {6D24888F-4718-4BDA-AFED-EA0FB4386CD8}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> OfflineStatus
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.OfflineStatus;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.OriginalFileName -- PKEY_OriginalFileName</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 6</para>
+ /// </summary>
+ public ShellProperty<String> OriginalFileName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.OriginalFileName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.OwnerSID -- PKEY_OwnerSID</para>
+ /// <para>Description: SID of the user that owns the library.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 6</para>
+ /// </summary>
+ public ShellProperty<String> OwnerSid
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.OwnerSid;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ParentalRating -- PKEY_ParentalRating</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 21 (PIDMSI_PARENTAL_RATING)</para>
+ /// </summary>
+ public ShellProperty<String> ParentalRating
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ParentalRating;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ParentalRatingReason -- PKEY_ParentalRatingReason</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {10984E0A-F9F2-4321-B7EF-BAF195AF4319}, 100</para>
+ /// </summary>
+ public ShellProperty<String> ParentalRatingReason
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ParentalRatingReason;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ParentalRatingsOrganization -- PKEY_ParentalRatingsOrganization</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {A7FE0840-1344-46F0-8D37-52ED712A4BF9}, 100</para>
+ /// </summary>
+ public ShellProperty<String> ParentalRatingsOrganization
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ParentalRatingsOrganization;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ParsingBindContext -- PKEY_ParsingBindContext</para>
+ /// <para>Description: used to get the IBindCtx for an item for parsing
+ ///</para>
+ /// <para>Type: Any -- VT_NULL Legacy code may treat this as VT_UNKNOWN.</para>
+ /// <para>FormatID: {DFB9A04D-362F-4CA3-B30B-0254B17B5B84}, 100</para>
+ /// </summary>
+ public ShellProperty<Object> ParsingBindContext
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ParsingBindContext;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ParsingName -- PKEY_ParsingName</para>
+ /// <para>Description: The shell namespace name of an item relative to a parent folder. This name may be passed to
+ ///IShellFolder::ParseDisplayName() of the parent shell folder.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 24</para>
+ /// </summary>
+ public ShellProperty<String> ParsingName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ParsingName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ParsingPath -- PKEY_ParsingPath</para>
+ /// <para>Description: This is the shell namespace path to the item. This path may be passed to
+ ///SHParseDisplayName to parse the path to the correct shell folder.
+ ///
+ ///If the item is a file, the value is identical to System.ItemPathDisplay.
+ ///
+ ///If the item cannot be accessed through the shell namespace, this value is VT_EMPTY.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 30</para>
+ /// </summary>
+ public ShellProperty<String> ParsingPath
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ParsingPath;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PerceivedType -- PKEY_PerceivedType</para>
+ /// <para>Description: The perceived type of a shell item, based upon its canonical type.
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 9</para>
+ /// </summary>
+ public ShellProperty<Int32?> PerceivedType
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PerceivedType;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PercentFull -- PKEY_PercentFull</para>
+ /// <para>Description: The amount filled as a percentage, multiplied by 100 (ie, the valid range is 0 through 100).
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 5 (Filesystem Volume Properties)</para>
+ /// </summary>
+ public ShellProperty<UInt32?> PercentFull
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PercentFull;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Priority -- PKEY_Priority</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {9C1FCF74-2D97-41BA-B4AE-CB2E3661A6E4}, 5</para>
+ /// </summary>
+ public ShellProperty<UInt16?> Priority
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Priority;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt16?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt16?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PriorityText -- PKEY_PriorityText</para>
+ /// <para>Description: This is the user-friendly form of System.Priority. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {D98BE98B-B86B-4095-BF52-9D23B2E0A752}, 100</para>
+ /// </summary>
+ public ShellProperty<String> PriorityText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PriorityText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Project -- PKEY_Project</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {39A7F922-477C-48DE-8BC8-B28441E342E3}, 100</para>
+ /// </summary>
+ public ShellProperty<String> Project
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Project;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ProviderItemID -- PKEY_ProviderItemID</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {F21D9941-81F0-471A-ADEE-4E74B49217ED}, 100</para>
+ /// </summary>
+ public ShellProperty<String> ProviderItemID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ProviderItemID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Rating -- PKEY_Rating</para>
+ /// <para>Description: Indicates the users preference rating of an item on a scale of 1-99 (1-12 = One Star,
+ ///13-37 = Two Stars, 38-62 = Three Stars, 63-87 = Four Stars, 88-99 = Five Stars).
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 9 (PIDMSI_RATING)</para>
+ /// </summary>
+ public ShellProperty<UInt32?> Rating
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Rating;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RatingText -- PKEY_RatingText</para>
+ /// <para>Description: This is the user-friendly form of System.Rating. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {90197CA7-FD8F-4E8C-9DA3-B57E1E609295}, 100</para>
+ /// </summary>
+ public ShellProperty<String> RatingText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.RatingText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sensitivity -- PKEY_Sensitivity</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {F8D3F6AC-4874-42CB-BE59-AB454B30716A}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt16?> Sensitivity
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Sensitivity;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt16?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt16?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.SensitivityText -- PKEY_SensitivityText</para>
+ /// <para>Description: This is the user-friendly form of System.Sensitivity. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {D0C7F054-3F72-4725-8527-129A577CB269}, 100</para>
+ /// </summary>
+ public ShellProperty<String> SensitivityText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.SensitivityText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.SFGAOFlags -- PKEY_SFGAOFlags</para>
+ /// <para>Description: IShellFolder::GetAttributesOf flags, with SFGAO_PKEYSFGAOMASK attributes masked out.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 25</para>
+ /// </summary>
+ public ShellProperty<UInt32?> SFGAOFlags
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.SFGAOFlags;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.SharedWith -- PKEY_SharedWith</para>
+ /// <para>Description: Who is the item shared with?
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {EF884C5B-2BFE-41BB-AAE5-76EEDF4F9902}, 200</para>
+ /// </summary>
+ public ShellProperty<String[]> SharedWith
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.SharedWith;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ShareUserRating -- PKEY_ShareUserRating</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 12 (PIDMSI_SHARE_USER_RATING)</para>
+ /// </summary>
+ public ShellProperty<UInt32?> ShareUserRating
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ShareUserRating;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.SharingStatus -- PKEY_SharingStatus</para>
+ /// <para>Description: What is the item's sharing status (not shared, shared, everyone (homegroup or everyone), or private)?
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {EF884C5B-2BFE-41BB-AAE5-76EEDF4F9902}, 300</para>
+ /// </summary>
+ public ShellProperty<UInt32?> SharingStatus
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.SharingStatus;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.SimpleRating -- PKEY_SimpleRating</para>
+ /// <para>Description: Indicates the users preference rating of an item on a scale of 0-5 (0=unrated, 1=One Star, 2=Two Stars, 3=Three Stars,
+ ///4=Four Stars, 5=Five Stars)
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {A09F084E-AD41-489F-8076-AA5BE3082BCA}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> SimpleRating
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.SimpleRating;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Size -- PKEY_Size</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 12 (PID_STG_SIZE)</para>
+ /// </summary>
+ public ShellProperty<UInt64?> Size
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Size;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt64?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt64?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.SoftwareUsed -- PKEY_SoftwareUsed</para>
+ /// <para>Description: PropertyTagSoftwareUsed
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 305</para>
+ /// </summary>
+ public ShellProperty<String> SoftwareUsed
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.SoftwareUsed;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.SourceItem -- PKEY_SourceItem</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {668CDFA5-7A1B-4323-AE4B-E527393A1D81}, 100</para>
+ /// </summary>
+ public ShellProperty<String> SourceItem
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.SourceItem;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.StartDate -- PKEY_StartDate</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {48FD6EC8-8A12-4CDF-A03E-4EC5A511EDDE}, 100</para>
+ /// </summary>
+ public ShellProperty<DateTime?> StartDate
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.StartDate;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Status -- PKEY_Status</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_IntSite) {000214A1-0000-0000-C000-000000000046}, 9</para>
+ /// </summary>
+ public ShellProperty<String> Status
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Status;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Subject -- PKEY_Subject</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 3 (PIDSI_SUBJECT)</para>
+ /// </summary>
+ public ShellProperty<String> Subject
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Subject;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Thumbnail -- PKEY_Thumbnail</para>
+ /// <para>Description: A data that represents the thumbnail in VT_CF format.
+ ///</para>
+ /// <para>Type: Clipboard -- VT_CF</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 17 (PIDSI_THUMBNAIL)</para>
+ /// </summary>
+ public ShellProperty<IntPtr?> Thumbnail
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Thumbnail;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<IntPtr?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<IntPtr?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ThumbnailCacheId -- PKEY_ThumbnailCacheId</para>
+ /// <para>Description: Unique value that can be used as a key to cache thumbnails. The value changes when the name, volume, or data modified
+ ///of an item changes.
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: {446D16B1-8DAD-4870-A748-402EA43D788C}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt64?> ThumbnailCacheId
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ThumbnailCacheId;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt64?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt64?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ThumbnailStream -- PKEY_ThumbnailStream</para>
+ /// <para>Description: Data that represents the thumbnail in VT_STREAM format that GDI+/WindowsCodecs supports (jpg, png, etc).
+ ///</para>
+ /// <para>Type: Stream -- VT_STREAM</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 27</para>
+ /// </summary>
+ public ShellProperty<IStream> ThumbnailStream
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.ThumbnailStream;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<IStream>(key));
+ }
+
+ return hashtable[key] as ShellProperty<IStream>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Title -- PKEY_Title</para>
+ /// <para>Description: Title of item.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR) Legacy code may treat this as VT_LPSTR.</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 2 (PIDSI_TITLE)</para>
+ /// </summary>
+ public ShellProperty<String> Title
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Title;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.TotalFileSize -- PKEY_TotalFileSize</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 14</para>
+ /// </summary>
+ public ShellProperty<UInt64?> TotalFileSize
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.TotalFileSize;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt64?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt64?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Trademarks -- PKEY_Trademarks</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 9 (PIDVSI_Trademarks)</para>
+ /// </summary>
+ public ShellProperty<String> Trademarks
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Trademarks;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ private PropertySystemAppUserModel internalPropertySystemAppUserModel;
+ /// <summary>
+ /// System.AppUserModel Properties
+ /// </summary>
+ public PropertySystemAppUserModel AppUserModel
+ {
+ get
+ {
+ if (internalPropertySystemAppUserModel == null)
+ {
+ internalPropertySystemAppUserModel = new PropertySystemAppUserModel(shellObjectParent);
+ }
+
+ return internalPropertySystemAppUserModel;
+ }
+ }
+ private PropertySystemAudio internalPropertySystemAudio;
+ /// <summary>
+ /// System.Audio Properties
+ /// </summary>
+ public PropertySystemAudio Audio
+ {
+ get
+ {
+ if (internalPropertySystemAudio == null)
+ {
+ internalPropertySystemAudio = new PropertySystemAudio(shellObjectParent);
+ }
+
+ return internalPropertySystemAudio;
+ }
+ }
+ private PropertySystemCalendar internalPropertySystemCalendar;
+ /// <summary>
+ /// System.Calendar Properties
+ /// </summary>
+ public PropertySystemCalendar Calendar
+ {
+ get
+ {
+ if (internalPropertySystemCalendar == null)
+ {
+ internalPropertySystemCalendar = new PropertySystemCalendar(shellObjectParent);
+ }
+
+ return internalPropertySystemCalendar;
+ }
+ }
+ private PropertySystemCommunication internalPropertySystemCommunication;
+ /// <summary>
+ /// System.Communication Properties
+ /// </summary>
+ public PropertySystemCommunication Communication
+ {
+ get
+ {
+ if (internalPropertySystemCommunication == null)
+ {
+ internalPropertySystemCommunication = new PropertySystemCommunication(shellObjectParent);
+ }
+
+ return internalPropertySystemCommunication;
+ }
+ }
+ private PropertySystemComputer internalPropertySystemComputer;
+ /// <summary>
+ /// System.Computer Properties
+ /// </summary>
+ public PropertySystemComputer Computer
+ {
+ get
+ {
+ if (internalPropertySystemComputer == null)
+ {
+ internalPropertySystemComputer = new PropertySystemComputer(shellObjectParent);
+ }
+
+ return internalPropertySystemComputer;
+ }
+ }
+ private PropertySystemContact internalPropertySystemContact;
+ /// <summary>
+ /// System.Contact Properties
+ /// </summary>
+ public PropertySystemContact Contact
+ {
+ get
+ {
+ if (internalPropertySystemContact == null)
+ {
+ internalPropertySystemContact = new PropertySystemContact(shellObjectParent);
+ }
+
+ return internalPropertySystemContact;
+ }
+ }
+ private PropertySystemDevice internalPropertySystemDevice;
+ /// <summary>
+ /// System.Device Properties
+ /// </summary>
+ public PropertySystemDevice Device
+ {
+ get
+ {
+ if (internalPropertySystemDevice == null)
+ {
+ internalPropertySystemDevice = new PropertySystemDevice(shellObjectParent);
+ }
+
+ return internalPropertySystemDevice;
+ }
+ }
+ private PropertySystemDeviceInterface internalPropertySystemDeviceInterface;
+ /// <summary>
+ /// System.DeviceInterface Properties
+ /// </summary>
+ public PropertySystemDeviceInterface DeviceInterface
+ {
+ get
+ {
+ if (internalPropertySystemDeviceInterface == null)
+ {
+ internalPropertySystemDeviceInterface = new PropertySystemDeviceInterface(shellObjectParent);
+ }
+
+ return internalPropertySystemDeviceInterface;
+ }
+ }
+ private PropertySystemDevices internalPropertySystemDevices;
+ /// <summary>
+ /// System.Devices Properties
+ /// </summary>
+ public PropertySystemDevices Devices
+ {
+ get
+ {
+ if (internalPropertySystemDevices == null)
+ {
+ internalPropertySystemDevices = new PropertySystemDevices(shellObjectParent);
+ }
+
+ return internalPropertySystemDevices;
+ }
+ }
+ private PropertySystemDocument internalPropertySystemDocument;
+ /// <summary>
+ /// System.Document Properties
+ /// </summary>
+ public PropertySystemDocument Document
+ {
+ get
+ {
+ if (internalPropertySystemDocument == null)
+ {
+ internalPropertySystemDocument = new PropertySystemDocument(shellObjectParent);
+ }
+
+ return internalPropertySystemDocument;
+ }
+ }
+ private PropertySystemDRM internalPropertySystemDRM;
+ /// <summary>
+ /// System.DRM Properties
+ /// </summary>
+ public PropertySystemDRM DRM
+ {
+ get
+ {
+ if (internalPropertySystemDRM == null)
+ {
+ internalPropertySystemDRM = new PropertySystemDRM(shellObjectParent);
+ }
+
+ return internalPropertySystemDRM;
+ }
+ }
+ private PropertySystemGPS internalPropertySystemGPS;
+ /// <summary>
+ /// System.GPS Properties
+ /// </summary>
+ public PropertySystemGPS GPS
+ {
+ get
+ {
+ if (internalPropertySystemGPS == null)
+ {
+ internalPropertySystemGPS = new PropertySystemGPS(shellObjectParent);
+ }
+
+ return internalPropertySystemGPS;
+ }
+ }
+ private PropertySystemIdentity internalPropertySystemIdentity;
+ /// <summary>
+ /// System.Identity Properties
+ /// </summary>
+ public PropertySystemIdentity Identity
+ {
+ get
+ {
+ if (internalPropertySystemIdentity == null)
+ {
+ internalPropertySystemIdentity = new PropertySystemIdentity(shellObjectParent);
+ }
+
+ return internalPropertySystemIdentity;
+ }
+ }
+ private PropertySystemIdentityProvider internalPropertySystemIdentityProvider;
+ /// <summary>
+ /// System.IdentityProvider Properties
+ /// </summary>
+ public PropertySystemIdentityProvider IdentityProvider
+ {
+ get
+ {
+ if (internalPropertySystemIdentityProvider == null)
+ {
+ internalPropertySystemIdentityProvider = new PropertySystemIdentityProvider(shellObjectParent);
+ }
+
+ return internalPropertySystemIdentityProvider;
+ }
+ }
+ private PropertySystemImage internalPropertySystemImage;
+ /// <summary>
+ /// System.Image Properties
+ /// </summary>
+ public PropertySystemImage Image
+ {
+ get
+ {
+ if (internalPropertySystemImage == null)
+ {
+ internalPropertySystemImage = new PropertySystemImage(shellObjectParent);
+ }
+
+ return internalPropertySystemImage;
+ }
+ }
+ private PropertySystemJournal internalPropertySystemJournal;
+ /// <summary>
+ /// System.Journal Properties
+ /// </summary>
+ public PropertySystemJournal Journal
+ {
+ get
+ {
+ if (internalPropertySystemJournal == null)
+ {
+ internalPropertySystemJournal = new PropertySystemJournal(shellObjectParent);
+ }
+
+ return internalPropertySystemJournal;
+ }
+ }
+ private PropertySystemLayoutPattern internalPropertySystemLayoutPattern;
+ /// <summary>
+ /// System.LayoutPattern Properties
+ /// </summary>
+ public PropertySystemLayoutPattern LayoutPattern
+ {
+ get
+ {
+ if (internalPropertySystemLayoutPattern == null)
+ {
+ internalPropertySystemLayoutPattern = new PropertySystemLayoutPattern(shellObjectParent);
+ }
+
+ return internalPropertySystemLayoutPattern;
+ }
+ }
+ private PropertySystemLink internalPropertySystemLink;
+ /// <summary>
+ /// System.Link Properties
+ /// </summary>
+ public PropertySystemLink Link
+ {
+ get
+ {
+ if (internalPropertySystemLink == null)
+ {
+ internalPropertySystemLink = new PropertySystemLink(shellObjectParent);
+ }
+
+ return internalPropertySystemLink;
+ }
+ }
+ private PropertySystemMedia internalPropertySystemMedia;
+ /// <summary>
+ /// System.Media Properties
+ /// </summary>
+ public PropertySystemMedia Media
+ {
+ get
+ {
+ if (internalPropertySystemMedia == null)
+ {
+ internalPropertySystemMedia = new PropertySystemMedia(shellObjectParent);
+ }
+
+ return internalPropertySystemMedia;
+ }
+ }
+ private PropertySystemMessage internalPropertySystemMessage;
+ /// <summary>
+ /// System.Message Properties
+ /// </summary>
+ public PropertySystemMessage Message
+ {
+ get
+ {
+ if (internalPropertySystemMessage == null)
+ {
+ internalPropertySystemMessage = new PropertySystemMessage(shellObjectParent);
+ }
+
+ return internalPropertySystemMessage;
+ }
+ }
+ private PropertySystemMusic internalPropertySystemMusic;
+ /// <summary>
+ /// System.Music Properties
+ /// </summary>
+ public PropertySystemMusic Music
+ {
+ get
+ {
+ if (internalPropertySystemMusic == null)
+ {
+ internalPropertySystemMusic = new PropertySystemMusic(shellObjectParent);
+ }
+
+ return internalPropertySystemMusic;
+ }
+ }
+ private PropertySystemNote internalPropertySystemNote;
+ /// <summary>
+ /// System.Note Properties
+ /// </summary>
+ public PropertySystemNote Note
+ {
+ get
+ {
+ if (internalPropertySystemNote == null)
+ {
+ internalPropertySystemNote = new PropertySystemNote(shellObjectParent);
+ }
+
+ return internalPropertySystemNote;
+ }
+ }
+ private PropertySystemPhoto internalPropertySystemPhoto;
+ /// <summary>
+ /// System.Photo Properties
+ /// </summary>
+ public PropertySystemPhoto Photo
+ {
+ get
+ {
+ if (internalPropertySystemPhoto == null)
+ {
+ internalPropertySystemPhoto = new PropertySystemPhoto(shellObjectParent);
+ }
+
+ return internalPropertySystemPhoto;
+ }
+ }
+ private PropertySystemPropGroup internalPropertySystemPropGroup;
+ /// <summary>
+ /// System.PropGroup Properties
+ /// </summary>
+ public PropertySystemPropGroup PropGroup
+ {
+ get
+ {
+ if (internalPropertySystemPropGroup == null)
+ {
+ internalPropertySystemPropGroup = new PropertySystemPropGroup(shellObjectParent);
+ }
+
+ return internalPropertySystemPropGroup;
+ }
+ }
+ private PropertySystemPropList internalPropertySystemPropList;
+ /// <summary>
+ /// System.PropList Properties
+ /// </summary>
+ public PropertySystemPropList PropList
+ {
+ get
+ {
+ if (internalPropertySystemPropList == null)
+ {
+ internalPropertySystemPropList = new PropertySystemPropList(shellObjectParent);
+ }
+
+ return internalPropertySystemPropList;
+ }
+ }
+ private PropertySystemRecordedTV internalPropertySystemRecordedTV;
+ /// <summary>
+ /// System.RecordedTV Properties
+ /// </summary>
+ public PropertySystemRecordedTV RecordedTV
+ {
+ get
+ {
+ if (internalPropertySystemRecordedTV == null)
+ {
+ internalPropertySystemRecordedTV = new PropertySystemRecordedTV(shellObjectParent);
+ }
+
+ return internalPropertySystemRecordedTV;
+ }
+ }
+ private PropertySystemSearch internalPropertySystemSearch;
+ /// <summary>
+ /// System.Search Properties
+ /// </summary>
+ public PropertySystemSearch Search
+ {
+ get
+ {
+ if (internalPropertySystemSearch == null)
+ {
+ internalPropertySystemSearch = new PropertySystemSearch(shellObjectParent);
+ }
+
+ return internalPropertySystemSearch;
+ }
+ }
+ private PropertySystemShell internalPropertySystemShell;
+ /// <summary>
+ /// System.Shell Properties
+ /// </summary>
+ public PropertySystemShell Shell
+ {
+ get
+ {
+ if (internalPropertySystemShell == null)
+ {
+ internalPropertySystemShell = new PropertySystemShell(shellObjectParent);
+ }
+
+ return internalPropertySystemShell;
+ }
+ }
+ private PropertySystemSoftware internalPropertySystemSoftware;
+ /// <summary>
+ /// System.Software Properties
+ /// </summary>
+ public PropertySystemSoftware Software
+ {
+ get
+ {
+ if (internalPropertySystemSoftware == null)
+ {
+ internalPropertySystemSoftware = new PropertySystemSoftware(shellObjectParent);
+ }
+
+ return internalPropertySystemSoftware;
+ }
+ }
+ private PropertySystemSync internalPropertySystemSync;
+ /// <summary>
+ /// System.Sync Properties
+ /// </summary>
+ public PropertySystemSync Sync
+ {
+ get
+ {
+ if (internalPropertySystemSync == null)
+ {
+ internalPropertySystemSync = new PropertySystemSync(shellObjectParent);
+ }
+
+ return internalPropertySystemSync;
+ }
+ }
+ private PropertySystemTask internalPropertySystemTask;
+ /// <summary>
+ /// System.Task Properties
+ /// </summary>
+ public PropertySystemTask Task
+ {
+ get
+ {
+ if (internalPropertySystemTask == null)
+ {
+ internalPropertySystemTask = new PropertySystemTask(shellObjectParent);
+ }
+
+ return internalPropertySystemTask;
+ }
+ }
+ private PropertySystemVideo internalPropertySystemVideo;
+ /// <summary>
+ /// System.Video Properties
+ /// </summary>
+ public PropertySystemVideo Video
+ {
+ get
+ {
+ if (internalPropertySystemVideo == null)
+ {
+ internalPropertySystemVideo = new PropertySystemVideo(shellObjectParent);
+ }
+
+ return internalPropertySystemVideo;
+ }
+ }
+ private PropertySystemVolume internalPropertySystemVolume;
+ /// <summary>
+ /// System.Volume Properties
+ /// </summary>
+ public PropertySystemVolume Volume
+ {
+ get
+ {
+ if (internalPropertySystemVolume == null)
+ {
+ internalPropertySystemVolume = new PropertySystemVolume(shellObjectParent);
+ }
+
+ return internalPropertySystemVolume;
+ }
+ }
+ #endregion
+ }
+
+ /// <summary>
+ /// System.AppUserModel Properties
+ /// </summary>
+ public class PropertySystemAppUserModel : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemAppUserModel(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.AppUserModel.ExcludeFromShowInNewInstall -- PKEY_AppUserModel_ExcludeFromShowInNewInstall</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 8</para>
+ /// </summary>
+ public ShellProperty<Boolean?> ExcludeFromShowInNewInstall
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.AppUserModel.ExcludeFromShowInNewInstall;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.AppUserModel.ID -- PKEY_AppUserModel_ID</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 5</para>
+ /// </summary>
+ public ShellProperty<String> ID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.AppUserModel.ID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.AppUserModel.IsDestListSeparator -- PKEY_AppUserModel_IsDestListSeparator</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 6</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsDestinationListSeparator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.AppUserModel.IsDestinationListSeparator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.AppUserModel.PreventPinning -- PKEY_AppUserModel_PreventPinning</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 9</para>
+ /// </summary>
+ public ShellProperty<Boolean?> PreventPinning
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.AppUserModel.PreventPinning;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.AppUserModel.RelaunchCommand -- PKEY_AppUserModel_RelaunchCommand</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 2</para>
+ /// </summary>
+ public ShellProperty<String> RelaunchCommand
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.AppUserModel.RelaunchCommand;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.AppUserModel.RelaunchDisplayNameResource -- PKEY_AppUserModel_RelaunchDisplayNameResource</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 4</para>
+ /// </summary>
+ public ShellProperty<String> RelaunchDisplayNameResource
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.AppUserModel.RelaunchDisplayNameResource;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.AppUserModel.RelaunchIconResource -- PKEY_AppUserModel_RelaunchIconResource</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 3</para>
+ /// </summary>
+ public ShellProperty<String> RelaunchIconResource
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.AppUserModel.RelaunchIconResource;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Audio Properties
+ /// </summary>
+ public class PropertySystemAudio : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemAudio(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Audio.ChannelCount -- PKEY_Audio_ChannelCount</para>
+ /// <para>Description: Indicates the channel count for the audio file. Values: 1 (mono), 2 (stereo).
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 7 (PIDASI_CHANNEL_COUNT)</para>
+ /// </summary>
+ public ShellProperty<UInt32?> ChannelCount
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Audio.ChannelCount;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Audio.Compression -- PKEY_Audio_Compression</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 10 (PIDASI_COMPRESSION)</para>
+ /// </summary>
+ public ShellProperty<String> Compression
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Audio.Compression;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Audio.EncodingBitrate -- PKEY_Audio_EncodingBitrate</para>
+ /// <para>Description: Indicates the average data rate in Hz for the audio file in "bits per second".
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 4 (PIDASI_AVG_DATA_RATE)</para>
+ /// </summary>
+ public ShellProperty<UInt32?> EncodingBitrate
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Audio.EncodingBitrate;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Audio.Format -- PKEY_Audio_Format</para>
+ /// <para>Description: Indicates the format of the audio file.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR) Legacy code may treat this as VT_BSTR.</para>
+ /// <para>FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 2 (PIDASI_FORMAT)</para>
+ /// </summary>
+ public ShellProperty<String> Format
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Audio.Format;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Audio.IsVariableBitRate -- PKEY_Audio_IsVariableBitRate</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {E6822FEE-8C17-4D62-823C-8E9CFCBD1D5C}, 100</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsVariableBitrate
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Audio.IsVariableBitrate;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Audio.PeakValue -- PKEY_Audio_PeakValue</para>
+ /// <para>Description: </para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {2579E5D0-1116-4084-BD9A-9B4F7CB4DF5E}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> PeakValue
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Audio.PeakValue;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Audio.SampleRate -- PKEY_Audio_SampleRate</para>
+ /// <para>Description: Indicates the audio sample rate for the audio file in "samples per second".
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 5 (PIDASI_SAMPLE_RATE)</para>
+ /// </summary>
+ public ShellProperty<UInt32?> SampleRate
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Audio.SampleRate;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Audio.SampleSize -- PKEY_Audio_SampleSize</para>
+ /// <para>Description: Indicates the audio sample size for the audio file in "bits per sample".
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 6 (PIDASI_SAMPLE_SIZE)</para>
+ /// </summary>
+ public ShellProperty<UInt32?> SampleSize
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Audio.SampleSize;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Audio.StreamName -- PKEY_Audio_StreamName</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 9 (PIDASI_STREAM_NAME)</para>
+ /// </summary>
+ public ShellProperty<String> StreamName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Audio.StreamName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Audio.StreamNumber -- PKEY_Audio_StreamNumber</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 8 (PIDASI_STREAM_NUMBER)</para>
+ /// </summary>
+ public ShellProperty<UInt16?> StreamNumber
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Audio.StreamNumber;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt16?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt16?>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Calendar Properties
+ /// </summary>
+ public class PropertySystemCalendar : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemCalendar(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Calendar.Duration -- PKEY_Calendar_Duration</para>
+ /// <para>Description: The duration as specified in a string.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {293CA35A-09AA-4DD2-B180-1FE245728A52}, 100</para>
+ /// </summary>
+ public ShellProperty<String> Duration
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Calendar.Duration;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.IsOnline -- PKEY_Calendar_IsOnline</para>
+ /// <para>Description: Identifies if the event is an online event.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {BFEE9149-E3E2-49A7-A862-C05988145CEC}, 100</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsOnline
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Calendar.IsOnline;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.IsRecurring -- PKEY_Calendar_IsRecurring</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {315B9C8D-80A9-4EF9-AE16-8E746DA51D70}, 100</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsRecurring
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Calendar.IsRecurring;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.Location -- PKEY_Calendar_Location</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {F6272D18-CECC-40B1-B26A-3911717AA7BD}, 100</para>
+ /// </summary>
+ public ShellProperty<String> Location
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Calendar.Location;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.OptionalAttendeeAddresses -- PKEY_Calendar_OptionalAttendeeAddresses</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {D55BAE5A-3892-417A-A649-C6AC5AAAEAB3}, 100</para>
+ /// </summary>
+ public ShellProperty<String[]> OptionalAttendeeAddresses
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Calendar.OptionalAttendeeAddresses;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.OptionalAttendeeNames -- PKEY_Calendar_OptionalAttendeeNames</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {09429607-582D-437F-84C3-DE93A2B24C3C}, 100</para>
+ /// </summary>
+ public ShellProperty<String[]> OptionalAttendeeNames
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Calendar.OptionalAttendeeNames;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.OrganizerAddress -- PKEY_Calendar_OrganizerAddress</para>
+ /// <para>Description: Address of the organizer organizing the event.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {744C8242-4DF5-456C-AB9E-014EFB9021E3}, 100</para>
+ /// </summary>
+ public ShellProperty<String> OrganizerAddress
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Calendar.OrganizerAddress;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.OrganizerName -- PKEY_Calendar_OrganizerName</para>
+ /// <para>Description: Name of the organizer organizing the event.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {AAA660F9-9865-458E-B484-01BC7FE3973E}, 100</para>
+ /// </summary>
+ public ShellProperty<String> OrganizerName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Calendar.OrganizerName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.ReminderTime -- PKEY_Calendar_ReminderTime</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {72FC5BA4-24F9-4011-9F3F-ADD27AFAD818}, 100</para>
+ /// </summary>
+ public ShellProperty<DateTime?> ReminderTime
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Calendar.ReminderTime;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.RequiredAttendeeAddresses -- PKEY_Calendar_RequiredAttendeeAddresses</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {0BA7D6C3-568D-4159-AB91-781A91FB71E5}, 100</para>
+ /// </summary>
+ public ShellProperty<String[]> RequiredAttendeeAddresses
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Calendar.RequiredAttendeeAddresses;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.RequiredAttendeeNames -- PKEY_Calendar_RequiredAttendeeNames</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {B33AF30B-F552-4584-936C-CB93E5CDA29F}, 100</para>
+ /// </summary>
+ public ShellProperty<String[]> RequiredAttendeeNames
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Calendar.RequiredAttendeeNames;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.Resources -- PKEY_Calendar_Resources</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {00F58A38-C54B-4C40-8696-97235980EAE1}, 100</para>
+ /// </summary>
+ public ShellProperty<String[]> Resources
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Calendar.Resources;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.ResponseStatus -- PKEY_Calendar_ResponseStatus</para>
+ /// <para>Description: This property stores the status of the user responses to meetings in her calendar.
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {188C1F91-3C40-4132-9EC5-D8B03B72A8A2}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt16?> ResponseStatus
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Calendar.ResponseStatus;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt16?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt16?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.ShowTimeAs -- PKEY_Calendar_ShowTimeAs</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {5BF396D4-5EB2-466F-BDE9-2FB3F2361D6E}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt16?> ShowTimeAs
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Calendar.ShowTimeAs;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt16?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt16?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.ShowTimeAsText -- PKEY_Calendar_ShowTimeAsText</para>
+ /// <para>Description: This is the user-friendly form of System.Calendar.ShowTimeAs. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {53DA57CF-62C0-45C4-81DE-7610BCEFD7F5}, 100</para>
+ /// </summary>
+ public ShellProperty<String> ShowTimeAsText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Calendar.ShowTimeAsText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+ #endregion
+
+ }
+
+ /// <summary>
+ /// System.Communication Properties
+ /// </summary>
+ public class PropertySystemCommunication : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemCommunication(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Communication.AccountName -- PKEY_Communication_AccountName</para>
+ /// <para>Description: Account Name
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 9</para>
+ /// </summary>
+ public ShellProperty<String> AccountName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Communication.AccountName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Communication.DateItemExpires -- PKEY_Communication_DateItemExpires</para>
+ /// <para>Description: Date the item expires due to the retention policy.
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {428040AC-A177-4C8A-9760-F6F761227F9A}, 100</para>
+ /// </summary>
+ public ShellProperty<DateTime?> DateItemExpires
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Communication.DateItemExpires;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Communication.FollowupIconIndex -- PKEY_Communication_FollowupIconIndex</para>
+ /// <para>Description: This is the icon index used on messages marked for followup.
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {83A6347E-6FE4-4F40-BA9C-C4865240D1F4}, 100</para>
+ /// </summary>
+ public ShellProperty<Int32?> FollowUpIconIndex
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Communication.FollowUpIconIndex;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Communication.HeaderItem -- PKEY_Communication_HeaderItem</para>
+ /// <para>Description: This property will be true if the item is a header item which means the item hasn't been fully downloaded.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {C9C34F84-2241-4401-B607-BD20ED75AE7F}, 100</para>
+ /// </summary>
+ public ShellProperty<Boolean?> HeaderItem
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Communication.HeaderItem;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Communication.PolicyTag -- PKEY_Communication_PolicyTag</para>
+ /// <para>Description: This a string used to identify the retention policy applied to the item.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {EC0B4191-AB0B-4C66-90B6-C6637CDEBBAB}, 100</para>
+ /// </summary>
+ public ShellProperty<String> PolicyTag
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Communication.PolicyTag;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Communication.SecurityFlags -- PKEY_Communication_SecurityFlags</para>
+ /// <para>Description: Security flags associated with the item to know if the item is encrypted, signed or DRM enabled.
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {8619A4B6-9F4D-4429-8C0F-B996CA59E335}, 100</para>
+ /// </summary>
+ public ShellProperty<Int32?> SecurityFlags
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Communication.SecurityFlags;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Communication.Suffix -- PKEY_Communication_Suffix</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {807B653A-9E91-43EF-8F97-11CE04EE20C5}, 100</para>
+ /// </summary>
+ public ShellProperty<String> Suffix
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Communication.Suffix;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Communication.TaskStatus -- PKEY_Communication_TaskStatus</para>
+ /// <para>Description: </para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {BE1A72C6-9A1D-46B7-AFE7-AFAF8CEF4999}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt16?> TaskStatus
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Communication.TaskStatus;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt16?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt16?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Communication.TaskStatusText -- PKEY_Communication_TaskStatusText</para>
+ /// <para>Description: This is the user-friendly form of System.Communication.TaskStatus. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {A6744477-C237-475B-A075-54F34498292A}, 100</para>
+ /// </summary>
+ public ShellProperty<String> TaskStatusText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Communication.TaskStatusText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Computer Properties
+ /// </summary>
+ public class PropertySystemComputer : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemComputer(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Computer.DecoratedFreeSpace -- PKEY_Computer_DecoratedFreeSpace</para>
+ /// <para>Description: Free space and total space: "%s free of %s"
+ ///</para>
+ /// <para>Type: Multivalue UInt64 -- VT_VECTOR | VT_UI8 (For variants: VT_ARRAY | VT_UI8)</para>
+ /// <para>FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 7 (Filesystem Volume Properties)</para>
+ /// </summary>
+ public ShellProperty<UInt64[]> DecoratedFreeSpace
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Computer.DecoratedFreeSpace;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt64[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt64[]>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Contact Properties
+ /// </summary>
+ public class PropertySystemContact : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemContact(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Contact.Anniversary -- PKEY_Contact_Anniversary</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {9AD5BADB-CEA7-4470-A03D-B84E51B9949E}, 100</para>
+ /// </summary>
+ public ShellProperty<DateTime?> Anniversary
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.Anniversary;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.AssistantName -- PKEY_Contact_AssistantName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {CD102C9C-5540-4A88-A6F6-64E4981C8CD1}, 100</para>
+ /// </summary>
+ public ShellProperty<String> AssistantName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.AssistantName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.AssistantTelephone -- PKEY_Contact_AssistantTelephone</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {9A93244D-A7AD-4FF8-9B99-45EE4CC09AF6}, 100</para>
+ /// </summary>
+ public ShellProperty<String> AssistantTelephone
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.AssistantTelephone;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.Birthday -- PKEY_Contact_Birthday</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 47</para>
+ /// </summary>
+ public ShellProperty<DateTime?> Birthday
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.Birthday;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.BusinessAddress -- PKEY_Contact_BusinessAddress</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {730FB6DD-CF7C-426B-A03F-BD166CC9EE24}, 100</para>
+ /// </summary>
+ public ShellProperty<String> BusinessAddress
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.BusinessAddress;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.BusinessAddressCity -- PKEY_Contact_BusinessAddressCity</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {402B5934-EC5A-48C3-93E6-85E86A2D934E}, 100</para>
+ /// </summary>
+ public ShellProperty<String> BusinessAddressCity
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.BusinessAddressCity;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.BusinessAddressCountry -- PKEY_Contact_BusinessAddressCountry</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {B0B87314-FCF6-4FEB-8DFF-A50DA6AF561C}, 100</para>
+ /// </summary>
+ public ShellProperty<String> BusinessAddressCountry
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.BusinessAddressCountry;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.BusinessAddressPostalCode -- PKEY_Contact_BusinessAddressPostalCode</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E1D4A09E-D758-4CD1-B6EC-34A8B5A73F80}, 100</para>
+ /// </summary>
+ public ShellProperty<String> BusinessAddressPostalCode
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.BusinessAddressPostalCode;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.BusinessAddressPostOfficeBox -- PKEY_Contact_BusinessAddressPostOfficeBox</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {BC4E71CE-17F9-48D5-BEE9-021DF0EA5409}, 100</para>
+ /// </summary>
+ public ShellProperty<String> BusinessAddressPostOfficeBox
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.BusinessAddressPostOfficeBox;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.BusinessAddressState -- PKEY_Contact_BusinessAddressState</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {446F787F-10C4-41CB-A6C4-4D0343551597}, 100</para>
+ /// </summary>
+ public ShellProperty<String> BusinessAddressState
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.BusinessAddressState;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.BusinessAddressStreet -- PKEY_Contact_BusinessAddressStreet</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {DDD1460F-C0BF-4553-8CE4-10433C908FB0}, 100</para>
+ /// </summary>
+ public ShellProperty<String> BusinessAddressStreet
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.BusinessAddressStreet;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.BusinessFaxNumber -- PKEY_Contact_BusinessFaxNumber</para>
+ /// <para>Description: Business fax number of the contact.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {91EFF6F3-2E27-42CA-933E-7C999FBE310B}, 100</para>
+ /// </summary>
+ public ShellProperty<String> BusinessFaxNumber
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.BusinessFaxNumber;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.BusinessHomePage -- PKEY_Contact_BusinessHomePage</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {56310920-2491-4919-99CE-EADB06FAFDB2}, 100</para>
+ /// </summary>
+ public ShellProperty<String> BusinessHomepage
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.BusinessHomepage;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.BusinessTelephone -- PKEY_Contact_BusinessTelephone</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {6A15E5A0-0A1E-4CD7-BB8C-D2F1B0C929BC}, 100</para>
+ /// </summary>
+ public ShellProperty<String> BusinessTelephone
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.BusinessTelephone;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.CallbackTelephone -- PKEY_Contact_CallbackTelephone</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {BF53D1C3-49E0-4F7F-8567-5A821D8AC542}, 100</para>
+ /// </summary>
+ public ShellProperty<String> CallbackTelephone
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.CallbackTelephone;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.CarTelephone -- PKEY_Contact_CarTelephone</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {8FDC6DEA-B929-412B-BA90-397A257465FE}, 100</para>
+ /// </summary>
+ public ShellProperty<String> CarTelephone
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.CarTelephone;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.Children -- PKEY_Contact_Children</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {D4729704-8EF1-43EF-9024-2BD381187FD5}, 100</para>
+ /// </summary>
+ public ShellProperty<String[]> Children
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.Children;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.CompanyMainTelephone -- PKEY_Contact_CompanyMainTelephone</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {8589E481-6040-473D-B171-7FA89C2708ED}, 100</para>
+ /// </summary>
+ public ShellProperty<String> CompanyMainTelephone
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.CompanyMainTelephone;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.Department -- PKEY_Contact_Department</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {FC9F7306-FF8F-4D49-9FB6-3FFE5C0951EC}, 100</para>
+ /// </summary>
+ public ShellProperty<String> Department
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.Department;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.EmailAddress -- PKEY_Contact_EmailAddress</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {F8FA7FA3-D12B-4785-8A4E-691A94F7A3E7}, 100</para>
+ /// </summary>
+ public ShellProperty<String> EmailAddress
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.EmailAddress;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.EmailAddress2 -- PKEY_Contact_EmailAddress2</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {38965063-EDC8-4268-8491-B7723172CF29}, 100</para>
+ /// </summary>
+ public ShellProperty<String> EmailAddress2
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.EmailAddress2;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.EmailAddress3 -- PKEY_Contact_EmailAddress3</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {644D37B4-E1B3-4BAD-B099-7E7C04966ACA}, 100</para>
+ /// </summary>
+ public ShellProperty<String> EmailAddress3
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.EmailAddress3;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.EmailAddresses -- PKEY_Contact_EmailAddresses</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {84D8F337-981D-44B3-9615-C7596DBA17E3}, 100</para>
+ /// </summary>
+ public ShellProperty<String[]> EmailAddresses
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.EmailAddresses;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.EmailName -- PKEY_Contact_EmailName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {CC6F4F24-6083-4BD4-8754-674D0DE87AB8}, 100</para>
+ /// </summary>
+ public ShellProperty<String> EmailName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.EmailName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.FileAsName -- PKEY_Contact_FileAsName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {F1A24AA7-9CA7-40F6-89EC-97DEF9FFE8DB}, 100</para>
+ /// </summary>
+ public ShellProperty<String> FileAsName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.FileAsName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.FirstName -- PKEY_Contact_FirstName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {14977844-6B49-4AAD-A714-A4513BF60460}, 100</para>
+ /// </summary>
+ public ShellProperty<String> FirstName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.FirstName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.FullName -- PKEY_Contact_FullName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {635E9051-50A5-4BA2-B9DB-4ED056C77296}, 100</para>
+ /// </summary>
+ public ShellProperty<String> FullName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.FullName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.Gender -- PKEY_Contact_Gender</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {3C8CEE58-D4F0-4CF9-B756-4E5D24447BCD}, 100</para>
+ /// </summary>
+ public ShellProperty<String> Gender
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.Gender;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.GenderValue -- PKEY_Contact_GenderValue</para>
+ /// <para>Description: </para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {3C8CEE58-D4F0-4CF9-B756-4E5D24447BCD}, 101</para>
+ /// </summary>
+ public ShellProperty<UInt16?> GenderValue
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.GenderValue;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt16?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt16?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.Hobbies -- PKEY_Contact_Hobbies</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {5DC2253F-5E11-4ADF-9CFE-910DD01E3E70}, 100</para>
+ /// </summary>
+ public ShellProperty<String[]> Hobbies
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.Hobbies;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.HomeAddress -- PKEY_Contact_HomeAddress</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {98F98354-617A-46B8-8560-5B1B64BF1F89}, 100</para>
+ /// </summary>
+ public ShellProperty<String> HomeAddress
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.HomeAddress;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.HomeAddressCity -- PKEY_Contact_HomeAddressCity</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 65</para>
+ /// </summary>
+ public ShellProperty<String> HomeAddressCity
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.HomeAddressCity;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.HomeAddressCountry -- PKEY_Contact_HomeAddressCountry</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {08A65AA1-F4C9-43DD-9DDF-A33D8E7EAD85}, 100</para>
+ /// </summary>
+ public ShellProperty<String> HomeAddressCountry
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.HomeAddressCountry;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.HomeAddressPostalCode -- PKEY_Contact_HomeAddressPostalCode</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {8AFCC170-8A46-4B53-9EEE-90BAE7151E62}, 100</para>
+ /// </summary>
+ public ShellProperty<String> HomeAddressPostalCode
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.HomeAddressPostalCode;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.HomeAddressPostOfficeBox -- PKEY_Contact_HomeAddressPostOfficeBox</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {7B9F6399-0A3F-4B12-89BD-4ADC51C918AF}, 100</para>
+ /// </summary>
+ public ShellProperty<String> HomeAddressPostOfficeBox
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.HomeAddressPostOfficeBox;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.HomeAddressState -- PKEY_Contact_HomeAddressState</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C89A23D0-7D6D-4EB8-87D4-776A82D493E5}, 100</para>
+ /// </summary>
+ public ShellProperty<String> HomeAddressState
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.HomeAddressState;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.HomeAddressStreet -- PKEY_Contact_HomeAddressStreet</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {0ADEF160-DB3F-4308-9A21-06237B16FA2A}, 100</para>
+ /// </summary>
+ public ShellProperty<String> HomeAddressStreet
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.HomeAddressStreet;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.HomeFaxNumber -- PKEY_Contact_HomeFaxNumber</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {660E04D6-81AB-4977-A09F-82313113AB26}, 100</para>
+ /// </summary>
+ public ShellProperty<String> HomeFaxNumber
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.HomeFaxNumber;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.HomeTelephone -- PKEY_Contact_HomeTelephone</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 20</para>
+ /// </summary>
+ public ShellProperty<String> HomeTelephone
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.HomeTelephone;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.IMAddress -- PKEY_Contact_IMAddress</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {D68DBD8A-3374-4B81-9972-3EC30682DB3D}, 100</para>
+ /// </summary>
+ public ShellProperty<String[]> IMAddress
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.IMAddress;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.Initials -- PKEY_Contact_Initials</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {F3D8F40D-50CB-44A2-9718-40CB9119495D}, 100</para>
+ /// </summary>
+ public ShellProperty<String> Initials
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.Initials;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.JobTitle -- PKEY_Contact_JobTitle</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 6</para>
+ /// </summary>
+ public ShellProperty<String> JobTitle
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.JobTitle;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.Label -- PKEY_Contact_Label</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {97B0AD89-DF49-49CC-834E-660974FD755B}, 100</para>
+ /// </summary>
+ public ShellProperty<String> Label
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.Label;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.LastName -- PKEY_Contact_LastName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {8F367200-C270-457C-B1D4-E07C5BCD90C7}, 100</para>
+ /// </summary>
+ public ShellProperty<String> LastName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.LastName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.MailingAddress -- PKEY_Contact_MailingAddress</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C0AC206A-827E-4650-95AE-77E2BB74FCC9}, 100</para>
+ /// </summary>
+ public ShellProperty<String> MailingAddress
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.MailingAddress;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.MiddleName -- PKEY_Contact_MiddleName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 71</para>
+ /// </summary>
+ public ShellProperty<String> MiddleName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.MiddleName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.MobileTelephone -- PKEY_Contact_MobileTelephone</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 35</para>
+ /// </summary>
+ public ShellProperty<String> MobileTelephone
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.MobileTelephone;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.NickName -- PKEY_Contact_NickName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 74</para>
+ /// </summary>
+ public ShellProperty<String> Nickname
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.Nickname;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.OfficeLocation -- PKEY_Contact_OfficeLocation</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 7</para>
+ /// </summary>
+ public ShellProperty<String> OfficeLocation
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.OfficeLocation;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.OtherAddress -- PKEY_Contact_OtherAddress</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {508161FA-313B-43D5-83A1-C1ACCF68622C}, 100</para>
+ /// </summary>
+ public ShellProperty<String> OtherAddress
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.OtherAddress;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.OtherAddressCity -- PKEY_Contact_OtherAddressCity</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {6E682923-7F7B-4F0C-A337-CFCA296687BF}, 100</para>
+ /// </summary>
+ public ShellProperty<String> OtherAddressCity
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.OtherAddressCity;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.OtherAddressCountry -- PKEY_Contact_OtherAddressCountry</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {8F167568-0AAE-4322-8ED9-6055B7B0E398}, 100</para>
+ /// </summary>
+ public ShellProperty<String> OtherAddressCountry
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.OtherAddressCountry;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.OtherAddressPostalCode -- PKEY_Contact_OtherAddressPostalCode</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {95C656C1-2ABF-4148-9ED3-9EC602E3B7CD}, 100</para>
+ /// </summary>
+ public ShellProperty<String> OtherAddressPostalCode
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.OtherAddressPostalCode;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.OtherAddressPostOfficeBox -- PKEY_Contact_OtherAddressPostOfficeBox</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {8B26EA41-058F-43F6-AECC-4035681CE977}, 100</para>
+ /// </summary>
+ public ShellProperty<String> OtherAddressPostOfficeBox
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.OtherAddressPostOfficeBox;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.OtherAddressState -- PKEY_Contact_OtherAddressState</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {71B377D6-E570-425F-A170-809FAE73E54E}, 100</para>
+ /// </summary>
+ public ShellProperty<String> OtherAddressState
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.OtherAddressState;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.OtherAddressStreet -- PKEY_Contact_OtherAddressStreet</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {FF962609-B7D6-4999-862D-95180D529AEA}, 100</para>
+ /// </summary>
+ public ShellProperty<String> OtherAddressStreet
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.OtherAddressStreet;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.PagerTelephone -- PKEY_Contact_PagerTelephone</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {D6304E01-F8F5-4F45-8B15-D024A6296789}, 100</para>
+ /// </summary>
+ public ShellProperty<String> PagerTelephone
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.PagerTelephone;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.PersonalTitle -- PKEY_Contact_PersonalTitle</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 69</para>
+ /// </summary>
+ public ShellProperty<String> PersonalTitle
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.PersonalTitle;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.PrimaryAddressCity -- PKEY_Contact_PrimaryAddressCity</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C8EA94F0-A9E3-4969-A94B-9C62A95324E0}, 100</para>
+ /// </summary>
+ public ShellProperty<String> PrimaryAddressCity
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.PrimaryAddressCity;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.PrimaryAddressCountry -- PKEY_Contact_PrimaryAddressCountry</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E53D799D-0F3F-466E-B2FF-74634A3CB7A4}, 100</para>
+ /// </summary>
+ public ShellProperty<String> PrimaryAddressCountry
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.PrimaryAddressCountry;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.PrimaryAddressPostalCode -- PKEY_Contact_PrimaryAddressPostalCode</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {18BBD425-ECFD-46EF-B612-7B4A6034EDA0}, 100</para>
+ /// </summary>
+ public ShellProperty<String> PrimaryAddressPostalCode
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.PrimaryAddressPostalCode;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.PrimaryAddressPostOfficeBox -- PKEY_Contact_PrimaryAddressPostOfficeBox</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {DE5EF3C7-46E1-484E-9999-62C5308394C1}, 100</para>
+ /// </summary>
+ public ShellProperty<String> PrimaryAddressPostOfficeBox
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.PrimaryAddressPostOfficeBox;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.PrimaryAddressState -- PKEY_Contact_PrimaryAddressState</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {F1176DFE-7138-4640-8B4C-AE375DC70A6D}, 100</para>
+ /// </summary>
+ public ShellProperty<String> PrimaryAddressState
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.PrimaryAddressState;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.PrimaryAddressStreet -- PKEY_Contact_PrimaryAddressStreet</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {63C25B20-96BE-488F-8788-C09C407AD812}, 100</para>
+ /// </summary>
+ public ShellProperty<String> PrimaryAddressStreet
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.PrimaryAddressStreet;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.PrimaryEmailAddress -- PKEY_Contact_PrimaryEmailAddress</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 48</para>
+ /// </summary>
+ public ShellProperty<String> PrimaryEmailAddress
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.PrimaryEmailAddress;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.PrimaryTelephone -- PKEY_Contact_PrimaryTelephone</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 25</para>
+ /// </summary>
+ public ShellProperty<String> PrimaryTelephone
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.PrimaryTelephone;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.Profession -- PKEY_Contact_Profession</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {7268AF55-1CE4-4F6E-A41F-B6E4EF10E4A9}, 100</para>
+ /// </summary>
+ public ShellProperty<String> Profession
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.Profession;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.SpouseName -- PKEY_Contact_SpouseName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {9D2408B6-3167-422B-82B0-F583B7A7CFE3}, 100</para>
+ /// </summary>
+ public ShellProperty<String> SpouseName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.SpouseName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.Suffix -- PKEY_Contact_Suffix</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 73</para>
+ /// </summary>
+ public ShellProperty<String> Suffix
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.Suffix;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.TelexNumber -- PKEY_Contact_TelexNumber</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C554493C-C1F7-40C1-A76C-EF8C0614003E}, 100</para>
+ /// </summary>
+ public ShellProperty<String> TelexNumber
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.TelexNumber;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.TTYTDDTelephone -- PKEY_Contact_TTYTDDTelephone</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {AAF16BAC-2B55-45E6-9F6D-415EB94910DF}, 100</para>
+ /// </summary>
+ public ShellProperty<String> TTYTDDTelephone
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.TTYTDDTelephone;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.WebPage -- PKEY_Contact_WebPage</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 18</para>
+ /// </summary>
+ public ShellProperty<String> Webpage
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.Webpage;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ private PropertyContactJA internalPropertyContactJA;
+ /// <summary>
+ /// Contact.JA Properties
+ /// </summary>
+ public PropertyContactJA JA
+ {
+ get
+ {
+ if (internalPropertyContactJA == null)
+ {
+ internalPropertyContactJA = new PropertyContactJA(shellObjectParent);
+ }
+
+ return internalPropertyContactJA;
+ }
+ }
+ #endregion
+ }
+
+ /// <summary>
+ /// Contact.JA Properties
+ /// </summary>
+ public class PropertyContactJA : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertyContactJA(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Contact.JA.CompanyNamePhonetic -- PKEY_Contact_JA_CompanyNamePhonetic</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {897B3694-FE9E-43E6-8066-260F590C0100}, 2</para>
+ /// </summary>
+ public ShellProperty<String> CompanyNamePhonetic
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.JA.CompanyNamePhonetic;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.JA.FirstNamePhonetic -- PKEY_Contact_JA_FirstNamePhonetic</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {897B3694-FE9E-43E6-8066-260F590C0100}, 3</para>
+ /// </summary>
+ public ShellProperty<String> FirstNamePhonetic
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.JA.FirstNamePhonetic;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.JA.LastNamePhonetic -- PKEY_Contact_JA_LastNamePhonetic</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {897B3694-FE9E-43E6-8066-260F590C0100}, 4</para>
+ /// </summary>
+ public ShellProperty<String> LastNamePhonetic
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Contact.JA.LastNamePhonetic;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Device Properties
+ /// </summary>
+ public class PropertySystemDevice : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemDevice(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Device.PrinterURL -- PKEY_Device_PrinterURL</para>
+ /// <para>Description: Printer information Printer URL.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {0B48F35A-BE6E-4F17-B108-3C4073D1669A}, 15</para>
+ /// </summary>
+ public ShellProperty<String> PrinterUrl
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Device.PrinterUrl;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.DeviceInterface Properties
+ /// </summary>
+ public class PropertySystemDeviceInterface : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemDeviceInterface(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.DeviceInterface.PrinterDriverDirectory -- PKEY_DeviceInterface_PrinterDriverDirectory</para>
+ /// <para>Description: Printer information Printer Driver Directory.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {847C66DE-B8D6-4AF9-ABC3-6F4F926BC039}, 14</para>
+ /// </summary>
+ public ShellProperty<String> PrinterDriverDirectory
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.DeviceInterface.PrinterDriverDirectory;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DeviceInterface.PrinterDriverName -- PKEY_DeviceInterface_PrinterDriverName</para>
+ /// <para>Description: Printer information Driver Name.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {AFC47170-14F5-498C-8F30-B0D19BE449C6}, 11</para>
+ /// </summary>
+ public ShellProperty<String> PrinterDriverName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.DeviceInterface.PrinterDriverName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DeviceInterface.PrinterName -- PKEY_DeviceInterface_PrinterName</para>
+ /// <para>Description: Printer information Printer Name.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {0A7B84EF-0C27-463F-84EF-06C5070001BE}, 10</para>
+ /// </summary>
+ public ShellProperty<String> PrinterName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.DeviceInterface.PrinterName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DeviceInterface.PrinterPortName -- PKEY_DeviceInterface_PrinterPortName</para>
+ /// <para>Description: Printer information Port Name.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {EEC7B761-6F94-41B1-949F-C729720DD13C}, 12</para>
+ /// </summary>
+ public ShellProperty<String> PrinterPortName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.DeviceInterface.PrinterPortName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Devices Properties
+ /// </summary>
+ public class PropertySystemDevices : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemDevices(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Devices.BatteryLife -- PKEY_Devices_BatteryLife</para>
+ /// <para>Description: Remaining battery life of the device as an integer between 0 and 100 percent.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 10</para>
+ /// </summary>
+ public ShellProperty<Byte?> BatteryLife
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.BatteryLife;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.BatteryPlusCharging -- PKEY_Devices_BatteryPlusCharging</para>
+ /// <para>Description: Remaining battery life of the device as an integer between 0 and 100 percent and the device's charging state.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 22</para>
+ /// </summary>
+ public ShellProperty<Byte?> BatteryPlusCharging
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.BatteryPlusCharging;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.BatteryPlusChargingText -- PKEY_Devices_BatteryPlusChargingText</para>
+ /// <para>Description: Remaining battery life of the device and the device's charging state as a string.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 23</para>
+ /// </summary>
+ public ShellProperty<String> BatteryPlusChargingText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.BatteryPlusChargingText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Category -- PKEY_Devices_Category_Desc_Singular</para>
+ /// <para>Description: Singular form of device category.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 91</para>
+ /// </summary>
+ public ShellProperty<String[]> Category
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.Category;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.CategoryGroup -- PKEY_Devices_CategoryGroup_Desc</para>
+ /// <para>Description: Plural form of device category.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 94</para>
+ /// </summary>
+ public ShellProperty<String[]> CategoryGroup
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.CategoryGroup;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.CategoryPlural -- PKEY_Devices_Category_Desc_Plural</para>
+ /// <para>Description: Plural form of device category.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 92</para>
+ /// </summary>
+ public ShellProperty<String[]> CategoryPlural
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.CategoryPlural;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.ChargingState -- PKEY_Devices_ChargingState</para>
+ /// <para>Description: Boolean value representing if the device is currently charging.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 11</para>
+ /// </summary>
+ public ShellProperty<Byte?> ChargingState
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.ChargingState;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Connected -- PKEY_Devices_IsConnected</para>
+ /// <para>Description: Device connection state. If VARIANT_TRUE, indicates the device is currently connected to the computer.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 55</para>
+ /// </summary>
+ public ShellProperty<Boolean?> Connected
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.Connected;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.ContainerId -- PKEY_Devices_ContainerId</para>
+ /// <para>Description: Device container ID.
+ ///</para>
+ /// <para>Type: Guid -- VT_CLSID</para>
+ /// <para>FormatID: {8C7ED206-3F8A-4827-B3AB-AE9E1FAEFC6C}, 2</para>
+ /// </summary>
+ public ShellProperty<IntPtr?> ContainerId
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.ContainerId;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<IntPtr?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<IntPtr?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.DefaultTooltip -- PKEY_Devices_DefaultTooltip</para>
+ /// <para>Description: Tooltip for default state
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {880F70A2-6082-47AC-8AAB-A739D1A300C3}, 153</para>
+ /// </summary>
+ public ShellProperty<String> DefaultTooltip
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.DefaultTooltip;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.DeviceDescription1 -- PKEY_Devices_DeviceDescription1</para>
+ /// <para>Description: First line of descriptive text about the device.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 81</para>
+ /// </summary>
+ public ShellProperty<String> DeviceDescription1
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.DeviceDescription1;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.DeviceDescription2 -- PKEY_Devices_DeviceDescription2</para>
+ /// <para>Description: Second line of descriptive text about the device.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 82</para>
+ /// </summary>
+ public ShellProperty<String> DeviceDescription2
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.DeviceDescription2;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.DiscoveryMethod -- PKEY_Devices_DiscoveryMethod</para>
+ /// <para>Description: Device discovery method. This indicates on what transport or physical connection the device is discovered.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 52</para>
+ /// </summary>
+ public ShellProperty<String[]> DiscoveryMethod
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.DiscoveryMethod;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.FriendlyName -- PKEY_Devices_FriendlyName</para>
+ /// <para>Description: Device friendly name.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {656A3BB3-ECC0-43FD-8477-4AE0404A96CD}, 12288</para>
+ /// </summary>
+ public ShellProperty<String> FriendlyName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.FriendlyName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.FunctionPaths -- PKEY_Devices_FunctionPaths</para>
+ /// <para>Description: Available functions for this device.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {D08DD4C0-3A9E-462E-8290-7B636B2576B9}, 3</para>
+ /// </summary>
+ public ShellProperty<String[]> FunctionPaths
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.FunctionPaths;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.InterfacePaths -- PKEY_Devices_InterfacePaths</para>
+ /// <para>Description: Available interfaces for this device.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {D08DD4C0-3A9E-462E-8290-7B636B2576B9}, 2</para>
+ /// </summary>
+ public ShellProperty<String[]> InterfacePaths
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.InterfacePaths;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.IsDefault -- PKEY_Devices_IsDefaultDevice</para>
+ /// <para>Description: If VARIANT_TRUE, the device is not working properly.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 86</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsDefault
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.IsDefault;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.IsNetworkConnected -- PKEY_Devices_IsNetworkDevice</para>
+ /// <para>Description: If VARIANT_TRUE, the device is not working properly.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 85</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsNetworkConnected
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.IsNetworkConnected;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.IsShared -- PKEY_Devices_IsSharedDevice</para>
+ /// <para>Description: If VARIANT_TRUE, the device is not working properly.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 84</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsShared
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.IsShared;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.IsSoftwareInstalling -- PKEY_Devices_IsSoftwareInstalling</para>
+ /// <para>Description: If VARIANT_TRUE, the device installer is currently installing software.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {83DA6326-97A6-4088-9453-A1923F573B29}, 9</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsSoftwareInstalling
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.IsSoftwareInstalling;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.LaunchDeviceStageFromExplorer -- PKEY_Devices_LaunchDeviceStageFromExplorer</para>
+ /// <para>Description: Indicates whether to launch Device Stage or not
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 77</para>
+ /// </summary>
+ public ShellProperty<Boolean?> LaunchDeviceStageFromExplorer
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.LaunchDeviceStageFromExplorer;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.LocalMachine -- PKEY_Devices_IsLocalMachine</para>
+ /// <para>Description: If VARIANT_TRUE, the device in question is actually the computer.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 70</para>
+ /// </summary>
+ public ShellProperty<Boolean?> LocalMachine
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.LocalMachine;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Manufacturer -- PKEY_Devices_Manufacturer</para>
+ /// <para>Description: Device manufacturer.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {656A3BB3-ECC0-43FD-8477-4AE0404A96CD}, 8192</para>
+ /// </summary>
+ public ShellProperty<String> Manufacturer
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.Manufacturer;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.MissedCalls -- PKEY_Devices_MissedCalls</para>
+ /// <para>Description: Number of missed calls on the device.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 5</para>
+ /// </summary>
+ public ShellProperty<Byte?> MissedCalls
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.MissedCalls;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.ModelName -- PKEY_Devices_ModelName</para>
+ /// <para>Description: Model name of the device.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {656A3BB3-ECC0-43FD-8477-4AE0404A96CD}, 8194</para>
+ /// </summary>
+ public ShellProperty<String> ModelName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.ModelName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.ModelNumber -- PKEY_Devices_ModelNumber</para>
+ /// <para>Description: Model number of the device.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {656A3BB3-ECC0-43FD-8477-4AE0404A96CD}, 8195</para>
+ /// </summary>
+ public ShellProperty<String> ModelNumber
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.ModelNumber;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.NetworkedTooltip -- PKEY_Devices_NetworkedTooltip</para>
+ /// <para>Description: Tooltip for connection state
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {880F70A2-6082-47AC-8AAB-A739D1A300C3}, 152</para>
+ /// </summary>
+ public ShellProperty<String> NetworkedTooltip
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.NetworkedTooltip;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.NetworkName -- PKEY_Devices_NetworkName</para>
+ /// <para>Description: Name of the device's network.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 7</para>
+ /// </summary>
+ public ShellProperty<String> NetworkName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.NetworkName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.NetworkType -- PKEY_Devices_NetworkType</para>
+ /// <para>Description: String representing the type of the device's network.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 8</para>
+ /// </summary>
+ public ShellProperty<String> NetworkType
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.NetworkType;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.NewPictures -- PKEY_Devices_NewPictures</para>
+ /// <para>Description: Number of new pictures on the device.
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 4</para>
+ /// </summary>
+ public ShellProperty<UInt16?> NewPictures
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.NewPictures;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt16?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt16?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Notification -- PKEY_Devices_Notification</para>
+ /// <para>Description: Device Notification Property.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {06704B0C-E830-4C81-9178-91E4E95A80A0}, 3</para>
+ /// </summary>
+ public ShellProperty<String> Notification
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.Notification;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.NotificationStore -- PKEY_Devices_NotificationStore</para>
+ /// <para>Description: Device Notification Store.
+ ///</para>
+ /// <para>Type: Object -- VT_UNKNOWN</para>
+ /// <para>FormatID: {06704B0C-E830-4C81-9178-91E4E95A80A0}, 2</para>
+ /// </summary>
+ public ShellProperty<IntPtr?> NotificationStore
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.NotificationStore;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<IntPtr?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<IntPtr?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.NotWorkingProperly -- PKEY_Devices_IsNotWorkingProperly</para>
+ /// <para>Description: If VARIANT_TRUE, the device is not working properly.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 83</para>
+ /// </summary>
+ public ShellProperty<Boolean?> NotWorkingProperly
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.NotWorkingProperly;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Paired -- PKEY_Devices_IsPaired</para>
+ /// <para>Description: Device paired state. If VARIANT_TRUE, indicates the device is not paired with the computer.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 56</para>
+ /// </summary>
+ public ShellProperty<Boolean?> Paired
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.Paired;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.PrimaryCategory -- PKEY_Devices_PrimaryCategory</para>
+ /// <para>Description: Primary category group for this device.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {D08DD4C0-3A9E-462E-8290-7B636B2576B9}, 10</para>
+ /// </summary>
+ public ShellProperty<String> PrimaryCategory
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.PrimaryCategory;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Roaming -- PKEY_Devices_Roaming</para>
+ /// <para>Description: Status indicator used to indicate if the device is roaming.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 9</para>
+ /// </summary>
+ public ShellProperty<Byte?> Roaming
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.Roaming;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.SafeRemovalRequired -- PKEY_Devices_SafeRemovalRequired</para>
+ /// <para>Description: Indicates if a device requires safe removal or not
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {AFD97640-86A3-4210-B67C-289C41AABE55}, 2</para>
+ /// </summary>
+ public ShellProperty<Boolean?> SafeRemovalRequired
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.SafeRemovalRequired;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.SharedTooltip -- PKEY_Devices_SharedTooltip</para>
+ /// <para>Description: Tooltip for sharing state
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {880F70A2-6082-47AC-8AAB-A739D1A300C3}, 151</para>
+ /// </summary>
+ public ShellProperty<String> SharedTooltip
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.SharedTooltip;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.SignalStrength -- PKEY_Devices_SignalStrength</para>
+ /// <para>Description: Device signal strength.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 2</para>
+ /// </summary>
+ public ShellProperty<Byte?> SignalStrength
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.SignalStrength;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Status1 -- PKEY_Devices_Status1</para>
+ /// <para>Description: 1st line of device status.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {D08DD4C0-3A9E-462E-8290-7B636B2576B9}, 257</para>
+ /// </summary>
+ public ShellProperty<String> Status1
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.Status1;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Status2 -- PKEY_Devices_Status2</para>
+ /// <para>Description: 2nd line of device status.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {D08DD4C0-3A9E-462E-8290-7B636B2576B9}, 258</para>
+ /// </summary>
+ public ShellProperty<String> Status2
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.Status2;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.StorageCapacity -- PKEY_Devices_StorageCapacity</para>
+ /// <para>Description: Total storage capacity of the device.
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 12</para>
+ /// </summary>
+ public ShellProperty<UInt64?> StorageCapacity
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.StorageCapacity;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt64?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt64?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.StorageFreeSpace -- PKEY_Devices_StorageFreeSpace</para>
+ /// <para>Description: Total free space of the storage of the device.
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 13</para>
+ /// </summary>
+ public ShellProperty<UInt64?> StorageFreeSpace
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.StorageFreeSpace;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt64?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt64?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.StorageFreeSpacePercent -- PKEY_Devices_StorageFreeSpacePercent</para>
+ /// <para>Description: Total free space of the storage of the device as a percentage.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 14</para>
+ /// </summary>
+ public ShellProperty<UInt32?> StorageFreeSpacePercent
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.StorageFreeSpacePercent;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.TextMessages -- PKEY_Devices_TextMessages</para>
+ /// <para>Description: Number of unread text messages on the device.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 3</para>
+ /// </summary>
+ public ShellProperty<Byte?> TextMessages
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.TextMessages;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Voicemail -- PKEY_Devices_Voicemail</para>
+ /// <para>Description: Status indicator used to indicate if the device has voicemail.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 6</para>
+ /// </summary>
+ public ShellProperty<Byte?> Voicemail
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.Voicemail;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte?>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ private PropertyDevicesNotifications internalPropertyDevicesNotifications;
+ /// <summary>
+ /// Devices.Notifications Properties
+ /// </summary>
+ public PropertyDevicesNotifications Notifications
+ {
+ get
+ {
+ if (internalPropertyDevicesNotifications == null)
+ {
+ internalPropertyDevicesNotifications = new PropertyDevicesNotifications(shellObjectParent);
+ }
+
+ return internalPropertyDevicesNotifications;
+ }
+ }
+ #endregion
+ }
+
+ /// <summary>
+ /// Devices.Notifications Properties
+ /// </summary>
+ public class PropertyDevicesNotifications : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertyDevicesNotifications(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Devices.Notifications.LowBattery -- PKEY_Devices_Notification_LowBattery</para>
+ /// <para>Description: Device Low Battery Notification.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {C4C07F2B-8524-4E66-AE3A-A6235F103BEB}, 2</para>
+ /// </summary>
+ public ShellProperty<Byte?> LowBattery
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.Notifications.LowBattery;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Notifications.MissedCall -- PKEY_Devices_Notification_MissedCall</para>
+ /// <para>Description: Device Missed Call Notification.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {6614EF48-4EFE-4424-9EDA-C79F404EDF3E}, 2</para>
+ /// </summary>
+ public ShellProperty<Byte?> MissedCall
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.Notifications.MissedCall;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Notifications.NewMessage -- PKEY_Devices_Notification_NewMessage</para>
+ /// <para>Description: Device New Message Notification.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {2BE9260A-2012-4742-A555-F41B638B7DCB}, 2</para>
+ /// </summary>
+ public ShellProperty<Byte?> NewMessage
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.Notifications.NewMessage;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Notifications.NewVoicemail -- PKEY_Devices_Notification_NewVoicemail</para>
+ /// <para>Description: Device Voicemail Notification.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {59569556-0A08-4212-95B9-FAE2AD6413DB}, 2</para>
+ /// </summary>
+ public ShellProperty<Byte?> NewVoicemail
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.Notifications.NewVoicemail;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Notifications.StorageFull -- PKEY_Devices_Notification_StorageFull</para>
+ /// <para>Description: Device Storage Full Notification.
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: {A0E00EE1-F0C7-4D41-B8E7-26A7BD8D38B0}, 2</para>
+ /// </summary>
+ public ShellProperty<UInt64?> StorageFull
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.Notifications.StorageFull;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt64?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt64?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Notifications.StorageFullLinkText -- PKEY_Devices_Notification_StorageFullLinkText</para>
+ /// <para>Description: Link Text for the Device Storage Full Notification.
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: {A0E00EE1-F0C7-4D41-B8E7-26A7BD8D38B0}, 3</para>
+ /// </summary>
+ public ShellProperty<UInt64?> StorageFullLinkText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Devices.Notifications.StorageFullLinkText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt64?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt64?>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Document Properties
+ /// </summary>
+ public class PropertySystemDocument : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemDocument(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Document.ByteCount -- PKEY_Document_ByteCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 4 (PIDDSI_BYTECOUNT)</para>
+ /// </summary>
+ public ShellProperty<Int32?> ByteCount
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.ByteCount;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.CharacterCount -- PKEY_Document_CharacterCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 16 (PIDSI_CHARCOUNT)</para>
+ /// </summary>
+ public ShellProperty<Int32?> CharacterCount
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.CharacterCount;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.ClientID -- PKEY_Document_ClientID</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {276D7BB0-5B34-4FB0-AA4B-158ED12A1809}, 100</para>
+ /// </summary>
+ public ShellProperty<String> ClientID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.ClientID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.Contributor -- PKEY_Document_Contributor</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {F334115E-DA1B-4509-9B3D-119504DC7ABB}, 100</para>
+ /// </summary>
+ public ShellProperty<String[]> Contributor
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.Contributor;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.DateCreated -- PKEY_Document_DateCreated</para>
+ /// <para>Description: This property is stored in the document, not obtained from the file system.
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 12 (PIDSI_CREATE_DTM)</para>
+ /// </summary>
+ public ShellProperty<DateTime?> DateCreated
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.DateCreated;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.DatePrinted -- PKEY_Document_DatePrinted</para>
+ /// <para>Description: Legacy name: "DocLastPrinted".
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 11 (PIDSI_LASTPRINTED)</para>
+ /// </summary>
+ public ShellProperty<DateTime?> DatePrinted
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.DatePrinted;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.DateSaved -- PKEY_Document_DateSaved</para>
+ /// <para>Description: Legacy name: "DocLastSavedTm".
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 13 (PIDSI_LASTSAVE_DTM)</para>
+ /// </summary>
+ public ShellProperty<DateTime?> DateSaved
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.DateSaved;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.Division -- PKEY_Document_Division</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {1E005EE6-BF27-428B-B01C-79676ACD2870}, 100</para>
+ /// </summary>
+ public ShellProperty<String> Division
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.Division;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.DocumentID -- PKEY_Document_DocumentID</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E08805C8-E395-40DF-80D2-54F0D6C43154}, 100</para>
+ /// </summary>
+ public ShellProperty<String> DocumentID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.DocumentID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.HiddenSlideCount -- PKEY_Document_HiddenSlideCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 9 (PIDDSI_HIDDENCOUNT)</para>
+ /// </summary>
+ public ShellProperty<Int32?> HiddenSlideCount
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.HiddenSlideCount;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.LastAuthor -- PKEY_Document_LastAuthor</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 8 (PIDSI_LASTAUTHOR)</para>
+ /// </summary>
+ public ShellProperty<String> LastAuthor
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.LastAuthor;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.LineCount -- PKEY_Document_LineCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 5 (PIDDSI_LINECOUNT)</para>
+ /// </summary>
+ public ShellProperty<Int32?> LineCount
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.LineCount;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.Manager -- PKEY_Document_Manager</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 14 (PIDDSI_MANAGER)</para>
+ /// </summary>
+ public ShellProperty<String> Manager
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.Manager;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.MultimediaClipCount -- PKEY_Document_MultimediaClipCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 10 (PIDDSI_MMCLIPCOUNT)</para>
+ /// </summary>
+ public ShellProperty<Int32?> MultimediaClipCount
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.MultimediaClipCount;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.NoteCount -- PKEY_Document_NoteCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 8 (PIDDSI_NOTECOUNT)</para>
+ /// </summary>
+ public ShellProperty<Int32?> NoteCount
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.NoteCount;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.PageCount -- PKEY_Document_PageCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 14 (PIDSI_PAGECOUNT)</para>
+ /// </summary>
+ public ShellProperty<Int32?> PageCount
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.PageCount;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.ParagraphCount -- PKEY_Document_ParagraphCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 6 (PIDDSI_PARCOUNT)</para>
+ /// </summary>
+ public ShellProperty<Int32?> ParagraphCount
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.ParagraphCount;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.PresentationFormat -- PKEY_Document_PresentationFormat</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 3 (PIDDSI_PRESFORMAT)</para>
+ /// </summary>
+ public ShellProperty<String> PresentationFormat
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.PresentationFormat;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.RevisionNumber -- PKEY_Document_RevisionNumber</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 9 (PIDSI_REVNUMBER)</para>
+ /// </summary>
+ public ShellProperty<String> RevisionNumber
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.RevisionNumber;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.Security -- PKEY_Document_Security</para>
+ /// <para>Description: Access control information, from SummaryInfo propset
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 19</para>
+ /// </summary>
+ public ShellProperty<Int32?> Security
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.Security;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.SlideCount -- PKEY_Document_SlideCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 7 (PIDDSI_SLIDECOUNT)</para>
+ /// </summary>
+ public ShellProperty<Int32?> SlideCount
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.SlideCount;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.Template -- PKEY_Document_Template</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 7 (PIDSI_TEMPLATE)</para>
+ /// </summary>
+ public ShellProperty<String> Template
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.Template;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.TotalEditingTime -- PKEY_Document_TotalEditingTime</para>
+ /// <para>Description: 100ns units, not milliseconds. VT_FILETIME for IPropertySetStorage handlers (legacy)
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 10 (PIDSI_EDITTIME)</para>
+ /// </summary>
+ public ShellProperty<UInt64?> TotalEditingTime
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.TotalEditingTime;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt64?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt64?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.Version -- PKEY_Document_Version</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 29</para>
+ /// </summary>
+ public ShellProperty<String> Version
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.Version;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.WordCount -- PKEY_Document_WordCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 15 (PIDSI_WORDCOUNT)</para>
+ /// </summary>
+ public ShellProperty<Int32?> WordCount
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Document.WordCount;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.DRM Properties
+ /// </summary>
+ public class PropertySystemDRM : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemDRM(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.DRM.DatePlayExpires -- PKEY_DRM_DatePlayExpires</para>
+ /// <para>Description: Indicates when play expires for digital rights management.
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: (FMTID_DRM) {AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}, 6 (PIDDRSI_PLAYEXPIRES)</para>
+ /// </summary>
+ public ShellProperty<DateTime?> DatePlayExpires
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.DRM.DatePlayExpires;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DRM.DatePlayStarts -- PKEY_DRM_DatePlayStarts</para>
+ /// <para>Description: Indicates when play starts for digital rights management.
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: (FMTID_DRM) {AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}, 5 (PIDDRSI_PLAYSTARTS)</para>
+ /// </summary>
+ public ShellProperty<DateTime?> DatePlayStarts
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.DRM.DatePlayStarts;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DRM.Description -- PKEY_DRM_Description</para>
+ /// <para>Description: Displays the description for digital rights management.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_DRM) {AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}, 3 (PIDDRSI_DESCRIPTION)</para>
+ /// </summary>
+ public ShellProperty<String> Description
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.DRM.Description;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DRM.IsProtected -- PKEY_DRM_IsProtected</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: (FMTID_DRM) {AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}, 2 (PIDDRSI_PROTECTED)</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsProtected
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.DRM.IsProtected;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DRM.PlayCount -- PKEY_DRM_PlayCount</para>
+ /// <para>Description: Indicates the play count for digital rights management.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_DRM) {AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}, 4 (PIDDRSI_PLAYCOUNT)</para>
+ /// </summary>
+ public ShellProperty<UInt32?> PlayCount
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.DRM.PlayCount;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.GPS Properties
+ /// </summary>
+ public class PropertySystemGPS : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemGPS(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.GPS.Altitude -- PKEY_GPS_Altitude</para>
+ /// <para>Description: Indicates the altitude based on the reference in PKEY_GPS_AltitudeRef. Calculated from PKEY_GPS_AltitudeNumerator and
+ ///PKEY_GPS_AltitudeDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {827EDB4F-5B73-44A7-891D-FDFFABEA35CA}, 100</para>
+ /// </summary>
+ public ShellProperty<Double?> Altitude
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.Altitude;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.AltitudeDenominator -- PKEY_GPS_AltitudeDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_Altitude
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {78342DCB-E358-4145-AE9A-6BFE4E0F9F51}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> AltitudeDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.AltitudeDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.AltitudeNumerator -- PKEY_GPS_AltitudeNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_Altitude
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {2DAD1EB7-816D-40D3-9EC3-C9773BE2AADE}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> AltitudeNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.AltitudeNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.AltitudeRef -- PKEY_GPS_AltitudeRef</para>
+ /// <para>Description: Indicates the reference for the altitude property. (eg: above sea level, below sea level, absolute value)
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {46AC629D-75EA-4515-867F-6DC4321C5844}, 100</para>
+ /// </summary>
+ public ShellProperty<Byte?> AltitudeRef
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.AltitudeRef;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.AreaInformation -- PKEY_GPS_AreaInformation</para>
+ /// <para>Description: Represents the name of the GPS area
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {972E333E-AC7E-49F1-8ADF-A70D07A9BCAB}, 100</para>
+ /// </summary>
+ public ShellProperty<String> AreaInformation
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.AreaInformation;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.Date -- PKEY_GPS_Date</para>
+ /// <para>Description: Date and time of the GPS record
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {3602C812-0F3B-45F0-85AD-603468D69423}, 100</para>
+ /// </summary>
+ public ShellProperty<DateTime?> Date
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.Date;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestBearing -- PKEY_GPS_DestBearing</para>
+ /// <para>Description: Indicates the bearing to the destination point. Calculated from PKEY_GPS_DestBearingNumerator and
+ ///PKEY_GPS_DestBearingDenominator.
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {C66D4B3C-E888-47CC-B99F-9DCA3EE34DEA}, 100</para>
+ /// </summary>
+ public ShellProperty<Double?> DestinationBearing
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.DestinationBearing;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestBearingDenominator -- PKEY_GPS_DestBearingDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_DestBearing
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {7ABCF4F8-7C3F-4988-AC91-8D2C2E97ECA5}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> DestinationBearingDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.DestinationBearingDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestBearingNumerator -- PKEY_GPS_DestBearingNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_DestBearing
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {BA3B1DA9-86EE-4B5D-A2A4-A271A429F0CF}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> DestinationBearingNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.DestinationBearingNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestBearingRef -- PKEY_GPS_DestBearingRef</para>
+ /// <para>Description: Indicates the reference used for the giving the bearing to the destination point. (eg: true direction, magnetic direction)
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {9AB84393-2A0F-4B75-BB22-7279786977CB}, 100</para>
+ /// </summary>
+ public ShellProperty<String> DestinationBearingRef
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.DestinationBearingRef;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestDistance -- PKEY_GPS_DestDistance</para>
+ /// <para>Description: Indicates the distance to the destination point. Calculated from PKEY_GPS_DestDistanceNumerator and
+ ///PKEY_GPS_DestDistanceDenominator.
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {A93EAE04-6804-4F24-AC81-09B266452118}, 100</para>
+ /// </summary>
+ public ShellProperty<Double?> DestinationDistance
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.DestinationDistance;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestDistanceDenominator -- PKEY_GPS_DestDistanceDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_DestDistance
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {9BC2C99B-AC71-4127-9D1C-2596D0D7DCB7}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> DestinationDistanceDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.DestinationDistanceDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestDistanceNumerator -- PKEY_GPS_DestDistanceNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_DestDistance
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {2BDA47DA-08C6-4FE1-80BC-A72FC517C5D0}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> DestinationDistanceNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.DestinationDistanceNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestDistanceRef -- PKEY_GPS_DestDistanceRef</para>
+ /// <para>Description: Indicates the unit used to express the distance to the destination. (eg: kilometers, miles, knots)
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {ED4DF2D3-8695-450B-856F-F5C1C53ACB66}, 100</para>
+ /// </summary>
+ public ShellProperty<String> DestinationDistanceRef
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.DestinationDistanceRef;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestLatitude -- PKEY_GPS_DestLatitude</para>
+ /// <para>Description: Indicates the latitude of the destination point. This is an array of three values. Index 0 is the degrees, index 1
+ ///is the minutes, index 2 is the seconds. Each is calculated from the values in PKEY_GPS_DestLatitudeNumerator and
+ ///PKEY_GPS_DestLatitudeDenominator.
+ ///</para>
+ /// <para>Type: Multivalue Double -- VT_VECTOR | VT_R8 (For variants: VT_ARRAY | VT_R8)</para>
+ /// <para>FormatID: {9D1D7CC5-5C39-451C-86B3-928E2D18CC47}, 100</para>
+ /// </summary>
+ public ShellProperty<Double[]> DestinationLatitude
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.DestinationLatitude;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestLatitudeDenominator -- PKEY_GPS_DestLatitudeDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_DestLatitude
+ ///</para>
+ /// <para>Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4)</para>
+ /// <para>FormatID: {3A372292-7FCA-49A7-99D5-E47BB2D4E7AB}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32[]> DestinationLatitudeDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.DestinationLatitudeDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestLatitudeNumerator -- PKEY_GPS_DestLatitudeNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_DestLatitude
+ ///</para>
+ /// <para>Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4)</para>
+ /// <para>FormatID: {ECF4B6F6-D5A6-433C-BB92-4076650FC890}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32[]> DestinationLatitudeNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.DestinationLatitudeNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestLatitudeRef -- PKEY_GPS_DestLatitudeRef</para>
+ /// <para>Description: Indicates whether the latitude destination point is north or south latitude
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {CEA820B9-CE61-4885-A128-005D9087C192}, 100</para>
+ /// </summary>
+ public ShellProperty<String> DestinationLatitudeRef
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.DestinationLatitudeRef;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestLongitude -- PKEY_GPS_DestLongitude</para>
+ /// <para>Description: Indicates the latitude of the destination point. This is an array of three values. Index 0 is the degrees, index 1
+ ///is the minutes, index 2 is the seconds. Each is calculated from the values in PKEY_GPS_DestLongitudeNumerator and
+ ///PKEY_GPS_DestLongitudeDenominator.
+ ///</para>
+ /// <para>Type: Multivalue Double -- VT_VECTOR | VT_R8 (For variants: VT_ARRAY | VT_R8)</para>
+ /// <para>FormatID: {47A96261-CB4C-4807-8AD3-40B9D9DBC6BC}, 100</para>
+ /// </summary>
+ public ShellProperty<Double[]> DestinationLongitude
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.DestinationLongitude;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestLongitudeDenominator -- PKEY_GPS_DestLongitudeDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_DestLongitude
+ ///</para>
+ /// <para>Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4)</para>
+ /// <para>FormatID: {425D69E5-48AD-4900-8D80-6EB6B8D0AC86}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32[]> DestinationLongitudeDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.DestinationLongitudeDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestLongitudeNumerator -- PKEY_GPS_DestLongitudeNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_DestLongitude
+ ///</para>
+ /// <para>Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4)</para>
+ /// <para>FormatID: {A3250282-FB6D-48D5-9A89-DBCACE75CCCF}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32[]> DestinationLongitudeNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.DestinationLongitudeNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestLongitudeRef -- PKEY_GPS_DestLongitudeRef</para>
+ /// <para>Description: Indicates whether the longitude destination point is east or west longitude
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {182C1EA6-7C1C-4083-AB4B-AC6C9F4ED128}, 100</para>
+ /// </summary>
+ public ShellProperty<String> DestinationLongitudeRef
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.DestinationLongitudeRef;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.Differential -- PKEY_GPS_Differential</para>
+ /// <para>Description: Indicates whether differential correction was applied to the GPS receiver
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {AAF4EE25-BD3B-4DD7-BFC4-47F77BB00F6D}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt16?> Differential
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.Differential;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt16?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt16?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DOP -- PKEY_GPS_DOP</para>
+ /// <para>Description: Indicates the GPS DOP (data degree of precision). Calculated from PKEY_GPS_DOPNumerator and PKEY_GPS_DOPDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {0CF8FB02-1837-42F1-A697-A7017AA289B9}, 100</para>
+ /// </summary>
+ public ShellProperty<Double?> DOP
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.DOP;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DOPDenominator -- PKEY_GPS_DOPDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_DOP
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {A0BE94C5-50BA-487B-BD35-0654BE8881ED}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> DOPDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.DOPDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DOPNumerator -- PKEY_GPS_DOPNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_DOP
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {47166B16-364F-4AA0-9F31-E2AB3DF449C3}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> DOPNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.DOPNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.ImgDirection -- PKEY_GPS_ImgDirection</para>
+ /// <para>Description: Indicates direction of the image when it was captured. Calculated from PKEY_GPS_ImgDirectionNumerator and
+ ///PKEY_GPS_ImgDirectionDenominator.
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {16473C91-D017-4ED9-BA4D-B6BAA55DBCF8}, 100</para>
+ /// </summary>
+ public ShellProperty<Double?> ImageDirection
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.ImageDirection;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.ImgDirectionDenominator -- PKEY_GPS_ImgDirectionDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_ImgDirection
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {10B24595-41A2-4E20-93C2-5761C1395F32}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> ImageDirectionDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.ImageDirectionDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.ImgDirectionNumerator -- PKEY_GPS_ImgDirectionNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_ImgDirection
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {DC5877C7-225F-45F7-BAC7-E81334B6130A}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> ImageDirectionNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.ImageDirectionNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.ImgDirectionRef -- PKEY_GPS_ImgDirectionRef</para>
+ /// <para>Description: Indicates reference for giving the direction of the image when it was captured. (eg: true direction, magnetic direction)
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {A4AAA5B7-1AD0-445F-811A-0F8F6E67F6B5}, 100</para>
+ /// </summary>
+ public ShellProperty<String> ImageDirectionRef
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.ImageDirectionRef;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.Latitude -- PKEY_GPS_Latitude</para>
+ /// <para>Description: Indicates the latitude. This is an array of three values. Index 0 is the degrees, index 1 is the minutes, index 2
+ ///is the seconds. Each is calculated from the values in PKEY_GPS_LatitudeNumerator and PKEY_GPS_LatitudeDenominator.
+ ///</para>
+ /// <para>Type: Multivalue Double -- VT_VECTOR | VT_R8 (For variants: VT_ARRAY | VT_R8)</para>
+ /// <para>FormatID: {8727CFFF-4868-4EC6-AD5B-81B98521D1AB}, 100</para>
+ /// </summary>
+ public ShellProperty<Double[]> Latitude
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.Latitude;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.LatitudeDenominator -- PKEY_GPS_LatitudeDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_Latitude
+ ///</para>
+ /// <para>Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4)</para>
+ /// <para>FormatID: {16E634EE-2BFF-497B-BD8A-4341AD39EEB9}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32[]> LatitudeDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.LatitudeDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.LatitudeNumerator -- PKEY_GPS_LatitudeNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_Latitude
+ ///</para>
+ /// <para>Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4)</para>
+ /// <para>FormatID: {7DDAAAD1-CCC8-41AE-B750-B2CB8031AEA2}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32[]> LatitudeNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.LatitudeNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.LatitudeRef -- PKEY_GPS_LatitudeRef</para>
+ /// <para>Description: Indicates whether latitude is north or south latitude
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {029C0252-5B86-46C7-ACA0-2769FFC8E3D4}, 100</para>
+ /// </summary>
+ public ShellProperty<String> LatitudeRef
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.LatitudeRef;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.Longitude -- PKEY_GPS_Longitude</para>
+ /// <para>Description: Indicates the longitude. This is an array of three values. Index 0 is the degrees, index 1 is the minutes, index 2
+ ///is the seconds. Each is calculated from the values in PKEY_GPS_LongitudeNumerator and PKEY_GPS_LongitudeDenominator.
+ ///</para>
+ /// <para>Type: Multivalue Double -- VT_VECTOR | VT_R8 (For variants: VT_ARRAY | VT_R8)</para>
+ /// <para>FormatID: {C4C4DBB2-B593-466B-BBDA-D03D27D5E43A}, 100</para>
+ /// </summary>
+ public ShellProperty<Double[]> Longitude
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.Longitude;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.LongitudeDenominator -- PKEY_GPS_LongitudeDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_Longitude
+ ///</para>
+ /// <para>Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4)</para>
+ /// <para>FormatID: {BE6E176C-4534-4D2C-ACE5-31DEDAC1606B}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32[]> LongitudeDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.LongitudeDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.LongitudeNumerator -- PKEY_GPS_LongitudeNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_Longitude
+ ///</para>
+ /// <para>Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4)</para>
+ /// <para>FormatID: {02B0F689-A914-4E45-821D-1DDA452ED2C4}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32[]> LongitudeNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.LongitudeNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.LongitudeRef -- PKEY_GPS_LongitudeRef</para>
+ /// <para>Description: Indicates whether longitude is east or west longitude
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {33DCF22B-28D5-464C-8035-1EE9EFD25278}, 100</para>
+ /// </summary>
+ public ShellProperty<String> LongitudeRef
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.LongitudeRef;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.MapDatum -- PKEY_GPS_MapDatum</para>
+ /// <para>Description: Indicates the geodetic survey data used by the GPS receiver
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {2CA2DAE6-EDDC-407D-BEF1-773942ABFA95}, 100</para>
+ /// </summary>
+ public ShellProperty<String> MapDatum
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.MapDatum;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.MeasureMode -- PKEY_GPS_MeasureMode</para>
+ /// <para>Description: Indicates the GPS measurement mode. (eg: 2-dimensional, 3-dimensional)
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {A015ED5D-AAEA-4D58-8A86-3C586920EA0B}, 100</para>
+ /// </summary>
+ public ShellProperty<String> MeasureMode
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.MeasureMode;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.ProcessingMethod -- PKEY_GPS_ProcessingMethod</para>
+ /// <para>Description: Indicates the name of the method used for location finding
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {59D49E61-840F-4AA9-A939-E2099B7F6399}, 100</para>
+ /// </summary>
+ public ShellProperty<String> ProcessingMethod
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.ProcessingMethod;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.Satellites -- PKEY_GPS_Satellites</para>
+ /// <para>Description: Indicates the GPS satellites used for measurements
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {467EE575-1F25-4557-AD4E-B8B58B0D9C15}, 100</para>
+ /// </summary>
+ public ShellProperty<String> Satellites
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.Satellites;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.Speed -- PKEY_GPS_Speed</para>
+ /// <para>Description: Indicates the speed of the GPS receiver movement. Calculated from PKEY_GPS_SpeedNumerator and
+ ///PKEY_GPS_SpeedDenominator.
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {DA5D0862-6E76-4E1B-BABD-70021BD25494}, 100</para>
+ /// </summary>
+ public ShellProperty<Double?> Speed
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.Speed;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.SpeedDenominator -- PKEY_GPS_SpeedDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_Speed
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {7D122D5A-AE5E-4335-8841-D71E7CE72F53}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> SpeedDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.SpeedDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.SpeedNumerator -- PKEY_GPS_SpeedNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_Speed
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {ACC9CE3D-C213-4942-8B48-6D0820F21C6D}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> SpeedNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.SpeedNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.SpeedRef -- PKEY_GPS_SpeedRef</para>
+ /// <para>Description: Indicates the unit used to express the speed of the GPS receiver movement. (eg: kilometers per hour,
+ ///miles per hour, knots).
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {ECF7F4C9-544F-4D6D-9D98-8AD79ADAF453}, 100</para>
+ /// </summary>
+ public ShellProperty<String> SpeedRef
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.SpeedRef;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.Status -- PKEY_GPS_Status</para>
+ /// <para>Description: Indicates the status of the GPS receiver when the image was recorded. (eg: measurement in progress,
+ ///measurement interoperability).
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {125491F4-818F-46B2-91B5-D537753617B2}, 100</para>
+ /// </summary>
+ public ShellProperty<String> Status
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.Status;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.Track -- PKEY_GPS_Track</para>
+ /// <para>Description: Indicates the direction of the GPS receiver movement. Calculated from PKEY_GPS_TrackNumerator and
+ ///PKEY_GPS_TrackDenominator.
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {76C09943-7C33-49E3-9E7E-CDBA872CFADA}, 100</para>
+ /// </summary>
+ public ShellProperty<Double?> Track
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.Track;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.TrackDenominator -- PKEY_GPS_TrackDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_Track
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {C8D1920C-01F6-40C0-AC86-2F3A4AD00770}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> TrackDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.TrackDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.TrackNumerator -- PKEY_GPS_TrackNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_Track
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {702926F4-44A6-43E1-AE71-45627116893B}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> TrackNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.TrackNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.TrackRef -- PKEY_GPS_TrackRef</para>
+ /// <para>Description: Indicates reference for the direction of the GPS receiver movement. (eg: true direction, magnetic direction)
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {35DBE6FE-44C3-4400-AAAE-D2C799C407E8}, 100</para>
+ /// </summary>
+ public ShellProperty<String> TrackRef
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.TrackRef;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.VersionID -- PKEY_GPS_VersionID</para>
+ /// <para>Description: Indicates the version of the GPS information
+ ///</para>
+ /// <para>Type: Buffer -- VT_VECTOR | VT_UI1 (For variants: VT_ARRAY | VT_UI1)</para>
+ /// <para>FormatID: {22704DA4-C6B2-4A99-8E56-F16DF8C92599}, 100</para>
+ /// </summary>
+ public ShellProperty<Byte[]> VersionID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.GPS.VersionID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte[]>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Identity Properties
+ /// </summary>
+ public class PropertySystemIdentity : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemIdentity(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Identity.Blob -- PKEY_Identity_Blob</para>
+ /// <para>Description: Blob used to import/export identities
+ ///</para>
+ /// <para>Type: Blob -- VT_BLOB</para>
+ /// <para>FormatID: {8C3B93A4-BAED-1A83-9A32-102EE313F6EB}, 100</para>
+ /// </summary>
+ public ShellProperty<Byte[]> Blob
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Identity.Blob;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Identity.DisplayName -- PKEY_Identity_DisplayName</para>
+ /// <para>Description: Display Name
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {7D683FC9-D155-45A8-BB1F-89D19BCB792F}, 100</para>
+ /// </summary>
+ public ShellProperty<String> DisplayName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Identity.DisplayName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Identity.IsMeIdentity -- PKEY_Identity_IsMeIdentity</para>
+ /// <para>Description: Is it Me Identity
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {A4108708-09DF-4377-9DFC-6D99986D5A67}, 100</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsMeIdentity
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Identity.IsMeIdentity;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Identity.PrimaryEmailAddress -- PKEY_Identity_PrimaryEmailAddress</para>
+ /// <para>Description: Primary Email Address
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {FCC16823-BAED-4F24-9B32-A0982117F7FA}, 100</para>
+ /// </summary>
+ public ShellProperty<String> PrimaryEmailAddress
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Identity.PrimaryEmailAddress;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Identity.ProviderID -- PKEY_Identity_ProviderID</para>
+ /// <para>Description: Provider ID
+ ///</para>
+ /// <para>Type: Guid -- VT_CLSID</para>
+ /// <para>FormatID: {74A7DE49-FA11-4D3D-A006-DB7E08675916}, 100</para>
+ /// </summary>
+ public ShellProperty<IntPtr?> ProviderID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Identity.ProviderID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<IntPtr?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<IntPtr?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Identity.UniqueID -- PKEY_Identity_UniqueID</para>
+ /// <para>Description: Unique ID
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E55FC3B0-2B60-4220-918E-B21E8BF16016}, 100</para>
+ /// </summary>
+ public ShellProperty<String> UniqueID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Identity.UniqueID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Identity.UserName -- PKEY_Identity_UserName</para>
+ /// <para>Description: Identity User Name
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C4322503-78CA-49C6-9ACC-A68E2AFD7B6B}, 100</para>
+ /// </summary>
+ public ShellProperty<String> UserName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Identity.UserName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.IdentityProvider Properties
+ /// </summary>
+ public class PropertySystemIdentityProvider : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemIdentityProvider(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.IdentityProvider.Name -- PKEY_IdentityProvider_Name</para>
+ /// <para>Description: Identity Provider Name
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {B96EFF7B-35CA-4A35-8607-29E3A54C46EA}, 100</para>
+ /// </summary>
+ public ShellProperty<String> Name
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.IdentityProvider.Name;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IdentityProvider.Picture -- PKEY_IdentityProvider_Picture</para>
+ /// <para>Description: Picture for the Identity Provider
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {2425166F-5642-4864-992F-98FD98F294C3}, 100</para>
+ /// </summary>
+ public ShellProperty<String> Picture
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.IdentityProvider.Picture;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Image Properties
+ /// </summary>
+ public class PropertySystemImage : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemImage(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Image.BitDepth -- PKEY_Image_BitDepth</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 7 (PIDISI_BITDEPTH)</para>
+ /// </summary>
+ public ShellProperty<UInt32?> BitDepth
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Image.BitDepth;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.ColorSpace -- PKEY_Image_ColorSpace</para>
+ /// <para>Description: PropertyTagExifColorSpace
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 40961</para>
+ /// </summary>
+ public ShellProperty<UInt16?> ColorSpace
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Image.ColorSpace;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt16?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt16?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.CompressedBitsPerPixel -- PKEY_Image_CompressedBitsPerPixel</para>
+ /// <para>Description: Calculated from PKEY_Image_CompressedBitsPerPixelNumerator and PKEY_Image_CompressedBitsPerPixelDenominator.
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {364B6FA9-37AB-482A-BE2B-AE02F60D4318}, 100</para>
+ /// </summary>
+ public ShellProperty<Double?> CompressedBitsPerPixel
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Image.CompressedBitsPerPixel;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.CompressedBitsPerPixelDenominator -- PKEY_Image_CompressedBitsPerPixelDenominator</para>
+ /// <para>Description: Denominator of PKEY_Image_CompressedBitsPerPixel.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {1F8844E1-24AD-4508-9DFD-5326A415CE02}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> CompressedBitsPerPixelDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Image.CompressedBitsPerPixelDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.CompressedBitsPerPixelNumerator -- PKEY_Image_CompressedBitsPerPixelNumerator</para>
+ /// <para>Description: Numerator of PKEY_Image_CompressedBitsPerPixel.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {D21A7148-D32C-4624-8900-277210F79C0F}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> CompressedBitsPerPixelNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Image.CompressedBitsPerPixelNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.Compression -- PKEY_Image_Compression</para>
+ /// <para>Description: Indicates the image compression level. PropertyTagCompression.
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 259</para>
+ /// </summary>
+ public ShellProperty<UInt16?> Compression
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Image.Compression;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt16?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt16?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.CompressionText -- PKEY_Image_CompressionText</para>
+ /// <para>Description: This is the user-friendly form of System.Image.Compression. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {3F08E66F-2F44-4BB9-A682-AC35D2562322}, 100</para>
+ /// </summary>
+ public ShellProperty<String> CompressionText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Image.CompressionText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.Dimensions -- PKEY_Image_Dimensions</para>
+ /// <para>Description: Indicates the dimensions of the image.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 13 (PIDISI_DIMENSIONS)</para>
+ /// </summary>
+ public ShellProperty<String> Dimensions
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Image.Dimensions;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.HorizontalResolution -- PKEY_Image_HorizontalResolution</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 5 (PIDISI_RESOLUTIONX)</para>
+ /// </summary>
+ public ShellProperty<Double?> HorizontalResolution
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Image.HorizontalResolution;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.HorizontalSize -- PKEY_Image_HorizontalSize</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 3 (PIDISI_CX)</para>
+ /// </summary>
+ public ShellProperty<UInt32?> HorizontalSize
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Image.HorizontalSize;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.ImageID -- PKEY_Image_ImageID</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {10DABE05-32AA-4C29-BF1A-63E2D220587F}, 100</para>
+ /// </summary>
+ public ShellProperty<String> ImageID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Image.ImageID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.ResolutionUnit -- PKEY_Image_ResolutionUnit</para>
+ /// <para>Description: </para>
+ /// <para>Type: Int16 -- VT_I2</para>
+ /// <para>FormatID: {19B51FA6-1F92-4A5C-AB48-7DF0ABD67444}, 100</para>
+ /// </summary>
+ public ShellProperty<Int16?> ResolutionUnit
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Image.ResolutionUnit;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int16?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int16?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.VerticalResolution -- PKEY_Image_VerticalResolution</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 6 (PIDISI_RESOLUTIONY)</para>
+ /// </summary>
+ public ShellProperty<Double?> VerticalResolution
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Image.VerticalResolution;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.VerticalSize -- PKEY_Image_VerticalSize</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 4 (PIDISI_CY)</para>
+ /// </summary>
+ public ShellProperty<UInt32?> VerticalSize
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Image.VerticalSize;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Journal Properties
+ /// </summary>
+ public class PropertySystemJournal : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemJournal(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Journal.Contacts -- PKEY_Journal_Contacts</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {DEA7C82C-1D89-4A66-9427-A4E3DEBABCB1}, 100</para>
+ /// </summary>
+ public ShellProperty<String[]> Contacts
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Journal.Contacts;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Journal.EntryType -- PKEY_Journal_EntryType</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {95BEB1FC-326D-4644-B396-CD3ED90E6DDF}, 100</para>
+ /// </summary>
+ public ShellProperty<String> EntryType
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Journal.EntryType;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.LayoutPattern Properties
+ /// </summary>
+ public class PropertySystemLayoutPattern : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemLayoutPattern(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.LayoutPattern.ContentViewModeForBrowse -- PKEY_LayoutPattern_ContentViewModeForBrowse</para>
+ /// <para>Description: Specifies the layout pattern that the content view mode should apply for this item in the context of browsing.
+ ///Register the regvalue under the name of "ContentViewModeLayoutPatternForBrowse".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 500</para>
+ /// </summary>
+ public ShellProperty<String> ContentViewModeForBrowse
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.LayoutPattern.ContentViewModeForBrowse;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.LayoutPattern.ContentViewModeForSearch -- PKEY_LayoutPattern_ContentViewModeForSearch</para>
+ /// <para>Description: Specifies the layout pattern that the content view mode should apply for this item in the context of searching.
+ ///Register the regvalue under the name of "ContentViewModeLayoutPatternForSearch".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 501</para>
+ /// </summary>
+ public ShellProperty<String> ContentViewModeForSearch
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.LayoutPattern.ContentViewModeForSearch;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Link Properties
+ /// </summary>
+ public class PropertySystemLink : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemLink(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Link.Arguments -- PKEY_Link_Arguments</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {436F2667-14E2-4FEB-B30A-146C53B5B674}, 100</para>
+ /// </summary>
+ public ShellProperty<String> Arguments
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Link.Arguments;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Link.Comment -- PKEY_Link_Comment</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_LINK) {B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}, 5</para>
+ /// </summary>
+ public ShellProperty<String> Comment
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Link.Comment;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Link.DateVisited -- PKEY_Link_DateVisited</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {5CBF2787-48CF-4208-B90E-EE5E5D420294}, 23 (PKEYs relating to URLs. Used by IE History.)</para>
+ /// </summary>
+ public ShellProperty<DateTime?> DateVisited
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Link.DateVisited;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Link.Description -- PKEY_Link_Description</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {5CBF2787-48CF-4208-B90E-EE5E5D420294}, 21 (PKEYs relating to URLs. Used by IE History.)</para>
+ /// </summary>
+ public ShellProperty<String> Description
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Link.Description;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Link.Status -- PKEY_Link_Status</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (PSGUID_LINK) {B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}, 3 (PID_LINK_TARGET_TYPE)</para>
+ /// </summary>
+ public ShellProperty<Int32?> Status
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Link.Status;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Link.TargetExtension -- PKEY_Link_TargetExtension</para>
+ /// <para>Description: The file extension of the link target. See System.File.Extension
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {7A7D76F4-B630-4BD7-95FF-37CC51A975C9}, 2</para>
+ /// </summary>
+ public ShellProperty<String[]> TargetExtension
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Link.TargetExtension;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Link.TargetParsingPath -- PKEY_Link_TargetParsingPath</para>
+ /// <para>Description: This is the shell namespace path to the target of the link item. This path may be passed to
+ ///SHParseDisplayName to parse the path to the correct shell folder.
+ ///
+ ///If the target item is a file, the value is identical to System.ItemPathDisplay.
+ ///
+ ///If the target item cannot be accessed through the shell namespace, this value is VT_EMPTY.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_LINK) {B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}, 2 (PID_LINK_TARGET)</para>
+ /// </summary>
+ public ShellProperty<String> TargetParsingPath
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Link.TargetParsingPath;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Link.TargetSFGAOFlags -- PKEY_Link_TargetSFGAOFlags</para>
+ /// <para>Description: IShellFolder::GetAttributesOf flags for the target of a link, with SFGAO_PKEYSFGAOMASK
+ ///attributes masked out.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (PSGUID_LINK) {B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}, 8</para>
+ /// </summary>
+ public ShellProperty<UInt32?> TargetSFGAOFlags
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Link.TargetSFGAOFlags;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Link.TargetSFGAOFlagsStrings -- PKEY_Link_TargetSFGAOFlagsStrings</para>
+ /// <para>Description: Expresses the SFGAO flags of a link as string values and is used as a query optimization. See
+ ///PKEY_Shell_SFGAOFlagsStrings for possible values of this.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {D6942081-D53B-443D-AD47-5E059D9CD27A}, 3</para>
+ /// </summary>
+ public ShellProperty<String[]> TargetSFGAOFlagsStrings
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Link.TargetSFGAOFlagsStrings;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Link.TargetUrl -- PKEY_Link_TargetUrl</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {5CBF2787-48CF-4208-B90E-EE5E5D420294}, 2 (PKEYs relating to URLs. Used by IE History.)</para>
+ /// </summary>
+ public ShellProperty<String> TargetUrl
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Link.TargetUrl;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Media Properties
+ /// </summary>
+ public class PropertySystemMedia : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemMedia(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Media.AuthorUrl -- PKEY_Media_AuthorUrl</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 32 (PIDMSI_AUTHOR_URL)</para>
+ /// </summary>
+ public ShellProperty<String> AuthorUrl
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.AuthorUrl;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.AverageLevel -- PKEY_Media_AverageLevel</para>
+ /// <para>Description: </para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {09EDD5B6-B301-43C5-9990-D00302EFFD46}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> AverageLevel
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.AverageLevel;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.ClassPrimaryID -- PKEY_Media_ClassPrimaryID</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 13 (PIDMSI_CLASS_PRIMARY_ID)</para>
+ /// </summary>
+ public ShellProperty<String> ClassPrimaryID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.ClassPrimaryID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.ClassSecondaryID -- PKEY_Media_ClassSecondaryID</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 14 (PIDMSI_CLASS_SECONDARY_ID)</para>
+ /// </summary>
+ public ShellProperty<String> ClassSecondaryID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.ClassSecondaryID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.CollectionGroupID -- PKEY_Media_CollectionGroupID</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 24 (PIDMSI_COLLECTION_GROUP_ID)</para>
+ /// </summary>
+ public ShellProperty<String> CollectionGroupID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.CollectionGroupID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.CollectionID -- PKEY_Media_CollectionID</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 25 (PIDMSI_COLLECTION_ID)</para>
+ /// </summary>
+ public ShellProperty<String> CollectionID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.CollectionID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.ContentDistributor -- PKEY_Media_ContentDistributor</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 18 (PIDMSI_CONTENTDISTRIBUTOR)</para>
+ /// </summary>
+ public ShellProperty<String> ContentDistributor
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.ContentDistributor;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.ContentID -- PKEY_Media_ContentID</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 26 (PIDMSI_CONTENT_ID)</para>
+ /// </summary>
+ public ShellProperty<String> ContentID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.ContentID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.CreatorApplication -- PKEY_Media_CreatorApplication</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 27 (PIDMSI_TOOL_NAME)</para>
+ /// </summary>
+ public ShellProperty<String> CreatorApplication
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.CreatorApplication;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.CreatorApplicationVersion -- PKEY_Media_CreatorApplicationVersion</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 28 (PIDMSI_TOOL_VERSION)</para>
+ /// </summary>
+ public ShellProperty<String> CreatorApplicationVersion
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.CreatorApplicationVersion;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.DateEncoded -- PKEY_Media_DateEncoded</para>
+ /// <para>Description: DateTime is in UTC (in the doc, not file system).
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {2E4B640D-5019-46D8-8881-55414CC5CAA0}, 100</para>
+ /// </summary>
+ public ShellProperty<DateTime?> DateEncoded
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.DateEncoded;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.DateReleased -- PKEY_Media_DateReleased</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {DE41CC29-6971-4290-B472-F59F2E2F31E2}, 100</para>
+ /// </summary>
+ public ShellProperty<String> DateReleased
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.DateReleased;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.Duration -- PKEY_Media_Duration</para>
+ /// <para>Description: 100ns units, not milliseconds
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 3 (PIDASI_TIMELENGTH)</para>
+ /// </summary>
+ public ShellProperty<UInt64?> Duration
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.Duration;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt64?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt64?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.DVDID -- PKEY_Media_DVDID</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 15 (PIDMSI_DVDID)</para>
+ /// </summary>
+ public ShellProperty<String> DVDID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.DVDID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.EncodedBy -- PKEY_Media_EncodedBy</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 36 (PIDMSI_ENCODED_BY)</para>
+ /// </summary>
+ public ShellProperty<String> EncodedBy
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.EncodedBy;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.EncodingSettings -- PKEY_Media_EncodingSettings</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 37 (PIDMSI_ENCODING_SETTINGS)</para>
+ /// </summary>
+ public ShellProperty<String> EncodingSettings
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.EncodingSettings;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.FrameCount -- PKEY_Media_FrameCount</para>
+ /// <para>Description: Indicates the frame count for the image.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 12 (PIDISI_FRAMECOUNT)</para>
+ /// </summary>
+ public ShellProperty<UInt32?> FrameCount
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.FrameCount;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.MCDI -- PKEY_Media_MCDI</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 16 (PIDMSI_MCDI)</para>
+ /// </summary>
+ public ShellProperty<String> MCDI
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.MCDI;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.MetadataContentProvider -- PKEY_Media_MetadataContentProvider</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 17 (PIDMSI_PROVIDER)</para>
+ /// </summary>
+ public ShellProperty<String> MetadataContentProvider
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.MetadataContentProvider;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.Producer -- PKEY_Media_Producer</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 22 (PIDMSI_PRODUCER)</para>
+ /// </summary>
+ public ShellProperty<String[]> Producer
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.Producer;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.PromotionUrl -- PKEY_Media_PromotionUrl</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 33 (PIDMSI_PROMOTION_URL)</para>
+ /// </summary>
+ public ShellProperty<String> PromotionUrl
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.PromotionUrl;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.ProtectionType -- PKEY_Media_ProtectionType</para>
+ /// <para>Description: If media is protected, how is it protected?
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 38</para>
+ /// </summary>
+ public ShellProperty<String> ProtectionType
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.ProtectionType;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.ProviderRating -- PKEY_Media_ProviderRating</para>
+ /// <para>Description: Rating (0 - 99) supplied by metadata provider
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 39</para>
+ /// </summary>
+ public ShellProperty<String> ProviderRating
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.ProviderRating;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.ProviderStyle -- PKEY_Media_ProviderStyle</para>
+ /// <para>Description: Style of music or video, supplied by metadata provider
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 40</para>
+ /// </summary>
+ public ShellProperty<String> ProviderStyle
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.ProviderStyle;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.Publisher -- PKEY_Media_Publisher</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 30 (PIDMSI_PUBLISHER)</para>
+ /// </summary>
+ public ShellProperty<String> Publisher
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.Publisher;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.SubscriptionContentId -- PKEY_Media_SubscriptionContentId</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {9AEBAE7A-9644-487D-A92C-657585ED751A}, 100</para>
+ /// </summary>
+ public ShellProperty<String> SubscriptionContentId
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.SubscriptionContentId;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.SubTitle -- PKEY_Media_SubTitle</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 38 (PIDSI_MUSIC_SUB_TITLE)</para>
+ /// </summary>
+ public ShellProperty<String> Subtitle
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.Subtitle;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.UniqueFileIdentifier -- PKEY_Media_UniqueFileIdentifier</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 35 (PIDMSI_UNIQUE_FILE_IDENTIFIER)</para>
+ /// </summary>
+ public ShellProperty<String> UniqueFileIdentifier
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.UniqueFileIdentifier;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.UserNoAutoInfo -- PKEY_Media_UserNoAutoInfo</para>
+ /// <para>Description: If true, do NOT alter this file's metadata. Set by user.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 41</para>
+ /// </summary>
+ public ShellProperty<String> UserNoAutoInfo
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.UserNoAutoInfo;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.UserWebUrl -- PKEY_Media_UserWebUrl</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 34 (PIDMSI_USER_WEB_URL)</para>
+ /// </summary>
+ public ShellProperty<String> UserWebUrl
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.UserWebUrl;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.Writer -- PKEY_Media_Writer</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 23 (PIDMSI_WRITER)</para>
+ /// </summary>
+ public ShellProperty<String[]> Writer
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.Writer;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.Year -- PKEY_Media_Year</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 5 (PIDSI_MUSIC_YEAR)</para>
+ /// </summary>
+ public ShellProperty<UInt32?> Year
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Media.Year;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Message Properties
+ /// </summary>
+ public class PropertySystemMessage : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemMessage(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Message.AttachmentContents -- PKEY_Message_AttachmentContents</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {3143BF7C-80A8-4854-8880-E2E40189BDD0}, 100</para>
+ /// </summary>
+ public ShellProperty<String> AttachmentContents
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.AttachmentContents;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.AttachmentNames -- PKEY_Message_AttachmentNames</para>
+ /// <para>Description: The names of the attachments in a message
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 21</para>
+ /// </summary>
+ public ShellProperty<String[]> AttachmentNames
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.AttachmentNames;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.BccAddress -- PKEY_Message_BccAddress</para>
+ /// <para>Description: Addresses in Bcc: field
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 2</para>
+ /// </summary>
+ public ShellProperty<String[]> BccAddress
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.BccAddress;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.BccName -- PKEY_Message_BccName</para>
+ /// <para>Description: person names in Bcc: field
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 3</para>
+ /// </summary>
+ public ShellProperty<String[]> BccName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.BccName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.CcAddress -- PKEY_Message_CcAddress</para>
+ /// <para>Description: Addresses in Cc: field
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 4</para>
+ /// </summary>
+ public ShellProperty<String[]> CcAddress
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.CcAddress;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.CcName -- PKEY_Message_CcName</para>
+ /// <para>Description: person names in Cc: field
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 5</para>
+ /// </summary>
+ public ShellProperty<String[]> CcName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.CcName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.ConversationID -- PKEY_Message_ConversationID</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {DC8F80BD-AF1E-4289-85B6-3DFC1B493992}, 100</para>
+ /// </summary>
+ public ShellProperty<String> ConversationID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.ConversationID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.ConversationIndex -- PKEY_Message_ConversationIndex</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Buffer -- VT_VECTOR | VT_UI1 (For variants: VT_ARRAY | VT_UI1)</para>
+ /// <para>FormatID: {DC8F80BD-AF1E-4289-85B6-3DFC1B493992}, 101</para>
+ /// </summary>
+ public ShellProperty<Byte[]> ConversationIndex
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.ConversationIndex;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.DateReceived -- PKEY_Message_DateReceived</para>
+ /// <para>Description: Date and Time communication was received
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 20</para>
+ /// </summary>
+ public ShellProperty<DateTime?> DateReceived
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.DateReceived;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.DateSent -- PKEY_Message_DateSent</para>
+ /// <para>Description: Date and Time communication was sent
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 19</para>
+ /// </summary>
+ public ShellProperty<DateTime?> DateSent
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.DateSent;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.Flags -- PKEY_Message_Flags</para>
+ /// <para>Description: These are flags associated with email messages to know if a read receipt is pending, etc.
+ ///The values stored here by Outlook are defined for PR_MESSAGE_FLAGS on MSDN.
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {A82D9EE7-CA67-4312-965E-226BCEA85023}, 100</para>
+ /// </summary>
+ public ShellProperty<Int32?> Flags
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.Flags;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.FromAddress -- PKEY_Message_FromAddress</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 13</para>
+ /// </summary>
+ public ShellProperty<String[]> FromAddress
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.FromAddress;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.FromName -- PKEY_Message_FromName</para>
+ /// <para>Description: Address in from field as person name
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 14</para>
+ /// </summary>
+ public ShellProperty<String[]> FromName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.FromName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.HasAttachments -- PKEY_Message_HasAttachments</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {9C1FCF74-2D97-41BA-B4AE-CB2E3661A6E4}, 8</para>
+ /// </summary>
+ public ShellProperty<Boolean?> HasAttachments
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.HasAttachments;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.IsFwdOrReply -- PKEY_Message_IsFwdOrReply</para>
+ /// <para>Description: </para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {9A9BC088-4F6D-469E-9919-E705412040F9}, 100</para>
+ /// </summary>
+ public ShellProperty<Int32?> IsFwdOrReply
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.IsFwdOrReply;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.MessageClass -- PKEY_Message_MessageClass</para>
+ /// <para>Description: What type of outlook msg this is (meeting, task, mail, etc.)
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {CD9ED458-08CE-418F-A70E-F912C7BB9C5C}, 103</para>
+ /// </summary>
+ public ShellProperty<String> MessageClass
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.MessageClass;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.ProofInProgress -- PKEY_Message_ProofInProgress</para>
+ /// <para>Description: This property will be true if the message junk email proofing is still in progress.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {9098F33C-9A7D-48A8-8DE5-2E1227A64E91}, 100</para>
+ /// </summary>
+ public ShellProperty<Boolean?> ProofInProgress
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.ProofInProgress;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.SenderAddress -- PKEY_Message_SenderAddress</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {0BE1C8E7-1981-4676-AE14-FDD78F05A6E7}, 100</para>
+ /// </summary>
+ public ShellProperty<String> SenderAddress
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.SenderAddress;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.SenderName -- PKEY_Message_SenderName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {0DA41CFA-D224-4A18-AE2F-596158DB4B3A}, 100</para>
+ /// </summary>
+ public ShellProperty<String> SenderName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.SenderName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.Store -- PKEY_Message_Store</para>
+ /// <para>Description: The store (aka protocol handler) FILE, MAIL, OUTLOOKEXPRESS
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 15</para>
+ /// </summary>
+ public ShellProperty<String> Store
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.Store;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.ToAddress -- PKEY_Message_ToAddress</para>
+ /// <para>Description: Addresses in To: field
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 16</para>
+ /// </summary>
+ public ShellProperty<String[]> ToAddress
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.ToAddress;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.ToDoFlags -- PKEY_Message_ToDoFlags</para>
+ /// <para>Description: Flags associated with a message flagged to know if it's still active, if it was custom flagged, etc.
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {1F856A9F-6900-4ABA-9505-2D5F1B4D66CB}, 100</para>
+ /// </summary>
+ public ShellProperty<Int32?> ToDoFlags
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.ToDoFlags;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.ToDoTitle -- PKEY_Message_ToDoTitle</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {BCCC8A3C-8CEF-42E5-9B1C-C69079398BC7}, 100</para>
+ /// </summary>
+ public ShellProperty<String> ToDoTitle
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.ToDoTitle;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.ToName -- PKEY_Message_ToName</para>
+ /// <para>Description: Person names in To: field
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 17</para>
+ /// </summary>
+ public ShellProperty<String[]> ToName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Message.ToName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Music Properties
+ /// </summary>
+ public class PropertySystemMusic : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemMusic(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Music.AlbumArtist -- PKEY_Music_AlbumArtist</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 13 (PIDSI_MUSIC_ALBUM_ARTIST)</para>
+ /// </summary>
+ public ShellProperty<String> AlbumArtist
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Music.AlbumArtist;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.AlbumID -- PKEY_Music_AlbumID</para>
+ /// <para>Description: Concatenation of System.Music.AlbumArtist and System.Music.AlbumTitle, suitable for indexing and display.
+ ///Used to differentiate albums with the same title from different artists.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 100</para>
+ /// </summary>
+ public ShellProperty<String> AlbumID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Music.AlbumID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.AlbumTitle -- PKEY_Music_AlbumTitle</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 4 (PIDSI_MUSIC_ALBUM)</para>
+ /// </summary>
+ public ShellProperty<String> AlbumTitle
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Music.AlbumTitle;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.Artist -- PKEY_Music_Artist</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 2 (PIDSI_MUSIC_ARTIST)</para>
+ /// </summary>
+ public ShellProperty<String[]> Artist
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Music.Artist;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.BeatsPerMinute -- PKEY_Music_BeatsPerMinute</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 35 (PIDSI_MUSIC_BEATS_PER_MINUTE)</para>
+ /// </summary>
+ public ShellProperty<String> BeatsPerMinute
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Music.BeatsPerMinute;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.Composer -- PKEY_Music_Composer</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 19 (PIDMSI_COMPOSER)</para>
+ /// </summary>
+ public ShellProperty<String[]> Composer
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Music.Composer;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.Conductor -- PKEY_Music_Conductor</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 36 (PIDSI_MUSIC_CONDUCTOR)</para>
+ /// </summary>
+ public ShellProperty<String[]> Conductor
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Music.Conductor;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.ContentGroupDescription -- PKEY_Music_ContentGroupDescription</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 33 (PIDSI_MUSIC_CONTENT_GROUP_DESCRIPTION)</para>
+ /// </summary>
+ public ShellProperty<String> ContentGroupDescription
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Music.ContentGroupDescription;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.DisplayArtist -- PKEY_Music_DisplayArtist</para>
+ /// <para>Description: This property returns the best representation of Album Artist for a given music file
+ ///based upon AlbumArtist, ContributingArtist and compilation info.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {FD122953-FA93-4EF7-92C3-04C946B2F7C8}, 100</para>
+ /// </summary>
+ public ShellProperty<String> DisplayArtist
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Music.DisplayArtist;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.Genre -- PKEY_Music_Genre</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 11 (PIDSI_MUSIC_GENRE)</para>
+ /// </summary>
+ public ShellProperty<String[]> Genre
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Music.Genre;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.InitialKey -- PKEY_Music_InitialKey</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 34 (PIDSI_MUSIC_INITIAL_KEY)</para>
+ /// </summary>
+ public ShellProperty<String> InitialKey
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Music.InitialKey;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.IsCompilation -- PKEY_Music_IsCompilation</para>
+ /// <para>Description: Indicates whether the file is part of a compilation.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {C449D5CB-9EA4-4809-82E8-AF9D59DED6D1}, 100</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsCompilation
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Music.IsCompilation;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.Lyrics -- PKEY_Music_Lyrics</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 12 (PIDSI_MUSIC_LYRICS)</para>
+ /// </summary>
+ public ShellProperty<String> Lyrics
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Music.Lyrics;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.Mood -- PKEY_Music_Mood</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 39 (PIDSI_MUSIC_MOOD)</para>
+ /// </summary>
+ public ShellProperty<String> Mood
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Music.Mood;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.PartOfSet -- PKEY_Music_PartOfSet</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 37 (PIDSI_MUSIC_PART_OF_SET)</para>
+ /// </summary>
+ public ShellProperty<String> PartOfSet
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Music.PartOfSet;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.Period -- PKEY_Music_Period</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 31 (PIDMSI_PERIOD)</para>
+ /// </summary>
+ public ShellProperty<String> Period
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Music.Period;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.SynchronizedLyrics -- PKEY_Music_SynchronizedLyrics</para>
+ /// <para>Description: </para>
+ /// <para>Type: Blob -- VT_BLOB</para>
+ /// <para>FormatID: {6B223B6A-162E-4AA9-B39F-05D678FC6D77}, 100</para>
+ /// </summary>
+ public ShellProperty<Byte[]> SynchronizedLyrics
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Music.SynchronizedLyrics;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.TrackNumber -- PKEY_Music_TrackNumber</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 7 (PIDSI_MUSIC_TRACK)</para>
+ /// </summary>
+ public ShellProperty<UInt32?> TrackNumber
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Music.TrackNumber;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Note Properties
+ /// </summary>
+ public class PropertySystemNote : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemNote(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Note.Color -- PKEY_Note_Color</para>
+ /// <para>Description: </para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {4776CAFA-BCE4-4CB1-A23E-265E76D8EB11}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt16?> Color
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Note.Color;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt16?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt16?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Note.ColorText -- PKEY_Note_ColorText</para>
+ /// <para>Description: This is the user-friendly form of System.Note.Color. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {46B4E8DE-CDB2-440D-885C-1658EB65B914}, 100</para>
+ /// </summary>
+ public ShellProperty<String> ColorText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Note.ColorText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Photo Properties
+ /// </summary>
+ public class PropertySystemPhoto : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemPhoto(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Photo.Aperture -- PKEY_Photo_Aperture</para>
+ /// <para>Description: PropertyTagExifAperture. Calculated from PKEY_Photo_ApertureNumerator and PKEY_Photo_ApertureDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37378</para>
+ /// </summary>
+ public ShellProperty<Double?> Aperture
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.Aperture;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ApertureDenominator -- PKEY_Photo_ApertureDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_Aperture
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {E1A9A38B-6685-46BD-875E-570DC7AD7320}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> ApertureDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.ApertureDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ApertureNumerator -- PKEY_Photo_ApertureNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_Aperture
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {0337ECEC-39FB-4581-A0BD-4C4CC51E9914}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> ApertureNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.ApertureNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.Brightness -- PKEY_Photo_Brightness</para>
+ /// <para>Description: This is the brightness of the photo.
+ ///
+ ///Calculated from PKEY_Photo_BrightnessNumerator and PKEY_Photo_BrightnessDenominator.
+ ///
+ ///The units are "APEX", normally in the range of -99.99 to 99.99. If the numerator of
+ ///the recorded value is FFFFFFFF.H, "Unknown" should be indicated.
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {1A701BF6-478C-4361-83AB-3701BB053C58}, 100 (PropertyTagExifBrightness)</para>
+ /// </summary>
+ public ShellProperty<Double?> Brightness
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.Brightness;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.BrightnessDenominator -- PKEY_Photo_BrightnessDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_Brightness
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {6EBE6946-2321-440A-90F0-C043EFD32476}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> BrightnessDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.BrightnessDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.BrightnessNumerator -- PKEY_Photo_BrightnessNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_Brightness
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {9E7D118F-B314-45A0-8CFB-D654B917C9E9}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> BrightnessNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.BrightnessNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.CameraManufacturer -- PKEY_Photo_CameraManufacturer</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 271 (PropertyTagEquipMake)</para>
+ /// </summary>
+ public ShellProperty<String> CameraManufacturer
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.CameraManufacturer;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.CameraModel -- PKEY_Photo_CameraModel</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 272 (PropertyTagEquipModel)</para>
+ /// </summary>
+ public ShellProperty<String> CameraModel
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.CameraModel;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.CameraSerialNumber -- PKEY_Photo_CameraSerialNumber</para>
+ /// <para>Description: Serial number of camera that produced this photo
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 273</para>
+ /// </summary>
+ public ShellProperty<String> CameraSerialNumber
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.CameraSerialNumber;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.Contrast -- PKEY_Photo_Contrast</para>
+ /// <para>Description: This indicates the direction of contrast processing applied by the camera
+ ///when the image was shot.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {2A785BA9-8D23-4DED-82E6-60A350C86A10}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> Contrast
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.Contrast;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ContrastText -- PKEY_Photo_ContrastText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.Contrast. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {59DDE9F2-5253-40EA-9A8B-479E96C6249A}, 100</para>
+ /// </summary>
+ public ShellProperty<String> ContrastText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.ContrastText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.DateTaken -- PKEY_Photo_DateTaken</para>
+ /// <para>Description: PropertyTagExifDTOrig
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 36867</para>
+ /// </summary>
+ public ShellProperty<DateTime?> DateTaken
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.DateTaken;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.DigitalZoom -- PKEY_Photo_DigitalZoom</para>
+ /// <para>Description: PropertyTagExifDigitalZoom. Calculated from PKEY_Photo_DigitalZoomNumerator and PKEY_Photo_DigitalZoomDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {F85BF840-A925-4BC2-B0C4-8E36B598679E}, 100</para>
+ /// </summary>
+ public ShellProperty<Double?> DigitalZoom
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.DigitalZoom;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.DigitalZoomDenominator -- PKEY_Photo_DigitalZoomDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_DigitalZoom
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {745BAF0E-E5C1-4CFB-8A1B-D031A0A52393}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> DigitalZoomDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.DigitalZoomDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.DigitalZoomNumerator -- PKEY_Photo_DigitalZoomNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_DigitalZoom
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {16CBB924-6500-473B-A5BE-F1599BCBE413}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> DigitalZoomNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.DigitalZoomNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.Event -- PKEY_Photo_Event</para>
+ /// <para>Description: The event at which the photo was taken
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 18248</para>
+ /// </summary>
+ public ShellProperty<String[]> Event
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.Event;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.EXIFVersion -- PKEY_Photo_EXIFVersion</para>
+ /// <para>Description: The EXIF version.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {D35F743A-EB2E-47F2-A286-844132CB1427}, 100</para>
+ /// </summary>
+ public ShellProperty<String> EXIFVersion
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.EXIFVersion;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureBias -- PKEY_Photo_ExposureBias</para>
+ /// <para>Description: PropertyTagExifExposureBias. Calculated from PKEY_Photo_ExposureBiasNumerator and PKEY_Photo_ExposureBiasDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37380</para>
+ /// </summary>
+ public ShellProperty<Double?> ExposureBias
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.ExposureBias;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureBiasDenominator -- PKEY_Photo_ExposureBiasDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_ExposureBias
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {AB205E50-04B7-461C-A18C-2F233836E627}, 100</para>
+ /// </summary>
+ public ShellProperty<Int32?> ExposureBiasDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.ExposureBiasDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureBiasNumerator -- PKEY_Photo_ExposureBiasNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_ExposureBias
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {738BF284-1D87-420B-92CF-5834BF6EF9ED}, 100</para>
+ /// </summary>
+ public ShellProperty<Int32?> ExposureBiasNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.ExposureBiasNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureIndex -- PKEY_Photo_ExposureIndex</para>
+ /// <para>Description: PropertyTagExifExposureIndex. Calculated from PKEY_Photo_ExposureIndexNumerator and PKEY_Photo_ExposureIndexDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {967B5AF8-995A-46ED-9E11-35B3C5B9782D}, 100</para>
+ /// </summary>
+ public ShellProperty<Double?> ExposureIndex
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.ExposureIndex;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureIndexDenominator -- PKEY_Photo_ExposureIndexDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_ExposureIndex
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {93112F89-C28B-492F-8A9D-4BE2062CEE8A}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> ExposureIndexDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.ExposureIndexDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureIndexNumerator -- PKEY_Photo_ExposureIndexNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_ExposureIndex
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {CDEDCF30-8919-44DF-8F4C-4EB2FFDB8D89}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> ExposureIndexNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.ExposureIndexNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureProgram -- PKEY_Photo_ExposureProgram</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 34850 (PropertyTagExifExposureProg)</para>
+ /// </summary>
+ public ShellProperty<UInt32?> ExposureProgram
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.ExposureProgram;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureProgramText -- PKEY_Photo_ExposureProgramText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.ExposureProgram. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {FEC690B7-5F30-4646-AE47-4CAAFBA884A3}, 100</para>
+ /// </summary>
+ public ShellProperty<String> ExposureProgramText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.ExposureProgramText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureTime -- PKEY_Photo_ExposureTime</para>
+ /// <para>Description: PropertyTagExifExposureTime. Calculated from PKEY_Photo_ExposureTimeNumerator and PKEY_Photo_ExposureTimeDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 33434</para>
+ /// </summary>
+ public ShellProperty<Double?> ExposureTime
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.ExposureTime;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureTimeDenominator -- PKEY_Photo_ExposureTimeDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_ExposureTime
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {55E98597-AD16-42E0-B624-21599A199838}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> ExposureTimeDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.ExposureTimeDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureTimeNumerator -- PKEY_Photo_ExposureTimeNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_ExposureTime
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {257E44E2-9031-4323-AC38-85C552871B2E}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> ExposureTimeNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.ExposureTimeNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.Flash -- PKEY_Photo_Flash</para>
+ /// <para>Description: PropertyTagExifFlash
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37385</para>
+ /// </summary>
+ public ShellProperty<Byte?> Flash
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.Flash;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FlashEnergy -- PKEY_Photo_FlashEnergy</para>
+ /// <para>Description: PropertyTagExifFlashEnergy. Calculated from PKEY_Photo_FlashEnergyNumerator and PKEY_Photo_FlashEnergyDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 41483</para>
+ /// </summary>
+ public ShellProperty<Double?> FlashEnergy
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.FlashEnergy;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FlashEnergyDenominator -- PKEY_Photo_FlashEnergyDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_FlashEnergy
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {D7B61C70-6323-49CD-A5FC-C84277162C97}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> FlashEnergyDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.FlashEnergyDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FlashEnergyNumerator -- PKEY_Photo_FlashEnergyNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_FlashEnergy
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {FCAD3D3D-0858-400F-AAA3-2F66CCE2A6BC}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> FlashEnergyNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.FlashEnergyNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FlashManufacturer -- PKEY_Photo_FlashManufacturer</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {AABAF6C9-E0C5-4719-8585-57B103E584FE}, 100</para>
+ /// </summary>
+ public ShellProperty<String> FlashManufacturer
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.FlashManufacturer;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FlashModel -- PKEY_Photo_FlashModel</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {FE83BB35-4D1A-42E2-916B-06F3E1AF719E}, 100</para>
+ /// </summary>
+ public ShellProperty<String> FlashModel
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.FlashModel;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FlashText -- PKEY_Photo_FlashText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.Flash. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {6B8B68F6-200B-47EA-8D25-D8050F57339F}, 100</para>
+ /// </summary>
+ public ShellProperty<String> FlashText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.FlashText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FNumber -- PKEY_Photo_FNumber</para>
+ /// <para>Description: PropertyTagExifFNumber. Calculated from PKEY_Photo_FNumberNumerator and PKEY_Photo_FNumberDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 33437</para>
+ /// </summary>
+ public ShellProperty<Double?> FNumber
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.FNumber;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FNumberDenominator -- PKEY_Photo_FNumberDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_FNumber
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {E92A2496-223B-4463-A4E3-30EABBA79D80}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> FNumberDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.FNumberDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FNumberNumerator -- PKEY_Photo_FNumberNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_FNumber
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {1B97738A-FDFC-462F-9D93-1957E08BE90C}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> FNumberNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.FNumberNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FocalLength -- PKEY_Photo_FocalLength</para>
+ /// <para>Description: PropertyTagExifFocalLength. Calculated from PKEY_Photo_FocalLengthNumerator and PKEY_Photo_FocalLengthDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37386</para>
+ /// </summary>
+ public ShellProperty<Double?> FocalLength
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.FocalLength;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FocalLengthDenominator -- PKEY_Photo_FocalLengthDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_FocalLength
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {305BC615-DCA1-44A5-9FD4-10C0BA79412E}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> FocalLengthDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.FocalLengthDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FocalLengthInFilm -- PKEY_Photo_FocalLengthInFilm</para>
+ /// <para>Description: </para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {A0E74609-B84D-4F49-B860-462BD9971F98}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt16?> FocalLengthInFilm
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.FocalLengthInFilm;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt16?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt16?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FocalLengthNumerator -- PKEY_Photo_FocalLengthNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_FocalLength
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {776B6B3B-1E3D-4B0C-9A0E-8FBAF2A8492A}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> FocalLengthNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.FocalLengthNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FocalPlaneXResolution -- PKEY_Photo_FocalPlaneXResolution</para>
+ /// <para>Description: PropertyTagExifFocalXRes. Calculated from PKEY_Photo_FocalPlaneXResolutionNumerator and
+ ///PKEY_Photo_FocalPlaneXResolutionDenominator.
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {CFC08D97-C6F7-4484-89DD-EBEF4356FE76}, 100</para>
+ /// </summary>
+ public ShellProperty<Double?> FocalPlaneXResolution
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.FocalPlaneXResolution;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FocalPlaneXResolutionDenominator -- PKEY_Photo_FocalPlaneXResolutionDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_FocalPlaneXResolution
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {0933F3F5-4786-4F46-A8E8-D64DD37FA521}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> FocalPlaneXResolutionDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.FocalPlaneXResolutionDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FocalPlaneXResolutionNumerator -- PKEY_Photo_FocalPlaneXResolutionNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_FocalPlaneXResolution
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {DCCB10AF-B4E2-4B88-95F9-031B4D5AB490}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> FocalPlaneXResolutionNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.FocalPlaneXResolutionNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FocalPlaneYResolution -- PKEY_Photo_FocalPlaneYResolution</para>
+ /// <para>Description: PropertyTagExifFocalYRes. Calculated from PKEY_Photo_FocalPlaneYResolutionNumerator and
+ ///PKEY_Photo_FocalPlaneYResolutionDenominator.
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {4FFFE4D0-914F-4AC4-8D6F-C9C61DE169B1}, 100</para>
+ /// </summary>
+ public ShellProperty<Double?> FocalPlaneYResolution
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.FocalPlaneYResolution;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FocalPlaneYResolutionDenominator -- PKEY_Photo_FocalPlaneYResolutionDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_FocalPlaneYResolution
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {1D6179A6-A876-4031-B013-3347B2B64DC8}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> FocalPlaneYResolutionDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.FocalPlaneYResolutionDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FocalPlaneYResolutionNumerator -- PKEY_Photo_FocalPlaneYResolutionNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_FocalPlaneYResolution
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {A2E541C5-4440-4BA8-867E-75CFC06828CD}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> FocalPlaneYResolutionNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.FocalPlaneYResolutionNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.GainControl -- PKEY_Photo_GainControl</para>
+ /// <para>Description: This indicates the degree of overall image gain adjustment.
+ ///
+ ///Calculated from PKEY_Photo_GainControlNumerator and PKEY_Photo_GainControlDenominator.
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {FA304789-00C7-4D80-904A-1E4DCC7265AA}, 100 (PropertyTagExifGainControl)</para>
+ /// </summary>
+ public ShellProperty<Double?> GainControl
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.GainControl;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.GainControlDenominator -- PKEY_Photo_GainControlDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_GainControl
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {42864DFD-9DA4-4F77-BDED-4AAD7B256735}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> GainControlDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.GainControlDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.GainControlNumerator -- PKEY_Photo_GainControlNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_GainControl
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {8E8ECF7C-B7B8-4EB8-A63F-0EE715C96F9E}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> GainControlNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.GainControlNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.GainControlText -- PKEY_Photo_GainControlText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.GainControl. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C06238B2-0BF9-4279-A723-25856715CB9D}, 100</para>
+ /// </summary>
+ public ShellProperty<String> GainControlText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.GainControlText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ISOSpeed -- PKEY_Photo_ISOSpeed</para>
+ /// <para>Description: PropertyTagExifISOSpeed
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 34855</para>
+ /// </summary>
+ public ShellProperty<UInt16?> ISOSpeed
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.ISOSpeed;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt16?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt16?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.LensManufacturer -- PKEY_Photo_LensManufacturer</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E6DDCAF7-29C5-4F0A-9A68-D19412EC7090}, 100</para>
+ /// </summary>
+ public ShellProperty<String> LensManufacturer
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.LensManufacturer;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.LensModel -- PKEY_Photo_LensModel</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E1277516-2B5F-4869-89B1-2E585BD38B7A}, 100</para>
+ /// </summary>
+ public ShellProperty<String> LensModel
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.LensModel;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.LightSource -- PKEY_Photo_LightSource</para>
+ /// <para>Description: PropertyTagExifLightSource
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37384</para>
+ /// </summary>
+ public ShellProperty<UInt32?> LightSource
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.LightSource;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.MakerNote -- PKEY_Photo_MakerNote</para>
+ /// <para>Description: </para>
+ /// <para>Type: Buffer -- VT_VECTOR | VT_UI1 (For variants: VT_ARRAY | VT_UI1)</para>
+ /// <para>FormatID: {FA303353-B659-4052-85E9-BCAC79549B84}, 100</para>
+ /// </summary>
+ public ShellProperty<Byte[]> MakerNote
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.MakerNote;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.MakerNoteOffset -- PKEY_Photo_MakerNoteOffset</para>
+ /// <para>Description: </para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: {813F4124-34E6-4D17-AB3E-6B1F3C2247A1}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt64?> MakerNoteOffset
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.MakerNoteOffset;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt64?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt64?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.MaxAperture -- PKEY_Photo_MaxAperture</para>
+ /// <para>Description: Calculated from PKEY_Photo_MaxApertureNumerator and PKEY_Photo_MaxApertureDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {08F6D7C2-E3F2-44FC-AF1E-5AA5C81A2D3E}, 100</para>
+ /// </summary>
+ public ShellProperty<Double?> MaxAperture
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.MaxAperture;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.MaxApertureDenominator -- PKEY_Photo_MaxApertureDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_MaxAperture
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {C77724D4-601F-46C5-9B89-C53F93BCEB77}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> MaxApertureDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.MaxApertureDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.MaxApertureNumerator -- PKEY_Photo_MaxApertureNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_MaxAperture
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {C107E191-A459-44C5-9AE6-B952AD4B906D}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> MaxApertureNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.MaxApertureNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.MeteringMode -- PKEY_Photo_MeteringMode</para>
+ /// <para>Description: PropertyTagExifMeteringMode
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37383</para>
+ /// </summary>
+ public ShellProperty<UInt16?> MeteringMode
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.MeteringMode;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt16?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt16?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.MeteringModeText -- PKEY_Photo_MeteringModeText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.MeteringMode. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {F628FD8C-7BA8-465A-A65B-C5AA79263A9E}, 100</para>
+ /// </summary>
+ public ShellProperty<String> MeteringModeText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.MeteringModeText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.Orientation -- PKEY_Photo_Orientation</para>
+ /// <para>Description: This is the image orientation viewed in terms of rows and columns.
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 274 (PropertyTagOrientation)</para>
+ /// </summary>
+ public ShellProperty<UInt16?> Orientation
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.Orientation;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt16?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt16?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.OrientationText -- PKEY_Photo_OrientationText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.Orientation. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {A9EA193C-C511-498A-A06B-58E2776DCC28}, 100</para>
+ /// </summary>
+ public ShellProperty<String> OrientationText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.OrientationText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.PeopleNames -- PKEY_Photo_PeopleNames</para>
+ /// <para>Description: The people tags on an image.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) Legacy code may treat this as VT_LPSTR.</para>
+ /// <para>FormatID: {E8309B6E-084C-49B4-B1FC-90A80331B638}, 100</para>
+ /// </summary>
+ public ShellProperty<String[]> PeopleNames
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.PeopleNames;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.PhotometricInterpretation -- PKEY_Photo_PhotometricInterpretation</para>
+ /// <para>Description: This is the pixel composition. In JPEG compressed data, a JPEG marker is used
+ ///instead of this property.
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {341796F1-1DF9-4B1C-A564-91BDEFA43877}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt16?> PhotometricInterpretation
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.PhotometricInterpretation;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt16?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt16?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.PhotometricInterpretationText -- PKEY_Photo_PhotometricInterpretationText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.PhotometricInterpretation. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {821437D6-9EAB-4765-A589-3B1CBBD22A61}, 100</para>
+ /// </summary>
+ public ShellProperty<String> PhotometricInterpretationText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.PhotometricInterpretationText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ProgramMode -- PKEY_Photo_ProgramMode</para>
+ /// <para>Description: This is the class of the program used by the camera to set exposure when the
+ ///picture is taken.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {6D217F6D-3F6A-4825-B470-5F03CA2FBE9B}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> ProgramMode
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.ProgramMode;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ProgramModeText -- PKEY_Photo_ProgramModeText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.ProgramMode. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {7FE3AA27-2648-42F3-89B0-454E5CB150C3}, 100</para>
+ /// </summary>
+ public ShellProperty<String> ProgramModeText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.ProgramModeText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.RelatedSoundFile -- PKEY_Photo_RelatedSoundFile</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {318A6B45-087F-4DC2-B8CC-05359551FC9E}, 100</para>
+ /// </summary>
+ public ShellProperty<String> RelatedSoundFile
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.RelatedSoundFile;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.Saturation -- PKEY_Photo_Saturation</para>
+ /// <para>Description: This indicates the direction of saturation processing applied by the camera when
+ ///the image was shot.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {49237325-A95A-4F67-B211-816B2D45D2E0}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> Saturation
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.Saturation;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.SaturationText -- PKEY_Photo_SaturationText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.Saturation. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {61478C08-B600-4A84-BBE4-E99C45F0A072}, 100</para>
+ /// </summary>
+ public ShellProperty<String> SaturationText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.SaturationText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.Sharpness -- PKEY_Photo_Sharpness</para>
+ /// <para>Description: This indicates the direction of sharpness processing applied by the camera when
+ ///the image was shot.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {FC6976DB-8349-4970-AE97-B3C5316A08F0}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> Sharpness
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.Sharpness;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.SharpnessText -- PKEY_Photo_SharpnessText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.Sharpness. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {51EC3F47-DD50-421D-8769-334F50424B1E}, 100</para>
+ /// </summary>
+ public ShellProperty<String> SharpnessText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.SharpnessText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ShutterSpeed -- PKEY_Photo_ShutterSpeed</para>
+ /// <para>Description: PropertyTagExifShutterSpeed. Calculated from PKEY_Photo_ShutterSpeedNumerator and PKEY_Photo_ShutterSpeedDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37377</para>
+ /// </summary>
+ public ShellProperty<Double?> ShutterSpeed
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.ShutterSpeed;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ShutterSpeedDenominator -- PKEY_Photo_ShutterSpeedDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_ShutterSpeed
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {E13D8975-81C7-4948-AE3F-37CAE11E8FF7}, 100</para>
+ /// </summary>
+ public ShellProperty<Int32?> ShutterSpeedDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.ShutterSpeedDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ShutterSpeedNumerator -- PKEY_Photo_ShutterSpeedNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_ShutterSpeed
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {16EA4042-D6F4-4BCA-8349-7C78D30FB333}, 100</para>
+ /// </summary>
+ public ShellProperty<Int32?> ShutterSpeedNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.ShutterSpeedNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.SubjectDistance -- PKEY_Photo_SubjectDistance</para>
+ /// <para>Description: PropertyTagExifSubjectDist. Calculated from PKEY_Photo_SubjectDistanceNumerator and PKEY_Photo_SubjectDistanceDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37382</para>
+ /// </summary>
+ public ShellProperty<Double?> SubjectDistance
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.SubjectDistance;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Double?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Double?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.SubjectDistanceDenominator -- PKEY_Photo_SubjectDistanceDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_SubjectDistance
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {0C840A88-B043-466D-9766-D4B26DA3FA77}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> SubjectDistanceDenominator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.SubjectDistanceDenominator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.SubjectDistanceNumerator -- PKEY_Photo_SubjectDistanceNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_SubjectDistance
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {8AF4961C-F526-43E5-AA81-DB768219178D}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> SubjectDistanceNumerator
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.SubjectDistanceNumerator;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.TagViewAggregate -- PKEY_Photo_TagViewAggregate</para>
+ /// <para>Description: A read-only aggregation of tag-like properties for use in building views.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) Legacy code may treat this as VT_LPSTR.</para>
+ /// <para>FormatID: {B812F15D-C2D8-4BBF-BACD-79744346113F}, 100</para>
+ /// </summary>
+ public ShellProperty<String[]> TagViewAggregate
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.TagViewAggregate;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.TranscodedForSync -- PKEY_Photo_TranscodedForSync</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {9A8EBB75-6458-4E82-BACB-35C0095B03BB}, 100</para>
+ /// </summary>
+ public ShellProperty<Boolean?> TranscodedForSync
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.TranscodedForSync;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.WhiteBalance -- PKEY_Photo_WhiteBalance</para>
+ /// <para>Description: This indicates the white balance mode set when the image was shot.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {EE3D3D8A-5381-4CFA-B13B-AAF66B5F4EC9}, 100</para>
+ /// </summary>
+ public ShellProperty<UInt32?> WhiteBalance
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.WhiteBalance;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.WhiteBalanceText -- PKEY_Photo_WhiteBalanceText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.WhiteBalance. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {6336B95E-C7A7-426D-86FD-7AE3D39C84B4}, 100</para>
+ /// </summary>
+ public ShellProperty<String> WhiteBalanceText
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Photo.WhiteBalanceText;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.PropGroup Properties
+ /// </summary>
+ public class PropertySystemPropGroup : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemPropGroup(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Advanced -- PKEY_PropGroup_Advanced</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {900A403B-097B-4B95-8AE2-071FDAEEB118}, 100</para>
+ /// </summary>
+ public ShellProperty<Object> Advanced
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropGroup.Advanced;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Audio -- PKEY_PropGroup_Audio</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {2804D469-788F-48AA-8570-71B9C187E138}, 100</para>
+ /// </summary>
+ public ShellProperty<Object> Audio
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropGroup.Audio;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Calendar -- PKEY_PropGroup_Calendar</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {9973D2B5-BFD8-438A-BA94-5349B293181A}, 100</para>
+ /// </summary>
+ public ShellProperty<Object> Calendar
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropGroup.Calendar;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Camera -- PKEY_PropGroup_Camera</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {DE00DE32-547E-4981-AD4B-542F2E9007D8}, 100</para>
+ /// </summary>
+ public ShellProperty<Object> Camera
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropGroup.Camera;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Contact -- PKEY_PropGroup_Contact</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {DF975FD3-250A-4004-858F-34E29A3E37AA}, 100</para>
+ /// </summary>
+ public ShellProperty<Object> Contact
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropGroup.Contact;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Content -- PKEY_PropGroup_Content</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {D0DAB0BA-368A-4050-A882-6C010FD19A4F}, 100</para>
+ /// </summary>
+ public ShellProperty<Object> Content
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropGroup.Content;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Description -- PKEY_PropGroup_Description</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {8969B275-9475-4E00-A887-FF93B8B41E44}, 100</para>
+ /// </summary>
+ public ShellProperty<Object> Description
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropGroup.Description;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.FileSystem -- PKEY_PropGroup_FileSystem</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {E3A7D2C1-80FC-4B40-8F34-30EA111BDC2E}, 100</para>
+ /// </summary>
+ public ShellProperty<Object> FileSystem
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropGroup.FileSystem;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.General -- PKEY_PropGroup_General</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {CC301630-B192-4C22-B372-9F4C6D338E07}, 100</para>
+ /// </summary>
+ public ShellProperty<Object> General
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropGroup.General;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.GPS -- PKEY_PropGroup_GPS</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {F3713ADA-90E3-4E11-AAE5-FDC17685B9BE}, 100</para>
+ /// </summary>
+ public ShellProperty<Object> GPS
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropGroup.GPS;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Image -- PKEY_PropGroup_Image</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {E3690A87-0FA8-4A2A-9A9F-FCE8827055AC}, 100</para>
+ /// </summary>
+ public ShellProperty<Object> Image
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropGroup.Image;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Media -- PKEY_PropGroup_Media</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {61872CF7-6B5E-4B4B-AC2D-59DA84459248}, 100</para>
+ /// </summary>
+ public ShellProperty<Object> Media
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropGroup.Media;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.MediaAdvanced -- PKEY_PropGroup_MediaAdvanced</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {8859A284-DE7E-4642-99BA-D431D044B1EC}, 100</para>
+ /// </summary>
+ public ShellProperty<Object> MediaAdvanced
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropGroup.MediaAdvanced;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Message -- PKEY_PropGroup_Message</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {7FD7259D-16B4-4135-9F97-7C96ECD2FA9E}, 100</para>
+ /// </summary>
+ public ShellProperty<Object> Message
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropGroup.Message;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Music -- PKEY_PropGroup_Music</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {68DD6094-7216-40F1-A029-43FE7127043F}, 100</para>
+ /// </summary>
+ public ShellProperty<Object> Music
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropGroup.Music;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Origin -- PKEY_PropGroup_Origin</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {2598D2FB-5569-4367-95DF-5CD3A177E1A5}, 100</para>
+ /// </summary>
+ public ShellProperty<Object> Origin
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropGroup.Origin;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.PhotoAdvanced -- PKEY_PropGroup_PhotoAdvanced</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {0CB2BF5A-9EE7-4A86-8222-F01E07FDADAF}, 100</para>
+ /// </summary>
+ public ShellProperty<Object> PhotoAdvanced
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropGroup.PhotoAdvanced;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.RecordedTV -- PKEY_PropGroup_RecordedTV</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {E7B33238-6584-4170-A5C0-AC25EFD9DA56}, 100</para>
+ /// </summary>
+ public ShellProperty<Object> RecordedTV
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropGroup.RecordedTV;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Video -- PKEY_PropGroup_Video</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {BEBE0920-7671-4C54-A3EB-49FDDFC191EE}, 100</para>
+ /// </summary>
+ public ShellProperty<Object> Video
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropGroup.Video;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.PropList Properties
+ /// </summary>
+ public class PropertySystemPropList : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemPropList(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.PropList.ConflictPrompt -- PKEY_PropList_ConflictPrompt</para>
+ /// <para>Description: The list of properties to show in the file operation conflict resolution dialog. Properties with empty
+ ///values will not be displayed. Register under the regvalue of "ConflictPrompt".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 11</para>
+ /// </summary>
+ public ShellProperty<String> ConflictPrompt
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropList.ConflictPrompt;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.ContentViewModeForBrowse -- PKEY_PropList_ContentViewModeForBrowse</para>
+ /// <para>Description: The list of properties to show in the content view mode of an item in the context of browsing.
+ ///Register the regvalue under the name of "ContentViewModeForBrowse".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 13</para>
+ /// </summary>
+ public ShellProperty<String> ContentViewModeForBrowse
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropList.ContentViewModeForBrowse;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.ContentViewModeForSearch -- PKEY_PropList_ContentViewModeForSearch</para>
+ /// <para>Description: The list of properties to show in the content view mode of an item in the context of searching.
+ ///Register the regvalue under the name of "ContentViewModeForSearch".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 14</para>
+ /// </summary>
+ public ShellProperty<String> ContentViewModeForSearch
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropList.ContentViewModeForSearch;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.ExtendedTileInfo -- PKEY_PropList_ExtendedTileInfo</para>
+ /// <para>Description: The list of properties to show in the listview on extended tiles. Register under the regvalue of
+ ///"ExtendedTileInfo".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 9</para>
+ /// </summary>
+ public ShellProperty<String> ExtendedTileInfo
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropList.ExtendedTileInfo;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.FileOperationPrompt -- PKEY_PropList_FileOperationPrompt</para>
+ /// <para>Description: The list of properties to show in the file operation confirmation dialog. Properties with empty values
+ ///will not be displayed. If this list is not specified, then the InfoTip property list is used instead.
+ ///Register under the regvalue of "FileOperationPrompt".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 10</para>
+ /// </summary>
+ public ShellProperty<String> FileOperationPrompt
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropList.FileOperationPrompt;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.FullDetails -- PKEY_PropList_FullDetails</para>
+ /// <para>Description: The list of all the properties to show in the details page. Property groups can be included in this list
+ ///in order to more easily organize the UI. Register under the regvalue of "FullDetails".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 2</para>
+ /// </summary>
+ public ShellProperty<String> FullDetails
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropList.FullDetails;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.InfoTip -- PKEY_PropList_InfoTip</para>
+ /// <para>Description: The list of properties to show in the infotip. Properties with empty values will not be displayed. Register
+ ///under the regvalue of "InfoTip".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 4 (PID_PROPLIST_INFOTIP)</para>
+ /// </summary>
+ public ShellProperty<String> InfoTip
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropList.InfoTip;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.NonPersonal -- PKEY_PropList_NonPersonal</para>
+ /// <para>Description: The list of properties that are considered 'non-personal'. When told to remove all non-personal properties
+ ///from a given file, the system will leave these particular properties untouched. Register under the regvalue
+ ///of "NonPersonal".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {49D1091F-082E-493F-B23F-D2308AA9668C}, 100</para>
+ /// </summary>
+ public ShellProperty<String> NonPersonal
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropList.NonPersonal;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.PreviewDetails -- PKEY_PropList_PreviewDetails</para>
+ /// <para>Description: The list of properties to display in the preview pane. Register under the regvalue of "PreviewDetails".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 8</para>
+ /// </summary>
+ public ShellProperty<String> PreviewDetails
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropList.PreviewDetails;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.PreviewTitle -- PKEY_PropList_PreviewTitle</para>
+ /// <para>Description: The one or two properties to display in the preview pane title section. The optional second property is
+ ///displayed as a subtitle. Register under the regvalue of "PreviewTitle".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 6</para>
+ /// </summary>
+ public ShellProperty<String> PreviewTitle
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropList.PreviewTitle;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.QuickTip -- PKEY_PropList_QuickTip</para>
+ /// <para>Description: The list of properties to show in the infotip when the item is on a slow network. Properties with empty
+ ///values will not be displayed. Register under the regvalue of "QuickTip".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 5 (PID_PROPLIST_QUICKTIP)</para>
+ /// </summary>
+ public ShellProperty<String> QuickTip
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropList.QuickTip;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.TileInfo -- PKEY_PropList_TileInfo</para>
+ /// <para>Description: The list of properties to show in the listview on tiles. Register under the regvalue of "TileInfo".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 3 (PID_PROPLIST_TILEINFO)</para>
+ /// </summary>
+ public ShellProperty<String> TileInfo
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropList.TileInfo;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.XPDetailsPanel -- PKEY_PropList_XPDetailsPanel</para>
+ /// <para>Description: The list of properties to display in the XP webview details panel. Obsolete.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_WebView) {F2275480-F782-4291-BD94-F13693513AEC}, 0 (PID_DISPLAY_PROPERTIES)</para>
+ /// </summary>
+ public ShellProperty<String> XPDetailsPanel
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.PropList.XPDetailsPanel;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.RecordedTV Properties
+ /// </summary>
+ public class PropertySystemRecordedTV : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemRecordedTV(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.ChannelNumber -- PKEY_RecordedTV_ChannelNumber</para>
+ /// <para>Description: Example: 42
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 7</para>
+ /// </summary>
+ public ShellProperty<UInt32?> ChannelNumber
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.RecordedTV.ChannelNumber;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.Credits -- PKEY_RecordedTV_Credits</para>
+ /// <para>Description: Example: "Don Messick/Frank Welker/Casey Kasem/Heather North/Nicole Jaffe;;;"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 4</para>
+ /// </summary>
+ public ShellProperty<String> Credits
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.RecordedTV.Credits;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.DateContentExpires -- PKEY_RecordedTV_DateContentExpires</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 15</para>
+ /// </summary>
+ public ShellProperty<DateTime?> DateContentExpires
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.RecordedTV.DateContentExpires;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.EpisodeName -- PKEY_RecordedTV_EpisodeName</para>
+ /// <para>Description: Example: "Nowhere to Hyde"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 2</para>
+ /// </summary>
+ public ShellProperty<String> EpisodeName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.RecordedTV.EpisodeName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.IsATSCContent -- PKEY_RecordedTV_IsATSCContent</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 16</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsATSCContent
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.RecordedTV.IsATSCContent;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.IsClosedCaptioningAvailable -- PKEY_RecordedTV_IsClosedCaptioningAvailable</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 12</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsClosedCaptioningAvailable
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.RecordedTV.IsClosedCaptioningAvailable;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.IsDTVContent -- PKEY_RecordedTV_IsDTVContent</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 17</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsDTVContent
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.RecordedTV.IsDTVContent;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.IsHDContent -- PKEY_RecordedTV_IsHDContent</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 18</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsHDContent
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.RecordedTV.IsHDContent;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.IsRepeatBroadcast -- PKEY_RecordedTV_IsRepeatBroadcast</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 13</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsRepeatBroadcast
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.RecordedTV.IsRepeatBroadcast;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.IsSAP -- PKEY_RecordedTV_IsSAP</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 14</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsSAP
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.RecordedTV.IsSAP;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.NetworkAffiliation -- PKEY_RecordedTV_NetworkAffiliation</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {2C53C813-FB63-4E22-A1AB-0B331CA1E273}, 100</para>
+ /// </summary>
+ public ShellProperty<String> NetworkAffiliation
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.RecordedTV.NetworkAffiliation;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.OriginalBroadcastDate -- PKEY_RecordedTV_OriginalBroadcastDate</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {4684FE97-8765-4842-9C13-F006447B178C}, 100</para>
+ /// </summary>
+ public ShellProperty<DateTime?> OriginalBroadcastDate
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.RecordedTV.OriginalBroadcastDate;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.ProgramDescription -- PKEY_RecordedTV_ProgramDescription</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 3</para>
+ /// </summary>
+ public ShellProperty<String> ProgramDescription
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.RecordedTV.ProgramDescription;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.RecordingTime -- PKEY_RecordedTV_RecordingTime</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {A5477F61-7A82-4ECA-9DDE-98B69B2479B3}, 100</para>
+ /// </summary>
+ public ShellProperty<DateTime?> RecordingTime
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.RecordedTV.RecordingTime;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.StationCallSign -- PKEY_RecordedTV_StationCallSign</para>
+ /// <para>Description: Example: "TOONP"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 5</para>
+ /// </summary>
+ public ShellProperty<String> StationCallSign
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.RecordedTV.StationCallSign;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.StationName -- PKEY_RecordedTV_StationName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {1B5439E7-EBA1-4AF8-BDD7-7AF1D4549493}, 100</para>
+ /// </summary>
+ public ShellProperty<String> StationName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.RecordedTV.StationName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Search Properties
+ /// </summary>
+ public class PropertySystemSearch : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemSearch(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Search.AutoSummary -- PKEY_Search_AutoSummary</para>
+ /// <para>Description: General Summary of the document.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {560C36C0-503A-11CF-BAA1-00004C752A9A}, 2</para>
+ /// </summary>
+ public ShellProperty<String> AutoSummary
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Search.AutoSummary;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.ContainerHash -- PKEY_Search_ContainerHash</para>
+ /// <para>Description: Hash code used to identify attachments to be deleted based on a common container url
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {BCEEE283-35DF-4D53-826A-F36A3EEFC6BE}, 100</para>
+ /// </summary>
+ public ShellProperty<String> ContainerHash
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Search.ContainerHash;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.Contents -- PKEY_Search_Contents</para>
+ /// <para>Description: The contents of the item. This property is for query restrictions only; it cannot be retrieved in a
+ ///query result. The Indexing Service friendly name is 'contents'.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 19 (PID_STG_CONTENTS)</para>
+ /// </summary>
+ public ShellProperty<String> Contents
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Search.Contents;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.EntryID -- PKEY_Search_EntryID</para>
+ /// <para>Description: The entry ID for an item within a given catalog in the Windows Search Index.
+ ///This value may be recycled, and therefore is not considered unique over time.
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_Query) {49691C90-7E17-101A-A91C-08002B2ECDA9}, 5 (PROPID_QUERY_WORKID)</para>
+ /// </summary>
+ public ShellProperty<Int32?> EntryID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Search.EntryID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.ExtendedProperties -- PKEY_Search_ExtendedProperties</para>
+ /// <para>Description: </para>
+ /// <para>Type: Blob -- VT_BLOB</para>
+ /// <para>FormatID: {7B03B546-FA4F-4A52-A2FE-03D5311E5865}, 100</para>
+ /// </summary>
+ public ShellProperty<Byte[]> ExtendedProperties
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Search.ExtendedProperties;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Byte[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Byte[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.GatherTime -- PKEY_Search_GatherTime</para>
+ /// <para>Description: The Datetime that the Windows Search Gatherer process last pushed properties of this document to the Windows Search Gatherer Plugins.
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {0B63E350-9CCC-11D0-BCDB-00805FCCCE04}, 8</para>
+ /// </summary>
+ public ShellProperty<DateTime?> GatherTime
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Search.GatherTime;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.HitCount -- PKEY_Search_HitCount</para>
+ /// <para>Description: When using CONTAINS over the Windows Search Index, this is the number of matches of the term.
+ ///If there are multiple CONTAINS, an AND computes the min number of hits and an OR the max number of hits.
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_Query) {49691C90-7E17-101A-A91C-08002B2ECDA9}, 4 (PROPID_QUERY_HITCOUNT)</para>
+ /// </summary>
+ public ShellProperty<Int32?> HitCount
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Search.HitCount;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.IsClosedDirectory -- PKEY_Search_IsClosedDirectory</para>
+ /// <para>Description: If this property is emitted with a value of TRUE, then it indicates that this URL's last modified time applies to all of it's children, and if this URL is deleted then all of it's children are deleted as well. For example, this would be emitted as TRUE when emitting the URL of an email so that all attachments are tied to the last modified time of that email.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {0B63E343-9CCC-11D0-BCDB-00805FCCCE04}, 23</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsClosedDirectory
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Search.IsClosedDirectory;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.IsFullyContained -- PKEY_Search_IsFullyContained</para>
+ /// <para>Description: Any child URL of a URL which has System.Search.IsClosedDirectory=TRUE must emit System.Search.IsFullyContained=TRUE. This ensures that the URL is not deleted at the end of a crawl because it hasn't been visited (which is the normal mechanism for detecting deletes). For example an email attachment would emit this property
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {0B63E343-9CCC-11D0-BCDB-00805FCCCE04}, 24</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsFullyContained
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Search.IsFullyContained;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.QueryFocusedSummary -- PKEY_Search_QueryFocusedSummary</para>
+ /// <para>Description: Query Focused Summary of the document.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {560C36C0-503A-11CF-BAA1-00004C752A9A}, 3</para>
+ /// </summary>
+ public ShellProperty<String> QueryFocusedSummary
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Search.QueryFocusedSummary;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.QueryFocusedSummaryWithFallback -- PKEY_Search_QueryFocusedSummaryWithFallback</para>
+ /// <para>Description: Query Focused Summary of the document, if none is available it returns the AutoSummary.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {560C36C0-503A-11CF-BAA1-00004C752A9A}, 4</para>
+ /// </summary>
+ public ShellProperty<String> QueryFocusedSummaryWithFallback
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Search.QueryFocusedSummaryWithFallback;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.Rank -- PKEY_Search_Rank</para>
+ /// <para>Description: Relevance rank of row. Ranges from 0-1000. Larger numbers = better matches. Query-time only.
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_Query) {49691C90-7E17-101A-A91C-08002B2ECDA9}, 3 (PROPID_QUERY_RANK)</para>
+ /// </summary>
+ public ShellProperty<Int32?> Rank
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Search.Rank;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Int32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Int32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.Store -- PKEY_Search_Store</para>
+ /// <para>Description: The identifier for the protocol handler that produced this item. (E.g. MAPI, CSC, FILE etc.)
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {A06992B3-8CAF-4ED7-A547-B259E32AC9FC}, 100</para>
+ /// </summary>
+ public ShellProperty<String> Store
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Search.Store;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.UrlToIndex -- PKEY_Search_UrlToIndex</para>
+ /// <para>Description: This property should be emitted by a container IFilter for each child URL within the container. The children will eventually be crawled by the indexer if they are within scope.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {0B63E343-9CCC-11D0-BCDB-00805FCCCE04}, 2</para>
+ /// </summary>
+ public ShellProperty<String> UrlToIndex
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Search.UrlToIndex;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.UrlToIndexWithModificationTime -- PKEY_Search_UrlToIndexWithModificationTime</para>
+ /// <para>Description: This property is the same as System.Search.UrlToIndex except that it includes the time the URL was last modified. This is an optimization for the indexer as it doesn't have to call back into the protocol handler to ask for this information to determine if the content needs to be indexed again. The property is a vector with two elements, a VT_LPWSTR with the URL and a VT_FILETIME for the last modified time.
+ ///</para>
+ /// <para>Type: Multivalue Any -- VT_VECTOR | VT_NULL (For variants: VT_ARRAY | VT_NULL)</para>
+ /// <para>FormatID: {0B63E343-9CCC-11D0-BCDB-00805FCCCE04}, 12</para>
+ /// </summary>
+ public ShellProperty<Object> UrlToIndexWithModificationTime
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Search.UrlToIndexWithModificationTime;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Object>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Object>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Shell Properties
+ /// </summary>
+ public class PropertySystemShell : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemShell(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Shell.OmitFromView -- PKEY_Shell_OmitFromView</para>
+ /// <para>Description: Set this to a string value of 'True' to omit this item from shell views
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {DE35258C-C695-4CBC-B982-38B0AD24CED0}, 2</para>
+ /// </summary>
+ public ShellProperty<String> OmitFromView
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Shell.OmitFromView;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Shell.SFGAOFlagsStrings -- PKEY_Shell_SFGAOFlagsStrings</para>
+ /// <para>Description: Expresses the SFGAO flags as string values and is used as a query optimization.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {D6942081-D53B-443D-AD47-5E059D9CD27A}, 2</para>
+ /// </summary>
+ public ShellProperty<String[]> SFGAOFlagsStrings
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Shell.SFGAOFlagsStrings;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Software Properties
+ /// </summary>
+ public class PropertySystemSoftware : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemSoftware(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Software.DateLastUsed -- PKEY_Software_DateLastUsed</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {841E4F90-FF59-4D16-8947-E81BBFFAB36D}, 16</para>
+ /// </summary>
+ public ShellProperty<DateTime?> DateLastUsed
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Software.DateLastUsed;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<DateTime?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<DateTime?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Software.ProductName -- PKEY_Software_ProductName</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 7</para>
+ /// </summary>
+ public ShellProperty<String> ProductName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Software.ProductName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Sync Properties
+ /// </summary>
+ public class PropertySystemSync : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemSync(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Sync.Comments -- PKEY_Sync_Comments</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 13</para>
+ /// </summary>
+ public ShellProperty<String> Comments
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Sync.Comments;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.ConflictDescription -- PKEY_Sync_ConflictDescription</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {CE50C159-2FB8-41FD-BE68-D3E042E274BC}, 4</para>
+ /// </summary>
+ public ShellProperty<String> ConflictDescription
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Sync.ConflictDescription;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.ConflictFirstLocation -- PKEY_Sync_ConflictFirstLocation</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {CE50C159-2FB8-41FD-BE68-D3E042E274BC}, 6</para>
+ /// </summary>
+ public ShellProperty<String> ConflictFirstLocation
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Sync.ConflictFirstLocation;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.ConflictSecondLocation -- PKEY_Sync_ConflictSecondLocation</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {CE50C159-2FB8-41FD-BE68-D3E042E274BC}, 7</para>
+ /// </summary>
+ public ShellProperty<String> ConflictSecondLocation
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Sync.ConflictSecondLocation;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.HandlerCollectionID -- PKEY_Sync_HandlerCollectionID</para>
+ /// <para>Description: </para>
+ /// <para>Type: Guid -- VT_CLSID</para>
+ /// <para>FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 2</para>
+ /// </summary>
+ public ShellProperty<IntPtr?> HandlerCollectionID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Sync.HandlerCollectionID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<IntPtr?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<IntPtr?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.HandlerID -- PKEY_Sync_HandlerID</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 3</para>
+ /// </summary>
+ public ShellProperty<String> HandlerID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Sync.HandlerID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.HandlerName -- PKEY_Sync_HandlerName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {CE50C159-2FB8-41FD-BE68-D3E042E274BC}, 2</para>
+ /// </summary>
+ public ShellProperty<String> HandlerName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Sync.HandlerName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.HandlerType -- PKEY_Sync_HandlerType</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 8</para>
+ /// </summary>
+ public ShellProperty<UInt32?> HandlerType
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Sync.HandlerType;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.HandlerTypeLabel -- PKEY_Sync_HandlerTypeLabel</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 9</para>
+ /// </summary>
+ public ShellProperty<String> HandlerTypeLabel
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Sync.HandlerTypeLabel;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.ItemID -- PKEY_Sync_ItemID</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 6</para>
+ /// </summary>
+ public ShellProperty<String> ItemID
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Sync.ItemID;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.ItemName -- PKEY_Sync_ItemName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {CE50C159-2FB8-41FD-BE68-D3E042E274BC}, 3</para>
+ /// </summary>
+ public ShellProperty<String> ItemName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Sync.ItemName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.ProgressPercentage -- PKEY_Sync_ProgressPercentage</para>
+ /// <para>Description: An integer value between 0 and 100 representing the percentage completed.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 23</para>
+ /// </summary>
+ public ShellProperty<UInt32?> ProgressPercentage
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Sync.ProgressPercentage;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.State -- PKEY_Sync_State</para>
+ /// <para>Description: Sync state.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 24</para>
+ /// </summary>
+ public ShellProperty<UInt32?> State
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Sync.State;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.Status -- PKEY_Sync_Status</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 10</para>
+ /// </summary>
+ public ShellProperty<String> Status
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Sync.Status;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Task Properties
+ /// </summary>
+ public class PropertySystemTask : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemTask(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Task.BillingInformation -- PKEY_Task_BillingInformation</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {D37D52C6-261C-4303-82B3-08B926AC6F12}, 100</para>
+ /// </summary>
+ public ShellProperty<String> BillingInformation
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Task.BillingInformation;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Task.CompletionStatus -- PKEY_Task_CompletionStatus</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {084D8A0A-E6D5-40DE-BF1F-C8820E7C877C}, 100</para>
+ /// </summary>
+ public ShellProperty<String> CompletionStatus
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Task.CompletionStatus;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Task.Owner -- PKEY_Task_Owner</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {08C7CC5F-60F2-4494-AD75-55E3E0B5ADD0}, 100</para>
+ /// </summary>
+ public ShellProperty<String> Owner
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Task.Owner;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Video Properties
+ /// </summary>
+ public class PropertySystemVideo : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemVideo(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Video.Compression -- PKEY_Video_Compression</para>
+ /// <para>Description: Indicates the level of compression for the video stream. "Compression".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 10 (PIDVSI_COMPRESSION)</para>
+ /// </summary>
+ public ShellProperty<String> Compression
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Video.Compression;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.Director -- PKEY_Video_Director</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 20 (PIDMSI_DIRECTOR)</para>
+ /// </summary>
+ public ShellProperty<String[]> Director
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Video.Director;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String[]>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String[]>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.EncodingBitrate -- PKEY_Video_EncodingBitrate</para>
+ /// <para>Description: Indicates the data rate in "bits per second" for the video stream. "DataRate".
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 8 (PIDVSI_DATA_RATE)</para>
+ /// </summary>
+ public ShellProperty<UInt32?> EncodingBitrate
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Video.EncodingBitrate;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.FourCC -- PKEY_Video_FourCC</para>
+ /// <para>Description: Indicates the 4CC for the video stream.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 44</para>
+ /// </summary>
+ public ShellProperty<UInt32?> FourCC
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Video.FourCC;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.FrameHeight -- PKEY_Video_FrameHeight</para>
+ /// <para>Description: Indicates the frame height for the video stream.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 4</para>
+ /// </summary>
+ public ShellProperty<UInt32?> FrameHeight
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Video.FrameHeight;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.FrameRate -- PKEY_Video_FrameRate</para>
+ /// <para>Description: Indicates the frame rate in "frames per millisecond" for the video stream. "FrameRate".
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 6 (PIDVSI_FRAME_RATE)</para>
+ /// </summary>
+ public ShellProperty<UInt32?> FrameRate
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Video.FrameRate;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.FrameWidth -- PKEY_Video_FrameWidth</para>
+ /// <para>Description: Indicates the frame width for the video stream.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 3</para>
+ /// </summary>
+ public ShellProperty<UInt32?> FrameWidth
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Video.FrameWidth;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.HorizontalAspectRatio -- PKEY_Video_HorizontalAspectRatio</para>
+ /// <para>Description: Indicates the horizontal portion of the aspect ratio. The X portion of XX:YY,
+ ///like 16:9.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 42</para>
+ /// </summary>
+ public ShellProperty<UInt32?> HorizontalAspectRatio
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Video.HorizontalAspectRatio;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.SampleSize -- PKEY_Video_SampleSize</para>
+ /// <para>Description: Indicates the sample size in bits for the video stream. "SampleSize".
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 9 (PIDVSI_SAMPLE_SIZE)</para>
+ /// </summary>
+ public ShellProperty<UInt32?> SampleSize
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Video.SampleSize;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.StreamName -- PKEY_Video_StreamName</para>
+ /// <para>Description: Indicates the name for the video stream. "StreamName".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 2 (PIDVSI_STREAM_NAME)</para>
+ /// </summary>
+ public ShellProperty<String> StreamName
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Video.StreamName;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.StreamNumber -- PKEY_Video_StreamNumber</para>
+ /// <para>Description: "Stream Number".
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 11 (PIDVSI_STREAM_NUMBER)</para>
+ /// </summary>
+ public ShellProperty<UInt16?> StreamNumber
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Video.StreamNumber;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt16?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt16?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.TotalBitrate -- PKEY_Video_TotalBitrate</para>
+ /// <para>Description: Indicates the total data rate in "bits per second" for all video and audio streams.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 43 (PIDVSI_TOTAL_BITRATE)</para>
+ /// </summary>
+ public ShellProperty<UInt32?> TotalBitrate
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Video.TotalBitrate;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.TranscodedForSync -- PKEY_Video_TranscodedForSync</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 46</para>
+ /// </summary>
+ public ShellProperty<Boolean?> TranscodedForSync
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Video.TranscodedForSync;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.VerticalAspectRatio -- PKEY_Video_VerticalAspectRatio</para>
+ /// <para>Description: Indicates the vertical portion of the aspect ratio. The Y portion of
+ ///XX:YY, like 16:9.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 45</para>
+ /// </summary>
+ public ShellProperty<UInt32?> VerticalAspectRatio
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Video.VerticalAspectRatio;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<UInt32?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<UInt32?>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+
+ /// <summary>
+ /// System.Volume Properties
+ /// </summary>
+ public class PropertySystemVolume : PropertyStoreItems
+ {
+
+
+ private ShellObject shellObjectParent;
+ private Hashtable hashtable = new Hashtable();
+
+ internal PropertySystemVolume(ShellObject parent)
+ {
+ shellObjectParent = parent;
+ }
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Volume.FileSystem -- PKEY_Volume_FileSystem</para>
+ /// <para>Description: Indicates the filesystem of the volume.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 4 (PID_VOLUME_FILESYSTEM) (Filesystem Volume Properties)</para>
+ /// </summary>
+ public ShellProperty<String> FileSystem
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Volume.FileSystem;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<String>(key));
+ }
+
+ return hashtable[key] as ShellProperty<String>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Volume.IsMappedDrive -- PKEY_Volume_IsMappedDrive</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {149C0B69-2C2D-48FC-808F-D318D78C4636}, 2</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsMappedDrive
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Volume.IsMappedDrive;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Volume.IsRoot -- PKEY_Volume_IsRoot</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 10 (Filesystem Volume Properties)</para>
+ /// </summary>
+ public ShellProperty<Boolean?> IsRoot
+ {
+ get
+ {
+ PropertyKey key = SystemProperties.System.Volume.IsRoot;
+
+ if (!hashtable.ContainsKey(key))
+ {
+ hashtable.Add(key, shellObjectParent.Properties.CreateTypedProperty<Boolean?>(key));
+ }
+
+ return hashtable[key] as ShellProperty<Boolean?>;
+ }
+ }
+ #endregion
+
+
+ #region sub-namespaces
+ #endregion
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/SystemProperties.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/SystemProperties.cs
new file mode 100644
index 0000000000..2174940404
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/SystemProperties.cs
@@ -0,0 +1,12306 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem
+{
+
+
+ /// <summary>
+ /// Provides easy access to all the system properties (property keys and their descriptions)
+ /// </summary>
+ public static class SystemProperties
+ {
+
+ /// <summary>
+ /// Returns the property description for a given property key.
+ /// </summary>
+ /// <param name="propertyKey">Property key of the property whose description is required.</param>
+ /// <returns>Property Description for a given property key</returns>
+ public static ShellPropertyDescription GetPropertyDescription(PropertyKey propertyKey)
+ {
+ return ShellPropertyDescriptionsCache.Cache.GetPropertyDescription(propertyKey);
+ }
+
+
+ /// <summary>
+ /// Gets the property description for a given property's canonical name.
+ /// </summary>
+ /// <param name="canonicalName">Canonical name of the property whose description is required.</param>
+ /// <returns>Property Description for a given property key</returns>
+ public static ShellPropertyDescription GetPropertyDescription(string canonicalName)
+ {
+ PropertyKey propKey;
+
+ int result = PropertySystemNativeMethods.PSGetPropertyKeyFromName(canonicalName, out propKey);
+
+ if (!CoreErrorHelper.Succeeded(result))
+ {
+ throw new ArgumentException(LocalizedMessages.ShellInvalidCanonicalName, Marshal.GetExceptionForHR(result));
+ }
+ return ShellPropertyDescriptionsCache.Cache.GetPropertyDescription(propKey);
+ }
+
+ /// <summary>
+ /// System Properties
+ /// </summary>
+ public static class System
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.AcquisitionID -- PKEY_AcquisitionID</para>
+ /// <para>Description: Hash to determine acquisition session.
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {65A98875-3C80-40AB-ABBC-EFDAF77DBEE2}, 100</para>
+ /// </summary>
+ public static PropertyKey AcquisitionID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{65A98875-3C80-40AB-ABBC-EFDAF77DBEE2}"), 100);
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ApplicationName -- PKEY_ApplicationName</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR) Legacy code may treat this as VT_LPSTR.</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 18 (PIDSI_APPNAME)</para>
+ /// </summary>
+ public static PropertyKey ApplicationName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 18);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Author -- PKEY_Author</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) Legacy code may treat this as VT_LPSTR.</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 4 (PIDSI_AUTHOR)</para>
+ /// </summary>
+ public static PropertyKey Author
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 4);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Capacity -- PKEY_Capacity</para>
+ /// <para>Description: The amount of total space in bytes.
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 3 (PID_VOLUME_CAPACITY) (Filesystem Volume Properties)</para>
+ /// </summary>
+ public static PropertyKey Capacity
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9B174B35-40FF-11D2-A27E-00C04FC30871}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Category -- PKEY_Category</para>
+ /// <para>Description: Legacy code treats this as VT_LPSTR.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 2 (PIDDSI_CATEGORY)</para>
+ /// </summary>
+ public static PropertyKey Category
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Comment -- PKEY_Comment</para>
+ /// <para>Description: Comments.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR) Legacy code may treat this as VT_LPSTR.</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 6 (PIDSI_COMMENTS)</para>
+ /// </summary>
+ public static PropertyKey Comment
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 6);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Company -- PKEY_Company</para>
+ /// <para>Description: The company or publisher.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 15 (PIDDSI_COMPANY)</para>
+ /// </summary>
+ public static PropertyKey Company
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 15);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ComputerName -- PKEY_ComputerName</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 5 (PID_COMPUTERNAME)</para>
+ /// </summary>
+ public static PropertyKey ComputerName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 5);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ContainedItems -- PKEY_ContainedItems</para>
+ /// <para>Description: The list of type of items, this item contains. For example, this item contains urls, attachments etc.
+ ///This is represented as a vector array of GUIDs where each GUID represents certain type.
+ ///</para>
+ /// <para>Type: Multivalue Guid -- VT_VECTOR | VT_CLSID (For variants: VT_ARRAY | VT_CLSID)</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 29</para>
+ /// </summary>
+ public static PropertyKey ContainedItems
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 29);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ContentStatus -- PKEY_ContentStatus</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 27</para>
+ /// </summary>
+ public static PropertyKey ContentStatus
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 27);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ContentType -- PKEY_ContentType</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 26</para>
+ /// </summary>
+ public static PropertyKey ContentType
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 26);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Copyright -- PKEY_Copyright</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 11 (PIDMSI_COPYRIGHT)</para>
+ /// </summary>
+ public static PropertyKey Copyright
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 11);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DateAccessed -- PKEY_DateAccessed</para>
+ /// <para>Description: The time of the last access to the item. The Indexing Service friendly name is 'access'.
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 16 (PID_STG_ACCESSTIME)</para>
+ /// </summary>
+ public static PropertyKey DateAccessed
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 16);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DateAcquired -- PKEY_DateAcquired</para>
+ /// <para>Description: The time the file entered the system via acquisition. This is not the same as System.DateImported.
+ ///Examples are when pictures are acquired from a camera, or when music is purchased online.
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {2CBAA8F5-D81F-47CA-B17A-F8D822300131}, 100</para>
+ /// </summary>
+ public static PropertyKey DateAcquired
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{2CBAA8F5-D81F-47CA-B17A-F8D822300131}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DateArchived -- PKEY_DateArchived</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {43F8D7B7-A444-4F87-9383-52271C9B915C}, 100</para>
+ /// </summary>
+ public static PropertyKey DateArchived
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{43F8D7B7-A444-4F87-9383-52271C9B915C}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DateCompleted -- PKEY_DateCompleted</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {72FAB781-ACDA-43E5-B155-B2434F85E678}, 100</para>
+ /// </summary>
+ public static PropertyKey DateCompleted
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{72FAB781-ACDA-43E5-B155-B2434F85E678}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DateCreated -- PKEY_DateCreated</para>
+ /// <para>Description: The date and time the item was created. The Indexing Service friendly name is 'create'.
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 15 (PID_STG_CREATETIME)</para>
+ /// </summary>
+ public static PropertyKey DateCreated
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 15);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DateImported -- PKEY_DateImported</para>
+ /// <para>Description: The time the file is imported into a separate database. This is not the same as System.DateAcquired. (Eg, 2003:05:22 13:55:04)
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 18258</para>
+ /// </summary>
+ public static PropertyKey DateImported
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 18258);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DateModified -- PKEY_DateModified</para>
+ /// <para>Description: The date and time of the last write to the item. The Indexing Service friendly name is 'write'.
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 14 (PID_STG_WRITETIME)</para>
+ /// </summary>
+ public static PropertyKey DateModified
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 14);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DescriptionID -- PKEY_DescriptionID</para>
+ /// <para>Description: The contents of a SHDESCRIPTIONID structure as a buffer of bytes.
+ ///</para>
+ /// <para>Type: Buffer -- VT_VECTOR | VT_UI1 (For variants: VT_ARRAY | VT_UI1)</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 2 (PID_DESCRIPTIONID)</para>
+ /// </summary>
+ public static PropertyKey DescriptionID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DueDate -- PKEY_DueDate</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {3F8472B5-E0AF-4DB2-8071-C53FE76AE7CE}, 100</para>
+ /// </summary>
+ public static PropertyKey DueDate
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{3F8472B5-E0AF-4DB2-8071-C53FE76AE7CE}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.EndDate -- PKEY_EndDate</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {C75FAA05-96FD-49E7-9CB4-9F601082D553}, 100</para>
+ /// </summary>
+ public static PropertyKey EndDate
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C75FAA05-96FD-49E7-9CB4-9F601082D553}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FileAllocationSize -- PKEY_FileAllocationSize</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 18 (PID_STG_ALLOCSIZE)</para>
+ /// </summary>
+ public static PropertyKey FileAllocationSize
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 18);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FileAttributes -- PKEY_FileAttributes</para>
+ /// <para>Description: This is the WIN32_FIND_DATA dwFileAttributes for the file-based item.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 13 (PID_STG_ATTRIBUTES)</para>
+ /// </summary>
+ public static PropertyKey FileAttributes
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 13);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FileCount -- PKEY_FileCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 12</para>
+ /// </summary>
+ public static PropertyKey FileCount
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 12);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FileDescription -- PKEY_FileDescription</para>
+ /// <para>Description: This is a user-friendly description of the file.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 3 (PIDVSI_FileDescription)</para>
+ /// </summary>
+ public static PropertyKey FileDescription
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0CEF7D53-FA64-11D1-A203-0000F81FEDEE}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FileExtension -- PKEY_FileExtension</para>
+ /// <para>Description: This is the file extension of the file based item, including the leading period.
+ ///
+ ///If System.FileName is VT_EMPTY, then this property should be too. Otherwise, it should be derived
+ ///appropriately by the data source from System.FileName. If System.FileName does not have a file
+ ///extension, this value should be VT_EMPTY.
+ ///
+ ///To obtain the type of any item (including an item that is not a file), use System.ItemType.
+ ///
+ ///Example values:
+ ///
+ /// If the path is... The property value is...
+ /// ----------------- ------------------------
+ /// "c:\foo\bar\hello.txt" ".txt"
+ /// "\\server\share\mydir\goodnews.doc" ".doc"
+ /// "\\server\share\numbers.xls" ".xls"
+ /// "\\server\share\folder" VT_EMPTY
+ /// "c:\foo\MyFolder" VT_EMPTY
+ /// [desktop] VT_EMPTY
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E4F10A3C-49E6-405D-8288-A23BD4EEAA6C}, 100</para>
+ /// </summary>
+ public static PropertyKey FileExtension
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E4F10A3C-49E6-405D-8288-A23BD4EEAA6C}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FileFRN -- PKEY_FileFRN</para>
+ /// <para>Description: This is the unique file ID, also known as the File Reference Number. For a given file, this is the same value
+ ///as is found in the structure variable FILE_ID_BOTH_DIR_INFO.FileId, via GetFileInformationByHandleEx().
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 21 (PID_STG_FRN)</para>
+ /// </summary>
+ public static PropertyKey FileFRN
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 21);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FileName -- PKEY_FileName</para>
+ /// <para>Description: This is the file name (including extension) of the file.
+ ///
+ ///It is possible that the item might not exist on a filesystem (ie, it may not be opened
+ ///using CreateFile). Nonetheless, if the item is represented as a file from the logical sense
+ ///(and its name follows standard Win32 file-naming syntax), then the data source should emit this property.
+ ///
+ ///If an item is not a file, then the value for this property is VT_EMPTY. See
+ ///System.ItemNameDisplay.
+ ///
+ ///This has the same value as System.ParsingName for items that are provided by the Shell's file folder.
+ ///
+ ///Example values:
+ ///
+ /// If the path is... The property value is...
+ /// ----------------- ------------------------
+ /// "c:\foo\bar\hello.txt" "hello.txt"
+ /// "\\server\share\mydir\goodnews.doc" "goodnews.doc"
+ /// "\\server\share\numbers.xls" "numbers.xls"
+ /// "c:\foo\MyFolder" "MyFolder"
+ /// (email message) VT_EMPTY
+ /// (song on portable device) "song.wma"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {41CF5AE0-F75A-4806-BD87-59C7D9248EB9}, 100</para>
+ /// </summary>
+ public static PropertyKey FileName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{41CF5AE0-F75A-4806-BD87-59C7D9248EB9}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FileOwner -- PKEY_FileOwner</para>
+ /// <para>Description: This is the owner of the file, according to the file system.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_Misc) {9B174B34-40FF-11D2-A27E-00C04FC30871}, 4 (PID_MISC_OWNER)</para>
+ /// </summary>
+ public static PropertyKey FileOwner
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9B174B34-40FF-11D2-A27E-00C04FC30871}"), 4);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FileVersion -- PKEY_FileVersion</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 4 (PIDVSI_FileVersion)</para>
+ /// </summary>
+ public static PropertyKey FileVersion
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0CEF7D53-FA64-11D1-A203-0000F81FEDEE}"), 4);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FindData -- PKEY_FindData</para>
+ /// <para>Description: WIN32_FIND_DATAW in buffer of bytes.
+ ///</para>
+ /// <para>Type: Buffer -- VT_VECTOR | VT_UI1 (For variants: VT_ARRAY | VT_UI1)</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 0 (PID_FINDDATA)</para>
+ /// </summary>
+ public static PropertyKey FindData
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 0);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FlagColor -- PKEY_FlagColor</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {67DF94DE-0CA7-4D6F-B792-053A3E4F03CF}, 100</para>
+ /// </summary>
+ public static PropertyKey FlagColor
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{67DF94DE-0CA7-4D6F-B792-053A3E4F03CF}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FlagColorText -- PKEY_FlagColorText</para>
+ /// <para>Description: This is the user-friendly form of System.FlagColor. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {45EAE747-8E2A-40AE-8CBF-CA52ABA6152A}, 100</para>
+ /// </summary>
+ public static PropertyKey FlagColorText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{45EAE747-8E2A-40AE-8CBF-CA52ABA6152A}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FlagStatus -- PKEY_FlagStatus</para>
+ /// <para>Description: Status of Flag. Values: (0=none 1=white 2=Red). cdoPR_FLAG_STATUS
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 12</para>
+ /// </summary>
+ public static PropertyKey FlagStatus
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 12);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FlagStatusText -- PKEY_FlagStatusText</para>
+ /// <para>Description: This is the user-friendly form of System.FlagStatus. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {DC54FD2E-189D-4871-AA01-08C2F57A4ABC}, 100</para>
+ /// </summary>
+ public static PropertyKey FlagStatusText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{DC54FD2E-189D-4871-AA01-08C2F57A4ABC}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FreeSpace -- PKEY_FreeSpace</para>
+ /// <para>Description: The amount of free space in bytes.
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 2 (PID_VOLUME_FREE) (Filesystem Volume Properties)</para>
+ /// </summary>
+ public static PropertyKey FreeSpace
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9B174B35-40FF-11D2-A27E-00C04FC30871}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.FullText -- PKEY_FullText</para>
+ /// <para>Description: This PKEY is used to specify search terms that should be applied as broadly as possible,
+ ///across all valid properties for the data source(s) being searched. It should not be
+ ///emitted from a data source.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {1E3EE840-BC2B-476C-8237-2ACD1A839B22}, 6</para>
+ /// </summary>
+ public static PropertyKey FullText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{1E3EE840-BC2B-476C-8237-2ACD1A839B22}"), 6);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Identity -- PKEY_Identity</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {A26F4AFC-7346-4299-BE47-EB1AE613139F}, 100</para>
+ /// </summary>
+ public static PropertyKey IdentityProperty
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A26F4AFC-7346-4299-BE47-EB1AE613139F}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ImageParsingName -- PKEY_ImageParsingName</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {D7750EE0-C6A4-48EC-B53E-B87B52E6D073}, 100</para>
+ /// </summary>
+ public static PropertyKey ImageParsingName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D7750EE0-C6A4-48EC-B53E-B87B52E6D073}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Importance -- PKEY_Importance</para>
+ /// <para>Description: </para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 11</para>
+ /// </summary>
+ public static PropertyKey Importance
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 11);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ImportanceText -- PKEY_ImportanceText</para>
+ /// <para>Description: This is the user-friendly form of System.Importance. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {A3B29791-7713-4E1D-BB40-17DB85F01831}, 100</para>
+ /// </summary>
+ public static PropertyKey ImportanceText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A3B29791-7713-4E1D-BB40-17DB85F01831}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.InfoTipText -- PKEY_InfoTipText</para>
+ /// <para>Description: The text (with formatted property values) to show in the infotip.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 17</para>
+ /// </summary>
+ public static PropertyKey InfoTipText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 17);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.InternalName -- PKEY_InternalName</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 5 (PIDVSI_InternalName)</para>
+ /// </summary>
+ public static PropertyKey InternalName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0CEF7D53-FA64-11D1-A203-0000F81FEDEE}"), 5);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsAttachment -- PKEY_IsAttachment</para>
+ /// <para>Description: Identifies if this item is an attachment.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {F23F425C-71A1-4FA8-922F-678EA4A60408}, 100</para>
+ /// </summary>
+ public static PropertyKey IsAttachment
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F23F425C-71A1-4FA8-922F-678EA4A60408}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsDefaultNonOwnerSaveLocation -- PKEY_IsDefaultNonOwnerSaveLocation</para>
+ /// <para>Description: Identifies the default save location for a library for non-owners of the library
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 5</para>
+ /// </summary>
+ public static PropertyKey IsDefaultNonOwnerSaveLocation
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}"), 5);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsDefaultSaveLocation -- PKEY_IsDefaultSaveLocation</para>
+ /// <para>Description: Identifies the default save location for a library for the owner of the library
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 3</para>
+ /// </summary>
+ public static PropertyKey IsDefaultSaveLocation
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsDeleted -- PKEY_IsDeleted</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {5CDA5FC8-33EE-4FF3-9094-AE7BD8868C4D}, 100</para>
+ /// </summary>
+ public static PropertyKey IsDeleted
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{5CDA5FC8-33EE-4FF3-9094-AE7BD8868C4D}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsEncrypted -- PKEY_IsEncrypted</para>
+ /// <para>Description: Is the item encrypted?
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {90E5E14E-648B-4826-B2AA-ACAF790E3513}, 10</para>
+ /// </summary>
+ public static PropertyKey IsEncrypted
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{90E5E14E-648B-4826-B2AA-ACAF790E3513}"), 10);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsFlagged -- PKEY_IsFlagged</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {5DA84765-E3FF-4278-86B0-A27967FBDD03}, 100</para>
+ /// </summary>
+ public static PropertyKey IsFlagged
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{5DA84765-E3FF-4278-86B0-A27967FBDD03}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsFlaggedComplete -- PKEY_IsFlaggedComplete</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {A6F360D2-55F9-48DE-B909-620E090A647C}, 100</para>
+ /// </summary>
+ public static PropertyKey IsFlaggedComplete
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A6F360D2-55F9-48DE-B909-620E090A647C}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsIncomplete -- PKEY_IsIncomplete</para>
+ /// <para>Description: Identifies if the message was not completely received for some error condition.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {346C8BD1-2E6A-4C45-89A4-61B78E8E700F}, 100</para>
+ /// </summary>
+ public static PropertyKey IsIncomplete
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{346C8BD1-2E6A-4C45-89A4-61B78E8E700F}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsLocationSupported -- PKEY_IsLocationSupported</para>
+ /// <para>Description: A bool value to know if a location is supported (locally indexable, or remotely indexed).
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 8</para>
+ /// </summary>
+ public static PropertyKey IsLocationSupported
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}"), 8);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsPinnedToNameSpaceTree -- PKEY_IsPinnedToNameSpaceTree</para>
+ /// <para>Description: A bool value to know if a shell folder is pinned to the navigation pane
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 2</para>
+ /// </summary>
+ public static PropertyKey IsPinnedToNamespaceTree
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsRead -- PKEY_IsRead</para>
+ /// <para>Description: Has the item been read?
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 10</para>
+ /// </summary>
+ public static PropertyKey IsRead
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 10);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsSearchOnlyItem -- PKEY_IsSearchOnlyItem</para>
+ /// <para>Description: Identifies if a location or a library is search only
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 4</para>
+ /// </summary>
+ public static PropertyKey IsSearchOnlyItem
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}"), 4);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsSendToTarget -- PKEY_IsSendToTarget</para>
+ /// <para>Description: Provided by certain shell folders. Return TRUE if the folder is a valid Send To target.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 33</para>
+ /// </summary>
+ public static PropertyKey IsSendToTarget
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 33);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IsShared -- PKEY_IsShared</para>
+ /// <para>Description: Is this item shared? This only checks for ACLs that are not inherited.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {EF884C5B-2BFE-41BB-AAE5-76EEDF4F9902}, 100</para>
+ /// </summary>
+ public static PropertyKey IsShared
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{EF884C5B-2BFE-41BB-AAE5-76EEDF4F9902}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemAuthors -- PKEY_ItemAuthors</para>
+ /// <para>Description: This is the generic list of authors associated with an item.
+ ///
+ ///For example, the artist name for a track is the item author.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {D0A04F0A-462A-48A4-BB2F-3706E88DBD7D}, 100</para>
+ /// </summary>
+ public static PropertyKey ItemAuthors
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D0A04F0A-462A-48A4-BB2F-3706E88DBD7D}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemClassType -- PKEY_ItemClassType</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {048658AD-2DB8-41A4-BBB6-AC1EF1207EB1}, 100</para>
+ /// </summary>
+ public static PropertyKey ItemClassType
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{048658AD-2DB8-41A4-BBB6-AC1EF1207EB1}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemDate -- PKEY_ItemDate</para>
+ /// <para>Description: This is the main date for an item. The date of interest.
+ ///
+ ///For example, for photos this maps to System.Photo.DateTaken.
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {F7DB74B4-4287-4103-AFBA-F1B13DCD75CF}, 100</para>
+ /// </summary>
+ public static PropertyKey ItemDate
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F7DB74B4-4287-4103-AFBA-F1B13DCD75CF}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemFolderNameDisplay -- PKEY_ItemFolderNameDisplay</para>
+ /// <para>Description: This is the user-friendly display name of the parent folder of an item.
+ ///
+ ///If System.ItemFolderPathDisplay is VT_EMPTY, then this property should be too. Otherwise, it
+ ///should be derived appropriately by the data source from System.ItemFolderPathDisplay.
+ ///
+ ///If the folder is a file folder, the value will be localized if a localized name is available.
+ ///
+ ///Example values:
+ ///
+ /// If the path is... The property value is...
+ /// ----------------- ------------------------
+ /// "c:\foo\bar\hello.txt" "bar"
+ /// "\\server\share\mydir\goodnews.doc" "mydir"
+ /// "\\server\share\numbers.xls" "share"
+ /// "c:\foo\MyFolder" "foo"
+ /// "/Mailbox Account/Inbox/'Re: Hello!'" "Inbox"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 2 (PID_STG_DIRECTORY)</para>
+ /// </summary>
+ public static PropertyKey ItemFolderNameDisplay
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemFolderPathDisplay -- PKEY_ItemFolderPathDisplay</para>
+ /// <para>Description: This is the user-friendly display path of the parent folder of an item.
+ ///
+ ///If System.ItemPathDisplay is VT_EMPTY, then this property should be too. Otherwise, it should
+ ///be derived appropriately by the data source from System.ItemPathDisplay.
+ ///
+ ///Example values:
+ ///
+ /// If the path is... The property value is...
+ /// ----------------- ------------------------
+ /// "c:\foo\bar\hello.txt" "c:\foo\bar"
+ /// "\\server\share\mydir\goodnews.doc" "\\server\share\mydir"
+ /// "\\server\share\numbers.xls" "\\server\share"
+ /// "c:\foo\MyFolder" "c:\foo"
+ /// "/Mailbox Account/Inbox/'Re: Hello!'" "/Mailbox Account/Inbox"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 6</para>
+ /// </summary>
+ public static PropertyKey ItemFolderPathDisplay
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 6);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemFolderPathDisplayNarrow -- PKEY_ItemFolderPathDisplayNarrow</para>
+ /// <para>Description: This is the user-friendly display path of the parent folder of an item. The format of the string
+ ///should be tailored such that the folder name comes first, to optimize for a narrow viewing column.
+ ///
+ ///If the folder is a file folder, the value includes localized names if they are present.
+ ///
+ ///If System.ItemFolderPathDisplay is VT_EMPTY, then this property should be too. Otherwise, it should
+ ///be derived appropriately by the data source from System.ItemFolderPathDisplay.
+ ///
+ ///Example values:
+ ///
+ /// If the path is... The property value is...
+ /// ----------------- ------------------------
+ /// "c:\foo\bar\hello.txt" "bar (c:\foo)"
+ /// "\\server\share\mydir\goodnews.doc" "mydir (\\server\share)"
+ /// "\\server\share\numbers.xls" "share (\\server)"
+ /// "c:\foo\MyFolder" "foo (c:\)"
+ /// "/Mailbox Account/Inbox/'Re: Hello!'" "Inbox (/Mailbox Account)"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {DABD30ED-0043-4789-A7F8-D013A4736622}, 100</para>
+ /// </summary>
+ public static PropertyKey ItemFolderPathDisplayNarrow
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{DABD30ED-0043-4789-A7F8-D013A4736622}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemName -- PKEY_ItemName</para>
+ /// <para>Description: This is the base-name of the System.ItemNameDisplay.
+ ///
+ ///If the item is a file this property
+ ///includes the extension in all cases, and will be localized if a localized name is available.
+ ///
+ ///If the item is a message, then the value of this property does not include the forwarding or
+ ///reply prefixes (see System.ItemNamePrefix).
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {6B8DA074-3B5C-43BC-886F-0A2CDCE00B6F}, 100</para>
+ /// </summary>
+ public static PropertyKey ItemName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6B8DA074-3B5C-43BC-886F-0A2CDCE00B6F}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemNameDisplay -- PKEY_ItemNameDisplay</para>
+ /// <para>Description: This is the display name in "most complete" form. This is the best effort unique representation
+ ///of the name of an item that makes sense for end users to read. It is the concatentation of
+ ///System.ItemNamePrefix and System.ItemName.
+ ///
+ ///If the item is a file this property
+ ///includes the extension in all cases, and will be localized if a localized name is available.
+ ///
+ ///There are acceptable cases when System.FileName is not VT_EMPTY, yet the value of this property
+ ///is completely different. Email messages are a key example. If the item is an email message,
+ ///the item name is likely the subject. In that case, the value must be the concatenation of the
+ ///System.ItemNamePrefix and System.ItemName. Since the value of System.ItemNamePrefix excludes
+ ///any trailing whitespace, the concatenation must include a whitespace when generating System.ItemNameDisplay.
+ ///
+ ///Note that this property is not guaranteed to be unique, but the idea is to promote the most likely
+ ///candidate that can be unique and also makes sense for end users. For example, for documents, you
+ ///might think about using System.Title as the System.ItemNameDisplay, but in practice the title of
+ ///the documents may not be useful or unique enough to be of value as the sole System.ItemNameDisplay.
+ ///Instead, providing the value of System.FileName as the value of System.ItemNameDisplay is a better
+ ///candidate. In Windows Mail, the emails are stored in the file system as .eml files and the
+ ///System.FileName for those files are not human-friendly as they contain GUIDs. In this example,
+ ///promoting System.Subject as System.ItemNameDisplay makes more sense.
+ ///
+ ///Compatibility notes:
+ ///
+ ///Shell folder implementations on Vista: use PKEY_ItemNameDisplay for the name column when
+ ///you want Explorer to call ISF::GetDisplayNameOf(SHGDN_NORMAL) to get the value of the name. Use
+ ///another PKEY (like PKEY_ItemName) when you want Explorer to call either the folder's property store or
+ ///ISF2::GetDetailsEx in order to get the value of the name.
+ ///
+ ///Shell folder implementations on XP: the first column needs to be the name column, and Explorer
+ ///will call ISF::GetDisplayNameOf to get the value of the name. The PKEY/SCID does not matter.
+ ///
+ ///Example values:
+ ///
+ /// File: "hello.txt"
+ /// Message: "Re: Let's talk about Tom's argyle socks!"
+ /// Device folder: "song.wma"
+ /// Folder: "Documents"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 10 (PID_STG_NAME)</para>
+ /// </summary>
+ public static PropertyKey ItemNameDisplay
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 10);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemNamePrefix -- PKEY_ItemNamePrefix</para>
+ /// <para>Description: This is the prefix of an item, used for email messages.
+ ///where the subject begins with "Re:" which is the prefix.
+ ///
+ ///If the item is a file, then the value of this property is VT_EMPTY.
+ ///
+ ///If the item is a message, then the value of this property is the forwarding or reply
+ ///prefixes (including delimiting colon, but no whitespace), or VT_EMPTY if there is no prefix.
+ ///
+ ///Example values:
+ ///
+ ///System.ItemNamePrefix System.ItemName System.ItemNameDisplay
+ ///--------------------- ------------------- ----------------------
+ ///VT_EMPTY "Great day" "Great day"
+ ///"Re:" "Great day" "Re: Great day"
+ ///"Fwd: " "Monthly budget" "Fwd: Monthly budget"
+ ///VT_EMPTY "accounts.xls" "accounts.xls"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {D7313FF1-A77A-401C-8C99-3DBDD68ADD36}, 100</para>
+ /// </summary>
+ public static PropertyKey ItemNamePrefix
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D7313FF1-A77A-401C-8C99-3DBDD68ADD36}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemParticipants -- PKEY_ItemParticipants</para>
+ /// <para>Description: This is the generic list of people associated with an item and who contributed
+ ///to the item.
+ ///
+ ///For example, this is the combination of people in the To list, Cc list and
+ ///sender of an email message.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {D4D0AA16-9948-41A4-AA85-D97FF9646993}, 100</para>
+ /// </summary>
+ public static PropertyKey ItemParticipants
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D4D0AA16-9948-41A4-AA85-D97FF9646993}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemPathDisplay -- PKEY_ItemPathDisplay</para>
+ /// <para>Description: This is the user-friendly display path to the item.
+ ///
+ ///If the item is a file or folder this property
+ ///includes the extension in all cases, and will be localized if a localized name is available.
+ ///
+ ///For other items,this is the user-friendly equivalent, assuming the item exists in hierarchical storage.
+ ///
+ ///Unlike System.ItemUrl, this property value does not include the URL scheme.
+ ///
+ ///To parse an item path, use System.ItemUrl or System.ParsingPath. To reference shell
+ ///namespace items using shell APIs, use System.ParsingPath.
+ ///
+ ///Example values:
+ ///
+ /// If the path is... The property value is...
+ /// ----------------- ------------------------
+ /// "c:\foo\bar\hello.txt" "c:\foo\bar\hello.txt"
+ /// "\\server\share\mydir\goodnews.doc" "\\server\share\mydir\goodnews.doc"
+ /// "\\server\share\numbers.xls" "\\server\share\numbers.xls"
+ /// "c:\foo\MyFolder" "c:\foo\MyFolder"
+ /// "/Mailbox Account/Inbox/'Re: Hello!'" "/Mailbox Account/Inbox/'Re: Hello!'"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 7</para>
+ /// </summary>
+ public static PropertyKey ItemPathDisplay
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 7);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemPathDisplayNarrow -- PKEY_ItemPathDisplayNarrow</para>
+ /// <para>Description: This is the user-friendly display path to the item. The format of the string should be
+ ///tailored such that the name comes first, to optimize for a narrow viewing column.
+ ///
+ ///If the item is a file, the value excludes the file extension, and includes localized names if they are present.
+ ///If the item is a message, the value includes the System.ItemNamePrefix.
+ ///
+ ///To parse an item path, use System.ItemUrl or System.ParsingPath.
+ ///
+ ///Example values:
+ ///
+ /// If the path is... The property value is...
+ /// ----------------- ------------------------
+ /// "c:\foo\bar\hello.txt" "hello (c:\foo\bar)"
+ /// "\\server\share\mydir\goodnews.doc" "goodnews (\\server\share\mydir)"
+ /// "\\server\share\folder" "folder (\\server\share)"
+ /// "c:\foo\MyFolder" "MyFolder (c:\foo)"
+ /// "/Mailbox Account/Inbox/'Re: Hello!'" "Re: Hello! (/Mailbox Account/Inbox)"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 8</para>
+ /// </summary>
+ public static PropertyKey ItemPathDisplayNarrow
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 8);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemType -- PKEY_ItemType</para>
+ /// <para>Description: This is the canonical type of the item and is intended to be programmatically
+ ///parsed.
+ ///
+ ///If there is no canonical type, the value is VT_EMPTY.
+ ///
+ ///If the item is a file (ie, System.FileName is not VT_EMPTY), the value is the same as
+ ///System.FileExtension.
+ ///
+ ///Use System.ItemTypeText when you want to display the type to end users in a view. (If
+ /// the item is a file, passing the System.ItemType value to PSFormatForDisplay will
+ /// result in the same value as System.ItemTypeText.)
+ ///
+ ///Example values:
+ ///
+ /// If the path is... The property value is...
+ /// ----------------- ------------------------
+ /// "c:\foo\bar\hello.txt" ".txt"
+ /// "\\server\share\mydir\goodnews.doc" ".doc"
+ /// "\\server\share\folder" "Directory"
+ /// "c:\foo\MyFolder" "Directory"
+ /// [desktop] "Folder"
+ /// "/Mailbox Account/Inbox/'Re: Hello!'" "MAPI/IPM.Message"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 11</para>
+ /// </summary>
+ public static PropertyKey ItemType
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 11);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemTypeText -- PKEY_ItemTypeText</para>
+ /// <para>Description: This is the user friendly type name of the item. This is not intended to be
+ ///programmatically parsed.
+ ///
+ ///If System.ItemType is VT_EMPTY, the value of this property is also VT_EMPTY.
+ ///
+ ///If the item is a file, the value of this property is the same as if you passed the
+ ///file's System.ItemType value to PSFormatForDisplay.
+ ///
+ ///This property should not be confused with System.Kind, where System.Kind is a high-level
+ ///user friendly kind name. For example, for a document, System.Kind = "Document" and
+ ///System.Item.Type = ".doc" and System.Item.TypeText = "Microsoft Word Document"
+ ///
+ ///Example values:
+ ///
+ /// If the path is... The property value is...
+ /// ----------------- ------------------------
+ /// "c:\foo\bar\hello.txt" "Text File"
+ /// "\\server\share\mydir\goodnews.doc" "Microsoft Word Document"
+ /// "\\server\share\folder" "File Folder"
+ /// "c:\foo\MyFolder" "File Folder"
+ /// "/Mailbox Account/Inbox/'Re: Hello!'" "Outlook E-Mail Message"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 4 (PID_STG_STORAGETYPE)</para>
+ /// </summary>
+ public static PropertyKey ItemTypeText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 4);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ItemUrl -- PKEY_ItemUrl</para>
+ /// <para>Description: This always represents a well formed URL that points to the item.
+ ///
+ ///To reference shell namespace items using shell APIs, use System.ParsingPath.
+ ///
+ ///Example values:
+ ///
+ /// Files: "file:///c:/foo/bar/hello.txt"
+ /// "csc://{GUID}/..."
+ /// Messages: "mapi://..."
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_Query) {49691C90-7E17-101A-A91C-08002B2ECDA9}, 9 (DISPID_QUERY_VIRTUALPATH)</para>
+ /// </summary>
+ public static PropertyKey ItemUrl
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{49691C90-7E17-101A-A91C-08002B2ECDA9}"), 9);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Keywords -- PKEY_Keywords</para>
+ /// <para>Description: The keywords for the item. Also referred to as tags.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) Legacy code may treat this as VT_LPSTR.</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 5 (PIDSI_KEYWORDS)</para>
+ /// </summary>
+ public static PropertyKey Keywords
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 5);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Kind -- PKEY_Kind</para>
+ /// <para>Description: System.Kind is used to map extensions to various .Search folders.
+ ///Extensions are mapped to Kinds at HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\KindMap
+ ///The list of kinds is not extensible.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {1E3EE840-BC2B-476C-8237-2ACD1A839B22}, 3</para>
+ /// </summary>
+ public static PropertyKey Kind
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{1E3EE840-BC2B-476C-8237-2ACD1A839B22}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.KindText -- PKEY_KindText</para>
+ /// <para>Description: This is the user-friendly form of System.Kind. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {F04BEF95-C585-4197-A2B7-DF46FDC9EE6D}, 100</para>
+ /// </summary>
+ public static PropertyKey KindText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F04BEF95-C585-4197-A2B7-DF46FDC9EE6D}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Language -- PKEY_Language</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 28</para>
+ /// </summary>
+ public static PropertyKey Language
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 28);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.MileageInformation -- PKEY_MileageInformation</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {FDF84370-031A-4ADD-9E91-0D775F1C6605}, 100</para>
+ /// </summary>
+ public static PropertyKey MileageInformation
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{FDF84370-031A-4ADD-9E91-0D775F1C6605}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.MIMEType -- PKEY_MIMEType</para>
+ /// <para>Description: The MIME type. Eg, for EML files: 'message/rfc822'.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {0B63E350-9CCC-11D0-BCDB-00805FCCCE04}, 5</para>
+ /// </summary>
+ public static PropertyKey MIMEType
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0B63E350-9CCC-11D0-BCDB-00805FCCCE04}"), 5);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.NamespaceCLSID -- PKEY_NamespaceCLSID</para>
+ /// <para>Description: The CLSID of the name space extension for an item, the object that implements IShellFolder for this item
+ ///</para>
+ /// <para>Type: Guid -- VT_CLSID</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 6</para>
+ /// </summary>
+ public static PropertyKey NamespaceClsid
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 6);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Null -- PKEY_Null</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {00000000-0000-0000-0000-000000000000}, 0</para>
+ /// </summary>
+ public static PropertyKey Null
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{00000000-0000-0000-0000-000000000000}"), 0);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.OfflineAvailability -- PKEY_OfflineAvailability</para>
+ /// <para>Description: </para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {A94688B6-7D9F-4570-A648-E3DFC0AB2B3F}, 100</para>
+ /// </summary>
+ public static PropertyKey OfflineAvailability
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A94688B6-7D9F-4570-A648-E3DFC0AB2B3F}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.OfflineStatus -- PKEY_OfflineStatus</para>
+ /// <para>Description: </para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {6D24888F-4718-4BDA-AFED-EA0FB4386CD8}, 100</para>
+ /// </summary>
+ public static PropertyKey OfflineStatus
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6D24888F-4718-4BDA-AFED-EA0FB4386CD8}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.OriginalFileName -- PKEY_OriginalFileName</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 6</para>
+ /// </summary>
+ public static PropertyKey OriginalFileName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0CEF7D53-FA64-11D1-A203-0000F81FEDEE}"), 6);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.OwnerSID -- PKEY_OwnerSID</para>
+ /// <para>Description: SID of the user that owns the library.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}, 6</para>
+ /// </summary>
+ public static PropertyKey OwnerSid
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{5D76B67F-9B3D-44BB-B6AE-25DA4F638A67}"), 6);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ParentalRating -- PKEY_ParentalRating</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 21 (PIDMSI_PARENTAL_RATING)</para>
+ /// </summary>
+ public static PropertyKey ParentalRating
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 21);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ParentalRatingReason -- PKEY_ParentalRatingReason</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {10984E0A-F9F2-4321-B7EF-BAF195AF4319}, 100</para>
+ /// </summary>
+ public static PropertyKey ParentalRatingReason
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{10984E0A-F9F2-4321-B7EF-BAF195AF4319}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ParentalRatingsOrganization -- PKEY_ParentalRatingsOrganization</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {A7FE0840-1344-46F0-8D37-52ED712A4BF9}, 100</para>
+ /// </summary>
+ public static PropertyKey ParentalRatingsOrganization
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A7FE0840-1344-46F0-8D37-52ED712A4BF9}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ParsingBindContext -- PKEY_ParsingBindContext</para>
+ /// <para>Description: used to get the IBindCtx for an item for parsing
+ ///</para>
+ /// <para>Type: Any -- VT_NULL Legacy code may treat this as VT_UNKNOWN.</para>
+ /// <para>FormatID: {DFB9A04D-362F-4CA3-B30B-0254B17B5B84}, 100</para>
+ /// </summary>
+ public static PropertyKey ParsingBindContext
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{DFB9A04D-362F-4CA3-B30B-0254B17B5B84}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ParsingName -- PKEY_ParsingName</para>
+ /// <para>Description: The shell namespace name of an item relative to a parent folder. This name may be passed to
+ ///IShellFolder::ParseDisplayName() of the parent shell folder.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 24</para>
+ /// </summary>
+ public static PropertyKey ParsingName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 24);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ParsingPath -- PKEY_ParsingPath</para>
+ /// <para>Description: This is the shell namespace path to the item. This path may be passed to
+ ///SHParseDisplayName to parse the path to the correct shell folder.
+ ///
+ ///If the item is a file, the value is identical to System.ItemPathDisplay.
+ ///
+ ///If the item cannot be accessed through the shell namespace, this value is VT_EMPTY.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 30</para>
+ /// </summary>
+ public static PropertyKey ParsingPath
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 30);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PerceivedType -- PKEY_PerceivedType</para>
+ /// <para>Description: The perceived type of a shell item, based upon its canonical type.
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 9</para>
+ /// </summary>
+ public static PropertyKey PerceivedType
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 9);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PercentFull -- PKEY_PercentFull</para>
+ /// <para>Description: The amount filled as a percentage, multiplied by 100 (ie, the valid range is 0 through 100).
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 5 (Filesystem Volume Properties)</para>
+ /// </summary>
+ public static PropertyKey PercentFull
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9B174B35-40FF-11D2-A27E-00C04FC30871}"), 5);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Priority -- PKEY_Priority</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {9C1FCF74-2D97-41BA-B4AE-CB2E3661A6E4}, 5</para>
+ /// </summary>
+ public static PropertyKey Priority
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9C1FCF74-2D97-41BA-B4AE-CB2E3661A6E4}"), 5);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PriorityText -- PKEY_PriorityText</para>
+ /// <para>Description: This is the user-friendly form of System.Priority. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {D98BE98B-B86B-4095-BF52-9D23B2E0A752}, 100</para>
+ /// </summary>
+ public static PropertyKey PriorityText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D98BE98B-B86B-4095-BF52-9D23B2E0A752}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Project -- PKEY_Project</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {39A7F922-477C-48DE-8BC8-B28441E342E3}, 100</para>
+ /// </summary>
+ public static PropertyKey Project
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{39A7F922-477C-48DE-8BC8-B28441E342E3}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ProviderItemID -- PKEY_ProviderItemID</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {F21D9941-81F0-471A-ADEE-4E74B49217ED}, 100</para>
+ /// </summary>
+ public static PropertyKey ProviderItemID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F21D9941-81F0-471A-ADEE-4E74B49217ED}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Rating -- PKEY_Rating</para>
+ /// <para>Description: Indicates the users preference rating of an item on a scale of 1-99 (1-12 = One Star,
+ ///13-37 = Two Stars, 38-62 = Three Stars, 63-87 = Four Stars, 88-99 = Five Stars).
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 9 (PIDMSI_RATING)</para>
+ /// </summary>
+ public static PropertyKey Rating
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 9);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RatingText -- PKEY_RatingText</para>
+ /// <para>Description: This is the user-friendly form of System.Rating. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {90197CA7-FD8F-4E8C-9DA3-B57E1E609295}, 100</para>
+ /// </summary>
+ public static PropertyKey RatingText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{90197CA7-FD8F-4E8C-9DA3-B57E1E609295}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sensitivity -- PKEY_Sensitivity</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {F8D3F6AC-4874-42CB-BE59-AB454B30716A}, 100</para>
+ /// </summary>
+ public static PropertyKey Sensitivity
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F8D3F6AC-4874-42CB-BE59-AB454B30716A}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.SensitivityText -- PKEY_SensitivityText</para>
+ /// <para>Description: This is the user-friendly form of System.Sensitivity. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {D0C7F054-3F72-4725-8527-129A577CB269}, 100</para>
+ /// </summary>
+ public static PropertyKey SensitivityText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D0C7F054-3F72-4725-8527-129A577CB269}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.SFGAOFlags -- PKEY_SFGAOFlags</para>
+ /// <para>Description: IShellFolder::GetAttributesOf flags, with SFGAO_PKEYSFGAOMASK attributes masked out.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 25</para>
+ /// </summary>
+ [SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags")]
+ public static PropertyKey SFGAOFlags
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 25);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.SharedWith -- PKEY_SharedWith</para>
+ /// <para>Description: Who is the item shared with?
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {EF884C5B-2BFE-41BB-AAE5-76EEDF4F9902}, 200</para>
+ /// </summary>
+ public static PropertyKey SharedWith
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{EF884C5B-2BFE-41BB-AAE5-76EEDF4F9902}"), 200);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ShareUserRating -- PKEY_ShareUserRating</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 12 (PIDMSI_SHARE_USER_RATING)</para>
+ /// </summary>
+ public static PropertyKey ShareUserRating
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 12);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.SharingStatus -- PKEY_SharingStatus</para>
+ /// <para>Description: What is the item's sharing status (not shared, shared, everyone (homegroup or everyone), or private)?
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {EF884C5B-2BFE-41BB-AAE5-76EEDF4F9902}, 300</para>
+ /// </summary>
+ public static PropertyKey SharingStatus
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{EF884C5B-2BFE-41BB-AAE5-76EEDF4F9902}"), 300);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.SimpleRating -- PKEY_SimpleRating</para>
+ /// <para>Description: Indicates the users preference rating of an item on a scale of 0-5 (0=unrated, 1=One Star, 2=Two Stars, 3=Three Stars,
+ ///4=Four Stars, 5=Five Stars)
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {A09F084E-AD41-489F-8076-AA5BE3082BCA}, 100</para>
+ /// </summary>
+ public static PropertyKey SimpleRating
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A09F084E-AD41-489F-8076-AA5BE3082BCA}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Size -- PKEY_Size</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 12 (PID_STG_SIZE)</para>
+ /// </summary>
+ public static PropertyKey Size
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 12);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.SoftwareUsed -- PKEY_SoftwareUsed</para>
+ /// <para>Description: PropertyTagSoftwareUsed
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 305</para>
+ /// </summary>
+ public static PropertyKey SoftwareUsed
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 305);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.SourceItem -- PKEY_SourceItem</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {668CDFA5-7A1B-4323-AE4B-E527393A1D81}, 100</para>
+ /// </summary>
+ public static PropertyKey SourceItem
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{668CDFA5-7A1B-4323-AE4B-E527393A1D81}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.StartDate -- PKEY_StartDate</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {48FD6EC8-8A12-4CDF-A03E-4EC5A511EDDE}, 100</para>
+ /// </summary>
+ public static PropertyKey StartDate
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{48FD6EC8-8A12-4CDF-A03E-4EC5A511EDDE}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Status -- PKEY_Status</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_IntSite) {000214A1-0000-0000-C000-000000000046}, 9</para>
+ /// </summary>
+ public static PropertyKey Status
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{000214A1-0000-0000-C000-000000000046}"), 9);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Subject -- PKEY_Subject</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 3 (PIDSI_SUBJECT)</para>
+ /// </summary>
+ public static PropertyKey Subject
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Thumbnail -- PKEY_Thumbnail</para>
+ /// <para>Description: A data that represents the thumbnail in VT_CF format.
+ ///</para>
+ /// <para>Type: Clipboard -- VT_CF</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 17 (PIDSI_THUMBNAIL)</para>
+ /// </summary>
+ public static PropertyKey Thumbnail
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 17);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ThumbnailCacheId -- PKEY_ThumbnailCacheId</para>
+ /// <para>Description: Unique value that can be used as a key to cache thumbnails. The value changes when the name, volume, or data modified
+ ///of an item changes.
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: {446D16B1-8DAD-4870-A748-402EA43D788C}, 100</para>
+ /// </summary>
+ public static PropertyKey ThumbnailCacheId
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{446D16B1-8DAD-4870-A748-402EA43D788C}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.ThumbnailStream -- PKEY_ThumbnailStream</para>
+ /// <para>Description: Data that represents the thumbnail in VT_STREAM format that GDI+/WindowsCodecs supports (jpg, png, etc).
+ ///</para>
+ /// <para>Type: Stream -- VT_STREAM</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 27</para>
+ /// </summary>
+ public static PropertyKey ThumbnailStream
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 27);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Title -- PKEY_Title</para>
+ /// <para>Description: Title of item.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR) Legacy code may treat this as VT_LPSTR.</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 2 (PIDSI_TITLE)</para>
+ /// </summary>
+ public static PropertyKey Title
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.TotalFileSize -- PKEY_TotalFileSize</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: (FMTID_ShellDetails) {28636AA6-953D-11D2-B5D6-00C04FD918D0}, 14</para>
+ /// </summary>
+ public static PropertyKey TotalFileSize
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{28636AA6-953D-11D2-B5D6-00C04FD918D0}"), 14);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Trademarks -- PKEY_Trademarks</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 9 (PIDVSI_Trademarks)</para>
+ /// </summary>
+ public static PropertyKey Trademarks
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0CEF7D53-FA64-11D1-A203-0000F81FEDEE}"), 9);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+ #region sub-classes
+
+ /// <summary>
+ /// AppUserModel Properties
+ /// </summary>
+ public static class AppUserModel
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.AppUserModel.ExcludeFromShowInNewInstall -- PKEY_AppUserModel_ExcludeFromShowInNewInstall</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 8</para>
+ /// </summary>
+ public static PropertyKey ExcludeFromShowInNewInstall
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}"), 8);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.AppUserModel.ID -- PKEY_AppUserModel_ID</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 5</para>
+ /// </summary>
+ public static PropertyKey ID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}"), 5);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.AppUserModel.IsDestListSeparator -- PKEY_AppUserModel_IsDestListSeparator</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 6</para>
+ /// </summary>
+ public static PropertyKey IsDestinationListSeparator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}"), 6);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.AppUserModel.PreventPinning -- PKEY_AppUserModel_PreventPinning</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 9</para>
+ /// </summary>
+ public static PropertyKey PreventPinning
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}"), 9);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.AppUserModel.RelaunchCommand -- PKEY_AppUserModel_RelaunchCommand</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 2</para>
+ /// </summary>
+ public static PropertyKey RelaunchCommand
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.AppUserModel.RelaunchDisplayNameResource -- PKEY_AppUserModel_RelaunchDisplayNameResource</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 4</para>
+ /// </summary>
+ public static PropertyKey RelaunchDisplayNameResource
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}"), 4);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.AppUserModel.RelaunchIconResource -- PKEY_AppUserModel_RelaunchIconResource</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 3</para>
+ /// </summary>
+ public static PropertyKey RelaunchIconResource
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}"), 3);
+
+ return key;
+ }
+ }
+ #endregion
+
+ }
+
+ /// <summary>
+ /// Audio Properties
+ /// </summary>
+ public static class Audio
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Audio.ChannelCount -- PKEY_Audio_ChannelCount</para>
+ /// <para>Description: Indicates the channel count for the audio file. Values: 1 (mono), 2 (stereo).
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 7 (PIDASI_CHANNEL_COUNT)</para>
+ /// </summary>
+ public static PropertyKey ChannelCount
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440490-4C8B-11D1-8B70-080036B11A03}"), 7);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Audio.Compression -- PKEY_Audio_Compression</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 10 (PIDASI_COMPRESSION)</para>
+ /// </summary>
+ public static PropertyKey Compression
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440490-4C8B-11D1-8B70-080036B11A03}"), 10);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Audio.EncodingBitrate -- PKEY_Audio_EncodingBitrate</para>
+ /// <para>Description: Indicates the average data rate in Hz for the audio file in "bits per second".
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 4 (PIDASI_AVG_DATA_RATE)</para>
+ /// </summary>
+ public static PropertyKey EncodingBitrate
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440490-4C8B-11D1-8B70-080036B11A03}"), 4);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Audio.Format -- PKEY_Audio_Format</para>
+ /// <para>Description: Indicates the format of the audio file.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR) Legacy code may treat this as VT_BSTR.</para>
+ /// <para>FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 2 (PIDASI_FORMAT)</para>
+ /// </summary>
+ public static PropertyKey Format
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440490-4C8B-11D1-8B70-080036B11A03}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Audio.IsVariableBitRate -- PKEY_Audio_IsVariableBitRate</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {E6822FEE-8C17-4D62-823C-8E9CFCBD1D5C}, 100</para>
+ /// </summary>
+ public static PropertyKey IsVariableBitrate
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E6822FEE-8C17-4D62-823C-8E9CFCBD1D5C}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Audio.PeakValue -- PKEY_Audio_PeakValue</para>
+ /// <para>Description: </para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {2579E5D0-1116-4084-BD9A-9B4F7CB4DF5E}, 100</para>
+ /// </summary>
+ public static PropertyKey PeakValue
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{2579E5D0-1116-4084-BD9A-9B4F7CB4DF5E}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Audio.SampleRate -- PKEY_Audio_SampleRate</para>
+ /// <para>Description: Indicates the audio sample rate for the audio file in "samples per second".
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 5 (PIDASI_SAMPLE_RATE)</para>
+ /// </summary>
+ public static PropertyKey SampleRate
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440490-4C8B-11D1-8B70-080036B11A03}"), 5);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Audio.SampleSize -- PKEY_Audio_SampleSize</para>
+ /// <para>Description: Indicates the audio sample size for the audio file in "bits per sample".
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 6 (PIDASI_SAMPLE_SIZE)</para>
+ /// </summary>
+ public static PropertyKey SampleSize
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440490-4C8B-11D1-8B70-080036B11A03}"), 6);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Audio.StreamName -- PKEY_Audio_StreamName</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 9 (PIDASI_STREAM_NAME)</para>
+ /// </summary>
+ public static PropertyKey StreamName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440490-4C8B-11D1-8B70-080036B11A03}"), 9);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Audio.StreamNumber -- PKEY_Audio_StreamNumber</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 8 (PIDASI_STREAM_NUMBER)</para>
+ /// </summary>
+ public static PropertyKey StreamNumber
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440490-4C8B-11D1-8B70-080036B11A03}"), 8);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Calendar Properties
+ /// </summary>
+ public static class Calendar
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Calendar.Duration -- PKEY_Calendar_Duration</para>
+ /// <para>Description: The duration as specified in a string.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {293CA35A-09AA-4DD2-B180-1FE245728A52}, 100</para>
+ /// </summary>
+ public static PropertyKey Duration
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{293CA35A-09AA-4DD2-B180-1FE245728A52}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.IsOnline -- PKEY_Calendar_IsOnline</para>
+ /// <para>Description: Identifies if the event is an online event.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {BFEE9149-E3E2-49A7-A862-C05988145CEC}, 100</para>
+ /// </summary>
+ public static PropertyKey IsOnline
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{BFEE9149-E3E2-49A7-A862-C05988145CEC}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.IsRecurring -- PKEY_Calendar_IsRecurring</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {315B9C8D-80A9-4EF9-AE16-8E746DA51D70}, 100</para>
+ /// </summary>
+ public static PropertyKey IsRecurring
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{315B9C8D-80A9-4EF9-AE16-8E746DA51D70}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.Location -- PKEY_Calendar_Location</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {F6272D18-CECC-40B1-B26A-3911717AA7BD}, 100</para>
+ /// </summary>
+ public static PropertyKey Location
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F6272D18-CECC-40B1-B26A-3911717AA7BD}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.OptionalAttendeeAddresses -- PKEY_Calendar_OptionalAttendeeAddresses</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {D55BAE5A-3892-417A-A649-C6AC5AAAEAB3}, 100</para>
+ /// </summary>
+ public static PropertyKey OptionalAttendeeAddresses
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D55BAE5A-3892-417A-A649-C6AC5AAAEAB3}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.OptionalAttendeeNames -- PKEY_Calendar_OptionalAttendeeNames</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {09429607-582D-437F-84C3-DE93A2B24C3C}, 100</para>
+ /// </summary>
+ public static PropertyKey OptionalAttendeeNames
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{09429607-582D-437F-84C3-DE93A2B24C3C}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.OrganizerAddress -- PKEY_Calendar_OrganizerAddress</para>
+ /// <para>Description: Address of the organizer organizing the event.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {744C8242-4DF5-456C-AB9E-014EFB9021E3}, 100</para>
+ /// </summary>
+ public static PropertyKey OrganizerAddress
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{744C8242-4DF5-456C-AB9E-014EFB9021E3}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.OrganizerName -- PKEY_Calendar_OrganizerName</para>
+ /// <para>Description: Name of the organizer organizing the event.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {AAA660F9-9865-458E-B484-01BC7FE3973E}, 100</para>
+ /// </summary>
+ public static PropertyKey OrganizerName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{AAA660F9-9865-458E-B484-01BC7FE3973E}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.ReminderTime -- PKEY_Calendar_ReminderTime</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {72FC5BA4-24F9-4011-9F3F-ADD27AFAD818}, 100</para>
+ /// </summary>
+ public static PropertyKey ReminderTime
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{72FC5BA4-24F9-4011-9F3F-ADD27AFAD818}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.RequiredAttendeeAddresses -- PKEY_Calendar_RequiredAttendeeAddresses</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {0BA7D6C3-568D-4159-AB91-781A91FB71E5}, 100</para>
+ /// </summary>
+ public static PropertyKey RequiredAttendeeAddresses
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0BA7D6C3-568D-4159-AB91-781A91FB71E5}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.RequiredAttendeeNames -- PKEY_Calendar_RequiredAttendeeNames</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {B33AF30B-F552-4584-936C-CB93E5CDA29F}, 100</para>
+ /// </summary>
+ public static PropertyKey RequiredAttendeeNames
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{B33AF30B-F552-4584-936C-CB93E5CDA29F}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.Resources -- PKEY_Calendar_Resources</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {00F58A38-C54B-4C40-8696-97235980EAE1}, 100</para>
+ /// </summary>
+ public static PropertyKey Resources
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{00F58A38-C54B-4C40-8696-97235980EAE1}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.ResponseStatus -- PKEY_Calendar_ResponseStatus</para>
+ /// <para>Description: This property stores the status of the user responses to meetings in her calendar.
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {188C1F91-3C40-4132-9EC5-D8B03B72A8A2}, 100</para>
+ /// </summary>
+ public static PropertyKey ResponseStatus
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{188C1F91-3C40-4132-9EC5-D8B03B72A8A2}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.ShowTimeAs -- PKEY_Calendar_ShowTimeAs</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {5BF396D4-5EB2-466F-BDE9-2FB3F2361D6E}, 100</para>
+ /// </summary>
+ public static PropertyKey ShowTimeAs
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{5BF396D4-5EB2-466F-BDE9-2FB3F2361D6E}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Calendar.ShowTimeAsText -- PKEY_Calendar_ShowTimeAsText</para>
+ /// <para>Description: This is the user-friendly form of System.Calendar.ShowTimeAs. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {53DA57CF-62C0-45C4-81DE-7610BCEFD7F5}, 100</para>
+ /// </summary>
+ public static PropertyKey ShowTimeAsText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{53DA57CF-62C0-45C4-81DE-7610BCEFD7F5}"), 100);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Communication Properties
+ /// </summary>
+ public static class Communication
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Communication.AccountName -- PKEY_Communication_AccountName</para>
+ /// <para>Description: Account Name
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 9</para>
+ /// </summary>
+ public static PropertyKey AccountName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 9);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Communication.DateItemExpires -- PKEY_Communication_DateItemExpires</para>
+ /// <para>Description: Date the item expires due to the retention policy.
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {428040AC-A177-4C8A-9760-F6F761227F9A}, 100</para>
+ /// </summary>
+ public static PropertyKey DateItemExpires
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{428040AC-A177-4C8A-9760-F6F761227F9A}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Communication.FollowupIconIndex -- PKEY_Communication_FollowupIconIndex</para>
+ /// <para>Description: This is the icon index used on messages marked for followup.
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {83A6347E-6FE4-4F40-BA9C-C4865240D1F4}, 100</para>
+ /// </summary>
+ public static PropertyKey FollowUpIconIndex
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{83A6347E-6FE4-4F40-BA9C-C4865240D1F4}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Communication.HeaderItem -- PKEY_Communication_HeaderItem</para>
+ /// <para>Description: This property will be true if the item is a header item which means the item hasn't been fully downloaded.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {C9C34F84-2241-4401-B607-BD20ED75AE7F}, 100</para>
+ /// </summary>
+ public static PropertyKey HeaderItem
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C9C34F84-2241-4401-B607-BD20ED75AE7F}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Communication.PolicyTag -- PKEY_Communication_PolicyTag</para>
+ /// <para>Description: This a string used to identify the retention policy applied to the item.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {EC0B4191-AB0B-4C66-90B6-C6637CDEBBAB}, 100</para>
+ /// </summary>
+ public static PropertyKey PolicyTag
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{EC0B4191-AB0B-4C66-90B6-C6637CDEBBAB}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Communication.SecurityFlags -- PKEY_Communication_SecurityFlags</para>
+ /// <para>Description: Security flags associated with the item to know if the item is encrypted, signed or DRM enabled.
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {8619A4B6-9F4D-4429-8C0F-B996CA59E335}, 100</para>
+ /// </summary>
+ public static PropertyKey SecurityFlags
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{8619A4B6-9F4D-4429-8C0F-B996CA59E335}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Communication.Suffix -- PKEY_Communication_Suffix</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {807B653A-9E91-43EF-8F97-11CE04EE20C5}, 100</para>
+ /// </summary>
+ public static PropertyKey Suffix
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{807B653A-9E91-43EF-8F97-11CE04EE20C5}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Communication.TaskStatus -- PKEY_Communication_TaskStatus</para>
+ /// <para>Description: </para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {BE1A72C6-9A1D-46B7-AFE7-AFAF8CEF4999}, 100</para>
+ /// </summary>
+ public static PropertyKey TaskStatus
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{BE1A72C6-9A1D-46B7-AFE7-AFAF8CEF4999}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Communication.TaskStatusText -- PKEY_Communication_TaskStatusText</para>
+ /// <para>Description: This is the user-friendly form of System.Communication.TaskStatus. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {A6744477-C237-475B-A075-54F34498292A}, 100</para>
+ /// </summary>
+ public static PropertyKey TaskStatusText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A6744477-C237-475B-A075-54F34498292A}"), 100);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Computer Properties
+ /// </summary>
+ public static class Computer
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Computer.DecoratedFreeSpace -- PKEY_Computer_DecoratedFreeSpace</para>
+ /// <para>Description: Free space and total space: "%s free of %s"
+ ///</para>
+ /// <para>Type: Multivalue UInt64 -- VT_VECTOR | VT_UI8 (For variants: VT_ARRAY | VT_UI8)</para>
+ /// <para>FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 7 (Filesystem Volume Properties)</para>
+ /// </summary>
+ public static PropertyKey DecoratedFreeSpace
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9B174B35-40FF-11D2-A27E-00C04FC30871}"), 7);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Contact Properties
+ /// </summary>
+ public static class Contact
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Contact.Anniversary -- PKEY_Contact_Anniversary</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {9AD5BADB-CEA7-4470-A03D-B84E51B9949E}, 100</para>
+ /// </summary>
+ public static PropertyKey Anniversary
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9AD5BADB-CEA7-4470-A03D-B84E51B9949E}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.AssistantName -- PKEY_Contact_AssistantName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {CD102C9C-5540-4A88-A6F6-64E4981C8CD1}, 100</para>
+ /// </summary>
+ public static PropertyKey AssistantName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{CD102C9C-5540-4A88-A6F6-64E4981C8CD1}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.AssistantTelephone -- PKEY_Contact_AssistantTelephone</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {9A93244D-A7AD-4FF8-9B99-45EE4CC09AF6}, 100</para>
+ /// </summary>
+ public static PropertyKey AssistantTelephone
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9A93244D-A7AD-4FF8-9B99-45EE4CC09AF6}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.Birthday -- PKEY_Contact_Birthday</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 47</para>
+ /// </summary>
+ public static PropertyKey Birthday
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 47);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.BusinessAddress -- PKEY_Contact_BusinessAddress</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {730FB6DD-CF7C-426B-A03F-BD166CC9EE24}, 100</para>
+ /// </summary>
+ public static PropertyKey BusinessAddress
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{730FB6DD-CF7C-426B-A03F-BD166CC9EE24}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.BusinessAddressCity -- PKEY_Contact_BusinessAddressCity</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {402B5934-EC5A-48C3-93E6-85E86A2D934E}, 100</para>
+ /// </summary>
+ public static PropertyKey BusinessAddressCity
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{402B5934-EC5A-48C3-93E6-85E86A2D934E}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.BusinessAddressCountry -- PKEY_Contact_BusinessAddressCountry</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {B0B87314-FCF6-4FEB-8DFF-A50DA6AF561C}, 100</para>
+ /// </summary>
+ public static PropertyKey BusinessAddressCountry
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{B0B87314-FCF6-4FEB-8DFF-A50DA6AF561C}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.BusinessAddressPostalCode -- PKEY_Contact_BusinessAddressPostalCode</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E1D4A09E-D758-4CD1-B6EC-34A8B5A73F80}, 100</para>
+ /// </summary>
+ public static PropertyKey BusinessAddressPostalCode
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E1D4A09E-D758-4CD1-B6EC-34A8B5A73F80}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.BusinessAddressPostOfficeBox -- PKEY_Contact_BusinessAddressPostOfficeBox</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {BC4E71CE-17F9-48D5-BEE9-021DF0EA5409}, 100</para>
+ /// </summary>
+ public static PropertyKey BusinessAddressPostOfficeBox
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{BC4E71CE-17F9-48D5-BEE9-021DF0EA5409}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.BusinessAddressState -- PKEY_Contact_BusinessAddressState</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {446F787F-10C4-41CB-A6C4-4D0343551597}, 100</para>
+ /// </summary>
+ public static PropertyKey BusinessAddressState
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{446F787F-10C4-41CB-A6C4-4D0343551597}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.BusinessAddressStreet -- PKEY_Contact_BusinessAddressStreet</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {DDD1460F-C0BF-4553-8CE4-10433C908FB0}, 100</para>
+ /// </summary>
+ public static PropertyKey BusinessAddressStreet
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{DDD1460F-C0BF-4553-8CE4-10433C908FB0}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.BusinessFaxNumber -- PKEY_Contact_BusinessFaxNumber</para>
+ /// <para>Description: Business fax number of the contact.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {91EFF6F3-2E27-42CA-933E-7C999FBE310B}, 100</para>
+ /// </summary>
+ public static PropertyKey BusinessFaxNumber
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{91EFF6F3-2E27-42CA-933E-7C999FBE310B}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.BusinessHomePage -- PKEY_Contact_BusinessHomePage</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {56310920-2491-4919-99CE-EADB06FAFDB2}, 100</para>
+ /// </summary>
+ public static PropertyKey BusinessHomepage
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{56310920-2491-4919-99CE-EADB06FAFDB2}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.BusinessTelephone -- PKEY_Contact_BusinessTelephone</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {6A15E5A0-0A1E-4CD7-BB8C-D2F1B0C929BC}, 100</para>
+ /// </summary>
+ public static PropertyKey BusinessTelephone
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6A15E5A0-0A1E-4CD7-BB8C-D2F1B0C929BC}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.CallbackTelephone -- PKEY_Contact_CallbackTelephone</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {BF53D1C3-49E0-4F7F-8567-5A821D8AC542}, 100</para>
+ /// </summary>
+ public static PropertyKey CallbackTelephone
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{BF53D1C3-49E0-4F7F-8567-5A821D8AC542}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.CarTelephone -- PKEY_Contact_CarTelephone</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {8FDC6DEA-B929-412B-BA90-397A257465FE}, 100</para>
+ /// </summary>
+ public static PropertyKey CarTelephone
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{8FDC6DEA-B929-412B-BA90-397A257465FE}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.Children -- PKEY_Contact_Children</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {D4729704-8EF1-43EF-9024-2BD381187FD5}, 100</para>
+ /// </summary>
+ public static PropertyKey Children
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D4729704-8EF1-43EF-9024-2BD381187FD5}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.CompanyMainTelephone -- PKEY_Contact_CompanyMainTelephone</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {8589E481-6040-473D-B171-7FA89C2708ED}, 100</para>
+ /// </summary>
+ public static PropertyKey CompanyMainTelephone
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{8589E481-6040-473D-B171-7FA89C2708ED}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.Department -- PKEY_Contact_Department</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {FC9F7306-FF8F-4D49-9FB6-3FFE5C0951EC}, 100</para>
+ /// </summary>
+ public static PropertyKey Department
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{FC9F7306-FF8F-4D49-9FB6-3FFE5C0951EC}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.EmailAddress -- PKEY_Contact_EmailAddress</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {F8FA7FA3-D12B-4785-8A4E-691A94F7A3E7}, 100</para>
+ /// </summary>
+ public static PropertyKey EmailAddress
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F8FA7FA3-D12B-4785-8A4E-691A94F7A3E7}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.EmailAddress2 -- PKEY_Contact_EmailAddress2</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {38965063-EDC8-4268-8491-B7723172CF29}, 100</para>
+ /// </summary>
+ public static PropertyKey EmailAddress2
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{38965063-EDC8-4268-8491-B7723172CF29}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.EmailAddress3 -- PKEY_Contact_EmailAddress3</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {644D37B4-E1B3-4BAD-B099-7E7C04966ACA}, 100</para>
+ /// </summary>
+ public static PropertyKey EmailAddress3
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{644D37B4-E1B3-4BAD-B099-7E7C04966ACA}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.EmailAddresses -- PKEY_Contact_EmailAddresses</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {84D8F337-981D-44B3-9615-C7596DBA17E3}, 100</para>
+ /// </summary>
+ public static PropertyKey EmailAddresses
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{84D8F337-981D-44B3-9615-C7596DBA17E3}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.EmailName -- PKEY_Contact_EmailName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {CC6F4F24-6083-4BD4-8754-674D0DE87AB8}, 100</para>
+ /// </summary>
+ public static PropertyKey EmailName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{CC6F4F24-6083-4BD4-8754-674D0DE87AB8}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.FileAsName -- PKEY_Contact_FileAsName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {F1A24AA7-9CA7-40F6-89EC-97DEF9FFE8DB}, 100</para>
+ /// </summary>
+ public static PropertyKey FileAsName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F1A24AA7-9CA7-40F6-89EC-97DEF9FFE8DB}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.FirstName -- PKEY_Contact_FirstName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {14977844-6B49-4AAD-A714-A4513BF60460}, 100</para>
+ /// </summary>
+ public static PropertyKey FirstName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14977844-6B49-4AAD-A714-A4513BF60460}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.FullName -- PKEY_Contact_FullName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {635E9051-50A5-4BA2-B9DB-4ED056C77296}, 100</para>
+ /// </summary>
+ public static PropertyKey FullName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{635E9051-50A5-4BA2-B9DB-4ED056C77296}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.Gender -- PKEY_Contact_Gender</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {3C8CEE58-D4F0-4CF9-B756-4E5D24447BCD}, 100</para>
+ /// </summary>
+ public static PropertyKey Gender
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{3C8CEE58-D4F0-4CF9-B756-4E5D24447BCD}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.GenderValue -- PKEY_Contact_GenderValue</para>
+ /// <para>Description: </para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {3C8CEE58-D4F0-4CF9-B756-4E5D24447BCD}, 101</para>
+ /// </summary>
+ public static PropertyKey GenderValue
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{3C8CEE58-D4F0-4CF9-B756-4E5D24447BCD}"), 101);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.Hobbies -- PKEY_Contact_Hobbies</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {5DC2253F-5E11-4ADF-9CFE-910DD01E3E70}, 100</para>
+ /// </summary>
+ public static PropertyKey Hobbies
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{5DC2253F-5E11-4ADF-9CFE-910DD01E3E70}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.HomeAddress -- PKEY_Contact_HomeAddress</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {98F98354-617A-46B8-8560-5B1B64BF1F89}, 100</para>
+ /// </summary>
+ public static PropertyKey HomeAddress
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{98F98354-617A-46B8-8560-5B1B64BF1F89}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.HomeAddressCity -- PKEY_Contact_HomeAddressCity</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 65</para>
+ /// </summary>
+ public static PropertyKey HomeAddressCity
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 65);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.HomeAddressCountry -- PKEY_Contact_HomeAddressCountry</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {08A65AA1-F4C9-43DD-9DDF-A33D8E7EAD85}, 100</para>
+ /// </summary>
+ public static PropertyKey HomeAddressCountry
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{08A65AA1-F4C9-43DD-9DDF-A33D8E7EAD85}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.HomeAddressPostalCode -- PKEY_Contact_HomeAddressPostalCode</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {8AFCC170-8A46-4B53-9EEE-90BAE7151E62}, 100</para>
+ /// </summary>
+ public static PropertyKey HomeAddressPostalCode
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{8AFCC170-8A46-4B53-9EEE-90BAE7151E62}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.HomeAddressPostOfficeBox -- PKEY_Contact_HomeAddressPostOfficeBox</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {7B9F6399-0A3F-4B12-89BD-4ADC51C918AF}, 100</para>
+ /// </summary>
+ public static PropertyKey HomeAddressPostOfficeBox
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{7B9F6399-0A3F-4B12-89BD-4ADC51C918AF}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.HomeAddressState -- PKEY_Contact_HomeAddressState</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C89A23D0-7D6D-4EB8-87D4-776A82D493E5}, 100</para>
+ /// </summary>
+ public static PropertyKey HomeAddressState
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C89A23D0-7D6D-4EB8-87D4-776A82D493E5}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.HomeAddressStreet -- PKEY_Contact_HomeAddressStreet</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {0ADEF160-DB3F-4308-9A21-06237B16FA2A}, 100</para>
+ /// </summary>
+ public static PropertyKey HomeAddressStreet
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0ADEF160-DB3F-4308-9A21-06237B16FA2A}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.HomeFaxNumber -- PKEY_Contact_HomeFaxNumber</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {660E04D6-81AB-4977-A09F-82313113AB26}, 100</para>
+ /// </summary>
+ public static PropertyKey HomeFaxNumber
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{660E04D6-81AB-4977-A09F-82313113AB26}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.HomeTelephone -- PKEY_Contact_HomeTelephone</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 20</para>
+ /// </summary>
+ public static PropertyKey HomeTelephone
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 20);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.IMAddress -- PKEY_Contact_IMAddress</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {D68DBD8A-3374-4B81-9972-3EC30682DB3D}, 100</para>
+ /// </summary>
+ public static PropertyKey IMAddress
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D68DBD8A-3374-4B81-9972-3EC30682DB3D}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.Initials -- PKEY_Contact_Initials</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {F3D8F40D-50CB-44A2-9718-40CB9119495D}, 100</para>
+ /// </summary>
+ public static PropertyKey Initials
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F3D8F40D-50CB-44A2-9718-40CB9119495D}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.JobTitle -- PKEY_Contact_JobTitle</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 6</para>
+ /// </summary>
+ public static PropertyKey JobTitle
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 6);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.Label -- PKEY_Contact_Label</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {97B0AD89-DF49-49CC-834E-660974FD755B}, 100</para>
+ /// </summary>
+ public static PropertyKey Label
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{97B0AD89-DF49-49CC-834E-660974FD755B}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.LastName -- PKEY_Contact_LastName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {8F367200-C270-457C-B1D4-E07C5BCD90C7}, 100</para>
+ /// </summary>
+ public static PropertyKey LastName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{8F367200-C270-457C-B1D4-E07C5BCD90C7}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.MailingAddress -- PKEY_Contact_MailingAddress</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C0AC206A-827E-4650-95AE-77E2BB74FCC9}, 100</para>
+ /// </summary>
+ public static PropertyKey MailingAddress
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C0AC206A-827E-4650-95AE-77E2BB74FCC9}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.MiddleName -- PKEY_Contact_MiddleName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 71</para>
+ /// </summary>
+ public static PropertyKey MiddleName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 71);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.MobileTelephone -- PKEY_Contact_MobileTelephone</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 35</para>
+ /// </summary>
+ public static PropertyKey MobileTelephone
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 35);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.NickName -- PKEY_Contact_NickName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 74</para>
+ /// </summary>
+ public static PropertyKey Nickname
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 74);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.OfficeLocation -- PKEY_Contact_OfficeLocation</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 7</para>
+ /// </summary>
+ public static PropertyKey OfficeLocation
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 7);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.OtherAddress -- PKEY_Contact_OtherAddress</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {508161FA-313B-43D5-83A1-C1ACCF68622C}, 100</para>
+ /// </summary>
+ public static PropertyKey OtherAddress
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{508161FA-313B-43D5-83A1-C1ACCF68622C}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.OtherAddressCity -- PKEY_Contact_OtherAddressCity</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {6E682923-7F7B-4F0C-A337-CFCA296687BF}, 100</para>
+ /// </summary>
+ public static PropertyKey OtherAddressCity
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6E682923-7F7B-4F0C-A337-CFCA296687BF}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.OtherAddressCountry -- PKEY_Contact_OtherAddressCountry</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {8F167568-0AAE-4322-8ED9-6055B7B0E398}, 100</para>
+ /// </summary>
+ public static PropertyKey OtherAddressCountry
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{8F167568-0AAE-4322-8ED9-6055B7B0E398}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.OtherAddressPostalCode -- PKEY_Contact_OtherAddressPostalCode</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {95C656C1-2ABF-4148-9ED3-9EC602E3B7CD}, 100</para>
+ /// </summary>
+ public static PropertyKey OtherAddressPostalCode
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{95C656C1-2ABF-4148-9ED3-9EC602E3B7CD}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.OtherAddressPostOfficeBox -- PKEY_Contact_OtherAddressPostOfficeBox</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {8B26EA41-058F-43F6-AECC-4035681CE977}, 100</para>
+ /// </summary>
+ public static PropertyKey OtherAddressPostOfficeBox
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{8B26EA41-058F-43F6-AECC-4035681CE977}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.OtherAddressState -- PKEY_Contact_OtherAddressState</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {71B377D6-E570-425F-A170-809FAE73E54E}, 100</para>
+ /// </summary>
+ public static PropertyKey OtherAddressState
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{71B377D6-E570-425F-A170-809FAE73E54E}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.OtherAddressStreet -- PKEY_Contact_OtherAddressStreet</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {FF962609-B7D6-4999-862D-95180D529AEA}, 100</para>
+ /// </summary>
+ public static PropertyKey OtherAddressStreet
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{FF962609-B7D6-4999-862D-95180D529AEA}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.PagerTelephone -- PKEY_Contact_PagerTelephone</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {D6304E01-F8F5-4F45-8B15-D024A6296789}, 100</para>
+ /// </summary>
+ public static PropertyKey PagerTelephone
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D6304E01-F8F5-4F45-8B15-D024A6296789}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.PersonalTitle -- PKEY_Contact_PersonalTitle</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 69</para>
+ /// </summary>
+ public static PropertyKey PersonalTitle
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 69);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.PrimaryAddressCity -- PKEY_Contact_PrimaryAddressCity</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C8EA94F0-A9E3-4969-A94B-9C62A95324E0}, 100</para>
+ /// </summary>
+ public static PropertyKey PrimaryAddressCity
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C8EA94F0-A9E3-4969-A94B-9C62A95324E0}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.PrimaryAddressCountry -- PKEY_Contact_PrimaryAddressCountry</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E53D799D-0F3F-466E-B2FF-74634A3CB7A4}, 100</para>
+ /// </summary>
+ public static PropertyKey PrimaryAddressCountry
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E53D799D-0F3F-466E-B2FF-74634A3CB7A4}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.PrimaryAddressPostalCode -- PKEY_Contact_PrimaryAddressPostalCode</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {18BBD425-ECFD-46EF-B612-7B4A6034EDA0}, 100</para>
+ /// </summary>
+ public static PropertyKey PrimaryAddressPostalCode
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{18BBD425-ECFD-46EF-B612-7B4A6034EDA0}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.PrimaryAddressPostOfficeBox -- PKEY_Contact_PrimaryAddressPostOfficeBox</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {DE5EF3C7-46E1-484E-9999-62C5308394C1}, 100</para>
+ /// </summary>
+ public static PropertyKey PrimaryAddressPostOfficeBox
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{DE5EF3C7-46E1-484E-9999-62C5308394C1}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.PrimaryAddressState -- PKEY_Contact_PrimaryAddressState</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {F1176DFE-7138-4640-8B4C-AE375DC70A6D}, 100</para>
+ /// </summary>
+ public static PropertyKey PrimaryAddressState
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F1176DFE-7138-4640-8B4C-AE375DC70A6D}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.PrimaryAddressStreet -- PKEY_Contact_PrimaryAddressStreet</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {63C25B20-96BE-488F-8788-C09C407AD812}, 100</para>
+ /// </summary>
+ public static PropertyKey PrimaryAddressStreet
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{63C25B20-96BE-488F-8788-C09C407AD812}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.PrimaryEmailAddress -- PKEY_Contact_PrimaryEmailAddress</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 48</para>
+ /// </summary>
+ public static PropertyKey PrimaryEmailAddress
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 48);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.PrimaryTelephone -- PKEY_Contact_PrimaryTelephone</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 25</para>
+ /// </summary>
+ public static PropertyKey PrimaryTelephone
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 25);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.Profession -- PKEY_Contact_Profession</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {7268AF55-1CE4-4F6E-A41F-B6E4EF10E4A9}, 100</para>
+ /// </summary>
+ public static PropertyKey Profession
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{7268AF55-1CE4-4F6E-A41F-B6E4EF10E4A9}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.SpouseName -- PKEY_Contact_SpouseName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {9D2408B6-3167-422B-82B0-F583B7A7CFE3}, 100</para>
+ /// </summary>
+ public static PropertyKey SpouseName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9D2408B6-3167-422B-82B0-F583B7A7CFE3}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.Suffix -- PKEY_Contact_Suffix</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {176DC63C-2688-4E89-8143-A347800F25E9}, 73</para>
+ /// </summary>
+ public static PropertyKey Suffix
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{176DC63C-2688-4E89-8143-A347800F25E9}"), 73);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.TelexNumber -- PKEY_Contact_TelexNumber</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C554493C-C1F7-40C1-A76C-EF8C0614003E}, 100</para>
+ /// </summary>
+ public static PropertyKey TelexNumber
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C554493C-C1F7-40C1-A76C-EF8C0614003E}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.TTYTDDTelephone -- PKEY_Contact_TTYTDDTelephone</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {AAF16BAC-2B55-45E6-9F6D-415EB94910DF}, 100</para>
+ /// </summary>
+ public static PropertyKey TTYTDDTelephone
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{AAF16BAC-2B55-45E6-9F6D-415EB94910DF}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.WebPage -- PKEY_Contact_WebPage</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 18</para>
+ /// </summary>
+ public static PropertyKey Webpage
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 18);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+ #region sub-classes
+
+ /// <summary>
+ /// JA Properties
+ /// </summary>
+ public static class JA
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Contact.JA.CompanyNamePhonetic -- PKEY_Contact_JA_CompanyNamePhonetic</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {897B3694-FE9E-43E6-8066-260F590C0100}, 2</para>
+ /// </summary>
+ public static PropertyKey CompanyNamePhonetic
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{897B3694-FE9E-43E6-8066-260F590C0100}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.JA.FirstNamePhonetic -- PKEY_Contact_JA_FirstNamePhonetic</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {897B3694-FE9E-43E6-8066-260F590C0100}, 3</para>
+ /// </summary>
+ public static PropertyKey FirstNamePhonetic
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{897B3694-FE9E-43E6-8066-260F590C0100}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.JA.LastNamePhonetic -- PKEY_Contact_JA_LastNamePhonetic</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {897B3694-FE9E-43E6-8066-260F590C0100}, 4</para>
+ /// </summary>
+ public static PropertyKey LastNamePhonetic
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{897B3694-FE9E-43E6-8066-260F590C0100}"), 4);
+
+ return key;
+ }
+ }
+ #endregion
+
+ }
+ #endregion
+ }
+
+ /// <summary>
+ /// JA Properties
+ /// </summary>
+ public static class JA
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Contact.JA.CompanyNamePhonetic -- PKEY_Contact_JA_CompanyNamePhonetic</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {897B3694-FE9E-43E6-8066-260F590C0100}, 2</para>
+ /// </summary>
+ public static PropertyKey CompanyNamePhonetic
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{897B3694-FE9E-43E6-8066-260F590C0100}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.JA.FirstNamePhonetic -- PKEY_Contact_JA_FirstNamePhonetic</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {897B3694-FE9E-43E6-8066-260F590C0100}, 3</para>
+ /// </summary>
+ public static PropertyKey FirstNamePhonetic
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{897B3694-FE9E-43E6-8066-260F590C0100}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Contact.JA.LastNamePhonetic -- PKEY_Contact_JA_LastNamePhonetic</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {897B3694-FE9E-43E6-8066-260F590C0100}, 4</para>
+ /// </summary>
+ public static PropertyKey LastNamePhonetic
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{897B3694-FE9E-43E6-8066-260F590C0100}"), 4);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Device Properties
+ /// </summary>
+ public static class Device
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Device.PrinterURL -- PKEY_Device_PrinterURL</para>
+ /// <para>Description: Printer information Printer URL.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {0B48F35A-BE6E-4F17-B108-3C4073D1669A}, 15</para>
+ /// </summary>
+ public static PropertyKey PrinterUrl
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0B48F35A-BE6E-4F17-B108-3C4073D1669A}"), 15);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// DeviceInterface Properties
+ /// </summary>
+ public static class DeviceInterface
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.DeviceInterface.PrinterDriverDirectory -- PKEY_DeviceInterface_PrinterDriverDirectory</para>
+ /// <para>Description: Printer information Printer Driver Directory.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {847C66DE-B8D6-4AF9-ABC3-6F4F926BC039}, 14</para>
+ /// </summary>
+ public static PropertyKey PrinterDriverDirectory
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{847C66DE-B8D6-4AF9-ABC3-6F4F926BC039}"), 14);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DeviceInterface.PrinterDriverName -- PKEY_DeviceInterface_PrinterDriverName</para>
+ /// <para>Description: Printer information Driver Name.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {AFC47170-14F5-498C-8F30-B0D19BE449C6}, 11</para>
+ /// </summary>
+ public static PropertyKey PrinterDriverName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{AFC47170-14F5-498C-8F30-B0D19BE449C6}"), 11);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DeviceInterface.PrinterName -- PKEY_DeviceInterface_PrinterName</para>
+ /// <para>Description: Printer information Printer Name.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {0A7B84EF-0C27-463F-84EF-06C5070001BE}, 10</para>
+ /// </summary>
+ public static PropertyKey PrinterName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0A7B84EF-0C27-463F-84EF-06C5070001BE}"), 10);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DeviceInterface.PrinterPortName -- PKEY_DeviceInterface_PrinterPortName</para>
+ /// <para>Description: Printer information Port Name.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {EEC7B761-6F94-41B1-949F-C729720DD13C}, 12</para>
+ /// </summary>
+ public static PropertyKey PrinterPortName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{EEC7B761-6F94-41B1-949F-C729720DD13C}"), 12);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Devices Properties
+ /// </summary>
+ public static class Devices
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Devices.BatteryLife -- PKEY_Devices_BatteryLife</para>
+ /// <para>Description: Remaining battery life of the device as an integer between 0 and 100 percent.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 10</para>
+ /// </summary>
+ public static PropertyKey BatteryLife
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 10);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.BatteryPlusCharging -- PKEY_Devices_BatteryPlusCharging</para>
+ /// <para>Description: Remaining battery life of the device as an integer between 0 and 100 percent and the device's charging state.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 22</para>
+ /// </summary>
+ public static PropertyKey BatteryPlusCharging
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 22);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.BatteryPlusChargingText -- PKEY_Devices_BatteryPlusChargingText</para>
+ /// <para>Description: Remaining battery life of the device and the device's charging state as a string.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 23</para>
+ /// </summary>
+ public static PropertyKey BatteryPlusChargingText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 23);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Category -- PKEY_Devices_Category_Desc_Singular</para>
+ /// <para>Description: Singular form of device category.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 91</para>
+ /// </summary>
+ public static PropertyKey Category
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 91);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.CategoryGroup -- PKEY_Devices_CategoryGroup_Desc</para>
+ /// <para>Description: Plural form of device category.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 94</para>
+ /// </summary>
+ public static PropertyKey CategoryGroup
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 94);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.CategoryPlural -- PKEY_Devices_Category_Desc_Plural</para>
+ /// <para>Description: Plural form of device category.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 92</para>
+ /// </summary>
+ public static PropertyKey CategoryPlural
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 92);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.ChargingState -- PKEY_Devices_ChargingState</para>
+ /// <para>Description: Boolean value representing if the device is currently charging.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 11</para>
+ /// </summary>
+ public static PropertyKey ChargingState
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 11);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Connected -- PKEY_Devices_IsConnected</para>
+ /// <para>Description: Device connection state. If VARIANT_TRUE, indicates the device is currently connected to the computer.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 55</para>
+ /// </summary>
+ public static PropertyKey Connected
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 55);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.ContainerId -- PKEY_Devices_ContainerId</para>
+ /// <para>Description: Device container ID.
+ ///</para>
+ /// <para>Type: Guid -- VT_CLSID</para>
+ /// <para>FormatID: {8C7ED206-3F8A-4827-B3AB-AE9E1FAEFC6C}, 2</para>
+ /// </summary>
+ public static PropertyKey ContainerId
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{8C7ED206-3F8A-4827-B3AB-AE9E1FAEFC6C}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.DefaultTooltip -- PKEY_Devices_DefaultTooltip</para>
+ /// <para>Description: Tooltip for default state
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {880F70A2-6082-47AC-8AAB-A739D1A300C3}, 153</para>
+ /// </summary>
+ public static PropertyKey DefaultTooltip
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{880F70A2-6082-47AC-8AAB-A739D1A300C3}"), 153);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.DeviceDescription1 -- PKEY_Devices_DeviceDescription1</para>
+ /// <para>Description: First line of descriptive text about the device.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 81</para>
+ /// </summary>
+ public static PropertyKey DeviceDescription1
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 81);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.DeviceDescription2 -- PKEY_Devices_DeviceDescription2</para>
+ /// <para>Description: Second line of descriptive text about the device.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 82</para>
+ /// </summary>
+ public static PropertyKey DeviceDescription2
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 82);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.DiscoveryMethod -- PKEY_Devices_DiscoveryMethod</para>
+ /// <para>Description: Device discovery method. This indicates on what transport or physical connection the device is discovered.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 52</para>
+ /// </summary>
+ public static PropertyKey DiscoveryMethod
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 52);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.FriendlyName -- PKEY_Devices_FriendlyName</para>
+ /// <para>Description: Device friendly name.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {656A3BB3-ECC0-43FD-8477-4AE0404A96CD}, 12288</para>
+ /// </summary>
+ public static PropertyKey FriendlyName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{656A3BB3-ECC0-43FD-8477-4AE0404A96CD}"), 12288);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.FunctionPaths -- PKEY_Devices_FunctionPaths</para>
+ /// <para>Description: Available functions for this device.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {D08DD4C0-3A9E-462E-8290-7B636B2576B9}, 3</para>
+ /// </summary>
+ public static PropertyKey FunctionPaths
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D08DD4C0-3A9E-462E-8290-7B636B2576B9}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.InterfacePaths -- PKEY_Devices_InterfacePaths</para>
+ /// <para>Description: Available interfaces for this device.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {D08DD4C0-3A9E-462E-8290-7B636B2576B9}, 2</para>
+ /// </summary>
+ public static PropertyKey InterfacePaths
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D08DD4C0-3A9E-462E-8290-7B636B2576B9}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.IsDefault -- PKEY_Devices_IsDefaultDevice</para>
+ /// <para>Description: If VARIANT_TRUE, the device is not working properly.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 86</para>
+ /// </summary>
+ public static PropertyKey IsDefault
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 86);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.IsNetworkConnected -- PKEY_Devices_IsNetworkDevice</para>
+ /// <para>Description: If VARIANT_TRUE, the device is not working properly.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 85</para>
+ /// </summary>
+ public static PropertyKey IsNetworkConnected
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 85);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.IsShared -- PKEY_Devices_IsSharedDevice</para>
+ /// <para>Description: If VARIANT_TRUE, the device is not working properly.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 84</para>
+ /// </summary>
+ public static PropertyKey IsShared
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 84);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.IsSoftwareInstalling -- PKEY_Devices_IsSoftwareInstalling</para>
+ /// <para>Description: If VARIANT_TRUE, the device installer is currently installing software.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {83DA6326-97A6-4088-9453-A1923F573B29}, 9</para>
+ /// </summary>
+ public static PropertyKey IsSoftwareInstalling
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{83DA6326-97A6-4088-9453-A1923F573B29}"), 9);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.LaunchDeviceStageFromExplorer -- PKEY_Devices_LaunchDeviceStageFromExplorer</para>
+ /// <para>Description: Indicates whether to launch Device Stage or not
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 77</para>
+ /// </summary>
+ public static PropertyKey LaunchDeviceStageFromExplorer
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 77);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.LocalMachine -- PKEY_Devices_IsLocalMachine</para>
+ /// <para>Description: If VARIANT_TRUE, the device in question is actually the computer.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 70</para>
+ /// </summary>
+ public static PropertyKey LocalMachine
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 70);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Manufacturer -- PKEY_Devices_Manufacturer</para>
+ /// <para>Description: Device manufacturer.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {656A3BB3-ECC0-43FD-8477-4AE0404A96CD}, 8192</para>
+ /// </summary>
+ public static PropertyKey Manufacturer
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{656A3BB3-ECC0-43FD-8477-4AE0404A96CD}"), 8192);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.MissedCalls -- PKEY_Devices_MissedCalls</para>
+ /// <para>Description: Number of missed calls on the device.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 5</para>
+ /// </summary>
+ public static PropertyKey MissedCalls
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 5);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.ModelName -- PKEY_Devices_ModelName</para>
+ /// <para>Description: Model name of the device.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {656A3BB3-ECC0-43FD-8477-4AE0404A96CD}, 8194</para>
+ /// </summary>
+ public static PropertyKey ModelName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{656A3BB3-ECC0-43FD-8477-4AE0404A96CD}"), 8194);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.ModelNumber -- PKEY_Devices_ModelNumber</para>
+ /// <para>Description: Model number of the device.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {656A3BB3-ECC0-43FD-8477-4AE0404A96CD}, 8195</para>
+ /// </summary>
+ public static PropertyKey ModelNumber
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{656A3BB3-ECC0-43FD-8477-4AE0404A96CD}"), 8195);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.NetworkedTooltip -- PKEY_Devices_NetworkedTooltip</para>
+ /// <para>Description: Tooltip for connection state
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {880F70A2-6082-47AC-8AAB-A739D1A300C3}, 152</para>
+ /// </summary>
+ public static PropertyKey NetworkedTooltip
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{880F70A2-6082-47AC-8AAB-A739D1A300C3}"), 152);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.NetworkName -- PKEY_Devices_NetworkName</para>
+ /// <para>Description: Name of the device's network.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 7</para>
+ /// </summary>
+ public static PropertyKey NetworkName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 7);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.NetworkType -- PKEY_Devices_NetworkType</para>
+ /// <para>Description: String representing the type of the device's network.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 8</para>
+ /// </summary>
+ public static PropertyKey NetworkType
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 8);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.NewPictures -- PKEY_Devices_NewPictures</para>
+ /// <para>Description: Number of new pictures on the device.
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 4</para>
+ /// </summary>
+ public static PropertyKey NewPictures
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 4);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Notification -- PKEY_Devices_Notification</para>
+ /// <para>Description: Device Notification Property.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {06704B0C-E830-4C81-9178-91E4E95A80A0}, 3</para>
+ /// </summary>
+ public static PropertyKey Notification
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{06704B0C-E830-4C81-9178-91E4E95A80A0}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.NotificationStore -- PKEY_Devices_NotificationStore</para>
+ /// <para>Description: Device Notification Store.
+ ///</para>
+ /// <para>Type: Object -- VT_UNKNOWN</para>
+ /// <para>FormatID: {06704B0C-E830-4C81-9178-91E4E95A80A0}, 2</para>
+ /// </summary>
+ public static PropertyKey NotificationStore
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{06704B0C-E830-4C81-9178-91E4E95A80A0}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.NotWorkingProperly -- PKEY_Devices_IsNotWorkingProperly</para>
+ /// <para>Description: If VARIANT_TRUE, the device is not working properly.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 83</para>
+ /// </summary>
+ public static PropertyKey NotWorkingProperly
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 83);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Paired -- PKEY_Devices_IsPaired</para>
+ /// <para>Description: Device paired state. If VARIANT_TRUE, indicates the device is not paired with the computer.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {78C34FC8-104A-4ACA-9EA4-524D52996E57}, 56</para>
+ /// </summary>
+ public static PropertyKey Paired
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{78C34FC8-104A-4ACA-9EA4-524D52996E57}"), 56);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.PrimaryCategory -- PKEY_Devices_PrimaryCategory</para>
+ /// <para>Description: Primary category group for this device.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {D08DD4C0-3A9E-462E-8290-7B636B2576B9}, 10</para>
+ /// </summary>
+ public static PropertyKey PrimaryCategory
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D08DD4C0-3A9E-462E-8290-7B636B2576B9}"), 10);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Roaming -- PKEY_Devices_Roaming</para>
+ /// <para>Description: Status indicator used to indicate if the device is roaming.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 9</para>
+ /// </summary>
+ public static PropertyKey Roaming
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 9);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.SafeRemovalRequired -- PKEY_Devices_SafeRemovalRequired</para>
+ /// <para>Description: Indicates if a device requires safe removal or not
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {AFD97640-86A3-4210-B67C-289C41AABE55}, 2</para>
+ /// </summary>
+ public static PropertyKey SafeRemovalRequired
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{AFD97640-86A3-4210-B67C-289C41AABE55}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.SharedTooltip -- PKEY_Devices_SharedTooltip</para>
+ /// <para>Description: Tooltip for sharing state
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {880F70A2-6082-47AC-8AAB-A739D1A300C3}, 151</para>
+ /// </summary>
+ public static PropertyKey SharedTooltip
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{880F70A2-6082-47AC-8AAB-A739D1A300C3}"), 151);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.SignalStrength -- PKEY_Devices_SignalStrength</para>
+ /// <para>Description: Device signal strength.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 2</para>
+ /// </summary>
+ public static PropertyKey SignalStrength
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Status1 -- PKEY_Devices_Status1</para>
+ /// <para>Description: 1st line of device status.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {D08DD4C0-3A9E-462E-8290-7B636B2576B9}, 257</para>
+ /// </summary>
+ public static PropertyKey Status1
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D08DD4C0-3A9E-462E-8290-7B636B2576B9}"), 257);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Status2 -- PKEY_Devices_Status2</para>
+ /// <para>Description: 2nd line of device status.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {D08DD4C0-3A9E-462E-8290-7B636B2576B9}, 258</para>
+ /// </summary>
+ public static PropertyKey Status2
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D08DD4C0-3A9E-462E-8290-7B636B2576B9}"), 258);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.StorageCapacity -- PKEY_Devices_StorageCapacity</para>
+ /// <para>Description: Total storage capacity of the device.
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 12</para>
+ /// </summary>
+ public static PropertyKey StorageCapacity
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 12);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.StorageFreeSpace -- PKEY_Devices_StorageFreeSpace</para>
+ /// <para>Description: Total free space of the storage of the device.
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 13</para>
+ /// </summary>
+ public static PropertyKey StorageFreeSpace
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 13);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.StorageFreeSpacePercent -- PKEY_Devices_StorageFreeSpacePercent</para>
+ /// <para>Description: Total free space of the storage of the device as a percentage.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 14</para>
+ /// </summary>
+ public static PropertyKey StorageFreeSpacePercent
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 14);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.TextMessages -- PKEY_Devices_TextMessages</para>
+ /// <para>Description: Number of unread text messages on the device.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 3</para>
+ /// </summary>
+ public static PropertyKey TextMessages
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Voicemail -- PKEY_Devices_Voicemail</para>
+ /// <para>Description: Status indicator used to indicate if the device has voicemail.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {49CD1F76-5626-4B17-A4E8-18B4AA1A2213}, 6</para>
+ /// </summary>
+ public static PropertyKey Voicemail
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{49CD1F76-5626-4B17-A4E8-18B4AA1A2213}"), 6);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+ #region sub-classes
+
+ /// <summary>
+ /// Notifications Properties
+ /// </summary>
+ public static class Notifications
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Devices.Notifications.LowBattery -- PKEY_Devices_Notification_LowBattery</para>
+ /// <para>Description: Device Low Battery Notification.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {C4C07F2B-8524-4E66-AE3A-A6235F103BEB}, 2</para>
+ /// </summary>
+ public static PropertyKey LowBattery
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C4C07F2B-8524-4E66-AE3A-A6235F103BEB}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Notifications.MissedCall -- PKEY_Devices_Notification_MissedCall</para>
+ /// <para>Description: Device Missed Call Notification.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {6614EF48-4EFE-4424-9EDA-C79F404EDF3E}, 2</para>
+ /// </summary>
+ public static PropertyKey MissedCall
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6614EF48-4EFE-4424-9EDA-C79F404EDF3E}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Notifications.NewMessage -- PKEY_Devices_Notification_NewMessage</para>
+ /// <para>Description: Device New Message Notification.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {2BE9260A-2012-4742-A555-F41B638B7DCB}, 2</para>
+ /// </summary>
+ public static PropertyKey NewMessage
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{2BE9260A-2012-4742-A555-F41B638B7DCB}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Notifications.NewVoicemail -- PKEY_Devices_Notification_NewVoicemail</para>
+ /// <para>Description: Device Voicemail Notification.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {59569556-0A08-4212-95B9-FAE2AD6413DB}, 2</para>
+ /// </summary>
+ public static PropertyKey NewVoicemail
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{59569556-0A08-4212-95B9-FAE2AD6413DB}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Notifications.StorageFull -- PKEY_Devices_Notification_StorageFull</para>
+ /// <para>Description: Device Storage Full Notification.
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: {A0E00EE1-F0C7-4D41-B8E7-26A7BD8D38B0}, 2</para>
+ /// </summary>
+ public static PropertyKey StorageFull
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A0E00EE1-F0C7-4D41-B8E7-26A7BD8D38B0}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Notifications.StorageFullLinkText -- PKEY_Devices_Notification_StorageFullLinkText</para>
+ /// <para>Description: Link Text for the Device Storage Full Notification.
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: {A0E00EE1-F0C7-4D41-B8E7-26A7BD8D38B0}, 3</para>
+ /// </summary>
+ public static PropertyKey StorageFullLinkText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A0E00EE1-F0C7-4D41-B8E7-26A7BD8D38B0}"), 3);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+ #endregion
+ }
+
+ /// <summary>
+ /// Notifications Properties
+ /// </summary>
+ public static class Notifications
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Devices.Notifications.LowBattery -- PKEY_Devices_Notification_LowBattery</para>
+ /// <para>Description: Device Low Battery Notification.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {C4C07F2B-8524-4E66-AE3A-A6235F103BEB}, 2</para>
+ /// </summary>
+ public static PropertyKey LowBattery
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C4C07F2B-8524-4E66-AE3A-A6235F103BEB}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Notifications.MissedCall -- PKEY_Devices_Notification_MissedCall</para>
+ /// <para>Description: Device Missed Call Notification.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {6614EF48-4EFE-4424-9EDA-C79F404EDF3E}, 2</para>
+ /// </summary>
+ public static PropertyKey MissedCall
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6614EF48-4EFE-4424-9EDA-C79F404EDF3E}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Notifications.NewMessage -- PKEY_Devices_Notification_NewMessage</para>
+ /// <para>Description: Device New Message Notification.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {2BE9260A-2012-4742-A555-F41B638B7DCB}, 2</para>
+ /// </summary>
+ public static PropertyKey NewMessage
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{2BE9260A-2012-4742-A555-F41B638B7DCB}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Notifications.NewVoicemail -- PKEY_Devices_Notification_NewVoicemail</para>
+ /// <para>Description: Device Voicemail Notification.
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {59569556-0A08-4212-95B9-FAE2AD6413DB}, 2</para>
+ /// </summary>
+ public static PropertyKey NewVoicemail
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{59569556-0A08-4212-95B9-FAE2AD6413DB}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Notifications.StorageFull -- PKEY_Devices_Notification_StorageFull</para>
+ /// <para>Description: Device Storage Full Notification.
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: {A0E00EE1-F0C7-4D41-B8E7-26A7BD8D38B0}, 2</para>
+ /// </summary>
+ public static PropertyKey StorageFull
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A0E00EE1-F0C7-4D41-B8E7-26A7BD8D38B0}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Devices.Notifications.StorageFullLinkText -- PKEY_Devices_Notification_StorageFullLinkText</para>
+ /// <para>Description: Link Text for the Device Storage Full Notification.
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: {A0E00EE1-F0C7-4D41-B8E7-26A7BD8D38B0}, 3</para>
+ /// </summary>
+ public static PropertyKey StorageFullLinkText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A0E00EE1-F0C7-4D41-B8E7-26A7BD8D38B0}"), 3);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Document Properties
+ /// </summary>
+ public static class Document
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Document.ByteCount -- PKEY_Document_ByteCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 4 (PIDDSI_BYTECOUNT)</para>
+ /// </summary>
+ public static PropertyKey ByteCount
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 4);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.CharacterCount -- PKEY_Document_CharacterCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 16 (PIDSI_CHARCOUNT)</para>
+ /// </summary>
+ public static PropertyKey CharacterCount
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 16);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.ClientID -- PKEY_Document_ClientID</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {276D7BB0-5B34-4FB0-AA4B-158ED12A1809}, 100</para>
+ /// </summary>
+ public static PropertyKey ClientID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{276D7BB0-5B34-4FB0-AA4B-158ED12A1809}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.Contributor -- PKEY_Document_Contributor</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {F334115E-DA1B-4509-9B3D-119504DC7ABB}, 100</para>
+ /// </summary>
+ public static PropertyKey Contributor
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F334115E-DA1B-4509-9B3D-119504DC7ABB}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.DateCreated -- PKEY_Document_DateCreated</para>
+ /// <para>Description: This property is stored in the document, not obtained from the file system.
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 12 (PIDSI_CREATE_DTM)</para>
+ /// </summary>
+ public static PropertyKey DateCreated
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 12);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.DatePrinted -- PKEY_Document_DatePrinted</para>
+ /// <para>Description: Legacy name: "DocLastPrinted".
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 11 (PIDSI_LASTPRINTED)</para>
+ /// </summary>
+ public static PropertyKey DatePrinted
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 11);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.DateSaved -- PKEY_Document_DateSaved</para>
+ /// <para>Description: Legacy name: "DocLastSavedTm".
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 13 (PIDSI_LASTSAVE_DTM)</para>
+ /// </summary>
+ public static PropertyKey DateSaved
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 13);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.Division -- PKEY_Document_Division</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {1E005EE6-BF27-428B-B01C-79676ACD2870}, 100</para>
+ /// </summary>
+ public static PropertyKey Division
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{1E005EE6-BF27-428B-B01C-79676ACD2870}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.DocumentID -- PKEY_Document_DocumentID</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E08805C8-E395-40DF-80D2-54F0D6C43154}, 100</para>
+ /// </summary>
+ public static PropertyKey DocumentID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E08805C8-E395-40DF-80D2-54F0D6C43154}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.HiddenSlideCount -- PKEY_Document_HiddenSlideCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 9 (PIDDSI_HIDDENCOUNT)</para>
+ /// </summary>
+ public static PropertyKey HiddenSlideCount
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 9);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.LastAuthor -- PKEY_Document_LastAuthor</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 8 (PIDSI_LASTAUTHOR)</para>
+ /// </summary>
+ public static PropertyKey LastAuthor
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 8);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.LineCount -- PKEY_Document_LineCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 5 (PIDDSI_LINECOUNT)</para>
+ /// </summary>
+ public static PropertyKey LineCount
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 5);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.Manager -- PKEY_Document_Manager</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 14 (PIDDSI_MANAGER)</para>
+ /// </summary>
+ public static PropertyKey Manager
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 14);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.MultimediaClipCount -- PKEY_Document_MultimediaClipCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 10 (PIDDSI_MMCLIPCOUNT)</para>
+ /// </summary>
+ public static PropertyKey MultimediaClipCount
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 10);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.NoteCount -- PKEY_Document_NoteCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 8 (PIDDSI_NOTECOUNT)</para>
+ /// </summary>
+ public static PropertyKey NoteCount
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 8);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.PageCount -- PKEY_Document_PageCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 14 (PIDSI_PAGECOUNT)</para>
+ /// </summary>
+ public static PropertyKey PageCount
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 14);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.ParagraphCount -- PKEY_Document_ParagraphCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 6 (PIDDSI_PARCOUNT)</para>
+ /// </summary>
+ public static PropertyKey ParagraphCount
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 6);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.PresentationFormat -- PKEY_Document_PresentationFormat</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 3 (PIDDSI_PRESFORMAT)</para>
+ /// </summary>
+ public static PropertyKey PresentationFormat
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.RevisionNumber -- PKEY_Document_RevisionNumber</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 9 (PIDSI_REVNUMBER)</para>
+ /// </summary>
+ public static PropertyKey RevisionNumber
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 9);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.Security -- PKEY_Document_Security</para>
+ /// <para>Description: Access control information, from SummaryInfo propset
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 19</para>
+ /// </summary>
+ public static PropertyKey Security
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 19);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.SlideCount -- PKEY_Document_SlideCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 7 (PIDDSI_SLIDECOUNT)</para>
+ /// </summary>
+ public static PropertyKey SlideCount
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 7);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.Template -- PKEY_Document_Template</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 7 (PIDSI_TEMPLATE)</para>
+ /// </summary>
+ public static PropertyKey Template
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 7);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.TotalEditingTime -- PKEY_Document_TotalEditingTime</para>
+ /// <para>Description: 100ns units, not milliseconds. VT_FILETIME for IPropertySetStorage handlers (legacy)
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 10 (PIDSI_EDITTIME)</para>
+ /// </summary>
+ public static PropertyKey TotalEditingTime
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 10);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.Version -- PKEY_Document_Version</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_DocumentSummaryInformation) {D5CDD502-2E9C-101B-9397-08002B2CF9AE}, 29</para>
+ /// </summary>
+ public static PropertyKey Version
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}"), 29);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Document.WordCount -- PKEY_Document_WordCount</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_SummaryInformation) {F29F85E0-4FF9-1068-AB91-08002B27B3D9}, 15 (PIDSI_WORDCOUNT)</para>
+ /// </summary>
+ public static PropertyKey WordCount
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 15);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// DRM Properties
+ /// </summary>
+ public static class DRM
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.DRM.DatePlayExpires -- PKEY_DRM_DatePlayExpires</para>
+ /// <para>Description: Indicates when play expires for digital rights management.
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: (FMTID_DRM) {AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}, 6 (PIDDRSI_PLAYEXPIRES)</para>
+ /// </summary>
+ public static PropertyKey DatePlayExpires
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}"), 6);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DRM.DatePlayStarts -- PKEY_DRM_DatePlayStarts</para>
+ /// <para>Description: Indicates when play starts for digital rights management.
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: (FMTID_DRM) {AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}, 5 (PIDDRSI_PLAYSTARTS)</para>
+ /// </summary>
+ public static PropertyKey DatePlayStarts
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}"), 5);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DRM.Description -- PKEY_DRM_Description</para>
+ /// <para>Description: Displays the description for digital rights management.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_DRM) {AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}, 3 (PIDDRSI_DESCRIPTION)</para>
+ /// </summary>
+ public static PropertyKey Description
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DRM.IsProtected -- PKEY_DRM_IsProtected</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: (FMTID_DRM) {AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}, 2 (PIDDRSI_PROTECTED)</para>
+ /// </summary>
+ public static PropertyKey IsProtected
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.DRM.PlayCount -- PKEY_DRM_PlayCount</para>
+ /// <para>Description: Indicates the play count for digital rights management.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_DRM) {AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}, 4 (PIDDRSI_PLAYCOUNT)</para>
+ /// </summary>
+ public static PropertyKey PlayCount
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED}"), 4);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// GPS Properties
+ /// </summary>
+ public static class GPS
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.GPS.Altitude -- PKEY_GPS_Altitude</para>
+ /// <para>Description: Indicates the altitude based on the reference in PKEY_GPS_AltitudeRef. Calculated from PKEY_GPS_AltitudeNumerator and
+ ///PKEY_GPS_AltitudeDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {827EDB4F-5B73-44A7-891D-FDFFABEA35CA}, 100</para>
+ /// </summary>
+ public static PropertyKey Altitude
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{827EDB4F-5B73-44A7-891D-FDFFABEA35CA}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.AltitudeDenominator -- PKEY_GPS_AltitudeDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_Altitude
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {78342DCB-E358-4145-AE9A-6BFE4E0F9F51}, 100</para>
+ /// </summary>
+ public static PropertyKey AltitudeDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{78342DCB-E358-4145-AE9A-6BFE4E0F9F51}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.AltitudeNumerator -- PKEY_GPS_AltitudeNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_Altitude
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {2DAD1EB7-816D-40D3-9EC3-C9773BE2AADE}, 100</para>
+ /// </summary>
+ public static PropertyKey AltitudeNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{2DAD1EB7-816D-40D3-9EC3-C9773BE2AADE}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.AltitudeRef -- PKEY_GPS_AltitudeRef</para>
+ /// <para>Description: Indicates the reference for the altitude property. (eg: above sea level, below sea level, absolute value)
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: {46AC629D-75EA-4515-867F-6DC4321C5844}, 100</para>
+ /// </summary>
+ public static PropertyKey AltitudeRef
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{46AC629D-75EA-4515-867F-6DC4321C5844}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.AreaInformation -- PKEY_GPS_AreaInformation</para>
+ /// <para>Description: Represents the name of the GPS area
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {972E333E-AC7E-49F1-8ADF-A70D07A9BCAB}, 100</para>
+ /// </summary>
+ public static PropertyKey AreaInformation
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{972E333E-AC7E-49F1-8ADF-A70D07A9BCAB}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.Date -- PKEY_GPS_Date</para>
+ /// <para>Description: Date and time of the GPS record
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {3602C812-0F3B-45F0-85AD-603468D69423}, 100</para>
+ /// </summary>
+ public static PropertyKey Date
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{3602C812-0F3B-45F0-85AD-603468D69423}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestBearing -- PKEY_GPS_DestBearing</para>
+ /// <para>Description: Indicates the bearing to the destination point. Calculated from PKEY_GPS_DestBearingNumerator and
+ ///PKEY_GPS_DestBearingDenominator.
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {C66D4B3C-E888-47CC-B99F-9DCA3EE34DEA}, 100</para>
+ /// </summary>
+ public static PropertyKey DestinationBearing
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C66D4B3C-E888-47CC-B99F-9DCA3EE34DEA}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestBearingDenominator -- PKEY_GPS_DestBearingDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_DestBearing
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {7ABCF4F8-7C3F-4988-AC91-8D2C2E97ECA5}, 100</para>
+ /// </summary>
+ public static PropertyKey DestinationBearingDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{7ABCF4F8-7C3F-4988-AC91-8D2C2E97ECA5}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestBearingNumerator -- PKEY_GPS_DestBearingNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_DestBearing
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {BA3B1DA9-86EE-4B5D-A2A4-A271A429F0CF}, 100</para>
+ /// </summary>
+ public static PropertyKey DestinationBearingNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{BA3B1DA9-86EE-4B5D-A2A4-A271A429F0CF}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestBearingRef -- PKEY_GPS_DestBearingRef</para>
+ /// <para>Description: Indicates the reference used for the giving the bearing to the destination point. (eg: true direction, magnetic direction)
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {9AB84393-2A0F-4B75-BB22-7279786977CB}, 100</para>
+ /// </summary>
+ public static PropertyKey DestinationBearingRef
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9AB84393-2A0F-4B75-BB22-7279786977CB}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestDistance -- PKEY_GPS_DestDistance</para>
+ /// <para>Description: Indicates the distance to the destination point. Calculated from PKEY_GPS_DestDistanceNumerator and
+ ///PKEY_GPS_DestDistanceDenominator.
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {A93EAE04-6804-4F24-AC81-09B266452118}, 100</para>
+ /// </summary>
+ public static PropertyKey DestinationDistance
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A93EAE04-6804-4F24-AC81-09B266452118}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestDistanceDenominator -- PKEY_GPS_DestDistanceDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_DestDistance
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {9BC2C99B-AC71-4127-9D1C-2596D0D7DCB7}, 100</para>
+ /// </summary>
+ public static PropertyKey DestinationDistanceDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9BC2C99B-AC71-4127-9D1C-2596D0D7DCB7}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestDistanceNumerator -- PKEY_GPS_DestDistanceNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_DestDistance
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {2BDA47DA-08C6-4FE1-80BC-A72FC517C5D0}, 100</para>
+ /// </summary>
+ public static PropertyKey DestinationDistanceNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{2BDA47DA-08C6-4FE1-80BC-A72FC517C5D0}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestDistanceRef -- PKEY_GPS_DestDistanceRef</para>
+ /// <para>Description: Indicates the unit used to express the distance to the destination. (eg: kilometers, miles, knots)
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {ED4DF2D3-8695-450B-856F-F5C1C53ACB66}, 100</para>
+ /// </summary>
+ public static PropertyKey DestinationDistanceRef
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{ED4DF2D3-8695-450B-856F-F5C1C53ACB66}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestLatitude -- PKEY_GPS_DestLatitude</para>
+ /// <para>Description: Indicates the latitude of the destination point. This is an array of three values. Index 0 is the degrees, index 1
+ ///is the minutes, index 2 is the seconds. Each is calculated from the values in PKEY_GPS_DestLatitudeNumerator and
+ ///PKEY_GPS_DestLatitudeDenominator.
+ ///</para>
+ /// <para>Type: Multivalue Double -- VT_VECTOR | VT_R8 (For variants: VT_ARRAY | VT_R8)</para>
+ /// <para>FormatID: {9D1D7CC5-5C39-451C-86B3-928E2D18CC47}, 100</para>
+ /// </summary>
+ public static PropertyKey DestinationLatitude
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9D1D7CC5-5C39-451C-86B3-928E2D18CC47}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestLatitudeDenominator -- PKEY_GPS_DestLatitudeDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_DestLatitude
+ ///</para>
+ /// <para>Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4)</para>
+ /// <para>FormatID: {3A372292-7FCA-49A7-99D5-E47BB2D4E7AB}, 100</para>
+ /// </summary>
+ public static PropertyKey DestinationLatitudeDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{3A372292-7FCA-49A7-99D5-E47BB2D4E7AB}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestLatitudeNumerator -- PKEY_GPS_DestLatitudeNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_DestLatitude
+ ///</para>
+ /// <para>Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4)</para>
+ /// <para>FormatID: {ECF4B6F6-D5A6-433C-BB92-4076650FC890}, 100</para>
+ /// </summary>
+ public static PropertyKey DestinationLatitudeNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{ECF4B6F6-D5A6-433C-BB92-4076650FC890}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestLatitudeRef -- PKEY_GPS_DestLatitudeRef</para>
+ /// <para>Description: Indicates whether the latitude destination point is north or south latitude
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {CEA820B9-CE61-4885-A128-005D9087C192}, 100</para>
+ /// </summary>
+ public static PropertyKey DestinationLatitudeRef
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{CEA820B9-CE61-4885-A128-005D9087C192}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestLongitude -- PKEY_GPS_DestLongitude</para>
+ /// <para>Description: Indicates the latitude of the destination point. This is an array of three values. Index 0 is the degrees, index 1
+ ///is the minutes, index 2 is the seconds. Each is calculated from the values in PKEY_GPS_DestLongitudeNumerator and
+ ///PKEY_GPS_DestLongitudeDenominator.
+ ///</para>
+ /// <para>Type: Multivalue Double -- VT_VECTOR | VT_R8 (For variants: VT_ARRAY | VT_R8)</para>
+ /// <para>FormatID: {47A96261-CB4C-4807-8AD3-40B9D9DBC6BC}, 100</para>
+ /// </summary>
+ public static PropertyKey DestinationLongitude
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{47A96261-CB4C-4807-8AD3-40B9D9DBC6BC}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestLongitudeDenominator -- PKEY_GPS_DestLongitudeDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_DestLongitude
+ ///</para>
+ /// <para>Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4)</para>
+ /// <para>FormatID: {425D69E5-48AD-4900-8D80-6EB6B8D0AC86}, 100</para>
+ /// </summary>
+ public static PropertyKey DestinationLongitudeDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{425D69E5-48AD-4900-8D80-6EB6B8D0AC86}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestLongitudeNumerator -- PKEY_GPS_DestLongitudeNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_DestLongitude
+ ///</para>
+ /// <para>Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4)</para>
+ /// <para>FormatID: {A3250282-FB6D-48D5-9A89-DBCACE75CCCF}, 100</para>
+ /// </summary>
+ public static PropertyKey DestinationLongitudeNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A3250282-FB6D-48D5-9A89-DBCACE75CCCF}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DestLongitudeRef -- PKEY_GPS_DestLongitudeRef</para>
+ /// <para>Description: Indicates whether the longitude destination point is east or west longitude
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {182C1EA6-7C1C-4083-AB4B-AC6C9F4ED128}, 100</para>
+ /// </summary>
+ public static PropertyKey DestinationLongitudeRef
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{182C1EA6-7C1C-4083-AB4B-AC6C9F4ED128}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.Differential -- PKEY_GPS_Differential</para>
+ /// <para>Description: Indicates whether differential correction was applied to the GPS receiver
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {AAF4EE25-BD3B-4DD7-BFC4-47F77BB00F6D}, 100</para>
+ /// </summary>
+ public static PropertyKey Differential
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{AAF4EE25-BD3B-4DD7-BFC4-47F77BB00F6D}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DOP -- PKEY_GPS_DOP</para>
+ /// <para>Description: Indicates the GPS DOP (data degree of precision). Calculated from PKEY_GPS_DOPNumerator and PKEY_GPS_DOPDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {0CF8FB02-1837-42F1-A697-A7017AA289B9}, 100</para>
+ /// </summary>
+ public static PropertyKey DOP
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0CF8FB02-1837-42F1-A697-A7017AA289B9}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DOPDenominator -- PKEY_GPS_DOPDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_DOP
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {A0BE94C5-50BA-487B-BD35-0654BE8881ED}, 100</para>
+ /// </summary>
+ public static PropertyKey DOPDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A0BE94C5-50BA-487B-BD35-0654BE8881ED}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.DOPNumerator -- PKEY_GPS_DOPNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_DOP
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {47166B16-364F-4AA0-9F31-E2AB3DF449C3}, 100</para>
+ /// </summary>
+ public static PropertyKey DOPNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{47166B16-364F-4AA0-9F31-E2AB3DF449C3}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.ImgDirection -- PKEY_GPS_ImgDirection</para>
+ /// <para>Description: Indicates direction of the image when it was captured. Calculated from PKEY_GPS_ImgDirectionNumerator and
+ ///PKEY_GPS_ImgDirectionDenominator.
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {16473C91-D017-4ED9-BA4D-B6BAA55DBCF8}, 100</para>
+ /// </summary>
+ public static PropertyKey ImageDirection
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{16473C91-D017-4ED9-BA4D-B6BAA55DBCF8}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.ImgDirectionDenominator -- PKEY_GPS_ImgDirectionDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_ImgDirection
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {10B24595-41A2-4E20-93C2-5761C1395F32}, 100</para>
+ /// </summary>
+ public static PropertyKey ImageDirectionDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{10B24595-41A2-4E20-93C2-5761C1395F32}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.ImgDirectionNumerator -- PKEY_GPS_ImgDirectionNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_ImgDirection
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {DC5877C7-225F-45F7-BAC7-E81334B6130A}, 100</para>
+ /// </summary>
+ public static PropertyKey ImageDirectionNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{DC5877C7-225F-45F7-BAC7-E81334B6130A}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.ImgDirectionRef -- PKEY_GPS_ImgDirectionRef</para>
+ /// <para>Description: Indicates reference for giving the direction of the image when it was captured. (eg: true direction, magnetic direction)
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {A4AAA5B7-1AD0-445F-811A-0F8F6E67F6B5}, 100</para>
+ /// </summary>
+ public static PropertyKey ImageDirectionRef
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A4AAA5B7-1AD0-445F-811A-0F8F6E67F6B5}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.Latitude -- PKEY_GPS_Latitude</para>
+ /// <para>Description: Indicates the latitude. This is an array of three values. Index 0 is the degrees, index 1 is the minutes, index 2
+ ///is the seconds. Each is calculated from the values in PKEY_GPS_LatitudeNumerator and PKEY_GPS_LatitudeDenominator.
+ ///</para>
+ /// <para>Type: Multivalue Double -- VT_VECTOR | VT_R8 (For variants: VT_ARRAY | VT_R8)</para>
+ /// <para>FormatID: {8727CFFF-4868-4EC6-AD5B-81B98521D1AB}, 100</para>
+ /// </summary>
+ public static PropertyKey Latitude
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{8727CFFF-4868-4EC6-AD5B-81B98521D1AB}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.LatitudeDenominator -- PKEY_GPS_LatitudeDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_Latitude
+ ///</para>
+ /// <para>Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4)</para>
+ /// <para>FormatID: {16E634EE-2BFF-497B-BD8A-4341AD39EEB9}, 100</para>
+ /// </summary>
+ public static PropertyKey LatitudeDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{16E634EE-2BFF-497B-BD8A-4341AD39EEB9}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.LatitudeNumerator -- PKEY_GPS_LatitudeNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_Latitude
+ ///</para>
+ /// <para>Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4)</para>
+ /// <para>FormatID: {7DDAAAD1-CCC8-41AE-B750-B2CB8031AEA2}, 100</para>
+ /// </summary>
+ public static PropertyKey LatitudeNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{7DDAAAD1-CCC8-41AE-B750-B2CB8031AEA2}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.LatitudeRef -- PKEY_GPS_LatitudeRef</para>
+ /// <para>Description: Indicates whether latitude is north or south latitude
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {029C0252-5B86-46C7-ACA0-2769FFC8E3D4}, 100</para>
+ /// </summary>
+ public static PropertyKey LatitudeRef
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{029C0252-5B86-46C7-ACA0-2769FFC8E3D4}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.Longitude -- PKEY_GPS_Longitude</para>
+ /// <para>Description: Indicates the longitude. This is an array of three values. Index 0 is the degrees, index 1 is the minutes, index 2
+ ///is the seconds. Each is calculated from the values in PKEY_GPS_LongitudeNumerator and PKEY_GPS_LongitudeDenominator.
+ ///</para>
+ /// <para>Type: Multivalue Double -- VT_VECTOR | VT_R8 (For variants: VT_ARRAY | VT_R8)</para>
+ /// <para>FormatID: {C4C4DBB2-B593-466B-BBDA-D03D27D5E43A}, 100</para>
+ /// </summary>
+ public static PropertyKey Longitude
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C4C4DBB2-B593-466B-BBDA-D03D27D5E43A}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.LongitudeDenominator -- PKEY_GPS_LongitudeDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_Longitude
+ ///</para>
+ /// <para>Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4)</para>
+ /// <para>FormatID: {BE6E176C-4534-4D2C-ACE5-31DEDAC1606B}, 100</para>
+ /// </summary>
+ public static PropertyKey LongitudeDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{BE6E176C-4534-4D2C-ACE5-31DEDAC1606B}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.LongitudeNumerator -- PKEY_GPS_LongitudeNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_Longitude
+ ///</para>
+ /// <para>Type: Multivalue UInt32 -- VT_VECTOR | VT_UI4 (For variants: VT_ARRAY | VT_UI4)</para>
+ /// <para>FormatID: {02B0F689-A914-4E45-821D-1DDA452ED2C4}, 100</para>
+ /// </summary>
+ public static PropertyKey LongitudeNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{02B0F689-A914-4E45-821D-1DDA452ED2C4}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.LongitudeRef -- PKEY_GPS_LongitudeRef</para>
+ /// <para>Description: Indicates whether longitude is east or west longitude
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {33DCF22B-28D5-464C-8035-1EE9EFD25278}, 100</para>
+ /// </summary>
+ public static PropertyKey LongitudeRef
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{33DCF22B-28D5-464C-8035-1EE9EFD25278}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.MapDatum -- PKEY_GPS_MapDatum</para>
+ /// <para>Description: Indicates the geodetic survey data used by the GPS receiver
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {2CA2DAE6-EDDC-407D-BEF1-773942ABFA95}, 100</para>
+ /// </summary>
+ public static PropertyKey MapDatum
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{2CA2DAE6-EDDC-407D-BEF1-773942ABFA95}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.MeasureMode -- PKEY_GPS_MeasureMode</para>
+ /// <para>Description: Indicates the GPS measurement mode. (eg: 2-dimensional, 3-dimensional)
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {A015ED5D-AAEA-4D58-8A86-3C586920EA0B}, 100</para>
+ /// </summary>
+ public static PropertyKey MeasureMode
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A015ED5D-AAEA-4D58-8A86-3C586920EA0B}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.ProcessingMethod -- PKEY_GPS_ProcessingMethod</para>
+ /// <para>Description: Indicates the name of the method used for location finding
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {59D49E61-840F-4AA9-A939-E2099B7F6399}, 100</para>
+ /// </summary>
+ public static PropertyKey ProcessingMethod
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{59D49E61-840F-4AA9-A939-E2099B7F6399}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.Satellites -- PKEY_GPS_Satellites</para>
+ /// <para>Description: Indicates the GPS satellites used for measurements
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {467EE575-1F25-4557-AD4E-B8B58B0D9C15}, 100</para>
+ /// </summary>
+ public static PropertyKey Satellites
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{467EE575-1F25-4557-AD4E-B8B58B0D9C15}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.Speed -- PKEY_GPS_Speed</para>
+ /// <para>Description: Indicates the speed of the GPS receiver movement. Calculated from PKEY_GPS_SpeedNumerator and
+ ///PKEY_GPS_SpeedDenominator.
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {DA5D0862-6E76-4E1B-BABD-70021BD25494}, 100</para>
+ /// </summary>
+ public static PropertyKey Speed
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{DA5D0862-6E76-4E1B-BABD-70021BD25494}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.SpeedDenominator -- PKEY_GPS_SpeedDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_Speed
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {7D122D5A-AE5E-4335-8841-D71E7CE72F53}, 100</para>
+ /// </summary>
+ public static PropertyKey SpeedDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{7D122D5A-AE5E-4335-8841-D71E7CE72F53}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.SpeedNumerator -- PKEY_GPS_SpeedNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_Speed
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {ACC9CE3D-C213-4942-8B48-6D0820F21C6D}, 100</para>
+ /// </summary>
+ public static PropertyKey SpeedNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{ACC9CE3D-C213-4942-8B48-6D0820F21C6D}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.SpeedRef -- PKEY_GPS_SpeedRef</para>
+ /// <para>Description: Indicates the unit used to express the speed of the GPS receiver movement. (eg: kilometers per hour,
+ ///miles per hour, knots).
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {ECF7F4C9-544F-4D6D-9D98-8AD79ADAF453}, 100</para>
+ /// </summary>
+ public static PropertyKey SpeedRef
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{ECF7F4C9-544F-4D6D-9D98-8AD79ADAF453}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.Status -- PKEY_GPS_Status</para>
+ /// <para>Description: Indicates the status of the GPS receiver when the image was recorded. (eg: measurement in progress,
+ ///measurement interoperability).
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {125491F4-818F-46B2-91B5-D537753617B2}, 100</para>
+ /// </summary>
+ public static PropertyKey Status
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{125491F4-818F-46B2-91B5-D537753617B2}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.Track -- PKEY_GPS_Track</para>
+ /// <para>Description: Indicates the direction of the GPS receiver movement. Calculated from PKEY_GPS_TrackNumerator and
+ ///PKEY_GPS_TrackDenominator.
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {76C09943-7C33-49E3-9E7E-CDBA872CFADA}, 100</para>
+ /// </summary>
+ public static PropertyKey Track
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{76C09943-7C33-49E3-9E7E-CDBA872CFADA}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.TrackDenominator -- PKEY_GPS_TrackDenominator</para>
+ /// <para>Description: Denominator of PKEY_GPS_Track
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {C8D1920C-01F6-40C0-AC86-2F3A4AD00770}, 100</para>
+ /// </summary>
+ public static PropertyKey TrackDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C8D1920C-01F6-40C0-AC86-2F3A4AD00770}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.TrackNumerator -- PKEY_GPS_TrackNumerator</para>
+ /// <para>Description: Numerator of PKEY_GPS_Track
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {702926F4-44A6-43E1-AE71-45627116893B}, 100</para>
+ /// </summary>
+ public static PropertyKey TrackNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{702926F4-44A6-43E1-AE71-45627116893B}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.TrackRef -- PKEY_GPS_TrackRef</para>
+ /// <para>Description: Indicates reference for the direction of the GPS receiver movement. (eg: true direction, magnetic direction)
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {35DBE6FE-44C3-4400-AAAE-D2C799C407E8}, 100</para>
+ /// </summary>
+ public static PropertyKey TrackRef
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{35DBE6FE-44C3-4400-AAAE-D2C799C407E8}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.GPS.VersionID -- PKEY_GPS_VersionID</para>
+ /// <para>Description: Indicates the version of the GPS information
+ ///</para>
+ /// <para>Type: Buffer -- VT_VECTOR | VT_UI1 (For variants: VT_ARRAY | VT_UI1)</para>
+ /// <para>FormatID: {22704DA4-C6B2-4A99-8E56-F16DF8C92599}, 100</para>
+ /// </summary>
+ public static PropertyKey VersionID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{22704DA4-C6B2-4A99-8E56-F16DF8C92599}"), 100);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Identity Properties
+ /// </summary>
+ public static class Identity
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Identity.Blob -- PKEY_Identity_Blob</para>
+ /// <para>Description: Blob used to import/export identities
+ ///</para>
+ /// <para>Type: Blob -- VT_BLOB</para>
+ /// <para>FormatID: {8C3B93A4-BAED-1A83-9A32-102EE313F6EB}, 100</para>
+ /// </summary>
+ public static PropertyKey Blob
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{8C3B93A4-BAED-1A83-9A32-102EE313F6EB}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Identity.DisplayName -- PKEY_Identity_DisplayName</para>
+ /// <para>Description: Display Name
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {7D683FC9-D155-45A8-BB1F-89D19BCB792F}, 100</para>
+ /// </summary>
+ public static PropertyKey DisplayName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{7D683FC9-D155-45A8-BB1F-89D19BCB792F}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Identity.IsMeIdentity -- PKEY_Identity_IsMeIdentity</para>
+ /// <para>Description: Is it Me Identity
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {A4108708-09DF-4377-9DFC-6D99986D5A67}, 100</para>
+ /// </summary>
+ public static PropertyKey IsMeIdentity
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A4108708-09DF-4377-9DFC-6D99986D5A67}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Identity.PrimaryEmailAddress -- PKEY_Identity_PrimaryEmailAddress</para>
+ /// <para>Description: Primary Email Address
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {FCC16823-BAED-4F24-9B32-A0982117F7FA}, 100</para>
+ /// </summary>
+ public static PropertyKey PrimaryEmailAddress
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{FCC16823-BAED-4F24-9B32-A0982117F7FA}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Identity.ProviderID -- PKEY_Identity_ProviderID</para>
+ /// <para>Description: Provider ID
+ ///</para>
+ /// <para>Type: Guid -- VT_CLSID</para>
+ /// <para>FormatID: {74A7DE49-FA11-4D3D-A006-DB7E08675916}, 100</para>
+ /// </summary>
+ public static PropertyKey ProviderID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{74A7DE49-FA11-4D3D-A006-DB7E08675916}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Identity.UniqueID -- PKEY_Identity_UniqueID</para>
+ /// <para>Description: Unique ID
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E55FC3B0-2B60-4220-918E-B21E8BF16016}, 100</para>
+ /// </summary>
+ public static PropertyKey UniqueID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E55FC3B0-2B60-4220-918E-B21E8BF16016}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Identity.UserName -- PKEY_Identity_UserName</para>
+ /// <para>Description: Identity User Name
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C4322503-78CA-49C6-9ACC-A68E2AFD7B6B}, 100</para>
+ /// </summary>
+ public static PropertyKey UserName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C4322503-78CA-49C6-9ACC-A68E2AFD7B6B}"), 100);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// IdentityProvider Properties
+ /// </summary>
+ public static class IdentityProvider
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.IdentityProvider.Name -- PKEY_IdentityProvider_Name</para>
+ /// <para>Description: Identity Provider Name
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {B96EFF7B-35CA-4A35-8607-29E3A54C46EA}, 100</para>
+ /// </summary>
+ public static PropertyKey Name
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{B96EFF7B-35CA-4A35-8607-29E3A54C46EA}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.IdentityProvider.Picture -- PKEY_IdentityProvider_Picture</para>
+ /// <para>Description: Picture for the Identity Provider
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {2425166F-5642-4864-992F-98FD98F294C3}, 100</para>
+ /// </summary>
+ public static PropertyKey Picture
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{2425166F-5642-4864-992F-98FD98F294C3}"), 100);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Image Properties
+ /// </summary>
+ public static class Image
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Image.BitDepth -- PKEY_Image_BitDepth</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 7 (PIDISI_BITDEPTH)</para>
+ /// </summary>
+ public static PropertyKey BitDepth
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6444048F-4C8B-11D1-8B70-080036B11A03}"), 7);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.ColorSpace -- PKEY_Image_ColorSpace</para>
+ /// <para>Description: PropertyTagExifColorSpace
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 40961</para>
+ /// </summary>
+ public static PropertyKey ColorSpace
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 40961);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.CompressedBitsPerPixel -- PKEY_Image_CompressedBitsPerPixel</para>
+ /// <para>Description: Calculated from PKEY_Image_CompressedBitsPerPixelNumerator and PKEY_Image_CompressedBitsPerPixelDenominator.
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {364B6FA9-37AB-482A-BE2B-AE02F60D4318}, 100</para>
+ /// </summary>
+ public static PropertyKey CompressedBitsPerPixel
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{364B6FA9-37AB-482A-BE2B-AE02F60D4318}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.CompressedBitsPerPixelDenominator -- PKEY_Image_CompressedBitsPerPixelDenominator</para>
+ /// <para>Description: Denominator of PKEY_Image_CompressedBitsPerPixel.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {1F8844E1-24AD-4508-9DFD-5326A415CE02}, 100</para>
+ /// </summary>
+ public static PropertyKey CompressedBitsPerPixelDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{1F8844E1-24AD-4508-9DFD-5326A415CE02}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.CompressedBitsPerPixelNumerator -- PKEY_Image_CompressedBitsPerPixelNumerator</para>
+ /// <para>Description: Numerator of PKEY_Image_CompressedBitsPerPixel.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {D21A7148-D32C-4624-8900-277210F79C0F}, 100</para>
+ /// </summary>
+ public static PropertyKey CompressedBitsPerPixelNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D21A7148-D32C-4624-8900-277210F79C0F}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.Compression -- PKEY_Image_Compression</para>
+ /// <para>Description: Indicates the image compression level. PropertyTagCompression.
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 259</para>
+ /// </summary>
+ public static PropertyKey Compression
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 259);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.CompressionText -- PKEY_Image_CompressionText</para>
+ /// <para>Description: This is the user-friendly form of System.Image.Compression. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {3F08E66F-2F44-4BB9-A682-AC35D2562322}, 100</para>
+ /// </summary>
+ public static PropertyKey CompressionText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{3F08E66F-2F44-4BB9-A682-AC35D2562322}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.Dimensions -- PKEY_Image_Dimensions</para>
+ /// <para>Description: Indicates the dimensions of the image.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 13 (PIDISI_DIMENSIONS)</para>
+ /// </summary>
+ public static PropertyKey Dimensions
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6444048F-4C8B-11D1-8B70-080036B11A03}"), 13);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.HorizontalResolution -- PKEY_Image_HorizontalResolution</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 5 (PIDISI_RESOLUTIONX)</para>
+ /// </summary>
+ public static PropertyKey HorizontalResolution
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6444048F-4C8B-11D1-8B70-080036B11A03}"), 5);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.HorizontalSize -- PKEY_Image_HorizontalSize</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 3 (PIDISI_CX)</para>
+ /// </summary>
+ public static PropertyKey HorizontalSize
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6444048F-4C8B-11D1-8B70-080036B11A03}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.ImageID -- PKEY_Image_ImageID</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {10DABE05-32AA-4C29-BF1A-63E2D220587F}, 100</para>
+ /// </summary>
+ public static PropertyKey ImageID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{10DABE05-32AA-4C29-BF1A-63E2D220587F}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.ResolutionUnit -- PKEY_Image_ResolutionUnit</para>
+ /// <para>Description: </para>
+ /// <para>Type: Int16 -- VT_I2</para>
+ /// <para>FormatID: {19B51FA6-1F92-4A5C-AB48-7DF0ABD67444}, 100</para>
+ /// </summary>
+ public static PropertyKey ResolutionUnit
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{19B51FA6-1F92-4A5C-AB48-7DF0ABD67444}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.VerticalResolution -- PKEY_Image_VerticalResolution</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 6 (PIDISI_RESOLUTIONY)</para>
+ /// </summary>
+ public static PropertyKey VerticalResolution
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6444048F-4C8B-11D1-8B70-080036B11A03}"), 6);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Image.VerticalSize -- PKEY_Image_VerticalSize</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 4 (PIDISI_CY)</para>
+ /// </summary>
+ public static PropertyKey VerticalSize
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6444048F-4C8B-11D1-8B70-080036B11A03}"), 4);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Journal Properties
+ /// </summary>
+ public static class Journal
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Journal.Contacts -- PKEY_Journal_Contacts</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {DEA7C82C-1D89-4A66-9427-A4E3DEBABCB1}, 100</para>
+ /// </summary>
+ public static PropertyKey Contacts
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{DEA7C82C-1D89-4A66-9427-A4E3DEBABCB1}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Journal.EntryType -- PKEY_Journal_EntryType</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {95BEB1FC-326D-4644-B396-CD3ED90E6DDF}, 100</para>
+ /// </summary>
+ public static PropertyKey EntryType
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{95BEB1FC-326D-4644-B396-CD3ED90E6DDF}"), 100);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// LayoutPattern Properties
+ /// </summary>
+ public static class LayoutPattern
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.LayoutPattern.ContentViewModeForBrowse -- PKEY_LayoutPattern_ContentViewModeForBrowse</para>
+ /// <para>Description: Specifies the layout pattern that the content view mode should apply for this item in the context of browsing.
+ ///Register the regvalue under the name of "ContentViewModeLayoutPatternForBrowse".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 500</para>
+ /// </summary>
+ public static PropertyKey ContentViewModeForBrowse
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 500);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.LayoutPattern.ContentViewModeForSearch -- PKEY_LayoutPattern_ContentViewModeForSearch</para>
+ /// <para>Description: Specifies the layout pattern that the content view mode should apply for this item in the context of searching.
+ ///Register the regvalue under the name of "ContentViewModeLayoutPatternForSearch".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 501</para>
+ /// </summary>
+ public static PropertyKey ContentViewModeForSearch
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 501);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Link Properties
+ /// </summary>
+ public static class Link
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Link.Arguments -- PKEY_Link_Arguments</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {436F2667-14E2-4FEB-B30A-146C53B5B674}, 100</para>
+ /// </summary>
+ public static PropertyKey Arguments
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{436F2667-14E2-4FEB-B30A-146C53B5B674}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Link.Comment -- PKEY_Link_Comment</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_LINK) {B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}, 5</para>
+ /// </summary>
+ public static PropertyKey Comment
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}"), 5);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Link.DateVisited -- PKEY_Link_DateVisited</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {5CBF2787-48CF-4208-B90E-EE5E5D420294}, 23 (PKEYs relating to URLs. Used by IE History.)</para>
+ /// </summary>
+ public static PropertyKey DateVisited
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{5CBF2787-48CF-4208-B90E-EE5E5D420294}"), 23);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Link.Description -- PKEY_Link_Description</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {5CBF2787-48CF-4208-B90E-EE5E5D420294}, 21 (PKEYs relating to URLs. Used by IE History.)</para>
+ /// </summary>
+ public static PropertyKey Description
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{5CBF2787-48CF-4208-B90E-EE5E5D420294}"), 21);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Link.Status -- PKEY_Link_Status</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (PSGUID_LINK) {B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}, 3 (PID_LINK_TARGET_TYPE)</para>
+ /// </summary>
+ public static PropertyKey Status
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Link.TargetExtension -- PKEY_Link_TargetExtension</para>
+ /// <para>Description: The file extension of the link target. See System.File.Extension
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {7A7D76F4-B630-4BD7-95FF-37CC51A975C9}, 2</para>
+ /// </summary>
+ public static PropertyKey TargetExtension
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{7A7D76F4-B630-4BD7-95FF-37CC51A975C9}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Link.TargetParsingPath -- PKEY_Link_TargetParsingPath</para>
+ /// <para>Description: This is the shell namespace path to the target of the link item. This path may be passed to
+ ///SHParseDisplayName to parse the path to the correct shell folder.
+ ///
+ ///If the target item is a file, the value is identical to System.ItemPathDisplay.
+ ///
+ ///If the target item cannot be accessed through the shell namespace, this value is VT_EMPTY.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_LINK) {B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}, 2 (PID_LINK_TARGET)</para>
+ /// </summary>
+ public static PropertyKey TargetParsingPath
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Link.TargetSFGAOFlags -- PKEY_Link_TargetSFGAOFlags</para>
+ /// <para>Description: IShellFolder::GetAttributesOf flags for the target of a link, with SFGAO_PKEYSFGAOMASK
+ ///attributes masked out.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (PSGUID_LINK) {B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}, 8</para>
+ /// </summary>
+ public static PropertyKey TargetSFGAOFlags
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{B9B4B3FC-2B51-4A42-B5D8-324146AFCF25}"), 8);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Link.TargetSFGAOFlagsStrings -- PKEY_Link_TargetSFGAOFlagsStrings</para>
+ /// <para>Description: Expresses the SFGAO flags of a link as string values and is used as a query optimization. See
+ ///PKEY_Shell_SFGAOFlagsStrings for possible values of this.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {D6942081-D53B-443D-AD47-5E059D9CD27A}, 3</para>
+ /// </summary>
+ public static PropertyKey TargetSFGAOFlagsStrings
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D6942081-D53B-443D-AD47-5E059D9CD27A}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Link.TargetUrl -- PKEY_Link_TargetUrl</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {5CBF2787-48CF-4208-B90E-EE5E5D420294}, 2 (PKEYs relating to URLs. Used by IE History.)</para>
+ /// </summary>
+ public static PropertyKey TargetUrl
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{5CBF2787-48CF-4208-B90E-EE5E5D420294}"), 2);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Media Properties
+ /// </summary>
+ public static class Media
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Media.AuthorUrl -- PKEY_Media_AuthorUrl</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 32 (PIDMSI_AUTHOR_URL)</para>
+ /// </summary>
+ public static PropertyKey AuthorUrl
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 32);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.AverageLevel -- PKEY_Media_AverageLevel</para>
+ /// <para>Description: </para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {09EDD5B6-B301-43C5-9990-D00302EFFD46}, 100</para>
+ /// </summary>
+ public static PropertyKey AverageLevel
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{09EDD5B6-B301-43C5-9990-D00302EFFD46}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.ClassPrimaryID -- PKEY_Media_ClassPrimaryID</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 13 (PIDMSI_CLASS_PRIMARY_ID)</para>
+ /// </summary>
+ public static PropertyKey ClassPrimaryID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 13);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.ClassSecondaryID -- PKEY_Media_ClassSecondaryID</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 14 (PIDMSI_CLASS_SECONDARY_ID)</para>
+ /// </summary>
+ public static PropertyKey ClassSecondaryID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 14);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.CollectionGroupID -- PKEY_Media_CollectionGroupID</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 24 (PIDMSI_COLLECTION_GROUP_ID)</para>
+ /// </summary>
+ public static PropertyKey CollectionGroupID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 24);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.CollectionID -- PKEY_Media_CollectionID</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 25 (PIDMSI_COLLECTION_ID)</para>
+ /// </summary>
+ public static PropertyKey CollectionID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 25);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.ContentDistributor -- PKEY_Media_ContentDistributor</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 18 (PIDMSI_CONTENTDISTRIBUTOR)</para>
+ /// </summary>
+ public static PropertyKey ContentDistributor
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 18);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.ContentID -- PKEY_Media_ContentID</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 26 (PIDMSI_CONTENT_ID)</para>
+ /// </summary>
+ public static PropertyKey ContentID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 26);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.CreatorApplication -- PKEY_Media_CreatorApplication</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 27 (PIDMSI_TOOL_NAME)</para>
+ /// </summary>
+ public static PropertyKey CreatorApplication
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 27);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.CreatorApplicationVersion -- PKEY_Media_CreatorApplicationVersion</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 28 (PIDMSI_TOOL_VERSION)</para>
+ /// </summary>
+ public static PropertyKey CreatorApplicationVersion
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 28);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.DateEncoded -- PKEY_Media_DateEncoded</para>
+ /// <para>Description: DateTime is in UTC (in the doc, not file system).
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {2E4B640D-5019-46D8-8881-55414CC5CAA0}, 100</para>
+ /// </summary>
+ public static PropertyKey DateEncoded
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{2E4B640D-5019-46D8-8881-55414CC5CAA0}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.DateReleased -- PKEY_Media_DateReleased</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {DE41CC29-6971-4290-B472-F59F2E2F31E2}, 100</para>
+ /// </summary>
+ public static PropertyKey DateReleased
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{DE41CC29-6971-4290-B472-F59F2E2F31E2}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.Duration -- PKEY_Media_Duration</para>
+ /// <para>Description: 100ns units, not milliseconds
+ ///</para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: (FMTID_AudioSummaryInformation) {64440490-4C8B-11D1-8B70-080036B11A03}, 3 (PIDASI_TIMELENGTH)</para>
+ /// </summary>
+ public static PropertyKey Duration
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440490-4C8B-11D1-8B70-080036B11A03}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.DVDID -- PKEY_Media_DVDID</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 15 (PIDMSI_DVDID)</para>
+ /// </summary>
+ public static PropertyKey DVDID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 15);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.EncodedBy -- PKEY_Media_EncodedBy</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 36 (PIDMSI_ENCODED_BY)</para>
+ /// </summary>
+ public static PropertyKey EncodedBy
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 36);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.EncodingSettings -- PKEY_Media_EncodingSettings</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 37 (PIDMSI_ENCODING_SETTINGS)</para>
+ /// </summary>
+ public static PropertyKey EncodingSettings
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 37);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.FrameCount -- PKEY_Media_FrameCount</para>
+ /// <para>Description: Indicates the frame count for the image.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (PSGUID_IMAGESUMMARYINFORMATION) {6444048F-4C8B-11D1-8B70-080036B11A03}, 12 (PIDISI_FRAMECOUNT)</para>
+ /// </summary>
+ public static PropertyKey FrameCount
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6444048F-4C8B-11D1-8B70-080036B11A03}"), 12);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.MCDI -- PKEY_Media_MCDI</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 16 (PIDMSI_MCDI)</para>
+ /// </summary>
+ public static PropertyKey MCDI
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 16);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.MetadataContentProvider -- PKEY_Media_MetadataContentProvider</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 17 (PIDMSI_PROVIDER)</para>
+ /// </summary>
+ public static PropertyKey MetadataContentProvider
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 17);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.Producer -- PKEY_Media_Producer</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 22 (PIDMSI_PRODUCER)</para>
+ /// </summary>
+ public static PropertyKey Producer
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 22);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.PromotionUrl -- PKEY_Media_PromotionUrl</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 33 (PIDMSI_PROMOTION_URL)</para>
+ /// </summary>
+ public static PropertyKey PromotionUrl
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 33);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.ProtectionType -- PKEY_Media_ProtectionType</para>
+ /// <para>Description: If media is protected, how is it protected?
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 38</para>
+ /// </summary>
+ public static PropertyKey ProtectionType
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 38);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.ProviderRating -- PKEY_Media_ProviderRating</para>
+ /// <para>Description: Rating (0 - 99) supplied by metadata provider
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 39</para>
+ /// </summary>
+ public static PropertyKey ProviderRating
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 39);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.ProviderStyle -- PKEY_Media_ProviderStyle</para>
+ /// <para>Description: Style of music or video, supplied by metadata provider
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 40</para>
+ /// </summary>
+ public static PropertyKey ProviderStyle
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 40);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.Publisher -- PKEY_Media_Publisher</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 30 (PIDMSI_PUBLISHER)</para>
+ /// </summary>
+ public static PropertyKey Publisher
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 30);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.SubscriptionContentId -- PKEY_Media_SubscriptionContentId</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {9AEBAE7A-9644-487D-A92C-657585ED751A}, 100</para>
+ /// </summary>
+ public static PropertyKey SubscriptionContentId
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9AEBAE7A-9644-487D-A92C-657585ED751A}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.SubTitle -- PKEY_Media_SubTitle</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 38 (PIDSI_MUSIC_SUB_TITLE)</para>
+ /// </summary>
+ public static PropertyKey Subtitle
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 38);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.UniqueFileIdentifier -- PKEY_Media_UniqueFileIdentifier</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 35 (PIDMSI_UNIQUE_FILE_IDENTIFIER)</para>
+ /// </summary>
+ public static PropertyKey UniqueFileIdentifier
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 35);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.UserNoAutoInfo -- PKEY_Media_UserNoAutoInfo</para>
+ /// <para>Description: If true, do NOT alter this file's metadata. Set by user.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 41</para>
+ /// </summary>
+ public static PropertyKey UserNoAutoInfo
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 41);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.UserWebUrl -- PKEY_Media_UserWebUrl</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 34 (PIDMSI_USER_WEB_URL)</para>
+ /// </summary>
+ public static PropertyKey UserWebUrl
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 34);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.Writer -- PKEY_Media_Writer</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 23 (PIDMSI_WRITER)</para>
+ /// </summary>
+ public static PropertyKey Writer
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 23);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Media.Year -- PKEY_Media_Year</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 5 (PIDSI_MUSIC_YEAR)</para>
+ /// </summary>
+ public static PropertyKey Year
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 5);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Message Properties
+ /// </summary>
+ public static class Message
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Message.AttachmentContents -- PKEY_Message_AttachmentContents</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {3143BF7C-80A8-4854-8880-E2E40189BDD0}, 100</para>
+ /// </summary>
+ public static PropertyKey AttachmentContents
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{3143BF7C-80A8-4854-8880-E2E40189BDD0}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.AttachmentNames -- PKEY_Message_AttachmentNames</para>
+ /// <para>Description: The names of the attachments in a message
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 21</para>
+ /// </summary>
+ public static PropertyKey AttachmentNames
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 21);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.BccAddress -- PKEY_Message_BccAddress</para>
+ /// <para>Description: Addresses in Bcc: field
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 2</para>
+ /// </summary>
+ public static PropertyKey BccAddress
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.BccName -- PKEY_Message_BccName</para>
+ /// <para>Description: person names in Bcc: field
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 3</para>
+ /// </summary>
+ public static PropertyKey BccName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.CcAddress -- PKEY_Message_CcAddress</para>
+ /// <para>Description: Addresses in Cc: field
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 4</para>
+ /// </summary>
+ public static PropertyKey CcAddress
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 4);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.CcName -- PKEY_Message_CcName</para>
+ /// <para>Description: person names in Cc: field
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 5</para>
+ /// </summary>
+ public static PropertyKey CcName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 5);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.ConversationID -- PKEY_Message_ConversationID</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {DC8F80BD-AF1E-4289-85B6-3DFC1B493992}, 100</para>
+ /// </summary>
+ public static PropertyKey ConversationID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{DC8F80BD-AF1E-4289-85B6-3DFC1B493992}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.ConversationIndex -- PKEY_Message_ConversationIndex</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Buffer -- VT_VECTOR | VT_UI1 (For variants: VT_ARRAY | VT_UI1)</para>
+ /// <para>FormatID: {DC8F80BD-AF1E-4289-85B6-3DFC1B493992}, 101</para>
+ /// </summary>
+ public static PropertyKey ConversationIndex
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{DC8F80BD-AF1E-4289-85B6-3DFC1B493992}"), 101);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.DateReceived -- PKEY_Message_DateReceived</para>
+ /// <para>Description: Date and Time communication was received
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 20</para>
+ /// </summary>
+ public static PropertyKey DateReceived
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 20);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.DateSent -- PKEY_Message_DateSent</para>
+ /// <para>Description: Date and Time communication was sent
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 19</para>
+ /// </summary>
+ public static PropertyKey DateSent
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 19);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.Flags -- PKEY_Message_Flags</para>
+ /// <para>Description: These are flags associated with email messages to know if a read receipt is pending, etc.
+ ///The values stored here by Outlook are defined for PR_MESSAGE_FLAGS on MSDN.
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {A82D9EE7-CA67-4312-965E-226BCEA85023}, 100</para>
+ /// </summary>
+ public static PropertyKey Flags
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A82D9EE7-CA67-4312-965E-226BCEA85023}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.FromAddress -- PKEY_Message_FromAddress</para>
+ /// <para>Description: </para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 13</para>
+ /// </summary>
+ public static PropertyKey FromAddress
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 13);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.FromName -- PKEY_Message_FromName</para>
+ /// <para>Description: Address in from field as person name
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 14</para>
+ /// </summary>
+ public static PropertyKey FromName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 14);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.HasAttachments -- PKEY_Message_HasAttachments</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {9C1FCF74-2D97-41BA-B4AE-CB2E3661A6E4}, 8</para>
+ /// </summary>
+ public static PropertyKey HasAttachments
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9C1FCF74-2D97-41BA-B4AE-CB2E3661A6E4}"), 8);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.IsFwdOrReply -- PKEY_Message_IsFwdOrReply</para>
+ /// <para>Description: </para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {9A9BC088-4F6D-469E-9919-E705412040F9}, 100</para>
+ /// </summary>
+ public static PropertyKey IsFwdOrReply
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9A9BC088-4F6D-469E-9919-E705412040F9}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.MessageClass -- PKEY_Message_MessageClass</para>
+ /// <para>Description: What type of outlook msg this is (meeting, task, mail, etc.)
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {CD9ED458-08CE-418F-A70E-F912C7BB9C5C}, 103</para>
+ /// </summary>
+ public static PropertyKey MessageClass
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{CD9ED458-08CE-418F-A70E-F912C7BB9C5C}"), 103);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.ProofInProgress -- PKEY_Message_ProofInProgress</para>
+ /// <para>Description: This property will be true if the message junk email proofing is still in progress.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {9098F33C-9A7D-48A8-8DE5-2E1227A64E91}, 100</para>
+ /// </summary>
+ public static PropertyKey ProofInProgress
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9098F33C-9A7D-48A8-8DE5-2E1227A64E91}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.SenderAddress -- PKEY_Message_SenderAddress</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {0BE1C8E7-1981-4676-AE14-FDD78F05A6E7}, 100</para>
+ /// </summary>
+ public static PropertyKey SenderAddress
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0BE1C8E7-1981-4676-AE14-FDD78F05A6E7}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.SenderName -- PKEY_Message_SenderName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {0DA41CFA-D224-4A18-AE2F-596158DB4B3A}, 100</para>
+ /// </summary>
+ public static PropertyKey SenderName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0DA41CFA-D224-4A18-AE2F-596158DB4B3A}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.Store -- PKEY_Message_Store</para>
+ /// <para>Description: The store (aka protocol handler) FILE, MAIL, OUTLOOKEXPRESS
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 15</para>
+ /// </summary>
+ public static PropertyKey Store
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 15);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.ToAddress -- PKEY_Message_ToAddress</para>
+ /// <para>Description: Addresses in To: field
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 16</para>
+ /// </summary>
+ public static PropertyKey ToAddress
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 16);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.ToDoFlags -- PKEY_Message_ToDoFlags</para>
+ /// <para>Description: Flags associated with a message flagged to know if it's still active, if it was custom flagged, etc.
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {1F856A9F-6900-4ABA-9505-2D5F1B4D66CB}, 100</para>
+ /// </summary>
+ public static PropertyKey ToDoFlags
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{1F856A9F-6900-4ABA-9505-2D5F1B4D66CB}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.ToDoTitle -- PKEY_Message_ToDoTitle</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {BCCC8A3C-8CEF-42E5-9B1C-C69079398BC7}, 100</para>
+ /// </summary>
+ public static PropertyKey ToDoTitle
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{BCCC8A3C-8CEF-42E5-9B1C-C69079398BC7}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Message.ToName -- PKEY_Message_ToName</para>
+ /// <para>Description: Person names in To: field
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}, 17</para>
+ /// </summary>
+ public static PropertyKey ToName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD}"), 17);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Music Properties
+ /// </summary>
+ public static class Music
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Music.AlbumArtist -- PKEY_Music_AlbumArtist</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 13 (PIDSI_MUSIC_ALBUM_ARTIST)</para>
+ /// </summary>
+ public static PropertyKey AlbumArtist
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 13);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.AlbumID -- PKEY_Music_AlbumID</para>
+ /// <para>Description: Concatenation of System.Music.AlbumArtist and System.Music.AlbumTitle, suitable for indexing and display.
+ ///Used to differentiate albums with the same title from different artists.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 100</para>
+ /// </summary>
+ public static PropertyKey AlbumID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.AlbumTitle -- PKEY_Music_AlbumTitle</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 4 (PIDSI_MUSIC_ALBUM)</para>
+ /// </summary>
+ public static PropertyKey AlbumTitle
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 4);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.Artist -- PKEY_Music_Artist</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 2 (PIDSI_MUSIC_ARTIST)</para>
+ /// </summary>
+ public static PropertyKey Artist
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.BeatsPerMinute -- PKEY_Music_BeatsPerMinute</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 35 (PIDSI_MUSIC_BEATS_PER_MINUTE)</para>
+ /// </summary>
+ public static PropertyKey BeatsPerMinute
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 35);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.Composer -- PKEY_Music_Composer</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 19 (PIDMSI_COMPOSER)</para>
+ /// </summary>
+ public static PropertyKey Composer
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 19);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.Conductor -- PKEY_Music_Conductor</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 36 (PIDSI_MUSIC_CONDUCTOR)</para>
+ /// </summary>
+ public static PropertyKey Conductor
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 36);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.ContentGroupDescription -- PKEY_Music_ContentGroupDescription</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 33 (PIDSI_MUSIC_CONTENT_GROUP_DESCRIPTION)</para>
+ /// </summary>
+ public static PropertyKey ContentGroupDescription
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 33);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.DisplayArtist -- PKEY_Music_DisplayArtist</para>
+ /// <para>Description: This property returns the best representation of Album Artist for a given music file
+ ///based upon AlbumArtist, ContributingArtist and compilation info.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {FD122953-FA93-4EF7-92C3-04C946B2F7C8}, 100</para>
+ /// </summary>
+ public static PropertyKey DisplayArtist
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{FD122953-FA93-4EF7-92C3-04C946B2F7C8}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.Genre -- PKEY_Music_Genre</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 11 (PIDSI_MUSIC_GENRE)</para>
+ /// </summary>
+ public static PropertyKey Genre
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 11);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.InitialKey -- PKEY_Music_InitialKey</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 34 (PIDSI_MUSIC_INITIAL_KEY)</para>
+ /// </summary>
+ public static PropertyKey InitialKey
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 34);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.IsCompilation -- PKEY_Music_IsCompilation</para>
+ /// <para>Description: Indicates whether the file is part of a compilation.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {C449D5CB-9EA4-4809-82E8-AF9D59DED6D1}, 100</para>
+ /// </summary>
+ public static PropertyKey IsCompilation
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C449D5CB-9EA4-4809-82E8-AF9D59DED6D1}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.Lyrics -- PKEY_Music_Lyrics</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 12 (PIDSI_MUSIC_LYRICS)</para>
+ /// </summary>
+ public static PropertyKey Lyrics
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 12);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.Mood -- PKEY_Music_Mood</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 39 (PIDSI_MUSIC_MOOD)</para>
+ /// </summary>
+ public static PropertyKey Mood
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 39);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.PartOfSet -- PKEY_Music_PartOfSet</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 37 (PIDSI_MUSIC_PART_OF_SET)</para>
+ /// </summary>
+ public static PropertyKey PartOfSet
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 37);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.Period -- PKEY_Music_Period</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 31 (PIDMSI_PERIOD)</para>
+ /// </summary>
+ public static PropertyKey Period
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 31);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.SynchronizedLyrics -- PKEY_Music_SynchronizedLyrics</para>
+ /// <para>Description: </para>
+ /// <para>Type: Blob -- VT_BLOB</para>
+ /// <para>FormatID: {6B223B6A-162E-4AA9-B39F-05D678FC6D77}, 100</para>
+ /// </summary>
+ public static PropertyKey SynchronizedLyrics
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6B223B6A-162E-4AA9-B39F-05D678FC6D77}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Music.TrackNumber -- PKEY_Music_TrackNumber</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_MUSIC) {56A3372E-CE9C-11D2-9F0E-006097C686F6}, 7 (PIDSI_MUSIC_TRACK)</para>
+ /// </summary>
+ public static PropertyKey TrackNumber
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{56A3372E-CE9C-11D2-9F0E-006097C686F6}"), 7);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Note Properties
+ /// </summary>
+ public static class Note
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Note.Color -- PKEY_Note_Color</para>
+ /// <para>Description: </para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {4776CAFA-BCE4-4CB1-A23E-265E76D8EB11}, 100</para>
+ /// </summary>
+ public static PropertyKey Color
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{4776CAFA-BCE4-4CB1-A23E-265E76D8EB11}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Note.ColorText -- PKEY_Note_ColorText</para>
+ /// <para>Description: This is the user-friendly form of System.Note.Color. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {46B4E8DE-CDB2-440D-885C-1658EB65B914}, 100</para>
+ /// </summary>
+ public static PropertyKey ColorText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{46B4E8DE-CDB2-440D-885C-1658EB65B914}"), 100);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Photo Properties
+ /// </summary>
+ public static class Photo
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Photo.Aperture -- PKEY_Photo_Aperture</para>
+ /// <para>Description: PropertyTagExifAperture. Calculated from PKEY_Photo_ApertureNumerator and PKEY_Photo_ApertureDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37378</para>
+ /// </summary>
+ public static PropertyKey Aperture
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 37378);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ApertureDenominator -- PKEY_Photo_ApertureDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_Aperture
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {E1A9A38B-6685-46BD-875E-570DC7AD7320}, 100</para>
+ /// </summary>
+ public static PropertyKey ApertureDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E1A9A38B-6685-46BD-875E-570DC7AD7320}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ApertureNumerator -- PKEY_Photo_ApertureNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_Aperture
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {0337ECEC-39FB-4581-A0BD-4C4CC51E9914}, 100</para>
+ /// </summary>
+ public static PropertyKey ApertureNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0337ECEC-39FB-4581-A0BD-4C4CC51E9914}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.Brightness -- PKEY_Photo_Brightness</para>
+ /// <para>Description: This is the brightness of the photo.
+ ///
+ ///Calculated from PKEY_Photo_BrightnessNumerator and PKEY_Photo_BrightnessDenominator.
+ ///
+ ///The units are "APEX", normally in the range of -99.99 to 99.99. If the numerator of
+ ///the recorded value is FFFFFFFF.H, "Unknown" should be indicated.
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {1A701BF6-478C-4361-83AB-3701BB053C58}, 100 (PropertyTagExifBrightness)</para>
+ /// </summary>
+ public static PropertyKey Brightness
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{1A701BF6-478C-4361-83AB-3701BB053C58}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.BrightnessDenominator -- PKEY_Photo_BrightnessDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_Brightness
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {6EBE6946-2321-440A-90F0-C043EFD32476}, 100</para>
+ /// </summary>
+ public static PropertyKey BrightnessDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6EBE6946-2321-440A-90F0-C043EFD32476}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.BrightnessNumerator -- PKEY_Photo_BrightnessNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_Brightness
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {9E7D118F-B314-45A0-8CFB-D654B917C9E9}, 100</para>
+ /// </summary>
+ public static PropertyKey BrightnessNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9E7D118F-B314-45A0-8CFB-D654B917C9E9}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.CameraManufacturer -- PKEY_Photo_CameraManufacturer</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 271 (PropertyTagEquipMake)</para>
+ /// </summary>
+ public static PropertyKey CameraManufacturer
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 271);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.CameraModel -- PKEY_Photo_CameraModel</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 272 (PropertyTagEquipModel)</para>
+ /// </summary>
+ public static PropertyKey CameraModel
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 272);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.CameraSerialNumber -- PKEY_Photo_CameraSerialNumber</para>
+ /// <para>Description: Serial number of camera that produced this photo
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 273</para>
+ /// </summary>
+ public static PropertyKey CameraSerialNumber
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 273);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.Contrast -- PKEY_Photo_Contrast</para>
+ /// <para>Description: This indicates the direction of contrast processing applied by the camera
+ ///when the image was shot.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {2A785BA9-8D23-4DED-82E6-60A350C86A10}, 100</para>
+ /// </summary>
+ public static PropertyKey Contrast
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{2A785BA9-8D23-4DED-82E6-60A350C86A10}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ContrastText -- PKEY_Photo_ContrastText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.Contrast. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {59DDE9F2-5253-40EA-9A8B-479E96C6249A}, 100</para>
+ /// </summary>
+ public static PropertyKey ContrastText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{59DDE9F2-5253-40EA-9A8B-479E96C6249A}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.DateTaken -- PKEY_Photo_DateTaken</para>
+ /// <para>Description: PropertyTagExifDTOrig
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 36867</para>
+ /// </summary>
+ public static PropertyKey DateTaken
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 36867);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.DigitalZoom -- PKEY_Photo_DigitalZoom</para>
+ /// <para>Description: PropertyTagExifDigitalZoom. Calculated from PKEY_Photo_DigitalZoomNumerator and PKEY_Photo_DigitalZoomDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {F85BF840-A925-4BC2-B0C4-8E36B598679E}, 100</para>
+ /// </summary>
+ public static PropertyKey DigitalZoom
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F85BF840-A925-4BC2-B0C4-8E36B598679E}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.DigitalZoomDenominator -- PKEY_Photo_DigitalZoomDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_DigitalZoom
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {745BAF0E-E5C1-4CFB-8A1B-D031A0A52393}, 100</para>
+ /// </summary>
+ public static PropertyKey DigitalZoomDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{745BAF0E-E5C1-4CFB-8A1B-D031A0A52393}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.DigitalZoomNumerator -- PKEY_Photo_DigitalZoomNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_DigitalZoom
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {16CBB924-6500-473B-A5BE-F1599BCBE413}, 100</para>
+ /// </summary>
+ public static PropertyKey DigitalZoomNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{16CBB924-6500-473B-A5BE-F1599BCBE413}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.Event -- PKEY_Photo_Event</para>
+ /// <para>Description: The event at which the photo was taken
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 18248</para>
+ /// </summary>
+ public static PropertyKey Event
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 18248);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.EXIFVersion -- PKEY_Photo_EXIFVersion</para>
+ /// <para>Description: The EXIF version.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {D35F743A-EB2E-47F2-A286-844132CB1427}, 100</para>
+ /// </summary>
+ public static PropertyKey EXIFVersion
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D35F743A-EB2E-47F2-A286-844132CB1427}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureBias -- PKEY_Photo_ExposureBias</para>
+ /// <para>Description: PropertyTagExifExposureBias. Calculated from PKEY_Photo_ExposureBiasNumerator and PKEY_Photo_ExposureBiasDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37380</para>
+ /// </summary>
+ public static PropertyKey ExposureBias
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 37380);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureBiasDenominator -- PKEY_Photo_ExposureBiasDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_ExposureBias
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {AB205E50-04B7-461C-A18C-2F233836E627}, 100</para>
+ /// </summary>
+ public static PropertyKey ExposureBiasDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{AB205E50-04B7-461C-A18C-2F233836E627}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureBiasNumerator -- PKEY_Photo_ExposureBiasNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_ExposureBias
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {738BF284-1D87-420B-92CF-5834BF6EF9ED}, 100</para>
+ /// </summary>
+ public static PropertyKey ExposureBiasNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{738BF284-1D87-420B-92CF-5834BF6EF9ED}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureIndex -- PKEY_Photo_ExposureIndex</para>
+ /// <para>Description: PropertyTagExifExposureIndex. Calculated from PKEY_Photo_ExposureIndexNumerator and PKEY_Photo_ExposureIndexDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {967B5AF8-995A-46ED-9E11-35B3C5B9782D}, 100</para>
+ /// </summary>
+ public static PropertyKey ExposureIndex
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{967B5AF8-995A-46ED-9E11-35B3C5B9782D}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureIndexDenominator -- PKEY_Photo_ExposureIndexDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_ExposureIndex
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {93112F89-C28B-492F-8A9D-4BE2062CEE8A}, 100</para>
+ /// </summary>
+ public static PropertyKey ExposureIndexDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{93112F89-C28B-492F-8A9D-4BE2062CEE8A}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureIndexNumerator -- PKEY_Photo_ExposureIndexNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_ExposureIndex
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {CDEDCF30-8919-44DF-8F4C-4EB2FFDB8D89}, 100</para>
+ /// </summary>
+ public static PropertyKey ExposureIndexNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{CDEDCF30-8919-44DF-8F4C-4EB2FFDB8D89}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureProgram -- PKEY_Photo_ExposureProgram</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 34850 (PropertyTagExifExposureProg)</para>
+ /// </summary>
+ public static PropertyKey ExposureProgram
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 34850);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureProgramText -- PKEY_Photo_ExposureProgramText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.ExposureProgram. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {FEC690B7-5F30-4646-AE47-4CAAFBA884A3}, 100</para>
+ /// </summary>
+ public static PropertyKey ExposureProgramText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{FEC690B7-5F30-4646-AE47-4CAAFBA884A3}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureTime -- PKEY_Photo_ExposureTime</para>
+ /// <para>Description: PropertyTagExifExposureTime. Calculated from PKEY_Photo_ExposureTimeNumerator and PKEY_Photo_ExposureTimeDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 33434</para>
+ /// </summary>
+ public static PropertyKey ExposureTime
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 33434);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureTimeDenominator -- PKEY_Photo_ExposureTimeDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_ExposureTime
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {55E98597-AD16-42E0-B624-21599A199838}, 100</para>
+ /// </summary>
+ public static PropertyKey ExposureTimeDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{55E98597-AD16-42E0-B624-21599A199838}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ExposureTimeNumerator -- PKEY_Photo_ExposureTimeNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_ExposureTime
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {257E44E2-9031-4323-AC38-85C552871B2E}, 100</para>
+ /// </summary>
+ public static PropertyKey ExposureTimeNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{257E44E2-9031-4323-AC38-85C552871B2E}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.Flash -- PKEY_Photo_Flash</para>
+ /// <para>Description: PropertyTagExifFlash
+ ///</para>
+ /// <para>Type: Byte -- VT_UI1</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37385</para>
+ /// </summary>
+ public static PropertyKey Flash
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 37385);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FlashEnergy -- PKEY_Photo_FlashEnergy</para>
+ /// <para>Description: PropertyTagExifFlashEnergy. Calculated from PKEY_Photo_FlashEnergyNumerator and PKEY_Photo_FlashEnergyDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 41483</para>
+ /// </summary>
+ public static PropertyKey FlashEnergy
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 41483);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FlashEnergyDenominator -- PKEY_Photo_FlashEnergyDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_FlashEnergy
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {D7B61C70-6323-49CD-A5FC-C84277162C97}, 100</para>
+ /// </summary>
+ public static PropertyKey FlashEnergyDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D7B61C70-6323-49CD-A5FC-C84277162C97}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FlashEnergyNumerator -- PKEY_Photo_FlashEnergyNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_FlashEnergy
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {FCAD3D3D-0858-400F-AAA3-2F66CCE2A6BC}, 100</para>
+ /// </summary>
+ public static PropertyKey FlashEnergyNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{FCAD3D3D-0858-400F-AAA3-2F66CCE2A6BC}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FlashManufacturer -- PKEY_Photo_FlashManufacturer</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {AABAF6C9-E0C5-4719-8585-57B103E584FE}, 100</para>
+ /// </summary>
+ public static PropertyKey FlashManufacturer
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{AABAF6C9-E0C5-4719-8585-57B103E584FE}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FlashModel -- PKEY_Photo_FlashModel</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {FE83BB35-4D1A-42E2-916B-06F3E1AF719E}, 100</para>
+ /// </summary>
+ public static PropertyKey FlashModel
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{FE83BB35-4D1A-42E2-916B-06F3E1AF719E}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FlashText -- PKEY_Photo_FlashText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.Flash. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {6B8B68F6-200B-47EA-8D25-D8050F57339F}, 100</para>
+ /// </summary>
+ public static PropertyKey FlashText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6B8B68F6-200B-47EA-8D25-D8050F57339F}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FNumber -- PKEY_Photo_FNumber</para>
+ /// <para>Description: PropertyTagExifFNumber. Calculated from PKEY_Photo_FNumberNumerator and PKEY_Photo_FNumberDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 33437</para>
+ /// </summary>
+ public static PropertyKey FNumber
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 33437);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FNumberDenominator -- PKEY_Photo_FNumberDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_FNumber
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {E92A2496-223B-4463-A4E3-30EABBA79D80}, 100</para>
+ /// </summary>
+ public static PropertyKey FNumberDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E92A2496-223B-4463-A4E3-30EABBA79D80}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FNumberNumerator -- PKEY_Photo_FNumberNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_FNumber
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {1B97738A-FDFC-462F-9D93-1957E08BE90C}, 100</para>
+ /// </summary>
+ public static PropertyKey FNumberNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{1B97738A-FDFC-462F-9D93-1957E08BE90C}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FocalLength -- PKEY_Photo_FocalLength</para>
+ /// <para>Description: PropertyTagExifFocalLength. Calculated from PKEY_Photo_FocalLengthNumerator and PKEY_Photo_FocalLengthDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37386</para>
+ /// </summary>
+ public static PropertyKey FocalLength
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 37386);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FocalLengthDenominator -- PKEY_Photo_FocalLengthDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_FocalLength
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {305BC615-DCA1-44A5-9FD4-10C0BA79412E}, 100</para>
+ /// </summary>
+ public static PropertyKey FocalLengthDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{305BC615-DCA1-44A5-9FD4-10C0BA79412E}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FocalLengthInFilm -- PKEY_Photo_FocalLengthInFilm</para>
+ /// <para>Description: </para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {A0E74609-B84D-4F49-B860-462BD9971F98}, 100</para>
+ /// </summary>
+ public static PropertyKey FocalLengthInFilm
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A0E74609-B84D-4F49-B860-462BD9971F98}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FocalLengthNumerator -- PKEY_Photo_FocalLengthNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_FocalLength
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {776B6B3B-1E3D-4B0C-9A0E-8FBAF2A8492A}, 100</para>
+ /// </summary>
+ public static PropertyKey FocalLengthNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{776B6B3B-1E3D-4B0C-9A0E-8FBAF2A8492A}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FocalPlaneXResolution -- PKEY_Photo_FocalPlaneXResolution</para>
+ /// <para>Description: PropertyTagExifFocalXRes. Calculated from PKEY_Photo_FocalPlaneXResolutionNumerator and
+ ///PKEY_Photo_FocalPlaneXResolutionDenominator.
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {CFC08D97-C6F7-4484-89DD-EBEF4356FE76}, 100</para>
+ /// </summary>
+ public static PropertyKey FocalPlaneXResolution
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{CFC08D97-C6F7-4484-89DD-EBEF4356FE76}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FocalPlaneXResolutionDenominator -- PKEY_Photo_FocalPlaneXResolutionDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_FocalPlaneXResolution
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {0933F3F5-4786-4F46-A8E8-D64DD37FA521}, 100</para>
+ /// </summary>
+ public static PropertyKey FocalPlaneXResolutionDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0933F3F5-4786-4F46-A8E8-D64DD37FA521}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FocalPlaneXResolutionNumerator -- PKEY_Photo_FocalPlaneXResolutionNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_FocalPlaneXResolution
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {DCCB10AF-B4E2-4B88-95F9-031B4D5AB490}, 100</para>
+ /// </summary>
+ public static PropertyKey FocalPlaneXResolutionNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{DCCB10AF-B4E2-4B88-95F9-031B4D5AB490}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FocalPlaneYResolution -- PKEY_Photo_FocalPlaneYResolution</para>
+ /// <para>Description: PropertyTagExifFocalYRes. Calculated from PKEY_Photo_FocalPlaneYResolutionNumerator and
+ ///PKEY_Photo_FocalPlaneYResolutionDenominator.
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {4FFFE4D0-914F-4AC4-8D6F-C9C61DE169B1}, 100</para>
+ /// </summary>
+ public static PropertyKey FocalPlaneYResolution
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{4FFFE4D0-914F-4AC4-8D6F-C9C61DE169B1}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FocalPlaneYResolutionDenominator -- PKEY_Photo_FocalPlaneYResolutionDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_FocalPlaneYResolution
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {1D6179A6-A876-4031-B013-3347B2B64DC8}, 100</para>
+ /// </summary>
+ public static PropertyKey FocalPlaneYResolutionDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{1D6179A6-A876-4031-B013-3347B2B64DC8}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.FocalPlaneYResolutionNumerator -- PKEY_Photo_FocalPlaneYResolutionNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_FocalPlaneYResolution
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {A2E541C5-4440-4BA8-867E-75CFC06828CD}, 100</para>
+ /// </summary>
+ public static PropertyKey FocalPlaneYResolutionNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A2E541C5-4440-4BA8-867E-75CFC06828CD}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.GainControl -- PKEY_Photo_GainControl</para>
+ /// <para>Description: This indicates the degree of overall image gain adjustment.
+ ///
+ ///Calculated from PKEY_Photo_GainControlNumerator and PKEY_Photo_GainControlDenominator.
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {FA304789-00C7-4D80-904A-1E4DCC7265AA}, 100 (PropertyTagExifGainControl)</para>
+ /// </summary>
+ public static PropertyKey GainControl
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{FA304789-00C7-4D80-904A-1E4DCC7265AA}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.GainControlDenominator -- PKEY_Photo_GainControlDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_GainControl
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {42864DFD-9DA4-4F77-BDED-4AAD7B256735}, 100</para>
+ /// </summary>
+ public static PropertyKey GainControlDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{42864DFD-9DA4-4F77-BDED-4AAD7B256735}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.GainControlNumerator -- PKEY_Photo_GainControlNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_GainControl
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {8E8ECF7C-B7B8-4EB8-A63F-0EE715C96F9E}, 100</para>
+ /// </summary>
+ public static PropertyKey GainControlNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{8E8ECF7C-B7B8-4EB8-A63F-0EE715C96F9E}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.GainControlText -- PKEY_Photo_GainControlText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.GainControl. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C06238B2-0BF9-4279-A723-25856715CB9D}, 100</para>
+ /// </summary>
+ public static PropertyKey GainControlText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C06238B2-0BF9-4279-A723-25856715CB9D}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ISOSpeed -- PKEY_Photo_ISOSpeed</para>
+ /// <para>Description: PropertyTagExifISOSpeed
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 34855</para>
+ /// </summary>
+ public static PropertyKey ISOSpeed
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 34855);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.LensManufacturer -- PKEY_Photo_LensManufacturer</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E6DDCAF7-29C5-4F0A-9A68-D19412EC7090}, 100</para>
+ /// </summary>
+ public static PropertyKey LensManufacturer
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E6DDCAF7-29C5-4F0A-9A68-D19412EC7090}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.LensModel -- PKEY_Photo_LensModel</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {E1277516-2B5F-4869-89B1-2E585BD38B7A}, 100</para>
+ /// </summary>
+ public static PropertyKey LensModel
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E1277516-2B5F-4869-89B1-2E585BD38B7A}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.LightSource -- PKEY_Photo_LightSource</para>
+ /// <para>Description: PropertyTagExifLightSource
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37384</para>
+ /// </summary>
+ public static PropertyKey LightSource
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 37384);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.MakerNote -- PKEY_Photo_MakerNote</para>
+ /// <para>Description: </para>
+ /// <para>Type: Buffer -- VT_VECTOR | VT_UI1 (For variants: VT_ARRAY | VT_UI1)</para>
+ /// <para>FormatID: {FA303353-B659-4052-85E9-BCAC79549B84}, 100</para>
+ /// </summary>
+ public static PropertyKey MakerNote
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{FA303353-B659-4052-85E9-BCAC79549B84}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.MakerNoteOffset -- PKEY_Photo_MakerNoteOffset</para>
+ /// <para>Description: </para>
+ /// <para>Type: UInt64 -- VT_UI8</para>
+ /// <para>FormatID: {813F4124-34E6-4D17-AB3E-6B1F3C2247A1}, 100</para>
+ /// </summary>
+ public static PropertyKey MakerNoteOffset
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{813F4124-34E6-4D17-AB3E-6B1F3C2247A1}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.MaxAperture -- PKEY_Photo_MaxAperture</para>
+ /// <para>Description: Calculated from PKEY_Photo_MaxApertureNumerator and PKEY_Photo_MaxApertureDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: {08F6D7C2-E3F2-44FC-AF1E-5AA5C81A2D3E}, 100</para>
+ /// </summary>
+ public static PropertyKey MaxAperture
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{08F6D7C2-E3F2-44FC-AF1E-5AA5C81A2D3E}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.MaxApertureDenominator -- PKEY_Photo_MaxApertureDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_MaxAperture
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {C77724D4-601F-46C5-9B89-C53F93BCEB77}, 100</para>
+ /// </summary>
+ public static PropertyKey MaxApertureDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C77724D4-601F-46C5-9B89-C53F93BCEB77}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.MaxApertureNumerator -- PKEY_Photo_MaxApertureNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_MaxAperture
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {C107E191-A459-44C5-9AE6-B952AD4B906D}, 100</para>
+ /// </summary>
+ public static PropertyKey MaxApertureNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C107E191-A459-44C5-9AE6-B952AD4B906D}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.MeteringMode -- PKEY_Photo_MeteringMode</para>
+ /// <para>Description: PropertyTagExifMeteringMode
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37383</para>
+ /// </summary>
+ public static PropertyKey MeteringMode
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 37383);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.MeteringModeText -- PKEY_Photo_MeteringModeText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.MeteringMode. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {F628FD8C-7BA8-465A-A65B-C5AA79263A9E}, 100</para>
+ /// </summary>
+ public static PropertyKey MeteringModeText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F628FD8C-7BA8-465A-A65B-C5AA79263A9E}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.Orientation -- PKEY_Photo_Orientation</para>
+ /// <para>Description: This is the image orientation viewed in terms of rows and columns.
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 274 (PropertyTagOrientation)</para>
+ /// </summary>
+ public static PropertyKey Orientation
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 274);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.OrientationText -- PKEY_Photo_OrientationText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.Orientation. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {A9EA193C-C511-498A-A06B-58E2776DCC28}, 100</para>
+ /// </summary>
+ public static PropertyKey OrientationText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A9EA193C-C511-498A-A06B-58E2776DCC28}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.PeopleNames -- PKEY_Photo_PeopleNames</para>
+ /// <para>Description: The people tags on an image.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) Legacy code may treat this as VT_LPSTR.</para>
+ /// <para>FormatID: {E8309B6E-084C-49B4-B1FC-90A80331B638}, 100</para>
+ /// </summary>
+ public static PropertyKey PeopleNames
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E8309B6E-084C-49B4-B1FC-90A80331B638}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.PhotometricInterpretation -- PKEY_Photo_PhotometricInterpretation</para>
+ /// <para>Description: This is the pixel composition. In JPEG compressed data, a JPEG marker is used
+ ///instead of this property.
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: {341796F1-1DF9-4B1C-A564-91BDEFA43877}, 100</para>
+ /// </summary>
+ public static PropertyKey PhotometricInterpretation
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{341796F1-1DF9-4B1C-A564-91BDEFA43877}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.PhotometricInterpretationText -- PKEY_Photo_PhotometricInterpretationText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.PhotometricInterpretation. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {821437D6-9EAB-4765-A589-3B1CBBD22A61}, 100</para>
+ /// </summary>
+ public static PropertyKey PhotometricInterpretationText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{821437D6-9EAB-4765-A589-3B1CBBD22A61}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ProgramMode -- PKEY_Photo_ProgramMode</para>
+ /// <para>Description: This is the class of the program used by the camera to set exposure when the
+ ///picture is taken.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {6D217F6D-3F6A-4825-B470-5F03CA2FBE9B}, 100</para>
+ /// </summary>
+ public static PropertyKey ProgramMode
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6D217F6D-3F6A-4825-B470-5F03CA2FBE9B}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ProgramModeText -- PKEY_Photo_ProgramModeText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.ProgramMode. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {7FE3AA27-2648-42F3-89B0-454E5CB150C3}, 100</para>
+ /// </summary>
+ public static PropertyKey ProgramModeText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{7FE3AA27-2648-42F3-89B0-454E5CB150C3}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.RelatedSoundFile -- PKEY_Photo_RelatedSoundFile</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {318A6B45-087F-4DC2-B8CC-05359551FC9E}, 100</para>
+ /// </summary>
+ public static PropertyKey RelatedSoundFile
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{318A6B45-087F-4DC2-B8CC-05359551FC9E}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.Saturation -- PKEY_Photo_Saturation</para>
+ /// <para>Description: This indicates the direction of saturation processing applied by the camera when
+ ///the image was shot.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {49237325-A95A-4F67-B211-816B2D45D2E0}, 100</para>
+ /// </summary>
+ public static PropertyKey Saturation
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{49237325-A95A-4F67-B211-816B2D45D2E0}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.SaturationText -- PKEY_Photo_SaturationText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.Saturation. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {61478C08-B600-4A84-BBE4-E99C45F0A072}, 100</para>
+ /// </summary>
+ public static PropertyKey SaturationText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{61478C08-B600-4A84-BBE4-E99C45F0A072}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.Sharpness -- PKEY_Photo_Sharpness</para>
+ /// <para>Description: This indicates the direction of sharpness processing applied by the camera when
+ ///the image was shot.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {FC6976DB-8349-4970-AE97-B3C5316A08F0}, 100</para>
+ /// </summary>
+ public static PropertyKey Sharpness
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{FC6976DB-8349-4970-AE97-B3C5316A08F0}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.SharpnessText -- PKEY_Photo_SharpnessText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.Sharpness. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {51EC3F47-DD50-421D-8769-334F50424B1E}, 100</para>
+ /// </summary>
+ public static PropertyKey SharpnessText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{51EC3F47-DD50-421D-8769-334F50424B1E}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ShutterSpeed -- PKEY_Photo_ShutterSpeed</para>
+ /// <para>Description: PropertyTagExifShutterSpeed. Calculated from PKEY_Photo_ShutterSpeedNumerator and PKEY_Photo_ShutterSpeedDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37377</para>
+ /// </summary>
+ public static PropertyKey ShutterSpeed
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 37377);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ShutterSpeedDenominator -- PKEY_Photo_ShutterSpeedDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_ShutterSpeed
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {E13D8975-81C7-4948-AE3F-37CAE11E8FF7}, 100</para>
+ /// </summary>
+ public static PropertyKey ShutterSpeedDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E13D8975-81C7-4948-AE3F-37CAE11E8FF7}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.ShutterSpeedNumerator -- PKEY_Photo_ShutterSpeedNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_ShutterSpeed
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: {16EA4042-D6F4-4BCA-8349-7C78D30FB333}, 100</para>
+ /// </summary>
+ public static PropertyKey ShutterSpeedNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{16EA4042-D6F4-4BCA-8349-7C78D30FB333}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.SubjectDistance -- PKEY_Photo_SubjectDistance</para>
+ /// <para>Description: PropertyTagExifSubjectDist. Calculated from PKEY_Photo_SubjectDistanceNumerator and PKEY_Photo_SubjectDistanceDenominator
+ ///</para>
+ /// <para>Type: Double -- VT_R8</para>
+ /// <para>FormatID: (FMTID_ImageProperties) {14B81DA1-0135-4D31-96D9-6CBFC9671A99}, 37382</para>
+ /// </summary>
+ public static PropertyKey SubjectDistance
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{14B81DA1-0135-4D31-96D9-6CBFC9671A99}"), 37382);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.SubjectDistanceDenominator -- PKEY_Photo_SubjectDistanceDenominator</para>
+ /// <para>Description: Denominator of PKEY_Photo_SubjectDistance
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {0C840A88-B043-466D-9766-D4B26DA3FA77}, 100</para>
+ /// </summary>
+ public static PropertyKey SubjectDistanceDenominator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0C840A88-B043-466D-9766-D4B26DA3FA77}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.SubjectDistanceNumerator -- PKEY_Photo_SubjectDistanceNumerator</para>
+ /// <para>Description: Numerator of PKEY_Photo_SubjectDistance
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {8AF4961C-F526-43E5-AA81-DB768219178D}, 100</para>
+ /// </summary>
+ public static PropertyKey SubjectDistanceNumerator
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{8AF4961C-F526-43E5-AA81-DB768219178D}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.TagViewAggregate -- PKEY_Photo_TagViewAggregate</para>
+ /// <para>Description: A read-only aggregation of tag-like properties for use in building views.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR) Legacy code may treat this as VT_LPSTR.</para>
+ /// <para>FormatID: {B812F15D-C2D8-4BBF-BACD-79744346113F}, 100</para>
+ /// </summary>
+ public static PropertyKey TagViewAggregate
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{B812F15D-C2D8-4BBF-BACD-79744346113F}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.TranscodedForSync -- PKEY_Photo_TranscodedForSync</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {9A8EBB75-6458-4E82-BACB-35C0095B03BB}, 100</para>
+ /// </summary>
+ public static PropertyKey TranscodedForSync
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9A8EBB75-6458-4E82-BACB-35C0095B03BB}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.WhiteBalance -- PKEY_Photo_WhiteBalance</para>
+ /// <para>Description: This indicates the white balance mode set when the image was shot.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {EE3D3D8A-5381-4CFA-B13B-AAF66B5F4EC9}, 100</para>
+ /// </summary>
+ public static PropertyKey WhiteBalance
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{EE3D3D8A-5381-4CFA-B13B-AAF66B5F4EC9}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Photo.WhiteBalanceText -- PKEY_Photo_WhiteBalanceText</para>
+ /// <para>Description: This is the user-friendly form of System.Photo.WhiteBalance. Not intended to be parsed
+ ///programmatically.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {6336B95E-C7A7-426D-86FD-7AE3D39C84B4}, 100</para>
+ /// </summary>
+ public static PropertyKey WhiteBalanceText
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6336B95E-C7A7-426D-86FD-7AE3D39C84B4}"), 100);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// PropGroup Properties
+ /// </summary>
+ public static class PropGroup
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Advanced -- PKEY_PropGroup_Advanced</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {900A403B-097B-4B95-8AE2-071FDAEEB118}, 100</para>
+ /// </summary>
+ public static PropertyKey Advanced
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{900A403B-097B-4B95-8AE2-071FDAEEB118}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Audio -- PKEY_PropGroup_Audio</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {2804D469-788F-48AA-8570-71B9C187E138}, 100</para>
+ /// </summary>
+ public static PropertyKey Audio
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{2804D469-788F-48AA-8570-71B9C187E138}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Calendar -- PKEY_PropGroup_Calendar</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {9973D2B5-BFD8-438A-BA94-5349B293181A}, 100</para>
+ /// </summary>
+ public static PropertyKey Calendar
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9973D2B5-BFD8-438A-BA94-5349B293181A}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Camera -- PKEY_PropGroup_Camera</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {DE00DE32-547E-4981-AD4B-542F2E9007D8}, 100</para>
+ /// </summary>
+ public static PropertyKey Camera
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{DE00DE32-547E-4981-AD4B-542F2E9007D8}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Contact -- PKEY_PropGroup_Contact</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {DF975FD3-250A-4004-858F-34E29A3E37AA}, 100</para>
+ /// </summary>
+ public static PropertyKey Contact
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{DF975FD3-250A-4004-858F-34E29A3E37AA}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Content -- PKEY_PropGroup_Content</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {D0DAB0BA-368A-4050-A882-6C010FD19A4F}, 100</para>
+ /// </summary>
+ public static PropertyKey Content
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D0DAB0BA-368A-4050-A882-6C010FD19A4F}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Description -- PKEY_PropGroup_Description</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {8969B275-9475-4E00-A887-FF93B8B41E44}, 100</para>
+ /// </summary>
+ public static PropertyKey Description
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{8969B275-9475-4E00-A887-FF93B8B41E44}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.FileSystem -- PKEY_PropGroup_FileSystem</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {E3A7D2C1-80FC-4B40-8F34-30EA111BDC2E}, 100</para>
+ /// </summary>
+ public static PropertyKey FileSystem
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E3A7D2C1-80FC-4B40-8F34-30EA111BDC2E}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.General -- PKEY_PropGroup_General</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {CC301630-B192-4C22-B372-9F4C6D338E07}, 100</para>
+ /// </summary>
+ public static PropertyKey General
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{CC301630-B192-4C22-B372-9F4C6D338E07}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.GPS -- PKEY_PropGroup_GPS</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {F3713ADA-90E3-4E11-AAE5-FDC17685B9BE}, 100</para>
+ /// </summary>
+ public static PropertyKey GPS
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F3713ADA-90E3-4E11-AAE5-FDC17685B9BE}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Image -- PKEY_PropGroup_Image</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {E3690A87-0FA8-4A2A-9A9F-FCE8827055AC}, 100</para>
+ /// </summary>
+ public static PropertyKey Image
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E3690A87-0FA8-4A2A-9A9F-FCE8827055AC}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Media -- PKEY_PropGroup_Media</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {61872CF7-6B5E-4B4B-AC2D-59DA84459248}, 100</para>
+ /// </summary>
+ public static PropertyKey Media
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{61872CF7-6B5E-4B4B-AC2D-59DA84459248}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.MediaAdvanced -- PKEY_PropGroup_MediaAdvanced</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {8859A284-DE7E-4642-99BA-D431D044B1EC}, 100</para>
+ /// </summary>
+ public static PropertyKey MediaAdvanced
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{8859A284-DE7E-4642-99BA-D431D044B1EC}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Message -- PKEY_PropGroup_Message</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {7FD7259D-16B4-4135-9F97-7C96ECD2FA9E}, 100</para>
+ /// </summary>
+ public static PropertyKey Message
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{7FD7259D-16B4-4135-9F97-7C96ECD2FA9E}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Music -- PKEY_PropGroup_Music</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {68DD6094-7216-40F1-A029-43FE7127043F}, 100</para>
+ /// </summary>
+ public static PropertyKey Music
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{68DD6094-7216-40F1-A029-43FE7127043F}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Origin -- PKEY_PropGroup_Origin</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {2598D2FB-5569-4367-95DF-5CD3A177E1A5}, 100</para>
+ /// </summary>
+ public static PropertyKey Origin
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{2598D2FB-5569-4367-95DF-5CD3A177E1A5}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.PhotoAdvanced -- PKEY_PropGroup_PhotoAdvanced</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {0CB2BF5A-9EE7-4A86-8222-F01E07FDADAF}, 100</para>
+ /// </summary>
+ public static PropertyKey PhotoAdvanced
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0CB2BF5A-9EE7-4A86-8222-F01E07FDADAF}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.RecordedTV -- PKEY_PropGroup_RecordedTV</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {E7B33238-6584-4170-A5C0-AC25EFD9DA56}, 100</para>
+ /// </summary>
+ public static PropertyKey RecordedTV
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{E7B33238-6584-4170-A5C0-AC25EFD9DA56}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropGroup.Video -- PKEY_PropGroup_Video</para>
+ /// <para>Description: </para>
+ /// <para>Type: Null -- VT_NULL</para>
+ /// <para>FormatID: {BEBE0920-7671-4C54-A3EB-49FDDFC191EE}, 100</para>
+ /// </summary>
+ public static PropertyKey Video
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{BEBE0920-7671-4C54-A3EB-49FDDFC191EE}"), 100);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// PropList Properties
+ /// </summary>
+ public static class PropList
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.PropList.ConflictPrompt -- PKEY_PropList_ConflictPrompt</para>
+ /// <para>Description: The list of properties to show in the file operation conflict resolution dialog. Properties with empty
+ ///values will not be displayed. Register under the regvalue of "ConflictPrompt".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 11</para>
+ /// </summary>
+ public static PropertyKey ConflictPrompt
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 11);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.ContentViewModeForBrowse -- PKEY_PropList_ContentViewModeForBrowse</para>
+ /// <para>Description: The list of properties to show in the content view mode of an item in the context of browsing.
+ ///Register the regvalue under the name of "ContentViewModeForBrowse".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 13</para>
+ /// </summary>
+ public static PropertyKey ContentViewModeForBrowse
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 13);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.ContentViewModeForSearch -- PKEY_PropList_ContentViewModeForSearch</para>
+ /// <para>Description: The list of properties to show in the content view mode of an item in the context of searching.
+ ///Register the regvalue under the name of "ContentViewModeForSearch".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 14</para>
+ /// </summary>
+ public static PropertyKey ContentViewModeForSearch
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 14);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.ExtendedTileInfo -- PKEY_PropList_ExtendedTileInfo</para>
+ /// <para>Description: The list of properties to show in the listview on extended tiles. Register under the regvalue of
+ ///"ExtendedTileInfo".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 9</para>
+ /// </summary>
+ public static PropertyKey ExtendedTileInfo
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 9);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.FileOperationPrompt -- PKEY_PropList_FileOperationPrompt</para>
+ /// <para>Description: The list of properties to show in the file operation confirmation dialog. Properties with empty values
+ ///will not be displayed. If this list is not specified, then the InfoTip property list is used instead.
+ ///Register under the regvalue of "FileOperationPrompt".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 10</para>
+ /// </summary>
+ public static PropertyKey FileOperationPrompt
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 10);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.FullDetails -- PKEY_PropList_FullDetails</para>
+ /// <para>Description: The list of all the properties to show in the details page. Property groups can be included in this list
+ ///in order to more easily organize the UI. Register under the regvalue of "FullDetails".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 2</para>
+ /// </summary>
+ public static PropertyKey FullDetails
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.InfoTip -- PKEY_PropList_InfoTip</para>
+ /// <para>Description: The list of properties to show in the infotip. Properties with empty values will not be displayed. Register
+ ///under the regvalue of "InfoTip".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 4 (PID_PROPLIST_INFOTIP)</para>
+ /// </summary>
+ public static PropertyKey InfoTip
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 4);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.NonPersonal -- PKEY_PropList_NonPersonal</para>
+ /// <para>Description: The list of properties that are considered 'non-personal'. When told to remove all non-personal properties
+ ///from a given file, the system will leave these particular properties untouched. Register under the regvalue
+ ///of "NonPersonal".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {49D1091F-082E-493F-B23F-D2308AA9668C}, 100</para>
+ /// </summary>
+ public static PropertyKey NonPersonal
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{49D1091F-082E-493F-B23F-D2308AA9668C}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.PreviewDetails -- PKEY_PropList_PreviewDetails</para>
+ /// <para>Description: The list of properties to display in the preview pane. Register under the regvalue of "PreviewDetails".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 8</para>
+ /// </summary>
+ public static PropertyKey PreviewDetails
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 8);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.PreviewTitle -- PKEY_PropList_PreviewTitle</para>
+ /// <para>Description: The one or two properties to display in the preview pane title section. The optional second property is
+ ///displayed as a subtitle. Register under the regvalue of "PreviewTitle".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 6</para>
+ /// </summary>
+ public static PropertyKey PreviewTitle
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 6);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.QuickTip -- PKEY_PropList_QuickTip</para>
+ /// <para>Description: The list of properties to show in the infotip when the item is on a slow network. Properties with empty
+ ///values will not be displayed. Register under the regvalue of "QuickTip".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 5 (PID_PROPLIST_QUICKTIP)</para>
+ /// </summary>
+ public static PropertyKey QuickTip
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 5);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.TileInfo -- PKEY_PropList_TileInfo</para>
+ /// <para>Description: The list of properties to show in the listview on tiles. Register under the regvalue of "TileInfo".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {C9944A21-A406-48FE-8225-AEC7E24C211B}, 3 (PID_PROPLIST_TILEINFO)</para>
+ /// </summary>
+ public static PropertyKey TileInfo
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{C9944A21-A406-48FE-8225-AEC7E24C211B}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.PropList.XPDetailsPanel -- PKEY_PropList_XPDetailsPanel</para>
+ /// <para>Description: The list of properties to display in the XP webview details panel. Obsolete.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_WebView) {F2275480-F782-4291-BD94-F13693513AEC}, 0 (PID_DISPLAY_PROPERTIES)</para>
+ /// </summary>
+ public static PropertyKey XPDetailsPanel
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{F2275480-F782-4291-BD94-F13693513AEC}"), 0);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// RecordedTV Properties
+ /// </summary>
+ public static class RecordedTV
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.ChannelNumber -- PKEY_RecordedTV_ChannelNumber</para>
+ /// <para>Description: Example: 42
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 7</para>
+ /// </summary>
+ public static PropertyKey ChannelNumber
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 7);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.Credits -- PKEY_RecordedTV_Credits</para>
+ /// <para>Description: Example: "Don Messick/Frank Welker/Casey Kasem/Heather North/Nicole Jaffe;;;"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 4</para>
+ /// </summary>
+ public static PropertyKey Credits
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 4);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.DateContentExpires -- PKEY_RecordedTV_DateContentExpires</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 15</para>
+ /// </summary>
+ public static PropertyKey DateContentExpires
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 15);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.EpisodeName -- PKEY_RecordedTV_EpisodeName</para>
+ /// <para>Description: Example: "Nowhere to Hyde"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 2</para>
+ /// </summary>
+ public static PropertyKey EpisodeName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.IsATSCContent -- PKEY_RecordedTV_IsATSCContent</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 16</para>
+ /// </summary>
+ public static PropertyKey IsATSCContent
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 16);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.IsClosedCaptioningAvailable -- PKEY_RecordedTV_IsClosedCaptioningAvailable</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 12</para>
+ /// </summary>
+ public static PropertyKey IsClosedCaptioningAvailable
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 12);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.IsDTVContent -- PKEY_RecordedTV_IsDTVContent</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 17</para>
+ /// </summary>
+ public static PropertyKey IsDTVContent
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 17);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.IsHDContent -- PKEY_RecordedTV_IsHDContent</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 18</para>
+ /// </summary>
+ public static PropertyKey IsHDContent
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 18);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.IsRepeatBroadcast -- PKEY_RecordedTV_IsRepeatBroadcast</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 13</para>
+ /// </summary>
+ public static PropertyKey IsRepeatBroadcast
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 13);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.IsSAP -- PKEY_RecordedTV_IsSAP</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 14</para>
+ /// </summary>
+ public static PropertyKey IsSAP
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 14);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.NetworkAffiliation -- PKEY_RecordedTV_NetworkAffiliation</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {2C53C813-FB63-4E22-A1AB-0B331CA1E273}, 100</para>
+ /// </summary>
+ public static PropertyKey NetworkAffiliation
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{2C53C813-FB63-4E22-A1AB-0B331CA1E273}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.OriginalBroadcastDate -- PKEY_RecordedTV_OriginalBroadcastDate</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {4684FE97-8765-4842-9C13-F006447B178C}, 100</para>
+ /// </summary>
+ public static PropertyKey OriginalBroadcastDate
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{4684FE97-8765-4842-9C13-F006447B178C}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.ProgramDescription -- PKEY_RecordedTV_ProgramDescription</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 3</para>
+ /// </summary>
+ public static PropertyKey ProgramDescription
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.RecordingTime -- PKEY_RecordedTV_RecordingTime</para>
+ /// <para>Description: </para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {A5477F61-7A82-4ECA-9DDE-98B69B2479B3}, 100</para>
+ /// </summary>
+ public static PropertyKey RecordingTime
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A5477F61-7A82-4ECA-9DDE-98B69B2479B3}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.StationCallSign -- PKEY_RecordedTV_StationCallSign</para>
+ /// <para>Description: Example: "TOONP"
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {6D748DE2-8D38-4CC3-AC60-F009B057C557}, 5</para>
+ /// </summary>
+ public static PropertyKey StationCallSign
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{6D748DE2-8D38-4CC3-AC60-F009B057C557}"), 5);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.RecordedTV.StationName -- PKEY_RecordedTV_StationName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {1B5439E7-EBA1-4AF8-BDD7-7AF1D4549493}, 100</para>
+ /// </summary>
+ public static PropertyKey StationName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{1B5439E7-EBA1-4AF8-BDD7-7AF1D4549493}"), 100);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Search Properties
+ /// </summary>
+ public static class Search
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Search.AutoSummary -- PKEY_Search_AutoSummary</para>
+ /// <para>Description: General Summary of the document.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {560C36C0-503A-11CF-BAA1-00004C752A9A}, 2</para>
+ /// </summary>
+ public static PropertyKey AutoSummary
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{560C36C0-503A-11CF-BAA1-00004C752A9A}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.ContainerHash -- PKEY_Search_ContainerHash</para>
+ /// <para>Description: Hash code used to identify attachments to be deleted based on a common container url
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {BCEEE283-35DF-4D53-826A-F36A3EEFC6BE}, 100</para>
+ /// </summary>
+ public static PropertyKey ContainerHash
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{BCEEE283-35DF-4D53-826A-F36A3EEFC6BE}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.Contents -- PKEY_Search_Contents</para>
+ /// <para>Description: The contents of the item. This property is for query restrictions only; it cannot be retrieved in a
+ ///query result. The Indexing Service friendly name is 'contents'.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_Storage) {B725F130-47EF-101A-A5F1-02608C9EEBAC}, 19 (PID_STG_CONTENTS)</para>
+ /// </summary>
+ public static PropertyKey Contents
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{B725F130-47EF-101A-A5F1-02608C9EEBAC}"), 19);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.EntryID -- PKEY_Search_EntryID</para>
+ /// <para>Description: The entry ID for an item within a given catalog in the Windows Search Index.
+ ///This value may be recycled, and therefore is not considered unique over time.
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_Query) {49691C90-7E17-101A-A91C-08002B2ECDA9}, 5 (PROPID_QUERY_WORKID)</para>
+ /// </summary>
+ public static PropertyKey EntryID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{49691C90-7E17-101A-A91C-08002B2ECDA9}"), 5);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.ExtendedProperties -- PKEY_Search_ExtendedProperties</para>
+ /// <para>Description: </para>
+ /// <para>Type: Blob -- VT_BLOB</para>
+ /// <para>FormatID: {7B03B546-FA4F-4A52-A2FE-03D5311E5865}, 100</para>
+ /// </summary>
+ public static PropertyKey ExtendedProperties
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{7B03B546-FA4F-4A52-A2FE-03D5311E5865}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.GatherTime -- PKEY_Search_GatherTime</para>
+ /// <para>Description: The Datetime that the Windows Search Gatherer process last pushed properties of this document to the Windows Search Gatherer Plugins.
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {0B63E350-9CCC-11D0-BCDB-00805FCCCE04}, 8</para>
+ /// </summary>
+ public static PropertyKey GatherTime
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0B63E350-9CCC-11D0-BCDB-00805FCCCE04}"), 8);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.HitCount -- PKEY_Search_HitCount</para>
+ /// <para>Description: When using CONTAINS over the Windows Search Index, this is the number of matches of the term.
+ ///If there are multiple CONTAINS, an AND computes the min number of hits and an OR the max number of hits.
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_Query) {49691C90-7E17-101A-A91C-08002B2ECDA9}, 4 (PROPID_QUERY_HITCOUNT)</para>
+ /// </summary>
+ public static PropertyKey HitCount
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{49691C90-7E17-101A-A91C-08002B2ECDA9}"), 4);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.IsClosedDirectory -- PKEY_Search_IsClosedDirectory</para>
+ /// <para>Description: If this property is emitted with a value of TRUE, then it indicates that this URL's last modified time applies to all of it's children, and if this URL is deleted then all of it's children are deleted as well. For example, this would be emitted as TRUE when emitting the URL of an email so that all attachments are tied to the last modified time of that email.
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {0B63E343-9CCC-11D0-BCDB-00805FCCCE04}, 23</para>
+ /// </summary>
+ public static PropertyKey IsClosedDirectory
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0B63E343-9CCC-11D0-BCDB-00805FCCCE04}"), 23);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.IsFullyContained -- PKEY_Search_IsFullyContained</para>
+ /// <para>Description: Any child URL of a URL which has System.Search.IsClosedDirectory=TRUE must emit System.Search.IsFullyContained=TRUE. This ensures that the URL is not deleted at the end of a crawl because it hasn't been visited (which is the normal mechanism for detecting deletes). For example an email attachment would emit this property
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {0B63E343-9CCC-11D0-BCDB-00805FCCCE04}, 24</para>
+ /// </summary>
+ public static PropertyKey IsFullyContained
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0B63E343-9CCC-11D0-BCDB-00805FCCCE04}"), 24);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.QueryFocusedSummary -- PKEY_Search_QueryFocusedSummary</para>
+ /// <para>Description: Query Focused Summary of the document.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {560C36C0-503A-11CF-BAA1-00004C752A9A}, 3</para>
+ /// </summary>
+ public static PropertyKey QueryFocusedSummary
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{560C36C0-503A-11CF-BAA1-00004C752A9A}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.QueryFocusedSummaryWithFallback -- PKEY_Search_QueryFocusedSummaryWithFallback</para>
+ /// <para>Description: Query Focused Summary of the document, if none is available it returns the AutoSummary.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {560C36C0-503A-11CF-BAA1-00004C752A9A}, 4</para>
+ /// </summary>
+ public static PropertyKey QueryFocusedSummaryWithFallback
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{560C36C0-503A-11CF-BAA1-00004C752A9A}"), 4);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.Rank -- PKEY_Search_Rank</para>
+ /// <para>Description: Relevance rank of row. Ranges from 0-1000. Larger numbers = better matches. Query-time only.
+ ///</para>
+ /// <para>Type: Int32 -- VT_I4</para>
+ /// <para>FormatID: (FMTID_Query) {49691C90-7E17-101A-A91C-08002B2ECDA9}, 3 (PROPID_QUERY_RANK)</para>
+ /// </summary>
+ public static PropertyKey Rank
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{49691C90-7E17-101A-A91C-08002B2ECDA9}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.Store -- PKEY_Search_Store</para>
+ /// <para>Description: The identifier for the protocol handler that produced this item. (E.g. MAPI, CSC, FILE etc.)
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {A06992B3-8CAF-4ED7-A547-B259E32AC9FC}, 100</para>
+ /// </summary>
+ public static PropertyKey Store
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{A06992B3-8CAF-4ED7-A547-B259E32AC9FC}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.UrlToIndex -- PKEY_Search_UrlToIndex</para>
+ /// <para>Description: This property should be emitted by a container IFilter for each child URL within the container. The children will eventually be crawled by the indexer if they are within scope.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {0B63E343-9CCC-11D0-BCDB-00805FCCCE04}, 2</para>
+ /// </summary>
+ public static PropertyKey UrlToIndex
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0B63E343-9CCC-11D0-BCDB-00805FCCCE04}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Search.UrlToIndexWithModificationTime -- PKEY_Search_UrlToIndexWithModificationTime</para>
+ /// <para>Description: This property is the same as System.Search.UrlToIndex except that it includes the time the URL was last modified. This is an optimization for the indexer as it doesn't have to call back into the protocol handler to ask for this information to determine if the content needs to be indexed again. The property is a vector with two elements, a VT_LPWSTR with the URL and a VT_FILETIME for the last modified time.
+ ///</para>
+ /// <para>Type: Multivalue Any -- VT_VECTOR | VT_NULL (For variants: VT_ARRAY | VT_NULL)</para>
+ /// <para>FormatID: {0B63E343-9CCC-11D0-BCDB-00805FCCCE04}, 12</para>
+ /// </summary>
+ public static PropertyKey UrlToIndexWithModificationTime
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0B63E343-9CCC-11D0-BCDB-00805FCCCE04}"), 12);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Shell Properties
+ /// </summary>
+ public static class Shell
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Shell.OmitFromView -- PKEY_Shell_OmitFromView</para>
+ /// <para>Description: Set this to a string value of 'True' to omit this item from shell views
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {DE35258C-C695-4CBC-B982-38B0AD24CED0}, 2</para>
+ /// </summary>
+ public static PropertyKey OmitFromView
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{DE35258C-C695-4CBC-B982-38B0AD24CED0}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Shell.SFGAOFlagsStrings -- PKEY_Shell_SFGAOFlagsStrings</para>
+ /// <para>Description: Expresses the SFGAO flags as string values and is used as a query optimization.
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: {D6942081-D53B-443D-AD47-5E059D9CD27A}, 2</para>
+ /// </summary>
+ [SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags")]
+ public static PropertyKey SFGAOFlagsStrings
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D6942081-D53B-443D-AD47-5E059D9CD27A}"), 2);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Software Properties
+ /// </summary>
+ public static class Software
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Software.DateLastUsed -- PKEY_Software_DateLastUsed</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: DateTime -- VT_FILETIME (For variants: VT_DATE)</para>
+ /// <para>FormatID: {841E4F90-FF59-4D16-8947-E81BBFFAB36D}, 16</para>
+ /// </summary>
+ public static PropertyKey DateLastUsed
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{841E4F90-FF59-4D16-8947-E81BBFFAB36D}"), 16);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Software.ProductName -- PKEY_Software_ProductName</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (PSFMTID_VERSION) {0CEF7D53-FA64-11D1-A203-0000F81FEDEE}, 7</para>
+ /// </summary>
+ public static PropertyKey ProductName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{0CEF7D53-FA64-11D1-A203-0000F81FEDEE}"), 7);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Sync Properties
+ /// </summary>
+ public static class Sync
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Sync.Comments -- PKEY_Sync_Comments</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 13</para>
+ /// </summary>
+ public static PropertyKey Comments
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{7BD5533E-AF15-44DB-B8C8-BD6624E1D032}"), 13);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.ConflictDescription -- PKEY_Sync_ConflictDescription</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {CE50C159-2FB8-41FD-BE68-D3E042E274BC}, 4</para>
+ /// </summary>
+ public static PropertyKey ConflictDescription
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{CE50C159-2FB8-41FD-BE68-D3E042E274BC}"), 4);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.ConflictFirstLocation -- PKEY_Sync_ConflictFirstLocation</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {CE50C159-2FB8-41FD-BE68-D3E042E274BC}, 6</para>
+ /// </summary>
+ public static PropertyKey ConflictFirstLocation
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{CE50C159-2FB8-41FD-BE68-D3E042E274BC}"), 6);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.ConflictSecondLocation -- PKEY_Sync_ConflictSecondLocation</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {CE50C159-2FB8-41FD-BE68-D3E042E274BC}, 7</para>
+ /// </summary>
+ public static PropertyKey ConflictSecondLocation
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{CE50C159-2FB8-41FD-BE68-D3E042E274BC}"), 7);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.HandlerCollectionID -- PKEY_Sync_HandlerCollectionID</para>
+ /// <para>Description: </para>
+ /// <para>Type: Guid -- VT_CLSID</para>
+ /// <para>FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 2</para>
+ /// </summary>
+ public static PropertyKey HandlerCollectionID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{7BD5533E-AF15-44DB-B8C8-BD6624E1D032}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.HandlerID -- PKEY_Sync_HandlerID</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 3</para>
+ /// </summary>
+ public static PropertyKey HandlerID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{7BD5533E-AF15-44DB-B8C8-BD6624E1D032}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.HandlerName -- PKEY_Sync_HandlerName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {CE50C159-2FB8-41FD-BE68-D3E042E274BC}, 2</para>
+ /// </summary>
+ public static PropertyKey HandlerName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{CE50C159-2FB8-41FD-BE68-D3E042E274BC}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.HandlerType -- PKEY_Sync_HandlerType</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 8</para>
+ /// </summary>
+ public static PropertyKey HandlerType
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{7BD5533E-AF15-44DB-B8C8-BD6624E1D032}"), 8);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.HandlerTypeLabel -- PKEY_Sync_HandlerTypeLabel</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 9</para>
+ /// </summary>
+ public static PropertyKey HandlerTypeLabel
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{7BD5533E-AF15-44DB-B8C8-BD6624E1D032}"), 9);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.ItemID -- PKEY_Sync_ItemID</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 6</para>
+ /// </summary>
+ public static PropertyKey ItemID
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{7BD5533E-AF15-44DB-B8C8-BD6624E1D032}"), 6);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.ItemName -- PKEY_Sync_ItemName</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {CE50C159-2FB8-41FD-BE68-D3E042E274BC}, 3</para>
+ /// </summary>
+ public static PropertyKey ItemName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{CE50C159-2FB8-41FD-BE68-D3E042E274BC}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.ProgressPercentage -- PKEY_Sync_ProgressPercentage</para>
+ /// <para>Description: An integer value between 0 and 100 representing the percentage completed.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 23</para>
+ /// </summary>
+ public static PropertyKey ProgressPercentage
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{7BD5533E-AF15-44DB-B8C8-BD6624E1D032}"), 23);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.State -- PKEY_Sync_State</para>
+ /// <para>Description: Sync state.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 24</para>
+ /// </summary>
+ public static PropertyKey State
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{7BD5533E-AF15-44DB-B8C8-BD6624E1D032}"), 24);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Sync.Status -- PKEY_Sync_Status</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {7BD5533E-AF15-44DB-B8C8-BD6624E1D032}, 10</para>
+ /// </summary>
+ public static PropertyKey Status
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{7BD5533E-AF15-44DB-B8C8-BD6624E1D032}"), 10);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Task Properties
+ /// </summary>
+ public static class Task
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Task.BillingInformation -- PKEY_Task_BillingInformation</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {D37D52C6-261C-4303-82B3-08B926AC6F12}, 100</para>
+ /// </summary>
+ public static PropertyKey BillingInformation
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{D37D52C6-261C-4303-82B3-08B926AC6F12}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Task.CompletionStatus -- PKEY_Task_CompletionStatus</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {084D8A0A-E6D5-40DE-BF1F-C8820E7C877C}, 100</para>
+ /// </summary>
+ public static PropertyKey CompletionStatus
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{084D8A0A-E6D5-40DE-BF1F-C8820E7C877C}"), 100);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Task.Owner -- PKEY_Task_Owner</para>
+ /// <para>Description: </para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: {08C7CC5F-60F2-4494-AD75-55E3E0B5ADD0}, 100</para>
+ /// </summary>
+ public static PropertyKey Owner
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{08C7CC5F-60F2-4494-AD75-55E3E0B5ADD0}"), 100);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Video Properties
+ /// </summary>
+ public static class Video
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Video.Compression -- PKEY_Video_Compression</para>
+ /// <para>Description: Indicates the level of compression for the video stream. "Compression".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 10 (PIDVSI_COMPRESSION)</para>
+ /// </summary>
+ public static PropertyKey Compression
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 10);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.Director -- PKEY_Video_Director</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Multivalue String -- VT_VECTOR | VT_LPWSTR (For variants: VT_ARRAY | VT_BSTR)</para>
+ /// <para>FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) {64440492-4C8B-11D1-8B70-080036B11A03}, 20 (PIDMSI_DIRECTOR)</para>
+ /// </summary>
+ public static PropertyKey Director
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440492-4C8B-11D1-8B70-080036B11A03}"), 20);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.EncodingBitrate -- PKEY_Video_EncodingBitrate</para>
+ /// <para>Description: Indicates the data rate in "bits per second" for the video stream. "DataRate".
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 8 (PIDVSI_DATA_RATE)</para>
+ /// </summary>
+ public static PropertyKey EncodingBitrate
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 8);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.FourCC -- PKEY_Video_FourCC</para>
+ /// <para>Description: Indicates the 4CC for the video stream.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 44</para>
+ /// </summary>
+ public static PropertyKey FourCC
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 44);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.FrameHeight -- PKEY_Video_FrameHeight</para>
+ /// <para>Description: Indicates the frame height for the video stream.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 4</para>
+ /// </summary>
+ public static PropertyKey FrameHeight
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 4);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.FrameRate -- PKEY_Video_FrameRate</para>
+ /// <para>Description: Indicates the frame rate in "frames per millisecond" for the video stream. "FrameRate".
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 6 (PIDVSI_FRAME_RATE)</para>
+ /// </summary>
+ public static PropertyKey FrameRate
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 6);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.FrameWidth -- PKEY_Video_FrameWidth</para>
+ /// <para>Description: Indicates the frame width for the video stream.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 3</para>
+ /// </summary>
+ public static PropertyKey FrameWidth
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 3);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.HorizontalAspectRatio -- PKEY_Video_HorizontalAspectRatio</para>
+ /// <para>Description: Indicates the horizontal portion of the aspect ratio. The X portion of XX:YY,
+ ///like 16:9.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 42</para>
+ /// </summary>
+ public static PropertyKey HorizontalAspectRatio
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 42);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.SampleSize -- PKEY_Video_SampleSize</para>
+ /// <para>Description: Indicates the sample size in bits for the video stream. "SampleSize".
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 9 (PIDVSI_SAMPLE_SIZE)</para>
+ /// </summary>
+ public static PropertyKey SampleSize
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 9);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.StreamName -- PKEY_Video_StreamName</para>
+ /// <para>Description: Indicates the name for the video stream. "StreamName".
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 2 (PIDVSI_STREAM_NAME)</para>
+ /// </summary>
+ public static PropertyKey StreamName
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.StreamNumber -- PKEY_Video_StreamNumber</para>
+ /// <para>Description: "Stream Number".
+ ///</para>
+ /// <para>Type: UInt16 -- VT_UI2</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 11 (PIDVSI_STREAM_NUMBER)</para>
+ /// </summary>
+ public static PropertyKey StreamNumber
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 11);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.TotalBitrate -- PKEY_Video_TotalBitrate</para>
+ /// <para>Description: Indicates the total data rate in "bits per second" for all video and audio streams.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 43 (PIDVSI_TOTAL_BITRATE)</para>
+ /// </summary>
+ public static PropertyKey TotalBitrate
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 43);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.TranscodedForSync -- PKEY_Video_TranscodedForSync</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 46</para>
+ /// </summary>
+ public static PropertyKey TranscodedForSync
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 46);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Video.VerticalAspectRatio -- PKEY_Video_VerticalAspectRatio</para>
+ /// <para>Description: Indicates the vertical portion of the aspect ratio. The Y portion of
+ ///XX:YY, like 16:9.
+ ///</para>
+ /// <para>Type: UInt32 -- VT_UI4</para>
+ /// <para>FormatID: (FMTID_VideoSummaryInformation) {64440491-4C8B-11D1-8B70-080036B11A03}, 45</para>
+ /// </summary>
+ public static PropertyKey VerticalAspectRatio
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{64440491-4C8B-11D1-8B70-080036B11A03}"), 45);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+
+ /// <summary>
+ /// Volume Properties
+ /// </summary>
+ public static class Volume
+ {
+
+
+ #region Properties
+
+ /// <summary>
+ /// <para>Name: System.Volume.FileSystem -- PKEY_Volume_FileSystem</para>
+ /// <para>Description: Indicates the filesystem of the volume.
+ ///</para>
+ /// <para>Type: String -- VT_LPWSTR (For variants: VT_BSTR)</para>
+ /// <para>FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 4 (PID_VOLUME_FILESYSTEM) (Filesystem Volume Properties)</para>
+ /// </summary>
+ public static PropertyKey FileSystem
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9B174B35-40FF-11D2-A27E-00C04FC30871}"), 4);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Volume.IsMappedDrive -- PKEY_Volume_IsMappedDrive</para>
+ /// <para>Description: </para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: {149C0B69-2C2D-48FC-808F-D318D78C4636}, 2</para>
+ /// </summary>
+ public static PropertyKey IsMappedDrive
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{149C0B69-2C2D-48FC-808F-D318D78C4636}"), 2);
+
+ return key;
+ }
+ }
+
+ /// <summary>
+ /// <para>Name: System.Volume.IsRoot -- PKEY_Volume_IsRoot</para>
+ /// <para>Description:
+ ///</para>
+ /// <para>Type: Boolean -- VT_BOOL</para>
+ /// <para>FormatID: (FMTID_Volume) {9B174B35-40FF-11D2-A27E-00C04FC30871}, 10 (Filesystem Volume Properties)</para>
+ /// </summary>
+ public static PropertyKey IsRoot
+ {
+ get
+ {
+ PropertyKey key = new PropertyKey(new Guid("{9B174B35-40FF-11D2-A27E-00C04FC30871}"), 10);
+
+ return key;
+ }
+ }
+ #endregion
+
+
+
+ }
+ #endregion
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/WindowProperties.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/WindowProperties.cs
new file mode 100644
index 0000000000..79443662ad
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/PropertySystem/WindowProperties.cs
@@ -0,0 +1,37 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Windows;
+using System.Windows.Interop;
+using Microsoft.WindowsAPICodePack.Taskbar;
+
+namespace Microsoft.WindowsAPICodePack.Shell.PropertySystem
+{
+ /// <summary>
+ /// Helper class to modify properties for a given window
+ /// </summary>
+ public static class WindowProperties
+ {
+ /// <summary>
+ /// Sets a shell property for a given window
+ /// </summary>
+ /// <param name="propKey">The property to set</param>
+ /// <param name="windowHandle">Handle to the window that the property will be set on</param>
+ /// <param name="value">The value to set for the property</param>
+ public static void SetWindowProperty(IntPtr windowHandle, PropertyKey propKey, string value)
+ {
+ TaskbarNativeMethods.SetWindowProperty(windowHandle, propKey, value);
+ }
+
+ /// <summary>
+ /// Sets a shell property for a given window
+ /// </summary>
+ /// <param name="propKey">The property to set</param>
+ /// <param name="window">Window that the property will be set on</param>
+ /// <param name="value">The value to set for the property</param>
+ public static void SetWindowProperty(Window window, PropertyKey propKey, string value)
+ {
+ TaskbarNativeMethods.SetWindowProperty((new WindowInteropHelper(window)).Handle, propKey, value);
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Resources/LocalizedMessages.Designer.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Resources/LocalizedMessages.Designer.cs
new file mode 100644
index 0000000000..01539c1acc
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Resources/LocalizedMessages.Designer.cs
@@ -0,0 +1,1251 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.1
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Microsoft.WindowsAPICodePack.Shell.Resources {
+ using System;
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class LocalizedMessages {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal LocalizedMessages() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.WindowsAPICodePack.Shell.Resources.LocalizedMessages", typeof(LocalizedMessages).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to AddToMostRecentlyUsedList cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string AddToMostRecentlyUsedListCannotBeChanged {
+ get {
+ return ResourceManager.GetString("AddToMostRecentlyUsedListCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to AlwaysAppendDefaultExtension cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string AlwaysAppendDefaultExtensionCannotBeChanged {
+ get {
+ return ResourceManager.GetString("AlwaysAppendDefaultExtensionCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Index was outside the bounds of the CommonFileDialogComboBox..
+ /// </summary>
+ internal static string ComboBoxIndexOutsideBounds {
+ get {
+ return ResourceManager.GetString("ComboBoxIndexOutsideBounds", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to File name not available - dialog was canceled..
+ /// </summary>
+ internal static string CommonFileDialogCanceled {
+ get {
+ return ResourceManager.GetString("CommonFileDialogCanceled", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Shell item could not be created..
+ /// </summary>
+ internal static string CommonFileDialogCannotCreateShellItem {
+ get {
+ return ResourceManager.GetString("CommonFileDialogCannotCreateShellItem", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Handle provided cannot be IntPtr.Zero..
+ /// </summary>
+ internal static string CommonFileDialogInvalidHandle {
+ get {
+ return ResourceManager.GetString("CommonFileDialogInvalidHandle", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Multiple files selected - the FileNames property should be used instead..
+ /// </summary>
+ internal static string CommonFileDialogMultipleFiles {
+ get {
+ return ResourceManager.GetString("CommonFileDialogMultipleFiles", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Multiple files selected - the Items property should be used instead..
+ /// </summary>
+ internal static string CommonFileDialogMultipleItems {
+ get {
+ return ResourceManager.GetString("CommonFileDialogMultipleItems", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to File name not available - dialog has not closed yet..
+ /// </summary>
+ internal static string CommonFileDialogNotClosed {
+ get {
+ return ResourceManager.GetString("CommonFileDialogNotClosed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Common File Dialog requires Windows Vista or later..
+ /// </summary>
+ internal static string CommonFileDialogRequiresVista {
+ get {
+ return ResourceManager.GetString("CommonFileDialogRequiresVista", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Office Files.
+ /// </summary>
+ internal static string CommonFiltersOffice {
+ get {
+ return ResourceManager.GetString("CommonFiltersOffice", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to All Picture Files.
+ /// </summary>
+ internal static string CommonFiltersPicture {
+ get {
+ return ResourceManager.GetString("CommonFiltersPicture", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Text Files.
+ /// </summary>
+ internal static string CommonFiltersText {
+ get {
+ return ResourceManager.GetString("CommonFiltersText", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to CreatePrompt cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string CreatePromptCannotBeChanged {
+ get {
+ return ResourceManager.GetString("CreatePromptCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Custom controls cannot be removed from a File dialog once added..
+ /// </summary>
+ internal static string DialogControlCollectionCannotRemoveControls {
+ get {
+ return ResourceManager.GetString("DialogControlCollectionCannotRemoveControls", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Control name cannot be null or zero length..
+ /// </summary>
+ internal static string DialogControlCollectionEmptyName {
+ get {
+ return ResourceManager.GetString("DialogControlCollectionEmptyName", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to CommonFileDialogMenuItem controls can only be added to CommonFileDialogMenu controls..
+ /// </summary>
+ internal static string DialogControlCollectionMenuItemControlsCannotBeAdded {
+ get {
+ return ResourceManager.GetString("DialogControlCollectionMenuItemControlsCannotBeAdded", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Modifying controls collection while dialog is showing is not supported..
+ /// </summary>
+ internal static string DialogControlCollectionModifyingControls {
+ get {
+ return ResourceManager.GetString("DialogControlCollectionModifyingControls", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Dialog cannot have more than one control with the same name..
+ /// </summary>
+ internal static string DialogControlCollectionMoreThanOneControl {
+ get {
+ return ResourceManager.GetString("DialogControlCollectionMoreThanOneControl", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Dialog control must be removed from current collections first..
+ /// </summary>
+ internal static string DialogControlCollectionRemoveControlFirst {
+ get {
+ return ResourceManager.GetString("DialogControlCollectionRemoveControlFirst", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to EnsureFileExists cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string EnsureFileExistsCannotBeChanged {
+ get {
+ return ResourceManager.GetString("EnsureFileExistsCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to EnsurePathExists cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string EnsurePathExistsCannotBeChanged {
+ get {
+ return ResourceManager.GetString("EnsurePathExistsCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to EnsureReadOnly cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string EnsureReadonlyCannotBeChanged {
+ get {
+ return ResourceManager.GetString("EnsureReadonlyCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to EnsureValidNames cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string EnsureValidNamesCannotBeChanged {
+ get {
+ return ResourceManager.GetString("EnsureValidNamesCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Browsing to object failed..
+ /// </summary>
+ internal static string ExplorerBrowserBrowseToObjectFailed {
+ get {
+ return ResourceManager.GetString("ExplorerBrowserBrowseToObjectFailed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to ExplorerBrowser failed to get current view..
+ /// </summary>
+ internal static string ExplorerBrowserFailedToGetView {
+ get {
+ return ResourceManager.GetString("ExplorerBrowserFailedToGetView", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unable to get icon size..
+ /// </summary>
+ internal static string ExplorerBrowserIconSize {
+ get {
+ return ResourceManager.GetString("ExplorerBrowserIconSize", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unexpected error retrieving item count..
+ /// </summary>
+ internal static string ExplorerBrowserItemCount {
+ get {
+ return ResourceManager.GetString("ExplorerBrowserItemCount", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unexpected error retrieving selected item count..
+ /// </summary>
+ internal static string ExplorerBrowserSelectedItemCount {
+ get {
+ return ResourceManager.GetString("ExplorerBrowserSelectedItemCount", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unexpected error retrieving selection..
+ /// </summary>
+ internal static string ExplorerBrowserUnexpectedError {
+ get {
+ return ResourceManager.GetString("ExplorerBrowserUnexpectedError", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unexpected error retrieving view items..
+ /// </summary>
+ internal static string ExplorerBrowserViewItems {
+ get {
+ return ResourceManager.GetString("ExplorerBrowserViewItems", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The given path does not exist ({0}).
+ /// </summary>
+ internal static string FilePathNotExist {
+ get {
+ return ResourceManager.GetString("FilePathNotExist", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Guid does not identify a known folder..
+ /// </summary>
+ internal static string FolderIdsUnknownGuid {
+ get {
+ return ResourceManager.GetString("FolderIdsUnknownGuid", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to ControlPanel Category.
+ /// </summary>
+ internal static string FolderTypeCategory {
+ get {
+ return ResourceManager.GetString("FolderTypeCategory", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to ControlPanel Classic.
+ /// </summary>
+ internal static string FolderTypeClassic {
+ get {
+ return ResourceManager.GetString("FolderTypeClassic", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Communications.
+ /// </summary>
+ internal static string FolderTypeCommunications {
+ get {
+ return ResourceManager.GetString("FolderTypeCommunications", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Compressed Folder.
+ /// </summary>
+ internal static string FolderTypeCompressedFolder {
+ get {
+ return ResourceManager.GetString("FolderTypeCompressedFolder", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Contacts.
+ /// </summary>
+ internal static string FolderTypeContacts {
+ get {
+ return ResourceManager.GetString("FolderTypeContacts", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Documents.
+ /// </summary>
+ internal static string FolderTypeDocuments {
+ get {
+ return ResourceManager.GetString("FolderTypeDocuments", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Games.
+ /// </summary>
+ internal static string FolderTypeGames {
+ get {
+ return ResourceManager.GetString("FolderTypeGames", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Generic Library.
+ /// </summary>
+ internal static string FolderTypeGenericLibrary {
+ get {
+ return ResourceManager.GetString("FolderTypeGenericLibrary", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Invalid.
+ /// </summary>
+ internal static string FolderTypeInvalid {
+ get {
+ return ResourceManager.GetString("FolderTypeInvalid", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Library.
+ /// </summary>
+ internal static string FolderTypeLibrary {
+ get {
+ return ResourceManager.GetString("FolderTypeLibrary", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Music.
+ /// </summary>
+ internal static string FolderTypeMusic {
+ get {
+ return ResourceManager.GetString("FolderTypeMusic", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Music Icons.
+ /// </summary>
+ internal static string FolderTypeMusicIcons {
+ get {
+ return ResourceManager.GetString("FolderTypeMusicIcons", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Network Explorer.
+ /// </summary>
+ internal static string FolderTypeNetworkExplorer {
+ get {
+ return ResourceManager.GetString("FolderTypeNetworkExplorer", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Not Specified.
+ /// </summary>
+ internal static string FolderTypeNotSpecified {
+ get {
+ return ResourceManager.GetString("FolderTypeNotSpecified", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Open Search.
+ /// </summary>
+ internal static string FolderTypeOpenSearch {
+ get {
+ return ResourceManager.GetString("FolderTypeOpenSearch", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Other Users.
+ /// </summary>
+ internal static string FolderTypeOtherUsers {
+ get {
+ return ResourceManager.GetString("FolderTypeOtherUsers", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Pictures.
+ /// </summary>
+ internal static string FolderTypePictures {
+ get {
+ return ResourceManager.GetString("FolderTypePictures", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Printers.
+ /// </summary>
+ internal static string FolderTypePrinters {
+ get {
+ return ResourceManager.GetString("FolderTypePrinters", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to RecordedTV.
+ /// </summary>
+ internal static string FolderTypeRecordedTV {
+ get {
+ return ResourceManager.GetString("FolderTypeRecordedTV", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to RecycleBin.
+ /// </summary>
+ internal static string FolderTypeRecycleBin {
+ get {
+ return ResourceManager.GetString("FolderTypeRecycleBin", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Saved Games.
+ /// </summary>
+ internal static string FolderTypeSavedGames {
+ get {
+ return ResourceManager.GetString("FolderTypeSavedGames", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Search Connector.
+ /// </summary>
+ internal static string FolderTypeSearchConnector {
+ get {
+ return ResourceManager.GetString("FolderTypeSearchConnector", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Searches.
+ /// </summary>
+ internal static string FolderTypeSearches {
+ get {
+ return ResourceManager.GetString("FolderTypeSearches", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Generic SearchResults.
+ /// </summary>
+ internal static string FolderTypeSearchResults {
+ get {
+ return ResourceManager.GetString("FolderTypeSearchResults", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Software Explorer.
+ /// </summary>
+ internal static string FolderTypeSoftwareExplorer {
+ get {
+ return ResourceManager.GetString("FolderTypeSoftwareExplorer", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to User Files.
+ /// </summary>
+ internal static string FolderTypeUserFiles {
+ get {
+ return ResourceManager.GetString("FolderTypeUserFiles", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Users Libraries.
+ /// </summary>
+ internal static string FolderTypeUserLibraries {
+ get {
+ return ResourceManager.GetString("FolderTypeUserLibraries", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Videos.
+ /// </summary>
+ internal static string FolderTypeVideos {
+ get {
+ return ResourceManager.GetString("FolderTypeVideos", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to IsExpandedMode cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string IsExpandedModeCannotBeChanged {
+ get {
+ return ResourceManager.GetString("IsExpandedModeCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Custom categories cannot be added while recent documents tracking is turned off..
+ /// </summary>
+ internal static string JumpListCustomCategoriesDisabled {
+ get {
+ return ResourceManager.GetString("JumpListCustomCategoriesDisabled", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The file type is not registered with this application..
+ /// </summary>
+ internal static string JumpListFileTypeNotRegistered {
+ get {
+ return ResourceManager.GetString("JumpListFileTypeNotRegistered", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to JumpListLink&apos;s path is required and cannot be null..
+ /// </summary>
+ internal static string JumpListLinkPathRequired {
+ get {
+ return ResourceManager.GetString("JumpListLinkPathRequired", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to JumpListLink&apos;s title is required and cannot be null..
+ /// </summary>
+ internal static string JumpListLinkTitleRequired {
+ get {
+ return ResourceManager.GetString("JumpListLinkTitleRequired", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Negative numbers are not allowed for the ordinal position..
+ /// </summary>
+ internal static string JumpListNegativeOrdinalPosition {
+ get {
+ return ResourceManager.GetString("JumpListNegativeOrdinalPosition", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Given Known Folder ID is invalid..
+ /// </summary>
+ internal static string KnownFolderInvalidGuid {
+ get {
+ return ResourceManager.GetString("KnownFolderInvalidGuid", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Parsing name is invalid..
+ /// </summary>
+ internal static string KnownFolderParsingName {
+ get {
+ return ResourceManager.GetString("KnownFolderParsingName", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Creation of window has failed, view inner exception for details..
+ /// </summary>
+ internal static string MessageListenerCannotCreateWindow {
+ get {
+ return ResourceManager.GetString("MessageListenerCannotCreateWindow", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Window class could not be registered, check inner exception for more details..
+ /// </summary>
+ internal static string MessageListenerClassNotRegistered {
+ get {
+ return ResourceManager.GetString("MessageListenerClassNotRegistered", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Message filter registration failed..
+ /// </summary>
+ internal static string MessageListenerFilterUnableToRegister {
+ get {
+ return ResourceManager.GetString("MessageListenerFilterUnableToRegister", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to No listener handled of that value is registered..
+ /// </summary>
+ internal static string MessageListenerFilterUnknownListenerHandle {
+ get {
+ return ResourceManager.GetString("MessageListenerFilterUnknownListenerHandle", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot create window on the listener thread because there is no existing window on the listener thread..
+ /// </summary>
+ internal static string MessageListenerNoWindowHandle {
+ get {
+ return ResourceManager.GetString("MessageListenerNoWindowHandle", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to NavigateToShortcut cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string NavigateToShortcutCannotBeChanged {
+ get {
+ return ResourceManager.GetString("NavigateToShortcutCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Parent cannot be null..
+ /// </summary>
+ internal static string NavigationLogNullParent {
+ get {
+ return ResourceManager.GetString("NavigationLogNullParent", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The method or operation is not implemented..
+ /// </summary>
+ internal static string NotImplementedException {
+ get {
+ return ResourceManager.GetString("NotImplementedException", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to OverwritePrompt cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string OverwritePromptCannotBeChanged {
+ get {
+ return ResourceManager.GetString("OverwritePromptCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to This CanonicalName is not a valid index..
+ /// </summary>
+ internal static string PropertyCollectionCanonicalInvalidIndex {
+ get {
+ return ResourceManager.GetString("PropertyCollectionCanonicalInvalidIndex", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to This PropertyKey is not a valid index..
+ /// </summary>
+ internal static string PropertyCollectionInvalidIndex {
+ get {
+ return ResourceManager.GetString("PropertyCollectionInvalidIndex", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Argument CanonicalName cannot be null or empty..
+ /// </summary>
+ internal static string PropertyCollectionNullCanonicalName {
+ get {
+ return ResourceManager.GetString("PropertyCollectionNullCanonicalName", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Index was outside the bounds of the CommonFileDialogRadioButtonList..
+ /// </summary>
+ internal static string RadioButtonListIndexOutOfBounds {
+ get {
+ return ResourceManager.GetString("RadioButtonListIndexOutOfBounds", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to RestoreDirectory cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string RestoreDirectoryCannotBeChanged {
+ get {
+ return ResourceManager.GetString("RestoreDirectoryCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Retrieved a null shell item from dialog..
+ /// </summary>
+ internal static string SaveFileNullItem {
+ get {
+ return ResourceManager.GetString("SaveFileNullItem", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Given property key is invalid..
+ /// </summary>
+ internal static string SearchConditionFactoryInvalidProperty {
+ get {
+ return ResourceManager.GetString("SearchConditionFactoryInvalidProperty", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Shell Exception has occurred, look at inner exception for information..
+ /// </summary>
+ internal static string ShellExceptionDefaultText {
+ get {
+ return ResourceManager.GetString("ShellExceptionDefaultText", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to GetParsingName has failed..
+ /// </summary>
+ internal static string ShellHelperGetParsingNameFailed {
+ get {
+ return ResourceManager.GetString("ShellHelperGetParsingNameFailed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The given CanonicalName is not valid..
+ /// </summary>
+ internal static string ShellInvalidCanonicalName {
+ get {
+ return ResourceManager.GetString("ShellInvalidCanonicalName", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to DefaultSaveFolder path not found..
+ /// </summary>
+ internal static string ShellLibraryDefaultSaveFolderNotFound {
+ get {
+ return ResourceManager.GetString("ShellLibraryDefaultSaveFolderNotFound", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to LibraryName cannot be empty..
+ /// </summary>
+ internal static string ShellLibraryEmptyName {
+ get {
+ return ResourceManager.GetString("ShellLibraryEmptyName", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Folder path not found..
+ /// </summary>
+ internal static string ShellLibraryFolderNotFound {
+ get {
+ return ResourceManager.GetString("ShellLibraryFolderNotFound", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Invalid FolderType Guid..
+ /// </summary>
+ internal static string ShellLibraryInvalidFolderType {
+ get {
+ return ResourceManager.GetString("ShellLibraryInvalidFolderType", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The given known folder is not a valid library..
+ /// </summary>
+ internal static string ShellLibraryInvalidLibrary {
+ get {
+ return ResourceManager.GetString("ShellLibraryInvalidLibrary", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Can&apos;t get the display name..
+ /// </summary>
+ internal static string ShellObjectCannotGetDisplayName {
+ get {
+ return ResourceManager.GetString("ShellObjectCannotGetDisplayName", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Destination array too small, or invalid arrayIndex..
+ /// </summary>
+ internal static string ShellObjectCollectionArrayTooSmall {
+ get {
+ return ResourceManager.GetString("ShellObjectCollectionArrayTooSmall", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Must have at least one shell object in the collection..
+ /// </summary>
+ internal static string ShellObjectCollectionEmptyCollection {
+ get {
+ return ResourceManager.GetString("ShellObjectCollectionEmptyCollection", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot insert items into a read only list..
+ /// </summary>
+ internal static string ShellObjectCollectionInsertReadOnly {
+ get {
+ return ResourceManager.GetString("ShellObjectCollectionInsertReadOnly", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot remove items from a read only list..
+ /// </summary>
+ internal static string ShellObjectCollectionRemoveReadOnly {
+ get {
+ return ResourceManager.GetString("ShellObjectCollectionRemoveReadOnly", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Shell item could not be created..
+ /// </summary>
+ internal static string ShellObjectCreationFailed {
+ get {
+ return ResourceManager.GetString("ShellObjectCreationFailed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Shell Object creation requires Windows Vista or higher operating system..
+ /// </summary>
+ internal static string ShellObjectFactoryPlatformNotSupported {
+ get {
+ return ResourceManager.GetString("ShellObjectFactoryPlatformNotSupported", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unable to Create Shell Item..
+ /// </summary>
+ internal static string ShellObjectFactoryUnableToCreateItem {
+ get {
+ return ResourceManager.GetString("ShellObjectFactoryUnableToCreateItem", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Registration for change notification has failed..
+ /// </summary>
+ internal static string ShellObjectWatcherRegisterFailed {
+ get {
+ return ResourceManager.GetString("ShellObjectWatcherRegisterFailed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unable to change watched events while listening..
+ /// </summary>
+ internal static string ShellObjectWatcherUnableToChangeEvents {
+ get {
+ return ResourceManager.GetString("ShellObjectWatcherUnableToChangeEvents", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The value on this property cannot be set. To set the property value, use the ShellObject that is associated with this property..
+ /// </summary>
+ internal static string ShellPropertyCannotSetProperty {
+ get {
+ return ResourceManager.GetString("ShellPropertyCannotSetProperty", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to No constructor found matching requested argument types..
+ /// </summary>
+ internal static string ShellPropertyFactoryConstructorNotFound {
+ get {
+ return ResourceManager.GetString("ShellPropertyFactoryConstructorNotFound", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unable to set property..
+ /// </summary>
+ internal static string ShellPropertySetValue {
+ get {
+ return ResourceManager.GetString("ShellPropertySetValue", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unable to get writable property store for this property..
+ /// </summary>
+ internal static string ShellPropertyUnableToGetWritableProperty {
+ get {
+ return ResourceManager.GetString("ShellPropertyUnableToGetWritableProperty", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A value had to be truncated in a string or rounded if a numeric value. Set AllowTruncatedValue to true to prevent this exception..
+ /// </summary>
+ internal static string ShellPropertyValueTruncated {
+ get {
+ return ResourceManager.GetString("ShellPropertyValueTruncated", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to This Property is available on Windows 7 only..
+ /// </summary>
+ internal static string ShellPropertyWindows7 {
+ get {
+ return ResourceManager.GetString("ShellPropertyWindows7", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to This property only accepts a value of type \&quot;{0}\&quot;..
+ /// </summary>
+ internal static string ShellPropertyWrongType {
+ get {
+ return ResourceManager.GetString("ShellPropertyWrongType", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unable to set list of sort columns..
+ /// </summary>
+ internal static string ShellSearchFolderUnableToSetSortColumns {
+ get {
+ return ResourceManager.GetString("ShellSearchFolderUnableToSetSortColumns", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unable to set visible columns..
+ /// </summary>
+ internal static string ShellSearchFolderUnableToSetVisibleColumns {
+ get {
+ return ResourceManager.GetString("ShellSearchFolderUnableToSetVisibleColumns", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to CurrentSize (width or height) cannot be greater than the maximum size: {0}..
+ /// </summary>
+ internal static string ShellThumbnailCurrentSizeRange {
+ get {
+ return ResourceManager.GetString("ShellThumbnailCurrentSizeRange", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The current ShellObject does not have a thumbnail. Try using ShellThumbnailFormatOption.Default to get the icon for this item..
+ /// </summary>
+ internal static string ShellThumbnailDoesNotHaveThumbnail {
+ get {
+ return ResourceManager.GetString("ShellThumbnailDoesNotHaveThumbnail", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The current ShellObject does not have a valid thumbnail handler or there was a problem in extracting the thumbnail for this specific shell object..
+ /// </summary>
+ internal static string ShellThumbnailNoHandler {
+ get {
+ return ResourceManager.GetString("ShellThumbnailNoHandler", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to CurrentSize (width or height) cannot be 0..
+ /// </summary>
+ internal static string ShellThumbnailSizeCannotBe0 {
+ get {
+ return ResourceManager.GetString("ShellThumbnailSizeCannotBe0", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to ShowHiddenItems cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string ShowHiddenItemsCannotBeChanged {
+ get {
+ return ResourceManager.GetString("ShowHiddenItemsCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Show places list cannot be changed while dialog is showing..
+ /// </summary>
+ internal static string ShowPlacesListCannotBeChanged {
+ get {
+ return ResourceManager.GetString("ShowPlacesListCannotBeChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The Stock Icon identifier given is invalid ({0})..
+ /// </summary>
+ internal static string StockIconInvalidGuid {
+ get {
+ return ResourceManager.GetString("StockIconInvalidGuid", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Child control&apos;s window handle cannot be zero..
+ /// </summary>
+ internal static string TabbedThumbnailZeroChildHandle {
+ get {
+ return ResourceManager.GetString("TabbedThumbnailZeroChildHandle", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Parent window handle cannot be zero..
+ /// </summary>
+ internal static string TabbedThumbnailZeroParentHandle {
+ get {
+ return ResourceManager.GetString("TabbedThumbnailZeroParentHandle", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to TabbedThumbnailProxyWindow has not been set..
+ /// </summary>
+ internal static string TasbarWindowProxyWindowSet {
+ get {
+ return ResourceManager.GetString("TasbarWindowProxyWindowSet", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A valid active Window is needed to update the Taskbar..
+ /// </summary>
+ internal static string TaskbarManagerValidWindowRequired {
+ get {
+ return ResourceManager.GetString("TaskbarManagerValidWindowRequired", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The array of buttons must contain at least 1 item..
+ /// </summary>
+ internal static string TaskbarWindowEmptyButtonArray {
+ get {
+ return ResourceManager.GetString("TaskbarWindowEmptyButtonArray", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Tool bar buttons for this window are already added. Please refer to the Remarks section of the AddButtons method for more information on updating the properties or hiding existing buttons..
+ /// </summary>
+ internal static string TaskbarWindowManagerButtonsAlreadyAdded {
+ get {
+ return ResourceManager.GetString("TaskbarWindowManagerButtonsAlreadyAdded", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Value is already set. It cannot be set more than once..
+ /// </summary>
+ internal static string TaskbarWindowValueSet {
+ get {
+ return ResourceManager.GetString("TaskbarWindowValueSet", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The given control has not been added to the taskbar..
+ /// </summary>
+ internal static string ThumbnailManagerControlNotAdded {
+ get {
+ return ResourceManager.GetString("ThumbnailManagerControlNotAdded", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Window handle is invalid..
+ /// </summary>
+ internal static string ThumbnailManagerInvalidHandle {
+ get {
+ return ResourceManager.GetString("ThumbnailManagerInvalidHandle", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to This preview has already been added..
+ /// </summary>
+ internal static string ThumbnailManagerPreviewAdded {
+ get {
+ return ResourceManager.GetString("ThumbnailManagerPreviewAdded", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The given preview has not been added to the taskbar..
+ /// </summary>
+ internal static string ThumbnailManagerPreviewNotAdded {
+ get {
+ return ResourceManager.GetString("ThumbnailManagerPreviewNotAdded", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Maximum number of buttons allowed is 7..
+ /// </summary>
+ internal static string ThumbnailToolbarManagerMaxButtons {
+ get {
+ return ResourceManager.GetString("ThumbnailToolbarManagerMaxButtons", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Null or empty arrays are not allowed..
+ /// </summary>
+ internal static string ThumbnailToolbarManagerNullEmptyArray {
+ get {
+ return ResourceManager.GetString("ThumbnailToolbarManagerNullEmptyArray", resourceCulture);
+ }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Resources/LocalizedMessages.resx b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Resources/LocalizedMessages.resx
new file mode 100644
index 0000000000..06256dbcdc
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Resources/LocalizedMessages.resx
@@ -0,0 +1,516 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="AddToMostRecentlyUsedListCannotBeChanged" xml:space="preserve">
+ <value>AddToMostRecentlyUsedList cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="AlwaysAppendDefaultExtensionCannotBeChanged" xml:space="preserve">
+ <value>AlwaysAppendDefaultExtension cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="ComboBoxIndexOutsideBounds" xml:space="preserve">
+ <value>Index was outside the bounds of the CommonFileDialogComboBox.</value>
+ </data>
+ <data name="CommonFileDialogCanceled" xml:space="preserve">
+ <value>File name not available - dialog was canceled.</value>
+ </data>
+ <data name="CommonFileDialogCannotCreateShellItem" xml:space="preserve">
+ <value>Shell item could not be created.</value>
+ </data>
+ <data name="CommonFileDialogInvalidHandle" xml:space="preserve">
+ <value>Handle provided cannot be IntPtr.Zero.</value>
+ </data>
+ <data name="CommonFileDialogMultipleFiles" xml:space="preserve">
+ <value>Multiple files selected - the FileNames property should be used instead.</value>
+ </data>
+ <data name="CommonFileDialogMultipleItems" xml:space="preserve">
+ <value>Multiple files selected - the Items property should be used instead.</value>
+ </data>
+ <data name="CommonFileDialogNotClosed" xml:space="preserve">
+ <value>File name not available - dialog has not closed yet.</value>
+ </data>
+ <data name="CommonFileDialogRequiresVista" xml:space="preserve">
+ <value>Common File Dialog requires Windows Vista or later.</value>
+ </data>
+ <data name="CommonFiltersOffice" xml:space="preserve">
+ <value>Office Files</value>
+ </data>
+ <data name="CommonFiltersPicture" xml:space="preserve">
+ <value>All Picture Files</value>
+ </data>
+ <data name="CommonFiltersText" xml:space="preserve">
+ <value>Text Files</value>
+ </data>
+ <data name="CreatePromptCannotBeChanged" xml:space="preserve">
+ <value>CreatePrompt cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="DialogControlCollectionCannotRemoveControls" xml:space="preserve">
+ <value>Custom controls cannot be removed from a File dialog once added.</value>
+ </data>
+ <data name="DialogControlCollectionEmptyName" xml:space="preserve">
+ <value>Control name cannot be null or zero length.</value>
+ </data>
+ <data name="DialogControlCollectionMenuItemControlsCannotBeAdded" xml:space="preserve">
+ <value>CommonFileDialogMenuItem controls can only be added to CommonFileDialogMenu controls.</value>
+ </data>
+ <data name="DialogControlCollectionModifyingControls" xml:space="preserve">
+ <value>Modifying controls collection while dialog is showing is not supported.</value>
+ </data>
+ <data name="DialogControlCollectionMoreThanOneControl" xml:space="preserve">
+ <value>Dialog cannot have more than one control with the same name.</value>
+ </data>
+ <data name="DialogControlCollectionRemoveControlFirst" xml:space="preserve">
+ <value>Dialog control must be removed from current collections first.</value>
+ </data>
+ <data name="EnsureFileExistsCannotBeChanged" xml:space="preserve">
+ <value>EnsureFileExists cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="EnsurePathExistsCannotBeChanged" xml:space="preserve">
+ <value>EnsurePathExists cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="EnsureReadonlyCannotBeChanged" xml:space="preserve">
+ <value>EnsureReadOnly cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="EnsureValidNamesCannotBeChanged" xml:space="preserve">
+ <value>EnsureValidNames cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="ExplorerBrowserFailedToGetView" xml:space="preserve">
+ <value>ExplorerBrowser failed to get current view.</value>
+ </data>
+ <data name="ExplorerBrowserIconSize" xml:space="preserve">
+ <value>Unable to get icon size.</value>
+ </data>
+ <data name="ExplorerBrowserItemCount" xml:space="preserve">
+ <value>Unexpected error retrieving item count.</value>
+ </data>
+ <data name="ExplorerBrowserSelectedItemCount" xml:space="preserve">
+ <value>Unexpected error retrieving selected item count.</value>
+ </data>
+ <data name="ExplorerBrowserUnexpectedError" xml:space="preserve">
+ <value>Unexpected error retrieving selection.</value>
+ </data>
+ <data name="ExplorerBrowserViewItems" xml:space="preserve">
+ <value>Unexpected error retrieving view items.</value>
+ </data>
+ <data name="FilePathNotExist" xml:space="preserve">
+ <value>The given path does not exist ({0})</value>
+ </data>
+ <data name="FolderIdsUnknownGuid" xml:space="preserve">
+ <value>Guid does not identify a known folder.</value>
+ </data>
+ <data name="FolderTypeCategory" xml:space="preserve">
+ <value>ControlPanel Category</value>
+ </data>
+ <data name="FolderTypeClassic" xml:space="preserve">
+ <value>ControlPanel Classic</value>
+ </data>
+ <data name="FolderTypeCommunications" xml:space="preserve">
+ <value>Communications</value>
+ </data>
+ <data name="FolderTypeCompressedFolder" xml:space="preserve">
+ <value>Compressed Folder</value>
+ </data>
+ <data name="FolderTypeContacts" xml:space="preserve">
+ <value>Contacts</value>
+ </data>
+ <data name="FolderTypeDocuments" xml:space="preserve">
+ <value>Documents</value>
+ </data>
+ <data name="FolderTypeGames" xml:space="preserve">
+ <value>Games</value>
+ </data>
+ <data name="FolderTypeGenericLibrary" xml:space="preserve">
+ <value>Generic Library</value>
+ </data>
+ <data name="FolderTypeInvalid" xml:space="preserve">
+ <value>Invalid</value>
+ </data>
+ <data name="FolderTypeLibrary" xml:space="preserve">
+ <value>Library</value>
+ </data>
+ <data name="FolderTypeMusic" xml:space="preserve">
+ <value>Music</value>
+ </data>
+ <data name="FolderTypeMusicIcons" xml:space="preserve">
+ <value>Music Icons</value>
+ </data>
+ <data name="FolderTypeNetworkExplorer" xml:space="preserve">
+ <value>Network Explorer</value>
+ </data>
+ <data name="FolderTypeNotSpecified" xml:space="preserve">
+ <value>Not Specified</value>
+ </data>
+ <data name="FolderTypeOpenSearch" xml:space="preserve">
+ <value>Open Search</value>
+ </data>
+ <data name="FolderTypeOtherUsers" xml:space="preserve">
+ <value>Other Users</value>
+ </data>
+ <data name="FolderTypePictures" xml:space="preserve">
+ <value>Pictures</value>
+ </data>
+ <data name="FolderTypePrinters" xml:space="preserve">
+ <value>Printers</value>
+ </data>
+ <data name="FolderTypeRecordedTV" xml:space="preserve">
+ <value>RecordedTV</value>
+ </data>
+ <data name="FolderTypeRecycleBin" xml:space="preserve">
+ <value>RecycleBin</value>
+ </data>
+ <data name="FolderTypeSavedGames" xml:space="preserve">
+ <value>Saved Games</value>
+ </data>
+ <data name="FolderTypeSearchConnector" xml:space="preserve">
+ <value>Search Connector</value>
+ </data>
+ <data name="FolderTypeSearches" xml:space="preserve">
+ <value>Searches</value>
+ </data>
+ <data name="FolderTypeSearchResults" xml:space="preserve">
+ <value>Generic SearchResults</value>
+ </data>
+ <data name="FolderTypeSoftwareExplorer" xml:space="preserve">
+ <value>Software Explorer</value>
+ </data>
+ <data name="FolderTypeUserFiles" xml:space="preserve">
+ <value>User Files</value>
+ </data>
+ <data name="FolderTypeUserLibraries" xml:space="preserve">
+ <value>Users Libraries</value>
+ </data>
+ <data name="FolderTypeVideos" xml:space="preserve">
+ <value>Videos</value>
+ </data>
+ <data name="IsExpandedModeCannotBeChanged" xml:space="preserve">
+ <value>IsExpandedMode cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="JumpListCustomCategoriesDisabled" xml:space="preserve">
+ <value>Custom categories cannot be added while recent documents tracking is turned off.</value>
+ </data>
+ <data name="JumpListFileTypeNotRegistered" xml:space="preserve">
+ <value>The file type is not registered with this application.</value>
+ </data>
+ <data name="JumpListLinkPathRequired" xml:space="preserve">
+ <value>JumpListLink's path is required and cannot be null.</value>
+ </data>
+ <data name="JumpListLinkTitleRequired" xml:space="preserve">
+ <value>JumpListLink's title is required and cannot be null.</value>
+ </data>
+ <data name="JumpListNegativeOrdinalPosition" xml:space="preserve">
+ <value>Negative numbers are not allowed for the ordinal position.</value>
+ </data>
+ <data name="KnownFolderInvalidGuid" xml:space="preserve">
+ <value>Given Known Folder ID is invalid.</value>
+ </data>
+ <data name="KnownFolderParsingName" xml:space="preserve">
+ <value>Parsing name is invalid.</value>
+ </data>
+ <data name="NavigateToShortcutCannotBeChanged" xml:space="preserve">
+ <value>NavigateToShortcut cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="NavigationLogNullParent" xml:space="preserve">
+ <value>Parent cannot be null.</value>
+ </data>
+ <data name="NotImplementedException" xml:space="preserve">
+ <value>The method or operation is not implemented.</value>
+ </data>
+ <data name="OverwritePromptCannotBeChanged" xml:space="preserve">
+ <value>OverwritePrompt cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="PropertyCollectionCanonicalInvalidIndex" xml:space="preserve">
+ <value>This CanonicalName is not a valid index.</value>
+ </data>
+ <data name="PropertyCollectionInvalidIndex" xml:space="preserve">
+ <value>This PropertyKey is not a valid index.</value>
+ </data>
+ <data name="PropertyCollectionNullCanonicalName" xml:space="preserve">
+ <value>Argument CanonicalName cannot be null or empty.</value>
+ </data>
+ <data name="RadioButtonListIndexOutOfBounds" xml:space="preserve">
+ <value>Index was outside the bounds of the CommonFileDialogRadioButtonList.</value>
+ </data>
+ <data name="RestoreDirectoryCannotBeChanged" xml:space="preserve">
+ <value>RestoreDirectory cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="SaveFileNullItem" xml:space="preserve">
+ <value>Retrieved a null shell item from dialog.</value>
+ </data>
+ <data name="SearchConditionFactoryInvalidProperty" xml:space="preserve">
+ <value>Given property key is invalid.</value>
+ </data>
+ <data name="ShellExceptionDefaultText" xml:space="preserve">
+ <value>Shell Exception has occurred, look at inner exception for information.</value>
+ </data>
+ <data name="ShellHelperGetParsingNameFailed" xml:space="preserve">
+ <value>GetParsingName has failed.</value>
+ </data>
+ <data name="ShellInvalidCanonicalName" xml:space="preserve">
+ <value>The given CanonicalName is not valid.</value>
+ </data>
+ <data name="ShellLibraryDefaultSaveFolderNotFound" xml:space="preserve">
+ <value>DefaultSaveFolder path not found.</value>
+ </data>
+ <data name="ShellLibraryEmptyName" xml:space="preserve">
+ <value>LibraryName cannot be empty.</value>
+ </data>
+ <data name="ShellLibraryFolderNotFound" xml:space="preserve">
+ <value>Folder path not found.</value>
+ </data>
+ <data name="ShellLibraryInvalidFolderType" xml:space="preserve">
+ <value>Invalid FolderType Guid.</value>
+ </data>
+ <data name="ShellLibraryInvalidLibrary" xml:space="preserve">
+ <value>The given known folder is not a valid library.</value>
+ </data>
+ <data name="ShellObjectCannotGetDisplayName" xml:space="preserve">
+ <value>Can't get the display name.</value>
+ </data>
+ <data name="ShellObjectCollectionArrayTooSmall" xml:space="preserve">
+ <value>Destination array too small, or invalid arrayIndex.</value>
+ </data>
+ <data name="ShellObjectCollectionEmptyCollection" xml:space="preserve">
+ <value>Must have at least one shell object in the collection.</value>
+ </data>
+ <data name="ShellObjectCollectionInsertReadOnly" xml:space="preserve">
+ <value>Cannot insert items into a read only list.</value>
+ </data>
+ <data name="ShellObjectCollectionRemoveReadOnly" xml:space="preserve">
+ <value>Cannot remove items from a read only list.</value>
+ </data>
+ <data name="ShellObjectCreationFailed" xml:space="preserve">
+ <value>Shell item could not be created.</value>
+ </data>
+ <data name="ShellObjectFactoryPlatformNotSupported" xml:space="preserve">
+ <value>Shell Object creation requires Windows Vista or higher operating system.</value>
+ </data>
+ <data name="ShellObjectFactoryUnableToCreateItem" xml:space="preserve">
+ <value>Unable to Create Shell Item.</value>
+ </data>
+ <data name="ShellPropertyCannotSetProperty" xml:space="preserve">
+ <value>The value on this property cannot be set. To set the property value, use the ShellObject that is associated with this property.</value>
+ </data>
+ <data name="ShellPropertySetValue" xml:space="preserve">
+ <value>Unable to set property.</value>
+ </data>
+ <data name="ShellPropertyUnableToGetWritableProperty" xml:space="preserve">
+ <value>Unable to get writable property store for this property.</value>
+ </data>
+ <data name="ShellPropertyValueTruncated" xml:space="preserve">
+ <value>A value had to be truncated in a string or rounded if a numeric value. Set AllowTruncatedValue to true to prevent this exception.</value>
+ </data>
+ <data name="ShellPropertyWindows7" xml:space="preserve">
+ <value>This Property is available on Windows 7 only.</value>
+ </data>
+ <data name="ShellPropertyWrongType" xml:space="preserve">
+ <value>This property only accepts a value of type \"{0}\".</value>
+ </data>
+ <data name="ShellSearchFolderUnableToSetSortColumns" xml:space="preserve">
+ <value>Unable to set list of sort columns.</value>
+ </data>
+ <data name="ShellSearchFolderUnableToSetVisibleColumns" xml:space="preserve">
+ <value>Unable to set visible columns.</value>
+ </data>
+ <data name="ShellThumbnailCurrentSizeRange" xml:space="preserve">
+ <value>CurrentSize (width or height) cannot be greater than the maximum size: {0}.</value>
+ </data>
+ <data name="ShellThumbnailDoesNotHaveThumbnail" xml:space="preserve">
+ <value>The current ShellObject does not have a thumbnail. Try using ShellThumbnailFormatOption.Default to get the icon for this item.</value>
+ </data>
+ <data name="ShellThumbnailNoHandler" xml:space="preserve">
+ <value>The current ShellObject does not have a valid thumbnail handler or there was a problem in extracting the thumbnail for this specific shell object.</value>
+ </data>
+ <data name="ShellThumbnailSizeCannotBe0" xml:space="preserve">
+ <value>CurrentSize (width or height) cannot be 0.</value>
+ </data>
+ <data name="ShowHiddenItemsCannotBeChanged" xml:space="preserve">
+ <value>ShowHiddenItems cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="ShowPlacesListCannotBeChanged" xml:space="preserve">
+ <value>Show places list cannot be changed while dialog is showing.</value>
+ </data>
+ <data name="StockIconInvalidGuid" xml:space="preserve">
+ <value>The Stock Icon identifier given is invalid ({0}).</value>
+ </data>
+ <data name="TabbedThumbnailZeroChildHandle" xml:space="preserve">
+ <value>Child control's window handle cannot be zero.</value>
+ </data>
+ <data name="TabbedThumbnailZeroParentHandle" xml:space="preserve">
+ <value>Parent window handle cannot be zero.</value>
+ </data>
+ <data name="TasbarWindowProxyWindowSet" xml:space="preserve">
+ <value>TabbedThumbnailProxyWindow has not been set.</value>
+ </data>
+ <data name="TaskbarManagerValidWindowRequired" xml:space="preserve">
+ <value>A valid active Window is needed to update the Taskbar.</value>
+ </data>
+ <data name="TaskbarWindowEmptyButtonArray" xml:space="preserve">
+ <value>The array of buttons must contain at least 1 item.</value>
+ </data>
+ <data name="TaskbarWindowManagerButtonsAlreadyAdded" xml:space="preserve">
+ <value>Tool bar buttons for this window are already added. Please refer to the Remarks section of the AddButtons method for more information on updating the properties or hiding existing buttons.</value>
+ </data>
+ <data name="TaskbarWindowValueSet" xml:space="preserve">
+ <value>Value is already set. It cannot be set more than once.</value>
+ </data>
+ <data name="ThumbnailManagerControlNotAdded" xml:space="preserve">
+ <value>The given control has not been added to the taskbar.</value>
+ </data>
+ <data name="ThumbnailManagerInvalidHandle" xml:space="preserve">
+ <value>Window handle is invalid.</value>
+ </data>
+ <data name="ThumbnailManagerPreviewAdded" xml:space="preserve">
+ <value>This preview has already been added.</value>
+ </data>
+ <data name="ThumbnailManagerPreviewNotAdded" xml:space="preserve">
+ <value>The given preview has not been added to the taskbar.</value>
+ </data>
+ <data name="ThumbnailToolbarManagerMaxButtons" xml:space="preserve">
+ <value>Maximum number of buttons allowed is 7.</value>
+ </data>
+ <data name="ThumbnailToolbarManagerNullEmptyArray" xml:space="preserve">
+ <value>Null or empty arrays are not allowed.</value>
+ </data>
+ <data name="ExplorerBrowserBrowseToObjectFailed" xml:space="preserve">
+ <value>Browsing to object failed.</value>
+ </data>
+ <data name="ShellObjectWatcherRegisterFailed" xml:space="preserve">
+ <value>Registration for change notification has failed.</value>
+ </data>
+ <data name="ShellPropertyFactoryConstructorNotFound" xml:space="preserve">
+ <value>No constructor found matching requested argument types.</value>
+ </data>
+ <data name="MessageListenerNoWindowHandle" xml:space="preserve">
+ <value>Cannot create window on the listener thread because there is no existing window on the listener thread.</value>
+ </data>
+ <data name="MessageListenerClassNotRegistered" xml:space="preserve">
+ <value>Window class could not be registered, check inner exception for more details.</value>
+ </data>
+ <data name="MessageListenerFilterUnableToRegister" xml:space="preserve">
+ <value>Message filter registration failed.</value>
+ </data>
+ <data name="MessageListenerFilterUnknownListenerHandle" xml:space="preserve">
+ <value>No listener handled of that value is registered.</value>
+ </data>
+ <data name="MessageListenerCannotCreateWindow" xml:space="preserve">
+ <value>Creation of window has failed, view inner exception for details.</value>
+ </data>
+ <data name="ShellObjectWatcherUnableToChangeEvents" xml:space="preserve">
+ <value>Unable to change watched events while listening.</value>
+ </data>
+</root> \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Shell.csproj b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Shell.csproj
new file mode 100644
index 0000000000..c768be894a
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Shell.csproj
@@ -0,0 +1,385 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{AA0C00CB-8699-4F37-BFAE-40CA87ACC06D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Microsoft.WindowsAPICodePack.Shell</RootNamespace>
+ <AssemblyName>Microsoft.WindowsAPICodePack.Shell</AssemblyName>
+ <FileAlignment>512</FileAlignment>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>3.5</OldToolsVersion>
+ <UpgradeBackupLocation />
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\..\..\..\..\build\AddIns\WindowsPlatform</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <DocumentationFile>..\..\..\..\..\build\AddIns\WindowsPlatform\Microsoft.WindowsAPICodePack.Shell.xml</DocumentationFile>
+ <CodeAnalysisRules>
+ </CodeAnalysisRules>
+ <RunCodeAnalysis>false</RunCodeAnalysis>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>..\..\..\..\..\build\AddIns\WindowsPlatform</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'CodeAnalysisDebug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>..\..\..\..\..\build\AddIns\WindowsPlatform</OutputPath>
+ <DefineConstants>TRACE;DEBUG;CODE_ANALYSIS</DefineConstants>
+ <DocumentationFile>bin\Debug\Microsoft.WindowsAPICodePack.Shell.XML</DocumentationFile>
+ <DebugType>full</DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <CodeAnalysisRules>
+ </CodeAnalysisRules>
+ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+ <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+ <ErrorReport>prompt</ErrorReport>
+ <RunCodeAnalysis>true</RunCodeAnalysis>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <WarningLevel>4</WarningLevel>
+ <Optimize>false</Optimize>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\x64\Debug\</OutputPath>
+ <DefineConstants>CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
+ <DocumentationFile>bin\Debug\Microsoft.WindowsAPICodePack.Shell.XML</DocumentationFile>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <CodeAnalysisLogFile>bin\Debug\Microsoft.WindowsAPICodePack.Shell.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
+ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+ <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSetDirectories>;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
+ <CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
+ <CodeAnalysisRuleDirectories>;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
+ <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
+ <RunCodeAnalysis>false</RunCodeAnalysis>
+ <WarningLevel>4</WarningLevel>
+ <Optimize>false</Optimize>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+ <OutputPath>bin\x64\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <CodeAnalysisLogFile>bin\Release\Microsoft.WindowsAPICodePack.Shell.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
+ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+ <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSetDirectories>;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
+ <CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
+ <CodeAnalysisRuleDirectories>;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
+ <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'CodeAnalysisDebug|x64'">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\x64\CodeAnalysisDebug\</OutputPath>
+ <DefineConstants>CODE_ANALYSIS;TRACE;DEBUG;CODE_ANALYSIS</DefineConstants>
+ <DocumentationFile>bin\Debug\Microsoft.WindowsAPICodePack.Shell.XML</DocumentationFile>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <RunCodeAnalysis>true</RunCodeAnalysis>
+ <CodeAnalysisLogFile>bin\CodeAnalysisDebug\Microsoft.WindowsAPICodePack.Shell.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
+ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+ <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSetDirectories>;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
+ <CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
+ <CodeAnalysisRuleDirectories>;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
+ <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
+ <WarningLevel>4</WarningLevel>
+ <Optimize>false</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="CustomMarshalers" />
+ <Reference Include="PresentationCore" />
+ <Reference Include="PresentationFramework" />
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ <Reference Include="WindowsBase" />
+ <Reference Include="WindowsFormsIntegration" />
+ <Reference Include="System.Xaml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Common\EnumUnknown.cs" />
+ <Compile Include="Common\EventHandlerExtensionMethods.cs" />
+ <Compile Include="Common\NativePoint.cs" />
+ <Compile Include="Common\NativeRect.cs" />
+ <Compile Include="Common\ShellException.cs" />
+ <Compile Include="Common\ShellFileSystemFolder.cs" />
+ <Compile Include="Common\IconReference.cs" />
+ <Compile Include="Common\SearchCondition.cs" />
+ <Compile Include="Common\SearchConditionFactory.cs" />
+ <Compile Include="Common\ShellSearchFolder.cs" />
+ <Compile Include="Common\ShellFile.cs" />
+ <Compile Include="Common\ShellFolder.cs" />
+ <Compile Include="Common\ShellFolderItems.cs" />
+ <Compile Include="Common\ShellHelper.cs" />
+ <Compile Include="Common\ShellItemArray.cs" />
+ <Compile Include="Common\ShellObjectFactory.cs" />
+ <Compile Include="Common\ShellThumbnail.cs" />
+ <Compile Include="Common\ShellObjectCollection.cs" />
+ <Compile Include="Common\DefaultShellImageSizes.cs" />
+ <Compile Include="Common\SortColumn.cs" />
+ <Compile Include="Controls\CommandLinkWinforms.cs">
+ <SubType>Component</SubType>
+ </Compile>
+ <Compile Include="Controls\CommandLinkWPF.xaml.cs">
+ <DependentUpon>CommandLinkWPF.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="DesktopWindowManager\DesktopWindowManagerNativeMethods.cs" />
+ <Compile Include="DesktopWindowManager\GlassEvents.cs" />
+ <Compile Include="DesktopWindowManager\GlassForm.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="DesktopWindowManager\GlassWindow.cs" />
+ <Compile Include="ExplorerBrowser\CommonControlException.cs" />
+ <Compile Include="ExplorerBrowser\ExplorerBrowser.cs">
+ <SubType>UserControl</SubType>
+ </Compile>
+ <Compile Include="ExplorerBrowser\ExplorerBrowser.WPF.xaml.cs">
+ <DependentUpon>ExplorerBrowser.WPF.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="ExplorerBrowser\ExplorerBrowserContentOptions.cs" />
+ <Compile Include="ExplorerBrowser\ExplorerBrowserEvents.cs" />
+ <Compile Include="ExplorerBrowser\ExplorerBrowserViewEvents.cs" />
+ <Compile Include="ExplorerBrowser\NavigationLog.cs" />
+ <Compile Include="ExplorerBrowser\ExplorerBrowserEnums.cs" />
+ <Compile Include="ExplorerBrowser\ExplorerBrowserPaneVisibility.cs" />
+ <Compile Include="ExplorerBrowser\NavigationLogEnums.cs" />
+ <Compile Include="ExplorerBrowser\NavigationLogEvents.cs" />
+ <Compile Include="ExplorerBrowser\NavigationOptions.cs" />
+ <Compile Include="GlobalSuppressions.cs" />
+ <Compile Include="Interop\Common\IntPtrExtensions.cs" />
+ <Compile Include="Interop\Common\ShellNativeStructs.cs" />
+ <Compile Include="Interop\ShellObjectWatcher\ShellObjectWatcherNativeMethods.cs" />
+ <Compile Include="PropertySystem\PropertySystemException.cs" />
+ <Compile Include="Interop\StockIcons\StockIconsNativeMethods.cs" />
+ <Compile Include="Interop\Common\WindowUtilities.cs" />
+ <Compile Include="KnownFolders\IKnownFolder.cs" />
+ <Compile Include="Interop\Common\ShellCOMClasses.cs" />
+ <Compile Include="Interop\ExplorerBrowser\ExplorerBrowserCOMGuids.cs">
+ </Compile>
+ <Compile Include="Interop\ExplorerBrowser\ExplorerBrowserCOMInterfaces.cs" />
+ <Compile Include="Interop\ExplorerBrowser\ExplorerBrowserNativeMethods.cs" />
+ <Compile Include="KnownFolders\DefinitionOptions.cs" />
+ <Compile Include="KnownFolders\FolderCategory.cs" />
+ <Compile Include="KnownFolders\FolderProperties.cs" />
+ <Compile Include="KnownFolders\FoldersIdentifiers.cs" />
+ <Compile Include="KnownFolders\FolderTypes.cs" />
+ <Compile Include="KnownFolders\KnownFolderHelper.cs" />
+ <Compile Include="KnownFolders\KnownFolders.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="KnownFolders\KnownFolderSettings.cs" />
+ <Compile Include="KnownFolders\RedirectionCapabilities.cs" />
+ <Compile Include="KnownFolders\RetrievalOptions.cs" />
+ <Compile Include="Common\ShellSearchConnector.cs" />
+ <Compile Include="Common\ShellEnums.cs" />
+ <Compile Include="Common\ShellLibrary.cs" />
+ <Compile Include="Common\ShellObject.cs" />
+ <Compile Include="CommonFileDialogs\CommonFileDialog.cs" />
+ <Compile Include="CommonFileDialogs\CommonFileDialogButton.cs" />
+ <Compile Include="CommonFileDialogs\CommonFileDialogCheckBox.cs" />
+ <Compile Include="CommonFileDialogs\CommonFileDialogComboBox.cs" />
+ <Compile Include="CommonFileDialogs\CommonFileDialogControl.cs" />
+ <Compile Include="CommonFileDialogs\CommonFileDialogControlCollection.cs" />
+ <Compile Include="CommonFileDialogs\CommonFileDialogFilter.cs" />
+ <Compile Include="CommonFileDialogs\CommonFileDialogFilterCollection.cs" />
+ <Compile Include="CommonFileDialogs\CommonFileDialogFolderChangeEventArgs.cs" />
+ <Compile Include="CommonFileDialogs\CommonFileDialogGroupBox.cs" />
+ <Compile Include="CommonFileDialogs\CommonFileDialogLabel.cs" />
+ <Compile Include="CommonFileDialogs\CommonFileDialogMenu.cs" />
+ <Compile Include="CommonFileDialogs\CommonFileDialogProminentControl.cs" />
+ <Compile Include="CommonFileDialogs\CommonFileDialogRadioButtonList.cs" />
+ <Compile Include="CommonFileDialogs\CommonFileDialogResult.cs" />
+ <Compile Include="CommonFileDialogs\CommonFileDialogSeperator.cs" />
+ <Compile Include="CommonFileDialogs\CommonFileDialogStandardFilters.cs" />
+ <Compile Include="CommonFileDialogs\CommonFileDialogTextBox.cs" />
+ <Compile Include="CommonFileDialogs\CommonOpenFileDialog.cs" />
+ <Compile Include="CommonFileDialogs\CommonSaveFileDialog.cs" />
+ <Compile Include="CommonFileDialogs\ICommonFileDialogIndexedControls.cs" />
+ <Compile Include="Interop\KnownFolders\KnownFoldersCOMGuids.cs" />
+ <Compile Include="Interop\KnownFolders\KnownFoldersCOMInterfaces.cs" />
+ <Compile Include="Interop\KnownFolders\KnownFoldersNativeMethods.cs" />
+ <Compile Include="Interop\PropertySystem\PropertySystemCOMInterfaces.cs" />
+ <Compile Include="Interop\PropertySystem\PropertySystemNativeMethods.cs" />
+ <Compile Include="Interop\Taskbar\TabbedThumbnailNativeMethods.cs" />
+ <Compile Include="Interop\Taskbar\TaskbarCOMInterfaces.cs" />
+ <Compile Include="PropertySystem\ShellProperties.cs" />
+ <Compile Include="PropertySystem\ShellPropertyEnums.cs" />
+ <Compile Include="PropertySystem\ShellPropertyEnumType.cs" />
+ <Compile Include="KnownFolders\FileSystemKnownFolder.cs" />
+ <Compile Include="Common\ShellNonFileSystemItem.cs" />
+ <Compile Include="Common\ShellNonFileSystemFolder.cs" />
+ <Compile Include="KnownFolders\NonFileSystemKnownFolder.cs" />
+ <Compile Include="Common\ShellThumbnailEnums.cs" />
+ <Compile Include="Common\ShellSearchCollection.cs" />
+ <Compile Include="Common\ShellObjectContainer.cs" />
+ <Compile Include="Common\ShellLink.cs" />
+ <Compile Include="PropertySystem\ShellPropertyFactory.cs" />
+ <Compile Include="PropertySystem\ShellPropertyWriter.cs" />
+ <Compile Include="PropertySystem\StronglyTypedProperties.cs" />
+ <Compile Include="PropertySystem\SystemProperties.cs" />
+ <Compile Include="PropertySystem\WindowProperties.cs" />
+ <Compile Include="Resources\LocalizedMessages.Designer.cs">
+ <DependentUpon>LocalizedMessages.resx</DependentUpon>
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ </Compile>
+ <Compile Include="ShellObjectWatcher\ChangeNotifyEventManager.cs" />
+ <Compile Include="ShellObjectWatcher\ChangeNotifyLock.cs" />
+ <Compile Include="ShellObjectWatcher\MessageListener.cs" />
+ <Compile Include="ShellObjectWatcher\MessageListenerFilter.cs" />
+ <Compile Include="ShellObjectWatcher\ShellObjectNotificationEventArgs.cs" />
+ <Compile Include="ShellObjectWatcher\ShellObjectWatcher.cs" />
+ <Compile Include="ShellObjectWatcher\ShellObjectWatcherEnums.cs" />
+ <Compile Include="StockIcons\StockIcon.cs" />
+ <Compile Include="StockIcons\StockIconEnums.cs" />
+ <Compile Include="StockIcons\StockIcons.cs" />
+ <Compile Include="Taskbar\JumpListCustomCategoryCollection.cs" />
+ <Compile Include="Taskbar\JumpListItemCollection.cs" />
+ <Compile Include="Taskbar\JumpListLink.cs" />
+ <Compile Include="Taskbar\JumpListSeparator.cs" />
+ <Compile Include="Taskbar\TabbedThumbnailClosedEventArgs.cs" />
+ <Compile Include="Taskbar\TabbedThumbnailScreenCapture.cs" />
+ <Compile Include="Taskbar\TabbedThumbnailManager.cs" />
+ <Compile Include="Taskbar\TabbedThumbnailBitmapRequestedEventArgs.cs" />
+ <Compile Include="Taskbar\TabbedThumbnailEventArgs.cs" />
+ <Compile Include="Taskbar\TabbedThumbnail.cs" />
+ <Compile Include="Taskbar\TabbedThumbnailProxyWindow.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Taskbar\TaskbarEnums.cs" />
+ <Compile Include="Interop\Taskbar\TaskbarNativeMethods.cs" />
+ <Compile Include="PropertySystem\IShellProperty.cs" />
+ <Compile Include="PropertySystem\ShellPropertyCollection.cs" />
+ <Compile Include="PropertySystem\ShellPropertyDescription.cs" />
+ <Compile Include="PropertySystem\ShellPropertyDescriptionsCache.cs" />
+ <Compile Include="Interop\Dialogs\DialogsCOMClasses.cs" />
+ <Compile Include="Interop\Common\ShellCOMGuids.cs" />
+ <Compile Include="Interop\Common\ShellNativeMethods.cs" />
+ <Compile Include="Interop\Common\ShellCOMInterfaces.cs" />
+ <Compile Include="Interop\Dialogs\DialogsCOMInterfaces.cs" />
+ <Compile Include="Common\ShellSavedSearchCollection.cs" />
+ <Compile Include="PropertySystem\ShellProperty.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Taskbar\JumpListCustomCategory.cs" />
+ <Compile Include="Taskbar\JumpList.cs" />
+ <Compile Include="Taskbar\JumpListItem.cs" />
+ <Compile Include="Taskbar\TaskbarList.cs" />
+ <Compile Include="Taskbar\TaskbarManager.cs">
+ </Compile>
+ <Compile Include="Taskbar\TaskbarInterfaces.cs" />
+ <Compile Include="Taskbar\TaskbarWindow.cs" />
+ <Compile Include="Taskbar\TaskbarWindowManager.cs" />
+ <Compile Include="Taskbar\ThumbnailButton.cs" />
+ <Compile Include="Taskbar\ThumbnailButtonClickedEventArgs.cs" />
+ <Compile Include="Taskbar\ThumbnailToolbarManager.cs" />
+ <Compile Include="Taskbar\ThumbnailToolbarProxyWindow.cs" />
+ <Compile Include="Taskbar\UserRemovedJumpListItemsEventArg.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="Design\ShellThumbnailClassDiagram.cd" />
+ <None Include="Design\ShellObjects.cd" />
+ <None Include="ExplorerBrowser\ExplorerBrowserDiagram.cd" />
+ </ItemGroup>
+ <ItemGroup>
+ <Page Include="Controls\CommandLinkWPF.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
+ <Page Include="ExplorerBrowser\ExplorerBrowser.WPF.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Core\Core.csproj">
+ <Project>{2E1FB0DF-F9BB-4909-9F32-2D9D022A8E57}</Project>
+ <Name>Core</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+ <Visible>False</Visible>
+ <ProductName>Windows Installer 3.1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Resources\LocalizedMessages.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>LocalizedMessages.Designer.cs</LastGenOutput>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <CodeAnalysisDictionary Include="CustomDictionary.xml" />
+ </ItemGroup>
+ <ItemGroup />
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ChangeNotifyEventManager.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ChangeNotifyEventManager.cs
new file mode 100644
index 0000000000..cd137b5f34
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ChangeNotifyEventManager.cs
@@ -0,0 +1,107 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ internal class ChangeNotifyEventManager
+ {
+ #region Change order
+ private static readonly ShellObjectChangeTypes[] _changeOrder = {
+ ShellObjectChangeTypes.ItemCreate,
+ ShellObjectChangeTypes.ItemRename,
+ ShellObjectChangeTypes.ItemDelete,
+
+ ShellObjectChangeTypes.AttributesChange,
+
+ ShellObjectChangeTypes.DirectoryCreate,
+ ShellObjectChangeTypes.DirectoryDelete,
+ ShellObjectChangeTypes.DirectoryContentsUpdate,
+ ShellObjectChangeTypes.DirectoryRename,
+
+ ShellObjectChangeTypes.Update,
+
+ ShellObjectChangeTypes.MediaInsert,
+ ShellObjectChangeTypes.MediaRemove,
+ ShellObjectChangeTypes.DriveAdd,
+ ShellObjectChangeTypes.DriveRemove,
+ ShellObjectChangeTypes.NetShare,
+ ShellObjectChangeTypes.NetUnshare,
+
+ ShellObjectChangeTypes.ServerDisconnect,
+ ShellObjectChangeTypes.SystemImageUpdate,
+
+ ShellObjectChangeTypes.AssociationChange,
+ ShellObjectChangeTypes.FreeSpace,
+
+ ShellObjectChangeTypes.DiskEventsMask,
+ ShellObjectChangeTypes.GlobalEventsMask,
+ ShellObjectChangeTypes.AllEventsMask
+ };
+ #endregion
+
+ private Dictionary<ShellObjectChangeTypes, Delegate> _events = new Dictionary<ShellObjectChangeTypes, Delegate>();
+
+ public void Register(ShellObjectChangeTypes changeType, Delegate handler)
+ {
+ Delegate del;
+ if (!_events.TryGetValue(changeType, out del))
+ {
+ _events.Add(changeType, handler);
+ }
+ else
+ {
+ del = MulticastDelegate.Combine(del, handler);
+ _events[changeType] = del;
+ }
+ }
+
+ public void Unregister(ShellObjectChangeTypes changeType, Delegate handler)
+ {
+ Delegate del;
+ if (_events.TryGetValue(changeType, out del))
+ {
+ del = MulticastDelegate.Remove(del, handler);
+ if (del == null) // It's a bug in .NET if del is non-null and has an empty invocation list.
+ {
+ _events.Remove(changeType);
+ }
+ else
+ {
+ _events[changeType] = del;
+ }
+ }
+ }
+
+ public void UnregisterAll()
+ {
+ _events.Clear();
+ }
+
+ public void Invoke(object sender, ShellObjectChangeTypes changeType, EventArgs args)
+ {
+ // Removes FromInterrupt flag if pressent
+ changeType = changeType & ~ShellObjectChangeTypes.FromInterrupt;
+
+ Delegate del;
+ foreach (var change in _changeOrder.Where(x => (x & changeType) != 0))
+ {
+ if (_events.TryGetValue(change, out del))
+ {
+ del.DynamicInvoke(sender, args);
+ }
+ }
+ }
+
+ public ShellObjectChangeTypes RegisteredTypes
+ {
+ get
+ {
+ return _events.Keys.Aggregate<ShellObjectChangeTypes, ShellObjectChangeTypes>(
+ ShellObjectChangeTypes.None,
+ (accumulator, changeType) => (changeType | accumulator));
+ }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ChangeNotifyLock.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ChangeNotifyLock.cs
new file mode 100644
index 0000000000..37c0578d59
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ChangeNotifyLock.cs
@@ -0,0 +1,90 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Runtime.InteropServices;
+using System.Diagnostics;
+using Microsoft.WindowsAPICodePack.Shell.Interop;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ internal class ChangeNotifyLock
+ {
+ private uint _event = 0;
+
+ internal ChangeNotifyLock(Message message)
+ {
+ IntPtr pidl;
+ IntPtr lockId = ShellNativeMethods.SHChangeNotification_Lock(
+ message.WParam, (int)message.LParam, out pidl, out _event);
+ try
+ {
+ Trace.TraceInformation("Message: {0}", (ShellObjectChangeTypes)_event);
+
+ var notifyStruct = pidl.MarshalAs<ShellNativeMethods.ShellNotifyStruct>();
+
+ Guid guid = new Guid(ShellIIDGuid.IShellItem2);
+ if (notifyStruct.item1 != IntPtr.Zero &&
+ (((ShellObjectChangeTypes)_event) & ShellObjectChangeTypes.SystemImageUpdate) == ShellObjectChangeTypes.None)
+ {
+ IShellItem2 nativeShellItem;
+ if (CoreErrorHelper.Succeeded(ShellNativeMethods.SHCreateItemFromIDList(
+ notifyStruct.item1, ref guid, out nativeShellItem)))
+ {
+ string name;
+ nativeShellItem.GetDisplayName(ShellNativeMethods.ShellItemDesignNameOptions.FileSystemPath,
+ out name);
+ ItemName = name;
+
+ Trace.TraceInformation("Item1: {0}", ItemName);
+ }
+ }
+ else
+ {
+ ImageIndex = notifyStruct.item1.ToInt32();
+ }
+
+ if (notifyStruct.item2 != IntPtr.Zero)
+ {
+ IShellItem2 nativeShellItem;
+ if (CoreErrorHelper.Succeeded(ShellNativeMethods.SHCreateItemFromIDList(
+ notifyStruct.item2, ref guid, out nativeShellItem)))
+ {
+ string name;
+ nativeShellItem.GetDisplayName(ShellNativeMethods.ShellItemDesignNameOptions.FileSystemPath,
+ out name);
+ ItemName2 = name;
+
+ Trace.TraceInformation("Item2: {0}", ItemName2);
+ }
+ }
+ }
+ finally
+ {
+ if (lockId != IntPtr.Zero)
+ {
+ ShellNativeMethods.SHChangeNotification_Unlock(lockId);
+ }
+ }
+
+ }
+
+ public bool FromSystemInterrupt
+ {
+ get
+ {
+ return ((ShellObjectChangeTypes)_event & ShellObjectChangeTypes.FromInterrupt)
+ != ShellObjectChangeTypes.None;
+ }
+ }
+
+ public int ImageIndex { get; private set; }
+ public string ItemName { get; private set; }
+ public string ItemName2 { get; private set; }
+
+ public ShellObjectChangeTypes ChangeType { get { return (ShellObjectChangeTypes)_event; } }
+
+
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/MessageListener.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/MessageListener.cs
new file mode 100644
index 0000000000..b729e25120
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/MessageListener.cs
@@ -0,0 +1,216 @@
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using System.Threading;
+using MS.WindowsAPICodePack.Internal;
+using Microsoft.WindowsAPICodePack.Shell.Interop;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ internal class MessageListener : IDisposable
+ {
+ public const uint CreateWindowMessage = (uint)WindowMessage.User + 1;
+ public const uint DestroyWindowMessage = (uint)WindowMessage.User + 2;
+ public const uint BaseUserMessage = (uint)WindowMessage.User + 5;
+
+ private const string MessageWindowClassName = "MessageListenerClass";
+
+ private static readonly object _threadlock = new object();
+ private static uint _atom;
+ private static Thread _windowThread = null;
+ private static volatile bool _running = false;
+
+ private static ShellObjectWatcherNativeMethods.WndProcDelegate wndProc = WndProc;
+ // Dictionary relating window's hwnd to its message window
+ private static Dictionary<IntPtr, MessageListener> _listeners = new Dictionary<IntPtr, MessageListener>();
+ private static IntPtr _firstWindowHandle = IntPtr.Zero;
+
+ private static readonly object _crossThreadWindowLock = new object();
+ private static IntPtr _tempHandle = IntPtr.Zero;
+
+ public event EventHandler<WindowMessageEventArgs> MessageReceived;
+
+ public MessageListener()
+ {
+ lock (_threadlock)
+ {
+ if (_windowThread == null)
+ {
+ _windowThread = new Thread(ThreadMethod);
+ _windowThread.SetApartmentState(ApartmentState.STA);
+ _windowThread.Name = "ShellObjectWatcherMessageListenerHelperThread";
+
+ lock (_crossThreadWindowLock)
+ {
+ _windowThread.Start();
+ Monitor.Wait(_crossThreadWindowLock);
+ }
+
+ _firstWindowHandle = WindowHandle;
+ }
+ else
+ {
+ CrossThreadCreateWindow();
+ }
+
+ if (WindowHandle == IntPtr.Zero)
+ {
+ throw new ShellException(LocalizedMessages.MessageListenerCannotCreateWindow,
+ Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error()));
+ }
+
+ _listeners.Add(WindowHandle, this);
+ }
+ }
+
+ private void CrossThreadCreateWindow()
+ {
+ if (_firstWindowHandle == IntPtr.Zero)
+ {
+ throw new InvalidOperationException(LocalizedMessages.MessageListenerNoWindowHandle);
+ }
+
+ lock (_crossThreadWindowLock)
+ {
+ CoreNativeMethods.PostMessage(_firstWindowHandle, (WindowMessage)CreateWindowMessage, IntPtr.Zero, IntPtr.Zero);
+ Monitor.Wait(_crossThreadWindowLock);
+ }
+
+ WindowHandle = _tempHandle;
+ }
+
+ private static void RegisterWindowClass()
+ {
+ WindowClassEx classEx = new WindowClassEx();
+ classEx.ClassName = MessageWindowClassName;
+ classEx.WndProc = wndProc;
+
+ classEx.Size = (uint)Marshal.SizeOf(typeof(WindowClassEx));
+
+ var atom = ShellObjectWatcherNativeMethods.RegisterClassEx(ref classEx);
+ if (atom == 0)
+ {
+ throw new ShellException(LocalizedMessages.MessageListenerClassNotRegistered,
+ Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error()));
+ }
+ _atom = atom;
+ }
+
+ private static IntPtr CreateWindow()
+ {
+ IntPtr handle = ShellObjectWatcherNativeMethods.CreateWindowEx(
+ 0, //extended style
+ MessageWindowClassName, //class name
+ "MessageListenerWindow", //title
+ 0, //style
+ 0, 0, 0, 0, // x,y,width,height
+ new IntPtr(-3), // -3 = Message-Only window
+ IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
+
+ return handle;
+ }
+
+ private void ThreadMethod() // Message Loop
+ {
+ lock (_crossThreadWindowLock)
+ {
+ _running = true;
+ if (_atom == 0)
+ {
+ RegisterWindowClass();
+ }
+ WindowHandle = CreateWindow();
+
+ Monitor.Pulse(_crossThreadWindowLock);
+ }
+
+ while (_running)
+ {
+ Message msg;
+ if (ShellObjectWatcherNativeMethods.GetMessage(out msg, IntPtr.Zero, 0, 0))
+ {
+ ShellObjectWatcherNativeMethods.DispatchMessage(ref msg);
+ }
+ }
+ }
+
+ private static int WndProc(IntPtr hwnd, uint msg, IntPtr wparam, IntPtr lparam)
+ {
+ switch (msg)
+ {
+ case CreateWindowMessage:
+ lock (_crossThreadWindowLock)
+ {
+ _tempHandle = CreateWindow();
+ Monitor.Pulse(_crossThreadWindowLock);
+ }
+ break;
+ case (uint)WindowMessage.Destroy:
+ break;
+ default:
+ MessageListener listener;
+ if (_listeners.TryGetValue(hwnd, out listener))
+ {
+ Message message = new Message(hwnd, msg, wparam, lparam, 0, new NativePoint());
+ listener.MessageReceived.SafeRaise(listener, new WindowMessageEventArgs(message));
+ }
+ break;
+ }
+
+ return ShellObjectWatcherNativeMethods.DefWindowProc(hwnd, msg, wparam, lparam);
+ }
+
+ public IntPtr WindowHandle { get; private set; }
+ public static bool Running { get { return _running; } }
+
+ #region IDisposable Members
+
+ ~MessageListener()
+ {
+ Dispose(false);
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ lock (_threadlock)
+ {
+ _listeners.Remove(WindowHandle);
+ if (_listeners.Count == 0)
+ {
+ CoreNativeMethods.PostMessage(WindowHandle, WindowMessage.Destroy, IntPtr.Zero, IntPtr.Zero);
+ }
+ }
+ }
+ }
+
+ #endregion
+ }
+
+
+ /// <summary>
+ /// Encapsulates the data about a window message
+ /// </summary>
+ public class WindowMessageEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Received windows message.
+ /// </summary>
+ public Message Message { get; private set; }
+
+ internal WindowMessageEventArgs(Message msg)
+ {
+ Message = msg;
+ }
+ }
+
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/MessageListenerFilter.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/MessageListenerFilter.cs
new file mode 100644
index 0000000000..d63beea446
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/MessageListenerFilter.cs
@@ -0,0 +1,126 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using MS.WindowsAPICodePack.Internal;
+using System.Threading;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ internal static class MessageListenerFilter
+ {
+ private static readonly object _registerLock = new object();
+ private static List<RegisteredListener> _packages = new List<RegisteredListener>();
+
+ public static MessageListenerFilterRegistrationResult Register(Action<WindowMessageEventArgs> callback)
+ {
+ lock (_registerLock)
+ {
+ uint message = 0;
+ var package = _packages.FirstOrDefault(x => x.TryRegister(callback, out message));
+ if (package == null)
+ {
+ package = new RegisteredListener();
+ if (!package.TryRegister(callback, out message))
+ { // this should never happen
+ throw new ShellException(LocalizedMessages.MessageListenerFilterUnableToRegister);
+ }
+ _packages.Add(package);
+ }
+
+ return new MessageListenerFilterRegistrationResult(
+ package.Listener.WindowHandle,
+ message);
+ }
+ }
+
+ public static void Unregister(IntPtr listenerHandle, uint message)
+ {
+ lock (_registerLock)
+ {
+ var package = _packages.FirstOrDefault(x => x.Listener.WindowHandle == listenerHandle);
+ if (package == null || !package.Callbacks.Remove(message))
+ {
+ throw new ArgumentException(LocalizedMessages.MessageListenerFilterUnknownListenerHandle);
+ }
+
+ if (package.Callbacks.Count == 0)
+ {
+ package.Listener.Dispose();
+ _packages.Remove(package);
+ }
+ }
+ }
+
+ class RegisteredListener
+ {
+ public Dictionary<uint, Action<WindowMessageEventArgs>> Callbacks { get; private set; }
+
+ public MessageListener Listener { get; private set; }
+
+ public RegisteredListener()
+ {
+ Callbacks = new Dictionary<uint, Action<WindowMessageEventArgs>>();
+ Listener = new MessageListener();
+ Listener.MessageReceived += MessageReceived;
+ }
+
+ private void MessageReceived(object sender, WindowMessageEventArgs e)
+ {
+ Action<WindowMessageEventArgs> action;
+ if (Callbacks.TryGetValue(e.Message.Msg, out action))
+ {
+ action(e);
+ }
+ }
+
+ private uint _lastMessage = MessageListener.BaseUserMessage;
+ public bool TryRegister(Action<WindowMessageEventArgs> callback, out uint message)
+ {
+ message = 0;
+ if (Callbacks.Count < ushort.MaxValue - MessageListener.BaseUserMessage)
+ {
+ uint i = _lastMessage + 1;
+ while (i != _lastMessage)
+ {
+ if (i > ushort.MaxValue) { i = MessageListener.BaseUserMessage; }
+
+ if (!Callbacks.ContainsKey(i))
+ {
+ _lastMessage = message = i;
+ Callbacks.Add(i, callback);
+ return true;
+ }
+ i++;
+ }
+ }
+ return false;
+ }
+ }
+ }
+
+ /// <summary>
+ /// The result of registering with the MessageListenerFilter
+ /// </summary>
+ internal class MessageListenerFilterRegistrationResult
+ {
+ internal MessageListenerFilterRegistrationResult(IntPtr handle, uint msg)
+ {
+ WindowHandle = handle;
+ Message = msg;
+ }
+
+ /// <summary>
+ /// Gets the window handle to which the callback was registered.
+ /// </summary>
+ public IntPtr WindowHandle { get; private set; }
+
+ /// <summary>
+ /// Gets the message for which the callback was registered.
+ /// </summary>
+ public uint Message { get; private set; }
+ }
+
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ShellObjectNotificationEventArgs.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ShellObjectNotificationEventArgs.cs
new file mode 100644
index 0000000000..b607fb0e67
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ShellObjectNotificationEventArgs.cs
@@ -0,0 +1,79 @@
+using System;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Base class for the Event Args for change notifications raised by <typeparamref name="ShellObjectWatcher"/>.
+ /// </summary>
+ public class ShellObjectNotificationEventArgs : EventArgs
+ {
+ /// <summary>
+ /// The type of the change that happened to the ShellObject
+ /// </summary>
+ public ShellObjectChangeTypes ChangeType { get; private set; }
+
+ /// <summary>
+ /// True if the event was raised as a result of a system interrupt.
+ /// </summary>
+ public bool FromSystemInterrupt { get; private set; }
+
+ internal ShellObjectNotificationEventArgs(ChangeNotifyLock notifyLock)
+ {
+ ChangeType = notifyLock.ChangeType;
+ FromSystemInterrupt = notifyLock.FromSystemInterrupt;
+ }
+ }
+
+ /// <summary>
+ /// The data that describes a ShellObject event with a single path parameter
+ /// </summary>
+ public class ShellObjectChangedEventArgs : ShellObjectNotificationEventArgs
+ {
+ /// <summary>
+ /// The path of the shell object
+ /// </summary>
+ public string Path { get; private set; }
+
+ internal ShellObjectChangedEventArgs(ChangeNotifyLock notifyLock)
+ : base(notifyLock)
+ {
+ Path = notifyLock.ItemName;
+ }
+ }
+
+ /// <summary>
+ /// The data that describes a ShellObject renamed event
+ /// </summary>
+ public class ShellObjectRenamedEventArgs : ShellObjectChangedEventArgs
+ {
+ /// <summary>
+ /// The new path of the shell object
+ /// </summary>
+ public string NewPath { get; private set; }
+
+ internal ShellObjectRenamedEventArgs(ChangeNotifyLock notifyLock)
+ : base(notifyLock)
+ {
+ NewPath = notifyLock.ItemName2;
+ }
+ }
+
+ /// <summary>
+ /// The data that describes a SystemImageUpdated event.
+ /// </summary>
+ public class SystemImageUpdatedEventArgs : ShellObjectNotificationEventArgs
+ {
+ /// <summary>
+ /// Gets the index of the system image that has been updated.
+ /// </summary>
+ public int ImageIndex { get; private set; }
+
+ internal SystemImageUpdatedEventArgs(ChangeNotifyLock notifyLock)
+ : base(notifyLock)
+ {
+ ImageIndex = notifyLock.ImageIndex;
+ }
+ }
+
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ShellObjectWatcher.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ShellObjectWatcher.cs
new file mode 100644
index 0000000000..3639abfb77
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ShellObjectWatcher.cs
@@ -0,0 +1,561 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.ComponentModel;
+using System.Threading;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Listens for changes in/on a ShellObject and raises events when they occur.
+ /// This class supports all items under the shell namespace including
+ /// files, folders and virtual folders (libraries, search results and network items), etc.
+ /// </summary>
+ public class ShellObjectWatcher : IDisposable
+ {
+ private ShellObject _shellObject;
+ private bool _recursive;
+
+ private ChangeNotifyEventManager _manager = new ChangeNotifyEventManager();
+ private IntPtr _listenerHandle;
+ private uint _message;
+
+ private uint _registrationId;
+ private volatile bool _running;
+
+ private SynchronizationContext _context = SynchronizationContext.Current;
+
+ /// <summary>
+ /// Creates the ShellObjectWatcher for the given ShellObject
+ /// </summary>
+ /// <param name="shellObject">The ShellObject to monitor</param>
+ /// <param name="recursive">Whether to listen for changes recursively (for when monitoring a container)</param>
+ public ShellObjectWatcher(ShellObject shellObject, bool recursive)
+ {
+ if (shellObject == null)
+ {
+ throw new ArgumentNullException("shellObject");
+ }
+
+ if (_context == null)
+ {
+ _context = new SynchronizationContext();
+ SynchronizationContext.SetSynchronizationContext(_context);
+ }
+
+ _shellObject = shellObject;
+ this._recursive = recursive;
+
+ var result = MessageListenerFilter.Register(OnWindowMessageReceived);
+ _listenerHandle = result.WindowHandle;
+ _message = result.Message;
+ }
+
+ /// <summary>
+ /// Gets whether the watcher is currently running.
+ /// </summary>
+ public bool Running
+ {
+ get { return _running; }
+ private set { _running = value; }
+ }
+
+ /// <summary>
+ /// Start the watcher and begin receiving change notifications.
+ /// <remarks>
+ /// If the watcher is running, has no effect.
+ /// Registration for notifications should be done before this is called.
+ /// </remarks>
+ /// </summary>
+ public void Start()
+ {
+ if (Running) { return; }
+
+ #region Registration
+ ShellNativeMethods.SHChangeNotifyEntry entry = new ShellNativeMethods.SHChangeNotifyEntry();
+ entry.recursively = _recursive;
+
+ entry.pIdl = _shellObject.PIDL;
+
+ _registrationId = ShellNativeMethods.SHChangeNotifyRegister(
+ _listenerHandle,
+ ShellNativeMethods.ShellChangeNotifyEventSource.ShellLevel | ShellNativeMethods.ShellChangeNotifyEventSource.InterruptLevel | ShellNativeMethods.ShellChangeNotifyEventSource.NewDelivery,
+ _manager.RegisteredTypes, //ShellObjectChangeTypes.AllEventsMask,
+ _message,
+ 1,
+ ref entry);
+
+ if (_registrationId == 0)
+ {
+ throw new Win32Exception(LocalizedMessages.ShellObjectWatcherRegisterFailed);
+ }
+ #endregion
+
+ Running = true;
+ }
+
+ /// <summary>
+ /// Stop the watcher and prevent further notifications from being received.
+ /// <remarks>If the watcher is not running, this has no effect.</remarks>
+ /// </summary>
+ public void Stop()
+ {
+ if (!Running) { return; }
+ if (_registrationId > 0)
+ {
+ ShellNativeMethods.SHChangeNotifyDeregister(_registrationId);
+ _registrationId = 0;
+ }
+ Running = false;
+ }
+
+ private void OnWindowMessageReceived(WindowMessageEventArgs e)
+ {
+ if (e.Message.Msg == _message)
+ {
+ _context.Send(x => ProcessChangeNotificationEvent(e), null);
+ }
+ }
+
+ private void ThrowIfRunning()
+ {
+ if (Running)
+ {
+ throw new InvalidOperationException(LocalizedMessages.ShellObjectWatcherUnableToChangeEvents);
+ }
+ }
+
+ /// <summary>
+ /// Processes all change notifications sent by the Windows Shell.
+ /// </summary>
+ /// <param name="e">The windows message representing the notification event</param>
+ protected virtual void ProcessChangeNotificationEvent(WindowMessageEventArgs e)
+ {
+ if (!Running) { return; }
+ if (e == null) { throw new ArgumentNullException("e"); }
+
+ ChangeNotifyLock notifyLock = new ChangeNotifyLock(e.Message);
+
+ ShellObjectNotificationEventArgs args = null;
+ switch (notifyLock.ChangeType)
+ {
+ case ShellObjectChangeTypes.DirectoryRename:
+ case ShellObjectChangeTypes.ItemRename:
+ args = new ShellObjectRenamedEventArgs(notifyLock);
+ break;
+ case ShellObjectChangeTypes.SystemImageUpdate:
+ args = new SystemImageUpdatedEventArgs(notifyLock);
+ break;
+ default:
+ args = new ShellObjectChangedEventArgs(notifyLock);
+ break;
+ }
+
+ _manager.Invoke(this, notifyLock.ChangeType, args);
+ }
+
+ #region Change Events
+
+ #region Mask Events
+ /// <summary>
+ /// Raised when any event occurs.
+ /// </summary>
+ public event EventHandler<ShellObjectNotificationEventArgs> AllEvents
+ {
+ add
+ {
+ ThrowIfRunning();
+ _manager.Register(ShellObjectChangeTypes.AllEventsMask, value);
+ }
+ remove
+ {
+ ThrowIfRunning();
+ _manager.Unregister(ShellObjectChangeTypes.AllEventsMask, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when global events occur.
+ /// </summary>
+ public event EventHandler<ShellObjectNotificationEventArgs> GlobalEvents
+ {
+ add
+ {
+ ThrowIfRunning();
+ _manager.Register(ShellObjectChangeTypes.GlobalEventsMask, value);
+ }
+ remove
+ {
+ ThrowIfRunning();
+ _manager.Unregister(ShellObjectChangeTypes.GlobalEventsMask, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when disk events occur.
+ /// </summary>
+ public event EventHandler<ShellObjectNotificationEventArgs> DiskEvents
+ {
+ add
+ {
+ ThrowIfRunning();
+ _manager.Register(ShellObjectChangeTypes.DiskEventsMask, value);
+ }
+ remove
+ {
+ ThrowIfRunning();
+ _manager.Unregister(ShellObjectChangeTypes.DiskEventsMask, value);
+ }
+ }
+ #endregion
+
+ #region Single Events
+ /// <summary>
+ /// Raised when an item is renamed.
+ /// </summary>
+ public event EventHandler<ShellObjectRenamedEventArgs> ItemRenamed
+ {
+ add
+ {
+ ThrowIfRunning();
+ _manager.Register(ShellObjectChangeTypes.ItemRename, value);
+ }
+ remove
+ {
+ ThrowIfRunning();
+ _manager.Unregister(ShellObjectChangeTypes.ItemRename, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when an item is created.
+ /// </summary>
+ public event EventHandler<ShellObjectChangedEventArgs> ItemCreated
+ {
+ add
+ {
+ ThrowIfRunning();
+ _manager.Register(ShellObjectChangeTypes.ItemCreate, value);
+ }
+ remove
+ {
+ ThrowIfRunning();
+ _manager.Unregister(ShellObjectChangeTypes.ItemCreate, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when an item is deleted.
+ /// </summary>
+ public event EventHandler<ShellObjectChangedEventArgs> ItemDeleted
+ {
+ add
+ {
+ ThrowIfRunning();
+ _manager.Register(ShellObjectChangeTypes.ItemDelete, value);
+ }
+ remove
+ {
+ ThrowIfRunning();
+ _manager.Unregister(ShellObjectChangeTypes.ItemDelete, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when an item is updated.
+ /// </summary>
+ public event EventHandler<ShellObjectChangedEventArgs> Updated
+ {
+ add
+ {
+ ThrowIfRunning();
+ _manager.Register(ShellObjectChangeTypes.Update, value);
+ }
+ remove
+ {
+ ThrowIfRunning();
+ _manager.Unregister(ShellObjectChangeTypes.Update, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when a directory is updated.
+ /// </summary>
+ public event EventHandler<ShellObjectChangedEventArgs> DirectoryUpdated
+ {
+ add
+ {
+ ThrowIfRunning();
+ _manager.Register(ShellObjectChangeTypes.DirectoryContentsUpdate, value);
+ }
+ remove
+ {
+ ThrowIfRunning();
+ _manager.Unregister(ShellObjectChangeTypes.DirectoryContentsUpdate, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when a directory is renamed.
+ /// </summary>
+ public event EventHandler<ShellObjectRenamedEventArgs> DirectoryRenamed
+ {
+ add
+ {
+ ThrowIfRunning();
+ _manager.Register(ShellObjectChangeTypes.DirectoryRename, value);
+ }
+ remove
+ {
+ ThrowIfRunning();
+ _manager.Unregister(ShellObjectChangeTypes.DirectoryRename, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when a directory is created.
+ /// </summary>
+ public event EventHandler<ShellObjectChangedEventArgs> DirectoryCreated
+ {
+ add
+ {
+ ThrowIfRunning();
+ _manager.Register(ShellObjectChangeTypes.DirectoryCreate, value);
+ }
+ remove
+ {
+ ThrowIfRunning();
+ _manager.Unregister(ShellObjectChangeTypes.DirectoryCreate, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when a directory is deleted.
+ /// </summary>
+ public event EventHandler<ShellObjectChangedEventArgs> DirectoryDeleted
+ {
+ add
+ {
+ ThrowIfRunning();
+ _manager.Register(ShellObjectChangeTypes.DirectoryDelete, value);
+ }
+ remove
+ {
+ ThrowIfRunning();
+ _manager.Unregister(ShellObjectChangeTypes.DirectoryDelete, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when media is inserted.
+ /// </summary>
+ public event EventHandler<ShellObjectChangedEventArgs> MediaInserted
+ {
+ add
+ {
+ ThrowIfRunning();
+ _manager.Register(ShellObjectChangeTypes.MediaInsert, value);
+ }
+ remove
+ {
+ ThrowIfRunning();
+ _manager.Unregister(ShellObjectChangeTypes.MediaInsert, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when media is removed.
+ /// </summary>
+ public event EventHandler<ShellObjectChangedEventArgs> MediaRemoved
+ {
+ add
+ {
+ ThrowIfRunning();
+ _manager.Register(ShellObjectChangeTypes.MediaRemove, value);
+ }
+ remove
+ {
+ ThrowIfRunning();
+ _manager.Unregister(ShellObjectChangeTypes.MediaRemove, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when a drive is added.
+ /// </summary>
+ public event EventHandler<ShellObjectChangedEventArgs> DriveAdded
+ {
+ add
+ {
+ ThrowIfRunning();
+ _manager.Register(ShellObjectChangeTypes.DriveAdd, value);
+ }
+ remove
+ {
+ ThrowIfRunning();
+ _manager.Unregister(ShellObjectChangeTypes.DriveAdd, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when a drive is removed.
+ /// </summary>
+ public event EventHandler<ShellObjectChangedEventArgs> DriveRemoved
+ {
+ add
+ {
+ ThrowIfRunning();
+ _manager.Register(ShellObjectChangeTypes.DriveRemove, value);
+ }
+ remove
+ {
+ ThrowIfRunning();
+ _manager.Unregister(ShellObjectChangeTypes.DriveRemove, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when a folder is shared on a network.
+ /// </summary>
+ public event EventHandler<ShellObjectChangedEventArgs> FolderNetworkShared
+ {
+ add
+ {
+ ThrowIfRunning();
+ _manager.Register(ShellObjectChangeTypes.NetShare, value);
+ }
+ remove
+ {
+ ThrowIfRunning();
+ _manager.Unregister(ShellObjectChangeTypes.NetShare, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when a folder is unshared from the network.
+ /// </summary>
+ public event EventHandler<ShellObjectChangedEventArgs> FolderNetworkUnshared
+ {
+ add
+ {
+ ThrowIfRunning();
+ _manager.Register(ShellObjectChangeTypes.NetUnshare, value);
+ }
+ remove
+ {
+ ThrowIfRunning();
+ _manager.Unregister(ShellObjectChangeTypes.NetUnshare, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when a server is disconnected.
+ /// </summary>
+ public event EventHandler<ShellObjectChangedEventArgs> ServerDisconnected
+ {
+ add
+ {
+ ThrowIfRunning();
+ _manager.Register(ShellObjectChangeTypes.ServerDisconnect, value);
+ }
+ remove
+ {
+ ThrowIfRunning();
+ _manager.Unregister(ShellObjectChangeTypes.ServerDisconnect, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when a system image is changed.
+ /// </summary>
+ public event EventHandler<ShellObjectChangedEventArgs> SystemImageChanged
+ {
+ add
+ {
+ ThrowIfRunning();
+ _manager.Register(ShellObjectChangeTypes.SystemImageUpdate, value);
+ }
+ remove
+ {
+ ThrowIfRunning();
+ _manager.Unregister(ShellObjectChangeTypes.SystemImageUpdate, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when free space changes.
+ /// </summary>
+ public event EventHandler<ShellObjectChangedEventArgs> FreeSpaceChanged
+ {
+ add
+ {
+ ThrowIfRunning();
+ _manager.Register(ShellObjectChangeTypes.FreeSpace, value);
+ }
+ remove
+ {
+ ThrowIfRunning();
+ _manager.Unregister(ShellObjectChangeTypes.FreeSpace, value);
+ }
+ }
+
+ /// <summary>
+ /// Raised when a file type association changes.
+ /// </summary>
+ public event EventHandler<ShellObjectChangedEventArgs> FileTypeAssociationChanged
+ {
+ add
+ {
+ ThrowIfRunning();
+ _manager.Register(ShellObjectChangeTypes.AssociationChange, value);
+ }
+ remove
+ {
+ ThrowIfRunning();
+ _manager.Unregister(ShellObjectChangeTypes.AssociationChange, value);
+ }
+ }
+ #endregion
+
+ #endregion
+
+ #region IDisposable Members
+
+ /// <summary>
+ /// Disposes ShellObjectWatcher
+ /// </summary>
+ /// <param name="disposing"></param>
+ protected virtual void Dispose(bool disposing)
+ {
+ Stop();
+ _manager.UnregisterAll();
+
+ if (_listenerHandle != IntPtr.Zero)
+ {
+ MessageListenerFilter.Unregister(_listenerHandle, _message);
+ }
+ }
+
+ /// <summary>
+ /// Disposes ShellObjectWatcher.
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Finalizer for ShellObjectWatcher
+ /// </summary>
+ ~ShellObjectWatcher()
+ {
+ Dispose(false);
+ }
+
+ #endregion
+ }
+
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ShellObjectWatcherEnums.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ShellObjectWatcherEnums.cs
new file mode 100644
index 0000000000..111e9eaf04
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ShellObjectWatcherEnums.cs
@@ -0,0 +1,190 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Describes the event that has occurred.
+ /// Typically, only one event is specified at a time.
+ /// If more than one event is specified,
+ /// the values contained in the dwItem1 and dwItem2 parameters must be the same,
+ /// respectively, for all specified events.
+ /// This parameter can be one or more of the following values:
+ /// </summary>
+ [Flags]
+ public enum ShellObjectChangeTypes
+ {
+ /// <summary>
+ /// None
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// The name of a nonfolder item has changed.
+ /// SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags.
+ /// dwItem1 contains the previous PIDL or name of the item.
+ /// dwItem2 contains the new PIDL or name of the item.
+ /// </summary>
+ ItemRename = 0x00000001,
+
+ /// <summary>
+ /// A nonfolder item has been created. SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags.
+ /// dwItem1 contains the item that was created.
+ /// dwItem2 is not used and should be NULL.
+ /// </summary>
+ ItemCreate = 0x00000002,
+
+ /// <summary>
+ /// A nonfolder item has been deleted. SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags.
+ /// dwItem1 contains the item that was deleted.
+ /// dwItem2 is not used and should be NULL.
+ /// </summary>
+ ItemDelete = 0x00000004,
+
+ /// <summary>
+ /// A folder has been created. SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags.
+ /// dwItem1 contains the folder that was created.
+ /// dwItem2 is not used and should be NULL.
+ /// </summary>
+ DirectoryCreate = 0x00000008,
+
+ /// <summary>
+ /// A folder has been removed. SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags.
+ /// dwItem1 contains the folder that was removed.
+ /// dwItem2 is not used and should be NULL.
+ /// </summary>
+ DirectoryDelete = 0x00000010,
+
+ /// <summary>
+ /// Storage media has been inserted into a drive. SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags.
+ /// dwItem1 contains the root of the drive that contains the new media.
+ /// dwItem2 is not used and should be NULL.
+ /// </summary>
+ MediaInsert = 0x00000020,
+
+ /// <summary>
+ /// Storage media has been removed from a drive. SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags.
+ /// dwItem1 contains the root of the drive from which the media was removed.
+ /// dwItem2 is not used and should be NULL.
+ /// </summary>
+ MediaRemove = 0x00000040,
+
+ /// <summary>
+ /// A drive has been removed. SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags.
+ /// dwItem1 contains the root of the drive that was removed.
+ /// dwItem2 is not used and should be NULL.
+ /// </summary>
+ DriveRemove = 0x00000080,
+
+ /// <summary>
+ /// A drive has been added. SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags.
+ /// dwItem1 contains the root of the drive that was added.
+ /// dwItem2 is not used and should be NULL.
+ /// </summary>
+ DriveAdd = 0x00000100,
+
+ /// <summary>
+ /// A folder on the local computer is being shared via the network.
+ /// SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags.
+ /// dwItem1 contains the folder that is being shared.
+ /// dwItem2 is not used and should be NULL.
+ /// </summary>
+ NetShare = 0x00000200,
+
+ /// <summary>
+ /// A folder on the local computer is no longer being shared via the network.
+ /// SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags.
+ /// dwItem1 contains the folder that is no longer being shared.
+ /// dwItem2 is not used and should be NULL.
+ /// </summary>
+ NetUnshare = 0x00000400,
+
+ /// <summary>
+ /// The attributes of an item or folder have changed.
+ /// SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags.
+ /// dwItem1 contains the item or folder that has changed.
+ /// dwItem2 is not used and should be NULL.
+ /// </summary>
+ AttributesChange = 0x00000800,
+
+ /// <summary>
+ /// The contents of an existing folder have changed, but the folder still exists and has not been renamed.
+ /// SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags.
+ /// dwItem1 contains the folder that has changed.
+ /// dwItem2 is not used and should be NULL.
+ /// If a folder has been created, deleted, or renamed, use SHCNE_MKDIR, SHCNE_RMDIR, or SHCNE_RENAMEFOLDER, respectively.
+ /// </summary>
+ DirectoryContentsUpdate = 0x00001000,
+
+ /// <summary>
+ /// An existing item (a folder or a nonfolder) has changed, but the item still exists and has not been renamed.
+ /// SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags.
+ /// dwItem1 contains the item that has changed.
+ /// dwItem2 is not used and should be NULL.
+ /// If a nonfolder item has been created, deleted, or renamed,
+ /// use SHCNE_CREATE, SHCNE_DELETE, or SHCNE_RENAMEITEM, respectively, instead.
+ /// </summary>
+ Update = 0x00002000,
+
+ /// <summary>
+ /// The computer has disconnected from a server.
+ /// SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags.
+ /// dwItem1 contains the server from which the computer was disconnected.
+ /// dwItem2 is not used and should be NULL.
+ /// </summary>
+ ServerDisconnect = 0x00004000,
+
+ /// <summary>
+ /// An image in the system image list has changed.
+ /// SHCNF_DWORD must be specified in uFlags.
+ /// dwItem1 is not used and should be NULL.
+ /// dwItem2 contains the index in the system image list that has changed.
+ /// </summary> //verify this is not opposite?
+ SystemImageUpdate = 0x00008000,
+
+ /// <summary>
+ /// The name of a folder has changed. SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags.
+ /// dwItem1 contains the previous PIDL or name of the folder.
+ /// dwItem2 contains the new PIDL or name of the folder.
+ /// </summary>
+ DirectoryRename = 0x00020000,
+
+ /// <summary>
+ /// The amount of free space on a drive has changed.
+ /// SHCNF_IDLIST or SHCNF_PATH must be specified in uFlags.
+ /// dwItem1 contains the root of the drive on which the free space changed.
+ /// dwItem2 is not used and should be NULL.
+ /// </summary>
+ FreeSpace = 0x00040000,
+
+ /// <summary>
+ /// A file type association has changed.
+ /// SHCNF_IDLIST must be specified in the uFlags parameter.
+ /// dwItem1 and dwItem2 are not used and must be NULL.
+ /// </summary>
+ AssociationChange = 0x08000000,
+
+ /// <summary>
+ /// Specifies a combination of all of the disk event identifiers.
+ /// </summary>
+ DiskEventsMask = 0x0002381F,
+
+ /// <summary>
+ /// Specifies a combination of all of the global event identifiers.
+ /// </summary>
+ GlobalEventsMask = 0x0C0581E0,
+
+ /// <summary>
+ /// All events have occurred.
+ /// </summary>
+ AllEventsMask = 0x7FFFFFFF,
+
+ /// <summary>
+ /// The specified event occurred as a result of a system interrupt.
+ /// As this value modifies other event values, it cannot be used alone.
+ /// </summary>
+ FromInterrupt = unchecked((int)0x80000000),
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/StockIcons/StockIcon.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/StockIcons/StockIcon.cs
new file mode 100644
index 0000000000..43af02ae6e
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/StockIcons/StockIcon.cs
@@ -0,0 +1,270 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using System.Windows;
+using System.Windows.Interop;
+using System.Windows.Media.Imaging;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Represents a standard system icon.
+ /// </summary>
+ public class StockIcon : IDisposable
+ {
+ #region Private Members
+
+ private StockIconIdentifier identifier = StockIconIdentifier.Application;
+ private StockIconSize currentSize = StockIconSize.Large;
+ private bool linkOverlay;
+ private bool selected;
+ private bool invalidateIcon = true;
+ private IntPtr hIcon = IntPtr.Zero;
+
+ #endregion
+
+ #region Public Constructors
+
+ /// <summary>
+ /// Creates a new StockIcon instance with the specified identifer, default size
+ /// and no link overlay or selected states.
+ /// </summary>
+ /// <param name="id">A value that identifies the icon represented by this instance.</param>
+ public StockIcon(StockIconIdentifier id)
+ {
+ identifier = id;
+ invalidateIcon = true;
+ }
+
+ /// <summary>
+ /// Creates a new StockIcon instance with the specified identifer and options.
+ /// </summary>
+ /// <param name="id">A value that identifies the icon represented by this instance.</param>
+ /// <param name="size">A value that indicates the size of the stock icon.</param>
+ /// <param name="isLinkOverlay">A bool value that indicates whether the icon has a link overlay.</param>
+ /// <param name="isSelected">A bool value that indicates whether the icon is in a selected state.</param>
+ public StockIcon(StockIconIdentifier id, StockIconSize size, bool isLinkOverlay, bool isSelected)
+ {
+ identifier = id;
+ linkOverlay = isLinkOverlay;
+ selected = isSelected;
+ currentSize = size;
+ invalidateIcon = true;
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the icon appears selected.
+ /// </summary>
+ /// <value>A <see cref="System.Boolean"/> value.</value>
+ public bool Selected
+ {
+ get { return selected; }
+ set
+ {
+ selected = value;
+ invalidateIcon = true;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value that cotrols whether to put a link overlay on the icon.
+ /// </summary>
+ /// <value>A <see cref="System.Boolean"/> value.</value>
+ public bool LinkOverlay
+ {
+ get { return linkOverlay; }
+ set
+ {
+ linkOverlay = value;
+ invalidateIcon = true;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value that controls the size of the Stock Icon.
+ /// </summary>
+ /// <value>A <see cref="Microsoft.WindowsAPICodePack.Shell.StockIconSize"/> value.</value>
+ public StockIconSize CurrentSize
+ {
+ get { return currentSize; }
+ set
+ {
+ currentSize = value;
+ invalidateIcon = true;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the Stock Icon identifier associated with this icon.
+ /// </summary>
+ public StockIconIdentifier Identifier
+ {
+ get { return identifier; }
+ set
+ {
+ identifier = value;
+ invalidateIcon = true;
+ }
+ }
+
+ /// <summary>
+ /// Gets the icon image in <see cref="System.Drawing.Bitmap"/> format.
+ /// </summary>
+ public Bitmap Bitmap
+ {
+ get
+ {
+ UpdateHIcon();
+
+ return hIcon != IntPtr.Zero ? Bitmap.FromHicon(hIcon) : null;
+ }
+ }
+
+ /// <summary>
+ /// Gets the icon image in <see cref="System.Windows.Media.Imaging.BitmapSource"/> format.
+ /// </summary>
+ public BitmapSource BitmapSource
+ {
+ get
+ {
+ UpdateHIcon();
+
+ return (hIcon != IntPtr.Zero) ?
+ Imaging.CreateBitmapSourceFromHIcon(hIcon, Int32Rect.Empty, null) : null;
+ }
+ }
+
+ /// <summary>
+ /// Gets the icon image in <see cref="System.Drawing.Icon"/> format.
+ /// </summary>
+ public Icon Icon
+ {
+ get
+ {
+ UpdateHIcon();
+
+ return hIcon != IntPtr.Zero ? Icon.FromHandle(hIcon) : null;
+ }
+ }
+
+ #endregion
+
+ #region Private Methods
+
+ private void UpdateHIcon()
+ {
+ if (invalidateIcon)
+ {
+ if (hIcon != IntPtr.Zero)
+ CoreNativeMethods.DestroyIcon(hIcon);
+
+ hIcon = GetHIcon();
+
+ invalidateIcon = false;
+ }
+ }
+
+ private IntPtr GetHIcon()
+ {
+ // Create our internal flag to pass to the native method
+ StockIconsNativeMethods.StockIconOptions flags = StockIconsNativeMethods.StockIconOptions.Handle;
+
+ // Based on the current settings, update the flags
+ if (CurrentSize == StockIconSize.Small)
+ {
+ flags |= StockIconsNativeMethods.StockIconOptions.Small;
+ }
+ else if (CurrentSize == StockIconSize.ShellSize)
+ {
+ flags |= StockIconsNativeMethods.StockIconOptions.ShellSize;
+ }
+ else
+ {
+ flags |= StockIconsNativeMethods.StockIconOptions.Large; // default
+ }
+
+ if (Selected)
+ {
+ flags |= StockIconsNativeMethods.StockIconOptions.Selected;
+ }
+
+ if (LinkOverlay)
+ {
+ flags |= StockIconsNativeMethods.StockIconOptions.LinkOverlay;
+ }
+
+ // Create a StockIconInfo structure to pass to the native method.
+ StockIconsNativeMethods.StockIconInfo info = new StockIconsNativeMethods.StockIconInfo();
+ info.StuctureSize = (UInt32)Marshal.SizeOf(typeof(StockIconsNativeMethods.StockIconInfo));
+
+ // Pass the struct to the native method
+ HResult hr = StockIconsNativeMethods.SHGetStockIconInfo(identifier, flags, ref info);
+
+ // If we get an error, return null as the icon requested might not be supported
+ // on the current system
+ if (hr != HResult.Ok)
+ {
+ if (hr == HResult.InvalidArguments)
+ {
+ throw new InvalidOperationException(
+ string.Format(System.Globalization.CultureInfo.InvariantCulture,
+ LocalizedMessages.StockIconInvalidGuid,
+ identifier));
+ }
+
+ return IntPtr.Zero;
+ }
+
+ // If we succeed, return the HIcon
+ return info.Handle;
+ }
+
+ #endregion
+
+ #region IDisposable Members
+
+ /// <summary>
+ /// Release the native and managed objects
+ /// </summary>
+ /// <param name="disposing">Indicates that this is being called from Dispose(), rather than the finalizer.</param>
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ // dispose managed resources here
+ }
+
+ // Unmanaged resources
+ if (hIcon != IntPtr.Zero)
+ CoreNativeMethods.DestroyIcon(hIcon);
+ }
+
+ /// <summary>
+ /// Release the native objects
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ ~StockIcon()
+ {
+ Dispose(false);
+ }
+
+ #endregion
+ }
+}
+
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/StockIcons/StockIconEnums.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/StockIcons/StockIconEnums.cs
new file mode 100644
index 0000000000..49a9452e79
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/StockIcons/StockIconEnums.cs
@@ -0,0 +1,419 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+
+ /// <summary>
+ /// Specifies options for the size of the stock icon.
+ /// </summary>
+ public enum StockIconSize
+ {
+ /// <summary>
+ /// Retrieve the small version of the icon, as specified by SM_CXSMICON and SM_CYSMICON system metrics.
+ /// </summary>
+ Small,
+
+ /// <summary>
+ /// Retrieve the large version of the icon, as specified by SM_CXICON and SM_CYICON system metrics.
+ /// </summary>
+ Large,
+
+ /// <summary>
+ /// Retrieve the shell-sized icons (instead of the size specified by the system metrics).
+ /// </summary>
+ ShellSize,
+ }
+
+ /// <summary>
+ /// Provides values used to specify which standard icon to retrieve.
+ /// </summary>
+ public enum StockIconIdentifier
+ {
+ /// <summary>
+ /// Icon for a document (blank page), no associated program.
+ /// </summary>
+ DocumentNotAssociated = 0,
+ /// <summary>
+ /// Icon for a document with an associated program.
+ /// </summary>
+ DocumentAssociated = 1,
+ /// <summary>
+ /// Icon for a generic application with no custom icon.
+ /// </summary>
+ Application = 2,
+ /// <summary>
+ /// Icon for a closed folder.
+ /// </summary>
+ Folder = 3,
+ /// <summary>
+ /// Icon for an open folder.
+ /// </summary>
+ FolderOpen = 4,
+ /// <summary>
+ /// Icon for a 5.25" floppy disk drive.
+ /// </summary>
+ Drive525 = 5,
+ /// <summary>
+ /// Icon for a 3.5" floppy disk drive.
+ /// </summary>
+ Drive35 = 6,
+ /// <summary>
+ /// Icon for a removable drive.
+ /// </summary>
+ DriveRemove = 7,
+ /// <summary>
+ /// Icon for a fixed (hard disk) drive.
+ /// </summary>
+ DriveFixed = 8,
+ /// <summary>
+ /// Icon for a network drive.
+ /// </summary>
+ DriveNetwork = 9,
+ /// <summary>
+ /// Icon for a disconnected network drive.
+ /// </summary>
+ DriveNetworkDisabled = 10,
+ /// <summary>
+ /// Icon for a CD drive.
+ /// </summary>
+ DriveCD = 11,
+ /// <summary>
+ /// Icon for a RAM disk drive.
+ /// </summary>
+ DriveRam = 12,
+ /// <summary>
+ /// Icon for an entire network.
+ /// </summary>
+ World = 13,
+ /// <summary>
+ /// Icon for a computer on the network.
+ /// </summary>
+ Server = 15,
+ /// <summary>
+ /// Icon for a printer.
+ /// </summary>
+ Printer = 16,
+ /// <summary>
+ /// Icon for My Network places.
+ /// </summary>
+ MyNetwork = 17,
+ /// <summary>
+ /// Icon for search (magnifying glass).
+ /// </summary>
+ Find = 22,
+ /// <summary>
+ /// Icon for help.
+ /// </summary>
+ Help = 23,
+ /// <summary>
+ /// Icon for an overlay indicating shared items.
+ /// </summary>
+ Share = 28,
+ /// <summary>
+ /// Icon for an overlay indicating shortcuts to items.
+ /// </summary>
+ Link = 29,
+ /// <summary>
+ /// Icon for an overlay for slow items.
+ /// </summary>
+ SlowFile = 30,
+ /// <summary>
+ /// Icon for a empty recycle bin.
+ /// </summary>
+ Recycler = 31,
+ /// <summary>
+ /// Icon for a full recycle bin.
+ /// </summary>
+ RecyclerFull = 32,
+ /// <summary>
+ /// Icon for audio CD media.
+ /// </summary>
+ MediaCDAudio = 40,
+ /// <summary>
+ /// Icon for a security lock.
+ /// </summary>
+ Lock = 47,
+ /// <summary>
+ /// Icon for a auto list.
+ /// </summary>
+ AutoList = 49,
+ /// <summary>
+ /// Icon for a network printer.
+ /// </summary>
+ PrinterNet = 50,
+ /// <summary>
+ /// Icon for a server share.
+ /// </summary>
+ ServerShare = 51,
+ /// <summary>
+ /// Icon for a Fax printer.
+ /// </summary>
+ PrinterFax = 52,
+ /// <summary>
+ /// Icon for a networked Fax printer.
+ /// </summary>
+ PrinterFaxNet = 53,
+ /// <summary>
+ /// Icon for print to file.
+ /// </summary>
+ PrinterFile = 54,
+ /// <summary>
+ /// Icon for a stack.
+ /// </summary>
+ Stack = 55,
+ /// <summary>
+ /// Icon for a SVCD media.
+ /// </summary>
+ MediaSvcd = 56,
+ /// <summary>
+ /// Icon for a folder containing other items.
+ /// </summary>
+ StuffedFolder = 57,
+ /// <summary>
+ /// Icon for an unknown drive.
+ /// </summary>
+ DriveUnknown = 58,
+ /// <summary>
+ /// Icon for a DVD drive.
+ /// </summary>
+ DriveDvd = 59,
+ /// <summary>
+ /// Icon for DVD media.
+ /// </summary>
+ MediaDvd = 60,
+ /// <summary>
+ /// Icon for DVD-RAM media.
+ /// </summary>
+ MediaDvdRam = 61,
+ /// <summary>
+ /// Icon for DVD-RW media.
+ /// </summary>
+ MediaDvdRW = 62,
+ /// <summary>
+ /// Icon for DVD-R media.
+ /// </summary>
+ MediaDvdR = 63,
+ /// <summary>
+ /// Icon for a DVD-ROM media.
+ /// </summary>
+ MediaDvdRom = 64,
+ /// <summary>
+ /// Icon for CD+ (Enhanced CD) media.
+ /// </summary>
+ MediaCDAudioPlus = 65,
+ /// <summary>
+ /// Icon for CD-RW media.
+ /// </summary>
+ MediaCDRW = 66,
+ /// <summary>
+ /// Icon for a CD-R media.
+ /// </summary>
+ MediaCDR = 67,
+ /// <summary>
+ /// Icon burning a CD.
+ /// </summary>
+ MediaCDBurn = 68,
+ /// <summary>
+ /// Icon for blank CD media.
+ /// </summary>
+ MediaBlankCD = 69,
+ /// <summary>
+ /// Icon for CD-ROM media.
+ /// </summary>
+ MediaCDRom = 70,
+ /// <summary>
+ /// Icon for audio files.
+ /// </summary>
+ AudioFiles = 71,
+ /// <summary>
+ /// Icon for image files.
+ /// </summary>
+ ImageFiles = 72,
+ /// <summary>
+ /// Icon for video files.
+ /// </summary>
+ VideoFiles = 73,
+ /// <summary>
+ /// Icon for mixed Files.
+ /// </summary>
+ MixedFiles = 74,
+ /// <summary>
+ /// Icon for a folder back.
+ /// </summary>
+ FolderBack = 75,
+ /// <summary>
+ /// Icon for a folder front.
+ /// </summary>
+ FolderFront = 76,
+ /// <summary>
+ /// Icon for a security shield. Use for UAC prompts only.
+ /// </summary>
+ Shield = 77,
+ /// <summary>
+ /// Icon for a warning.
+ /// </summary>
+ Warning = 78,
+ /// <summary>
+ /// Icon for an informational message.
+ /// </summary>
+ Info = 79,
+ /// <summary>
+ /// Icon for an error message.
+ /// </summary>
+ Error = 80,
+ /// <summary>
+ /// Icon for a key.
+ /// </summary>
+ Key = 81,
+ /// <summary>
+ /// Icon for software.
+ /// </summary>
+ Software = 82,
+ /// <summary>
+ /// Icon for a rename.
+ /// </summary>
+ Rename = 83,
+ /// <summary>
+ /// Icon for delete.
+ /// </summary>
+ Delete = 84,
+ /// <summary>
+ /// Icon for audio DVD media.
+ /// </summary>
+ MediaAudioDvd = 85,
+ /// <summary>
+ /// Icon for movie DVD media.
+ /// </summary>
+ MediaMovieDvd = 86,
+ /// <summary>
+ /// Icon for enhanced CD media.
+ /// </summary>
+ MediaEnhancedCD = 87,
+ /// <summary>
+ /// Icon for enhanced DVD media.
+ /// </summary>
+ MediaEnhancedDvd = 88,
+ /// <summary>
+ /// Icon for HD-DVD media.
+ /// </summary>
+ MediaHDDvd = 89,
+ /// <summary>
+ /// Icon for BluRay media.
+ /// </summary>
+ MediaBluRay = 90,
+ /// <summary>
+ /// Icon for VCD media.
+ /// </summary>
+ MediaVcd = 91,
+ /// <summary>
+ /// Icon for DVD+R media.
+ /// </summary>
+ MediaDvdPlusR = 92,
+ /// <summary>
+ /// Icon for DVD+RW media.
+ /// </summary>
+ MediaDvdPlusRW = 93,
+ /// <summary>
+ /// Icon for desktop computer.
+ /// </summary>
+ DesktopPC = 94,
+ /// <summary>
+ /// Icon for mobile computer (laptop/notebook).
+ /// </summary>
+ MobilePC = 95,
+ /// <summary>
+ /// Icon for users.
+ /// </summary>
+ Users = 96,
+ /// <summary>
+ /// Icon for smart media.
+ /// </summary>
+ MediaSmartMedia = 97,
+ /// <summary>
+ /// Icon for compact flash.
+ /// </summary>
+ MediaCompactFlash = 98,
+ /// <summary>
+ /// Icon for a cell phone.
+ /// </summary>
+ DeviceCellPhone = 99,
+ /// <summary>
+ /// Icon for a camera.
+ /// </summary>
+ DeviceCamera = 100,
+ /// <summary>
+ /// Icon for video camera.
+ /// </summary>
+ DeviceVideoCamera = 101,
+ /// <summary>
+ /// Icon for audio player.
+ /// </summary>
+ DeviceAudioPlayer = 102,
+ /// <summary>
+ /// Icon for connecting to network.
+ /// </summary>
+ NetworkConnect = 103,
+ /// <summary>
+ /// Icon for the Internet.
+ /// </summary>
+ Internet = 104,
+ /// <summary>
+ /// Icon for a ZIP file.
+ /// </summary>
+ ZipFile = 105,
+ /// <summary>
+ /// Icon for settings.
+ /// </summary>
+ Settings = 106,
+
+ // 107-131 are internal Vista RTM icons
+ // 132-159 for SP1 icons
+
+ /// <summary>
+ /// HDDVD Drive (all types)
+ /// </summary>
+ DriveHDDVD = 132,
+
+ /// <summary>
+ /// Icon for BluRay Drive (all types)
+ /// </summary>
+ DriveBluRay = 133,
+
+ /// <summary>
+ /// Icon for HDDVD-ROM Media
+ /// </summary>
+ MediaHDDVDROM = 134,
+
+ /// <summary>
+ /// Icon for HDDVD-R Media
+ /// </summary>
+ MediaHDDVDR = 135,
+
+ /// <summary>
+ /// Icon for HDDVD-RAM Media
+ /// </summary>
+ MediaHDDVDRAM = 136,
+
+ /// <summary>
+ /// Icon for BluRay ROM Media
+ /// </summary>
+ MediaBluRayROM = 137,
+
+ /// <summary>
+ /// Icon for BluRay R Media
+ /// </summary>
+ MediaBluRayR = 138,
+
+ /// <summary>
+ /// Icon for BluRay RE Media (Rewriable and RAM)
+ /// </summary>
+ MediaBluRayRE = 139,
+
+ /// <summary>
+ /// Icon for Clustered disk
+ /// </summary>
+ ClusteredDisk = 140,
+
+ }
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/StockIcons/StockIcons.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/StockIcons/StockIcons.cs
new file mode 100644
index 0000000000..5df9bff567
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/StockIcons/StockIcons.cs
@@ -0,0 +1,631 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+
+namespace Microsoft.WindowsAPICodePack.Shell
+{
+ /// <summary>
+ /// Collection of all the standard system stock icons
+ /// </summary>
+ public class StockIcons
+ {
+ #region Private Members
+
+ private IDictionary<StockIconIdentifier, StockIcon> stockIconCache;
+ private StockIconSize defaultSize = StockIconSize.Large;
+ private bool isSelected;
+ private bool isLinkOverlay;
+
+ #endregion
+
+ #region Public Constructors
+
+ /// <summary>
+ /// Creates a stock icon collection using the default options for
+ /// size, link overlay and selection state.
+ /// </summary>
+ public StockIcons()
+ {
+ // Create an empty dictionary. Stock icons will be created when requested
+ // or when they are enumerated on this collection
+ stockIconCache = new Dictionary<StockIconIdentifier, StockIcon>();
+
+ Array allIdentifiers = Enum.GetValues(typeof(StockIconIdentifier));
+
+ foreach (StockIconIdentifier id in allIdentifiers)
+ {
+ stockIconCache.Add(id, null);
+ }
+ }
+
+ /// <summary>
+ /// Overloaded constructor that takes in size and Boolean values for
+ /// link overlay and selected icon state. The settings are applied to
+ /// all the stock icons in the collection.
+ /// </summary>
+ /// <param name="size">StockIcon size for all the icons in the collection.</param>
+ /// <param name="linkOverlay">Link Overlay state for all the icons in the collection.</param>
+ /// <param name="selected">Selection state for all the icons in the collection.</param>
+ public StockIcons(StockIconSize size, bool linkOverlay, bool selected)
+ {
+ defaultSize = size;
+ isLinkOverlay = linkOverlay;
+ isSelected = selected;
+
+ // Create an empty dictionary. Stock icons will be created when requested
+ // or when they are enumerated on this collection
+ stockIconCache = new Dictionary<StockIconIdentifier, StockIcon>();
+
+ Array allIdentifiers = Enum.GetValues(typeof(StockIconIdentifier));
+
+ foreach (StockIconIdentifier id in allIdentifiers)
+ {
+ stockIconCache.Add(id, null);
+ }
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ /// <summary>
+ /// Gets the default stock icon size in one of the StockIconSize values.
+ /// This size applies to all the stock icons in the collection.
+ /// </summary>
+ public StockIconSize DefaultSize
+ {
+ get { return defaultSize; }
+ }
+
+ /// <summary>
+ /// Gets the default link overlay state for the icon. This property
+ /// applies to all the stock icons in the collection.
+ /// </summary>
+ public bool DefaultLinkOverlay
+ {
+ get { return isLinkOverlay; }
+ }
+
+ /// <summary>
+ /// Gets the default selected state for the icon. This property
+ /// applies to all the stock icons in the collection.
+ /// </summary>
+ public bool DefaultSelectedState
+ {
+ get { return isSelected; }
+ }
+
+ /// <summary>
+ /// Gets a collection of all the system stock icons
+ /// </summary>
+ public ICollection<StockIcon> AllStockIcons
+ {
+ get { return GetAllStockIcons(); }
+ }
+
+ /// <summary>
+ /// Icon for a document (blank page), no associated program.
+ /// </summary>
+ public StockIcon DocumentNotAssociated { get { return GetStockIcon(StockIconIdentifier.DocumentNotAssociated); } }
+
+ /// <summary>
+ /// Icon for a document with an associated program.
+ /// </summary>
+ public StockIcon DocumentAssociated { get { return GetStockIcon(StockIconIdentifier.DocumentAssociated); } }
+
+ /// <summary>
+ /// Icon for a generic application with no custom icon.
+ /// </summary>
+ public StockIcon Application { get { return GetStockIcon(StockIconIdentifier.Application); } }
+
+ /// <summary>
+ /// Icon for a closed folder.
+ /// </summary>
+ public StockIcon Folder { get { return GetStockIcon(StockIconIdentifier.Folder); } }
+
+ /// <summary>
+ /// Icon for an open folder.
+ /// </summary>
+ public StockIcon FolderOpen { get { return GetStockIcon(StockIconIdentifier.FolderOpen); } }
+
+ /// <summary>
+ /// Icon for a 5.25" floppy disk drive.
+ /// </summary>
+ public StockIcon Drive525 { get { return GetStockIcon(StockIconIdentifier.Drive525); } }
+
+ /// <summary>
+ /// Icon for a 3.5" floppy disk drive.
+ /// </summary>
+ public StockIcon Drive35 { get { return GetStockIcon(StockIconIdentifier.Drive35); } }
+
+ /// <summary>
+ /// Icon for a removable drive.
+ /// </summary>
+ public StockIcon DriveRemove { get { return GetStockIcon(StockIconIdentifier.DriveRemove); } }
+
+ /// <summary>
+ /// Icon for a fixed (hard disk) drive.
+ /// </summary>
+ public StockIcon DriveFixed { get { return GetStockIcon(StockIconIdentifier.DriveFixed); } }
+
+ /// <summary>
+ /// Icon for a network drive.
+ /// </summary>
+ public StockIcon DriveNetwork { get { return GetStockIcon(StockIconIdentifier.DriveNetwork); } }
+
+ /// <summary>
+ /// Icon for a disconnected network drive.
+ /// </summary>
+ public StockIcon DriveNetworkDisabled { get { return GetStockIcon(StockIconIdentifier.DriveNetworkDisabled); } }
+
+ /// <summary>
+ /// Icon for a CD drive.
+ /// </summary>
+ public StockIcon DriveCD { get { return GetStockIcon(StockIconIdentifier.DriveCD); } }
+
+ /// <summary>
+ /// Icon for a RAM disk drive.
+ /// </summary>
+ public StockIcon DriveRam { get { return GetStockIcon(StockIconIdentifier.DriveRam); } }
+
+ /// <summary>
+ /// Icon for an entire network.
+ /// </summary>
+ public StockIcon World { get { return GetStockIcon(StockIconIdentifier.World); } }
+
+ /// <summary>
+ /// Icon for a computer on the network.
+ /// </summary>
+ public StockIcon Server { get { return GetStockIcon(StockIconIdentifier.Server); } }
+
+ /// <summary>
+ /// Icon for a printer.
+ /// </summary>
+ public StockIcon Printer { get { return GetStockIcon(StockIconIdentifier.Printer); } }
+
+ /// <summary>
+ /// Icon for My Network places.
+ /// </summary>
+ public StockIcon MyNetwork { get { return GetStockIcon(StockIconIdentifier.MyNetwork); } }
+
+ /// <summary>
+ /// Icon for search (magnifying glass).
+ /// </summary>
+ public StockIcon Find { get { return GetStockIcon(StockIconIdentifier.Find); } }
+
+ /// <summary>
+ /// Icon for help.
+ /// </summary>
+ public StockIcon Help { get { return GetStockIcon(StockIconIdentifier.Help); } }
+
+ /// <summary>
+ /// Icon for an overlay indicating shared items.
+ /// </summary>
+ public StockIcon Share { get { return GetStockIcon(StockIconIdentifier.Share); } }
+
+ /// <summary>
+ /// Icon for an overlay indicating shortcuts to items.
+ /// </summary>
+ public StockIcon Link { get { return GetStockIcon(StockIconIdentifier.Link); } }
+
+ /// <summary>
+ /// Icon for an overlay for slow items.
+ /// </summary>
+ public StockIcon SlowFile { get { return GetStockIcon(StockIconIdentifier.SlowFile); } }
+
+ /// <summary>
+ /// Icon for a empty recycle bin.
+ /// </summary>
+ public StockIcon Recycler { get { return GetStockIcon(StockIconIdentifier.Recycler); } }
+
+ /// <summary>
+ /// Icon for a full recycle bin.
+ /// </summary>
+ public StockIcon RecyclerFull { get { return GetStockIcon(StockIconIdentifier.RecyclerFull); } }
+
+ /// <summary>
+ /// Icon for audio CD media.
+ /// </summary>
+ public StockIcon MediaCDAudio { get { return GetStockIcon(StockIconIdentifier.MediaCDAudio); } }
+
+ /// <summary>
+ /// Icon for a security lock.
+ /// </summary>
+ public StockIcon Lock { get { return GetStockIcon(StockIconIdentifier.Lock); } }
+
+ /// <summary>
+ /// Icon for a auto list.
+ /// </summary>
+ public StockIcon AutoList { get { return GetStockIcon(StockIconIdentifier.AutoList); } }
+
+ /// <summary>
+ /// Icon for a network printer.
+ /// </summary>
+ public StockIcon PrinterNet { get { return GetStockIcon(StockIconIdentifier.PrinterNet); } }
+
+ /// <summary>
+ /// Icon for a server share.
+ /// </summary>
+ public StockIcon ServerShare { get { return GetStockIcon(StockIconIdentifier.ServerShare); } }
+
+ /// <summary>
+ /// Icon for a Fax printer.
+ /// </summary>
+ public StockIcon PrinterFax { get { return GetStockIcon(StockIconIdentifier.PrinterFax); } }
+
+ /// <summary>
+ /// Icon for a networked Fax printer.
+ /// </summary>
+ public StockIcon PrinterFaxNet { get { return GetStockIcon(StockIconIdentifier.PrinterFaxNet); } }
+
+ /// <summary>
+ /// Icon for print to file.
+ /// </summary>
+ public StockIcon PrinterFile { get { return GetStockIcon(StockIconIdentifier.PrinterFile); } }
+
+ /// <summary>
+ /// Icon for a stack.
+ /// </summary>
+ public StockIcon Stack { get { return GetStockIcon(StockIconIdentifier.Stack); } }
+
+ /// <summary>
+ /// Icon for a SVCD media.
+ /// </summary>
+ public StockIcon MediaSvcd { get { return GetStockIcon(StockIconIdentifier.MediaSvcd); } }
+
+ /// <summary>
+ /// Icon for a folder containing other items.
+ /// </summary>
+ public StockIcon StuffedFolder { get { return GetStockIcon(StockIconIdentifier.StuffedFolder); } }
+
+ /// <summary>
+ /// Icon for an unknown drive.
+ /// </summary>
+ public StockIcon DriveUnknown { get { return GetStockIcon(StockIconIdentifier.DriveUnknown); } }
+
+ /// <summary>
+ /// Icon for a DVD drive.
+ /// </summary>
+ public StockIcon DriveDvd { get { return GetStockIcon(StockIconIdentifier.DriveDvd); } }
+
+ /// <summary>
+ /// Icon for DVD media.
+ /// </summary>
+ public StockIcon MediaDvd { get { return GetStockIcon(StockIconIdentifier.MediaDvd); } }
+
+ /// <summary>
+ /// Icon for DVD-RAM media.
+ /// </summary>
+ public StockIcon MediaDvdRam { get { return GetStockIcon(StockIconIdentifier.MediaDvdRam); } }
+
+ /// <summary>
+ /// Icon for DVD-RW media.
+ /// </summary>
+ public StockIcon MediaDvdRW { get { return GetStockIcon(StockIconIdentifier.MediaDvdRW); } }
+
+ /// <summary>
+ /// Icon for DVD-R media.
+ /// </summary>
+ public StockIcon MediaDvdR { get { return GetStockIcon(StockIconIdentifier.MediaDvdR); } }
+
+ /// <summary>
+ /// Icon for a DVD-ROM media.
+ /// </summary>
+ public StockIcon MediaDvdRom { get { return GetStockIcon(StockIconIdentifier.MediaDvdRom); } }
+
+ /// <summary>
+ /// Icon for CD+ (Enhanced CD) media.
+ /// </summary>
+ public StockIcon MediaCDAudioPlus { get { return GetStockIcon(StockIconIdentifier.MediaCDAudioPlus); } }
+
+ /// <summary>
+ /// Icon for CD-RW media.
+ /// </summary>
+ public StockIcon MediaCDRW { get { return GetStockIcon(StockIconIdentifier.MediaCDRW); } }
+
+ /// <summary>
+ /// Icon for a CD-R media.
+ /// </summary>
+ public StockIcon MediaCDR { get { return GetStockIcon(StockIconIdentifier.MediaCDR); } }
+
+ /// <summary>
+ /// Icon burning a CD.
+ /// </summary>
+ public StockIcon MediaCDBurn { get { return GetStockIcon(StockIconIdentifier.MediaCDBurn); } }
+
+ /// <summary>
+ /// Icon for blank CD media.
+ /// </summary>
+ public StockIcon MediaBlankCD { get { return GetStockIcon(StockIconIdentifier.MediaBlankCD); } }
+
+ /// <summary>
+ /// Icon for CD-ROM media.
+ /// </summary>
+ public StockIcon MediaCDRom { get { return GetStockIcon(StockIconIdentifier.MediaCDRom); } }
+
+ /// <summary>
+ /// Icon for audio files.
+ /// </summary>
+ public StockIcon AudioFiles { get { return GetStockIcon(StockIconIdentifier.AudioFiles); } }
+
+ /// <summary>
+ /// Icon for image files.
+ /// </summary>
+ public StockIcon ImageFiles { get { return GetStockIcon(StockIconIdentifier.ImageFiles); } }
+
+ /// <summary>
+ /// Icon for video files.
+ /// </summary>
+ public StockIcon VideoFiles { get { return GetStockIcon(StockIconIdentifier.VideoFiles); } }
+
+ /// <summary>
+ /// Icon for mixed Files.
+ /// </summary>
+ public StockIcon MixedFiles { get { return GetStockIcon(StockIconIdentifier.MixedFiles); } }
+
+ /// <summary>
+ /// Icon for a folder back.
+ /// </summary>
+ public StockIcon FolderBack { get { return GetStockIcon(StockIconIdentifier.FolderBack); } }
+
+ /// <summary>
+ /// Icon for a folder front.
+ /// </summary>
+ public StockIcon FolderFront { get { return GetStockIcon(StockIconIdentifier.FolderFront); } }
+
+ /// <summary>
+ /// Icon for a security shield. Use for UAC prompts only.
+ /// </summary>
+ public StockIcon Shield { get { return GetStockIcon(StockIconIdentifier.Shield); } }
+
+ /// <summary>
+ /// Icon for a warning.
+ /// </summary>
+ public StockIcon Warning { get { return GetStockIcon(StockIconIdentifier.Warning); } }
+
+ /// <summary>
+ /// Icon for an informational message.
+ /// </summary>
+ public StockIcon Info { get { return GetStockIcon(StockIconIdentifier.Info); } }
+
+ /// <summary>
+ /// Icon for an error message.
+ /// </summary>
+ public StockIcon Error { get { return GetStockIcon(StockIconIdentifier.Error); } }
+
+ /// <summary>
+ /// Icon for a key.
+ /// </summary>
+ public StockIcon Key { get { return GetStockIcon(StockIconIdentifier.Key); } }
+
+ /// <summary>
+ /// Icon for software.
+ /// </summary>
+ public StockIcon Software { get { return GetStockIcon(StockIconIdentifier.Software); } }
+
+ /// <summary>
+ /// Icon for a rename.
+ /// </summary>
+ public StockIcon Rename { get { return GetStockIcon(StockIconIdentifier.Rename); } }
+
+ /// <summary>
+ /// Icon for delete.
+ /// </summary>
+ public StockIcon Delete { get { return GetStockIcon(StockIconIdentifier.Delete); } }
+
+ /// <summary>
+ /// Icon for audio DVD media.
+ /// </summary>
+ public StockIcon MediaAudioDvd { get { return GetStockIcon(StockIconIdentifier.MediaAudioDvd); } }
+
+ /// <summary>
+ /// Icon for movie DVD media.
+ /// </summary>
+ public StockIcon MediaMovieDvd { get { return GetStockIcon(StockIconIdentifier.MediaMovieDvd); } }
+
+ /// <summary>
+ /// Icon for enhanced CD media.
+ /// </summary>
+ public StockIcon MediaEnhancedCD { get { return GetStockIcon(StockIconIdentifier.MediaEnhancedCD); } }
+
+ /// <summary>
+ /// Icon for enhanced DVD media.
+ /// </summary>
+ public StockIcon MediaEnhancedDvd { get { return GetStockIcon(StockIconIdentifier.MediaEnhancedDvd); } }
+
+ /// <summary>
+ /// Icon for HD-DVD media.
+ /// </summary>
+ public StockIcon MediaHDDvd { get { return GetStockIcon(StockIconIdentifier.MediaHDDvd); } }
+
+ /// <summary>
+ /// Icon for BluRay media.
+ /// </summary>
+ public StockIcon MediaBluRay { get { return GetStockIcon(StockIconIdentifier.MediaBluRay); } }
+
+ /// <summary>
+ /// Icon for VCD media.
+ /// </summary>
+ public StockIcon MediaVcd { get { return GetStockIcon(StockIconIdentifier.MediaVcd); } }
+
+ /// <summary>
+ /// Icon for DVD+R media.
+ /// </summary>
+ public StockIcon MediaDvdPlusR { get { return GetStockIcon(StockIconIdentifier.MediaDvdPlusR); } }
+
+ /// <summary>
+ /// Icon for DVD+RW media.
+ /// </summary>
+ public StockIcon MediaDvdPlusRW { get { return GetStockIcon(StockIconIdentifier.MediaDvdPlusRW); } }
+
+ /// <summary>
+ /// Icon for desktop computer.
+ /// </summary>
+ public StockIcon DesktopPC { get { return GetStockIcon(StockIconIdentifier.DesktopPC); } }
+
+ /// <summary>
+ /// Icon for mobile computer (laptop/notebook).
+ /// </summary>
+ public StockIcon MobilePC { get { return GetStockIcon(StockIconIdentifier.MobilePC); } }
+
+ /// <summary>
+ /// Icon for users.
+ /// </summary>
+ public StockIcon Users { get { return GetStockIcon(StockIconIdentifier.Users); } }
+
+ /// <summary>
+ /// Icon for smart media.
+ /// </summary>
+ public StockIcon MediaSmartMedia { get { return GetStockIcon(StockIconIdentifier.MediaSmartMedia); } }
+
+ /// <summary>
+ /// Icon for compact flash.
+ /// </summary>
+ public StockIcon MediaCompactFlash { get { return GetStockIcon(StockIconIdentifier.MediaCompactFlash); } }
+
+ /// <summary>
+ /// Icon for a cell phone.
+ /// </summary>
+ public StockIcon DeviceCellPhone { get { return GetStockIcon(StockIconIdentifier.DeviceCellPhone); } }
+
+ /// <summary>
+ /// Icon for a camera.
+ /// </summary>
+ public StockIcon DeviceCamera { get { return GetStockIcon(StockIconIdentifier.DeviceCamera); } }
+
+ /// <summary>
+ /// Icon for video camera.
+ /// </summary>
+ public StockIcon DeviceVideoCamera { get { return GetStockIcon(StockIconIdentifier.DeviceVideoCamera); } }
+
+ /// <summary>
+ /// Icon for audio player.
+ /// </summary>
+ public StockIcon DeviceAudioPlayer { get { return GetStockIcon(StockIconIdentifier.DeviceAudioPlayer); } }
+
+ /// <summary>
+ /// Icon for connecting to network.
+ /// </summary>
+ public StockIcon NetworkConnect { get { return GetStockIcon(StockIconIdentifier.NetworkConnect); } }
+
+ /// <summary>
+ /// Icon for the Internet.
+ /// </summary>
+ public StockIcon Internet { get { return GetStockIcon(StockIconIdentifier.Internet); } }
+
+ /// <summary>
+ /// Icon for a ZIP file.
+ /// </summary>
+ public StockIcon ZipFile { get { return GetStockIcon(StockIconIdentifier.ZipFile); } }
+
+ /// <summary>
+ /// Icon for settings.
+ /// </summary>
+ public StockIcon Settings { get { return GetStockIcon(StockIconIdentifier.Settings); } }
+
+ /// <summary>
+ /// HDDVD Drive (all types)
+ /// </summary>
+ public StockIcon DriveHDDVD { get { return GetStockIcon(StockIconIdentifier.DriveHDDVD); } }
+
+ /// <summary>
+ /// Icon for BluRay Drive (all types)
+ /// </summary>
+ public StockIcon DriveBluRay { get { return GetStockIcon(StockIconIdentifier.DriveBluRay); } }
+
+ /// <summary>
+ /// Icon for HDDVD-ROM Media
+ /// </summary>
+ public StockIcon MediaHDDVDROM { get { return GetStockIcon(StockIconIdentifier.MediaHDDVDROM); } }
+
+ /// <summary>
+ /// Icon for HDDVD-R Media
+ /// </summary>
+ public StockIcon MediaHDDVDR { get { return GetStockIcon(StockIconIdentifier.MediaHDDVDR); } }
+
+ /// <summary>
+ /// Icon for HDDVD-RAM Media
+ /// </summary>
+ public StockIcon MediaHDDVDRAM { get { return GetStockIcon(StockIconIdentifier.MediaHDDVDRAM); } }
+
+ /// <summary>
+ /// Icon for BluRay ROM Media
+ /// </summary>
+ public StockIcon MediaBluRayROM { get { return GetStockIcon(StockIconIdentifier.MediaBluRayROM); } }
+
+ /// <summary>
+ /// Icon for BluRay R Media
+ /// </summary>
+ public StockIcon MediaBluRayR { get { return GetStockIcon(StockIconIdentifier.MediaBluRayR); } }
+
+ /// <summary>
+ /// Icon for BluRay RE Media (Rewriable and RAM)
+ /// </summary>
+ public StockIcon MediaBluRayRE { get { return GetStockIcon(StockIconIdentifier.MediaBluRayRE); } }
+
+ /// <summary>
+ /// Icon for Clustered disk
+ /// </summary>
+ public StockIcon ClusteredDisk { get { return GetStockIcon(StockIconIdentifier.ClusteredDisk); } }
+
+ #endregion
+
+ #region Private Methods
+
+ /// <summary>
+ /// Returns the existing stock icon from the internal cache, or creates a new one
+ /// based on the current settings if it's not in the cache.
+ /// </summary>
+ /// <param name="stockIconIdentifier">Unique identifier for the requested stock icon</param>
+ /// <returns>Stock Icon based on the identifier given (either from the cache or created new)</returns>
+ private StockIcon GetStockIcon(StockIconIdentifier stockIconIdentifier)
+ {
+ // Check the cache first
+ if (stockIconCache[stockIconIdentifier] != null)
+ return stockIconCache[stockIconIdentifier];
+ else
+ {
+ // Create a new icon based on our default settings
+ StockIcon icon = new StockIcon(stockIconIdentifier, defaultSize, isLinkOverlay, isSelected);
+
+ try
+ {
+ // Add it to the cache
+ stockIconCache[stockIconIdentifier] = icon;
+ }
+ catch
+ {
+ icon.Dispose();
+ throw;
+ }
+
+ // Return
+ return icon;
+ }
+ }
+
+ private ICollection<StockIcon> GetAllStockIcons()
+ {
+ // Create a list of stock Identifiers
+ StockIconIdentifier[] ids = new StockIconIdentifier[stockIconCache.Count];
+ stockIconCache.Keys.CopyTo(ids, 0);
+
+ // For each identifier, if our cache is null, create a new stock icon
+ foreach (StockIconIdentifier id in ids)
+ {
+ if (stockIconCache[id] == null)
+ GetStockIcon(id);
+ }
+
+ // return the list of stock icons
+ return stockIconCache.Values;
+ }
+
+
+ #endregion
+
+ }
+
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpList.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpList.cs
new file mode 100644
index 0000000000..e167582182
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpList.cs
@@ -0,0 +1,575 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using System.Text;
+using Microsoft.WindowsAPICodePack.Shell;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ /// <summary>
+ /// Represents an instance of a Taskbar button jump list.
+ /// </summary>
+ public class JumpList
+ {
+
+ /// <summary>
+ /// Create a JumpList for the application's taskbar button.
+ /// </summary>
+ /// <returns>A new JumpList that is associated with the app id of the main application window</returns>
+ /// <remarks>If there are any other child (top-level) windows for this application and they don't have
+ /// a specific JumpList created for them, they all will share the same JumpList as the main application window.
+ /// In order to have a individual JumpList for a top-level window, use the overloaded method CreateJumpListForIndividualWindow.</remarks>
+ public static JumpList CreateJumpList()
+ {
+ return new JumpList(TaskbarManager.Instance.ApplicationId);
+ }
+
+ /// <summary>
+ /// Create a JumpList for the application's taskbar button.
+ /// </summary>
+ /// <param name="appId">Application Id for the individual window. This must be unique for each top-level window in order to have a individual JumpList.</param>
+ /// <param name="windowHandle">Handle of the window associated with the new JumpList</param>
+ /// <returns>A new JumpList that is associated with the specific window handle</returns>
+ public static JumpList CreateJumpListForIndividualWindow(string appId, IntPtr windowHandle)
+ {
+ return new JumpList(appId, windowHandle);
+ }
+
+ /// <summary>
+ /// Create a JumpList for the application's taskbar button.
+ /// </summary>
+ /// <param name="appId">Application Id for the individual window. This must be unique for each top-level window in order to have a individual JumpList.</param>
+ /// <param name="window">WPF Window associated with the new JumpList</param>
+ /// <returns>A new JumpList that is associated with the specific WPF window</returns>
+ public static JumpList CreateJumpListForIndividualWindow(string appId, System.Windows.Window window)
+ {
+ return new JumpList(appId, window);
+ }
+
+ // Best practice recommends defining a private object to lock on
+ private readonly object syncLock = new Object();
+
+ // Native implementation of destination list
+ private ICustomDestinationList customDestinationList;
+
+ #region Properties
+
+ private JumpListCustomCategoryCollection customCategoriesCollection;
+ /// <summary>
+ /// Adds a collection of custom categories to the Taskbar jump list.
+ /// </summary>
+ /// <param name="customCategories">The catagories to add to the jump list.</param>
+ public void AddCustomCategories(params JumpListCustomCategory[] customCategories)
+ {
+ lock (syncLock)
+ {
+ if (customCategoriesCollection == null)
+ {
+ customCategoriesCollection = new JumpListCustomCategoryCollection();
+ }
+ }
+
+ if (customCategories != null)
+ {
+ foreach (JumpListCustomCategory category in customCategories)
+ {
+ customCategoriesCollection.Add(category);
+ }
+ }
+ }
+
+ private JumpListItemCollection<JumpListTask> userTasks;
+ /// <summary>
+ /// Adds user tasks to the Taskbar JumpList. User tasks can only consist of JumpListTask or
+ /// JumpListSeparator objects.
+ /// </summary>
+ /// <param name="tasks">The user tasks to add to the JumpList.</param>
+ public void AddUserTasks(params JumpListTask[] tasks)
+ {
+ if (userTasks == null)
+ {
+ // Make sure that we don't create multiple instances
+ // of this object
+ lock (syncLock)
+ {
+ if (userTasks == null)
+ {
+ userTasks = new JumpListItemCollection<JumpListTask>();
+ }
+ }
+ }
+
+ if (tasks != null)
+ {
+ foreach (JumpListTask task in tasks)
+ {
+ userTasks.Add(task);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Removes all user tasks that have been added.
+ /// </summary>
+ public void ClearAllUserTasks()
+ {
+ if (userTasks != null)
+ {
+ userTasks.Clear();
+ }
+ }
+
+ /// <summary>
+ /// Gets the recommended number of items to add to the jump list.
+ /// </summary>
+ /// <remarks>
+ /// This number doesn’t
+ /// imply or suggest how many items will appear on the jump list.
+ /// This number should only be used for reference purposes since
+ /// the actual number of slots in the jump list can change after the last
+ /// refresh due to items being pinned or removed and resolution changes.
+ /// The jump list can increase in size accordingly.
+ /// </remarks>
+ public uint MaxSlotsInList
+ {
+ get
+ {
+ // Because we need the correct number for max slots, start a commit, get the max slots
+ // and then abort. If we wait until the user calls RefreshTaskbarlist(), it will be too late.
+ // The user needs to use this number before they update the jumplist.
+
+ object removedItems;
+ uint maxSlotsInList = 10; // default
+
+ // Native call to start adding items to the taskbar destination list
+ HResult hr = customDestinationList.BeginList(
+ out maxSlotsInList,
+ ref TaskbarNativeMethods.TaskbarGuids.IObjectArray,
+ out removedItems);
+
+ if (CoreErrorHelper.Succeeded(hr))
+ {
+ customDestinationList.AbortList();
+ }
+
+ return maxSlotsInList;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the type of known categories to display.
+ /// </summary>
+ public JumpListKnownCategoryType KnownCategoryToDisplay { get; set; }
+
+ private int knownCategoryOrdinalPosition;
+ /// <summary>
+ /// Gets or sets the value for the known category location relative to the
+ /// custom category collection.
+ /// </summary>
+ public int KnownCategoryOrdinalPosition
+ {
+ get
+ {
+ return knownCategoryOrdinalPosition;
+ }
+ set
+ {
+ if (value < 0)
+ {
+ throw new ArgumentOutOfRangeException("value", LocalizedMessages.JumpListNegativeOrdinalPosition);
+ }
+
+ knownCategoryOrdinalPosition = value;
+ }
+
+ }
+
+ /// <summary>
+ /// Gets or sets the application ID to use for this jump list.
+ /// </summary>
+ public string ApplicationId { get; private set; }
+
+ #endregion
+
+ /// <summary>
+ /// Creates a new instance of the JumpList class with the specified
+ /// appId. The JumpList is associated with the main window of the application.
+ /// </summary>
+ /// <param name="appID">Application Id to use for this instace.</param>
+ internal JumpList(string appID)
+ : this(appID, TaskbarManager.Instance.OwnerHandle)
+ {
+ }
+
+ /// <summary>
+ /// Creates a new instance of the JumpList class with the specified
+ /// appId. The JumpList is associated with the given WPF Window.
+ /// </summary>
+ /// <param name="appID">Application Id to use for this instace.</param>
+ /// <param name="window">WPF Window that is associated with this JumpList</param>
+ internal JumpList(string appID, System.Windows.Window window)
+ : this(appID, (new System.Windows.Interop.WindowInteropHelper(window)).Handle)
+ {
+ }
+
+ /// <summary>
+ /// Creates a new instance of the JumpList class with the specified
+ /// appId. The JumpList is associated with the given window.
+ /// </summary>
+ /// <param name="appID">Application Id to use for this instace.</param>
+ /// <param name="windowHandle">Window handle for the window that is associated with this JumpList</param>
+ private JumpList(string appID, IntPtr windowHandle)
+ {
+ // Throw exception if not running on Win7 or newer
+ CoreHelpers.ThrowIfNotWin7();
+
+ // Native implementation of destination list
+ customDestinationList = (ICustomDestinationList)new CDestinationList();
+
+ // Set application user model ID
+ if (!string.IsNullOrEmpty(appID))
+ {
+ ApplicationId = appID;
+
+ // If the user hasn't yet set the application id for the whole process,
+ // use the first JumpList's AppId for the whole process. This will ensure
+ // we have the same JumpList for all the windows (unless user overrides and creates a new
+ // JumpList for a specific child window)
+ if (!TaskbarManager.Instance.ApplicationIdSetProcessWide)
+ {
+ TaskbarManager.Instance.ApplicationId = appID;
+ }
+
+ TaskbarManager.Instance.SetApplicationIdForSpecificWindow(windowHandle, appID);
+ }
+ }
+
+ /// <summary>
+ /// Reports document usage to the shell.
+ /// </summary>
+ /// <param name="destination">The full path of the file to report usage.</param>
+ public static void AddToRecent(string destination)
+ {
+ TaskbarNativeMethods.SHAddToRecentDocs(destination);
+ }
+
+ /// <summary>
+ /// Commits the pending JumpList changes and refreshes the Taskbar.
+ /// </summary>
+ /// <exception cref="System.InvalidOperationException">Will throw if the type of the file being added to the JumpList is not registered with the application.</exception>
+ /// <exception cref="System.UnauthorizedAccessException">Will throw if recent documents tracking is turned off by the user or via group policy.</exception>
+ /// <exception cref="System.Runtime.InteropServices.COMException">Will throw if updating the JumpList fails for any other reason.</exception>
+ public void Refresh()
+ {
+ // Let the taskbar know which specific jumplist we are updating
+ if (!string.IsNullOrEmpty(ApplicationId))
+ {
+ customDestinationList.SetAppID(ApplicationId);
+ }
+
+ // Begins rendering on the taskbar destination list
+ BeginList();
+
+ Exception exception = null;
+
+ try
+ {
+ // try to add the user tasks first
+ AppendTaskList();
+ }
+ catch (Exception e)
+ {
+ // If this fails, save the exception but don't throw it yet.
+ // We need to continue to try and add the custom categories
+ exception = e;
+ }
+
+ // Even it fails, continue appending the custom categories
+ try
+ {
+ // Add custom categories
+ AppendCustomCategories();
+ }
+ finally
+ {
+ // End rendering of the taskbar destination list
+ customDestinationList.CommitList();
+ }
+
+ // If an exception was thrown while adding the user tasks or
+ // custom categories, throw it.
+ if (exception != null)
+ {
+ throw exception;
+ }
+ }
+
+ private void BeginList()
+ {
+ // Get list of removed items from native code
+ object removedItems;
+ uint maxSlotsInList = 10; // default
+
+ // Native call to start adding items to the taskbar destination list
+ HResult hr = customDestinationList.BeginList(
+ out maxSlotsInList,
+ ref TaskbarNativeMethods.TaskbarGuids.IObjectArray,
+ out removedItems);
+
+ if (!CoreErrorHelper.Succeeded(hr))
+ {
+ throw new ShellException(hr);
+ }
+
+ // Process the deleted items
+ IEnumerable removedItemsArray = ProcessDeletedItems((IObjectArray)removedItems);
+
+ // Raise the event if items were removed
+ if (JumpListItemsRemoved != null && removedItemsArray != null && removedItemsArray.GetEnumerator().MoveNext())
+ {
+ JumpListItemsRemoved(this, new UserRemovedJumpListItemsEventArgs(removedItemsArray));
+ }
+ }
+
+ /// <summary>
+ /// Occurs when items are removed from the Taskbar's jump list since the last
+ /// refresh.
+ /// </summary>
+ /// <remarks>
+ /// This event is not triggered
+ /// immediately when a user removes an item from the jump list but rather
+ /// when the application refreshes the task bar list directly.
+ /// </remarks>
+ public event EventHandler<UserRemovedJumpListItemsEventArgs> JumpListItemsRemoved = delegate { };
+
+ /// <summary>
+ /// Retrieves the current list of destinations that have been removed from the existing jump list by the user.
+ /// The removed destinations may become items on a custom jump list.
+ /// </summary>
+ /// <value>A collection of items (filenames) removed from the existing jump list by the user.</value>
+ public IEnumerable RemovedDestinations
+ {
+ get
+ {
+ // Get list of removed items from native code
+ object removedItems;
+
+ customDestinationList.GetRemovedDestinations(ref TaskbarNativeMethods.TaskbarGuids.IObjectArray, out removedItems);
+
+ return ProcessDeletedItems((IObjectArray)removedItems);
+ }
+ }
+
+ private IEnumerable<string> ProcessDeletedItems(IObjectArray removedItems)
+ {
+ List<string> removedItemsArray = new List<string>();
+
+ uint count;
+ removedItems.GetCount(out count);
+
+ // Process each removed item based on its type
+ for (uint i = 0; i < count; i++)
+ {
+ // Native call to retrieve objects from IObjectArray
+ object item;
+ removedItems.GetAt(i,
+ ref TaskbarNativeMethods.TaskbarGuids.IUnknown,
+ out item);
+
+ IShellItem shellItem = item as IShellItem;
+ IShellLinkW shellLink;
+ // Process item
+ if (shellItem != null)
+ {
+ removedItemsArray.Add(RemoveCustomCategoryItem(shellItem));
+ }
+ else if ((shellLink = item as IShellLinkW) != null)
+ {
+ removedItemsArray.Add(RemoveCustomCategoryLink(shellLink));
+ }
+ }
+ return removedItemsArray;
+ }
+
+ private string RemoveCustomCategoryItem(IShellItem item)
+ {
+ string path = null;
+
+ if (customCategoriesCollection != null)
+ {
+ IntPtr pszString = IntPtr.Zero;
+ HResult hr = item.GetDisplayName(ShellNativeMethods.ShellItemDesignNameOptions.FileSystemPath, out pszString);
+ if (hr == HResult.Ok && pszString != IntPtr.Zero)
+ {
+ path = Marshal.PtrToStringAuto(pszString);
+ // Free the string
+ Marshal.FreeCoTaskMem(pszString);
+ }
+
+ // Remove this item from each category
+ foreach (JumpListCustomCategory category in customCategoriesCollection)
+ {
+ category.RemoveJumpListItem(path);
+ }
+
+ }
+
+ return path;
+ }
+
+
+ private string RemoveCustomCategoryLink(IShellLinkW link)
+ {
+ string path = null;
+
+ if (customCategoriesCollection != null)
+ {
+ StringBuilder sb = new StringBuilder(256);
+ link.GetPath(sb, sb.Capacity, IntPtr.Zero, 2);
+
+ path = sb.ToString();
+
+ // Remove this item from each category
+ foreach (JumpListCustomCategory category in customCategoriesCollection)
+ {
+ category.RemoveJumpListItem(path);
+ }
+ }
+
+ return path;
+ }
+
+ private void AppendCustomCategories()
+ {
+ // Initialize our current index in the custom categories list
+ int currentIndex = 0;
+
+ // Keep track whether we add the Known Categories to our list
+ bool knownCategoriesAdded = false;
+
+ if (customCategoriesCollection != null)
+ {
+ // Append each category to list
+ foreach (JumpListCustomCategory category in customCategoriesCollection)
+ {
+ // If our current index is same as the KnownCategory OrdinalPosition,
+ // append the Known Categories
+ if (!knownCategoriesAdded && currentIndex == KnownCategoryOrdinalPosition)
+ {
+ AppendKnownCategories();
+ knownCategoriesAdded = true;
+ }
+
+ // Don't process empty categories
+ if (category.JumpListItems.Count == 0) { continue; }
+
+ IObjectCollection categoryContent =
+ (IObjectCollection)new CEnumerableObjectCollection();
+
+ // Add each link's shell representation to the object array
+ foreach (IJumpListItem link in category.JumpListItems)
+ {
+ JumpListItem listItem = link as JumpListItem;
+ JumpListLink listLink = link as JumpListLink;
+ if (listItem != null)
+ {
+ categoryContent.AddObject(listItem.NativeShellItem);
+ }
+ else if (listLink != null)
+ {
+ categoryContent.AddObject(listLink.NativeShellLink);
+ }
+ }
+
+ // Add current category to destination list
+ HResult hr = customDestinationList.AppendCategory(
+ category.Name,
+ (IObjectArray)categoryContent);
+
+ if (!CoreErrorHelper.Succeeded(hr))
+ {
+ if ((uint)hr == 0x80040F03)
+ {
+ throw new InvalidOperationException(LocalizedMessages.JumpListFileTypeNotRegistered);
+ }
+ else if ((uint)hr == 0x80070005 /*E_ACCESSDENIED*/)
+ {
+ // If the recent documents tracking is turned off by the user,
+ // custom categories or items to an existing category cannot be added.
+ // The recent documents tracking can be changed via:
+ // 1. Group Policy “Do not keep history of recently opened documents”.
+ // 2. Via the user setting “Store and display recently opened items in
+ // the Start menu and the taskbar” in the Start menu property dialog.
+ //
+ throw new UnauthorizedAccessException(LocalizedMessages.JumpListCustomCategoriesDisabled);
+ }
+
+ throw new ShellException(hr);
+ }
+
+ // Increase our current index
+ currentIndex++;
+ }
+ }
+
+ // If the ordinal position was out of range, append the Known Categories
+ // at the end
+ if (!knownCategoriesAdded)
+ {
+ AppendKnownCategories();
+ }
+ }
+
+ private void AppendTaskList()
+ {
+ if (userTasks == null || userTasks.Count == 0) { return; }
+
+ IObjectCollection taskContent =
+ (IObjectCollection)new CEnumerableObjectCollection();
+
+ // Add each task's shell representation to the object array
+ foreach (JumpListTask task in userTasks)
+ {
+ JumpListSeparator seperator;
+ JumpListLink link = task as JumpListLink;
+ if (link != null)
+ {
+ taskContent.AddObject(link.NativeShellLink);
+ }
+ else if ((seperator = task as JumpListSeparator) != null)
+ {
+ taskContent.AddObject(seperator.NativeShellLink);
+ }
+ }
+
+ // Add tasks to the taskbar
+ HResult hr = customDestinationList.AddUserTasks((IObjectArray)taskContent);
+
+ if (!CoreErrorHelper.Succeeded(hr))
+ {
+ if ((uint)hr == 0x80040F03)
+ {
+ throw new InvalidOperationException(LocalizedMessages.JumpListFileTypeNotRegistered);
+ }
+ throw new ShellException(hr);
+ }
+ }
+
+ private void AppendKnownCategories()
+ {
+ if (KnownCategoryToDisplay == JumpListKnownCategoryType.Recent)
+ {
+ customDestinationList.AppendKnownCategory(KnownDestinationCategory.Recent);
+ }
+ else if (KnownCategoryToDisplay == JumpListKnownCategoryType.Frequent)
+ {
+ customDestinationList.AppendKnownCategory(KnownDestinationCategory.Frequent);
+ }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListCustomCategory.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListCustomCategory.cs
new file mode 100644
index 0000000000..b5f616d866
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListCustomCategory.cs
@@ -0,0 +1,92 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Linq;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ /// <summary>
+ /// Represents a custom category on the taskbar's jump list
+ /// </summary>
+ public class JumpListCustomCategory
+ {
+ private string name;
+
+ internal JumpListItemCollection<IJumpListItem> JumpListItems
+ {
+ get;
+ private set;
+ }
+
+ /// <summary>
+ /// Category name
+ /// </summary>
+ public string Name
+ {
+ get { return name; }
+ set
+ {
+ if (value != name)
+ {
+ name = value;
+ this.CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
+ }
+ }
+ }
+
+
+ /// <summary>
+ /// Add JumpList items for this category
+ /// </summary>
+ /// <param name="items">The items to add to the JumpList.</param>
+ public void AddJumpListItems(params IJumpListItem[] items)
+ {
+ if (items != null)
+ {
+ foreach (IJumpListItem item in items)
+ {
+ JumpListItems.Add(item);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Event that is triggered when the jump list collection is modified
+ /// </summary>
+ internal event NotifyCollectionChangedEventHandler CollectionChanged = delegate { };
+
+ /// <summary>
+ /// Creates a new custom category instance
+ /// </summary>
+ /// <param name="categoryName">Category name</param>
+ public JumpListCustomCategory(string categoryName)
+ {
+ Name = categoryName;
+
+ JumpListItems = new JumpListItemCollection<IJumpListItem>();
+ JumpListItems.CollectionChanged += OnJumpListCollectionChanged;
+ }
+
+ internal void OnJumpListCollectionChanged(object sender, NotifyCollectionChangedEventArgs args)
+ {
+ this.CollectionChanged(this, args);
+ }
+
+
+ internal void RemoveJumpListItem(string path)
+ {
+ List<IJumpListItem> itemsToRemove = new List<IJumpListItem>(
+ from i in JumpListItems
+ where string.Equals(path, i.Path, StringComparison.OrdinalIgnoreCase)
+ select i);
+
+ // Remove matching items
+ for (int i = 0; i < itemsToRemove.Count; i++)
+ {
+ JumpListItems.Remove(itemsToRemove[i]);
+ }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListCustomCategoryCollection.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListCustomCategoryCollection.cs
new file mode 100644
index 0000000000..ba917a5212
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListCustomCategoryCollection.cs
@@ -0,0 +1,135 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ /// <summary>
+ /// Represents a collection of custom categories
+ /// </summary>
+ internal class JumpListCustomCategoryCollection
+ : ICollection<JumpListCustomCategory>, INotifyCollectionChanged
+ {
+ private List<JumpListCustomCategory> categories = new List<JumpListCustomCategory>();
+
+ /// <summary>
+ /// Event to trigger anytime this collection is modified
+ /// </summary>
+ public event NotifyCollectionChangedEventHandler CollectionChanged = delegate { };
+
+ /// <summary>
+ /// Determines if this collection is read-only
+ /// </summary>
+ public bool IsReadOnly { get; set; }
+
+ /// <summary>
+ /// The number of items in this collection
+ /// </summary>
+ public int Count
+ {
+ get { return categories.Count; }
+ }
+
+ /// <summary>
+ /// Add the specified category to this collection
+ /// </summary>
+ /// <param name="category">Category to add</param>
+ public void Add(JumpListCustomCategory category)
+ {
+ if (category == null)
+ {
+ throw new ArgumentNullException("category");
+ }
+ categories.Add(category);
+
+ // Trigger CollectionChanged event
+ CollectionChanged(
+ this,
+ new NotifyCollectionChangedEventArgs(
+ NotifyCollectionChangedAction.Add,
+ category));
+
+ // Make sure that a collection changed event is fire if this category
+ // or it's corresponding jumplist is modified
+ category.CollectionChanged += CollectionChanged;
+ category.JumpListItems.CollectionChanged += CollectionChanged;
+ }
+
+ /// <summary>
+ /// Remove the specified category from this collection
+ /// </summary>
+ /// <param name="category">Category item to remove</param>
+ /// <returns>True if item was removed.</returns>
+ public bool Remove(JumpListCustomCategory category)
+ {
+ bool removed = categories.Remove(category);
+
+ if (removed == true)
+ {
+ // Trigger CollectionChanged event
+ CollectionChanged(
+ this,
+ new NotifyCollectionChangedEventArgs(
+ NotifyCollectionChangedAction.Remove,
+ 0));
+ }
+
+ return removed;
+ }
+
+ /// <summary>
+ /// Clear all items from the collection
+ /// </summary>
+ public void Clear()
+ {
+ categories.Clear();
+
+ CollectionChanged(
+ this,
+ new NotifyCollectionChangedEventArgs(
+ NotifyCollectionChangedAction.Reset));
+ }
+
+ /// <summary>
+ /// Determine if this collection contains the specified item
+ /// </summary>
+ /// <param name="category">Category to search for</param>
+ /// <returns>True if category was found</returns>
+ public bool Contains(JumpListCustomCategory category)
+ {
+ return categories.Contains(category);
+ }
+
+ /// <summary>
+ /// Copy this collection to a compatible one-dimensional array,
+ /// starting at the specified index of the target array
+ /// </summary>
+ /// <param name="array">Array to copy to</param>
+ /// <param name="index">Index of target array to start copy</param>
+ public void CopyTo(JumpListCustomCategory[] array, int index)
+ {
+ categories.CopyTo(array, index);
+ }
+
+ /// <summary>
+ /// Returns an enumerator that iterates through this collection.
+ /// </summary>
+ /// <returns>Enumerator to iterate through this collection.</returns>
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return categories.GetEnumerator();
+ }
+
+ /// <summary>
+ /// Returns an enumerator that iterates through this collection.
+ /// </summary>
+ /// <returns>Enumerator to iterate through this collection.</returns>
+ IEnumerator<JumpListCustomCategory> IEnumerable<JumpListCustomCategory>.GetEnumerator()
+ {
+ return categories.GetEnumerator();
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListItem.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListItem.cs
new file mode 100644
index 0000000000..2b29c3a209
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListItem.cs
@@ -0,0 +1,39 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using Microsoft.WindowsAPICodePack.Shell;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ /// <summary>
+ /// Represents a jump list item.
+ /// </summary>
+ public class JumpListItem : ShellFile, IJumpListItem
+ {
+ /// <summary>
+ /// Creates a jump list item with the specified path.
+ /// </summary>
+ /// <param name="path">The path to the jump list item.</param>
+ /// <remarks>The file type should associate the given file
+ /// with the calling application.</remarks>
+ public JumpListItem(string path) : base(path) { }
+
+ #region IJumpListItem Members
+
+ /// <summary>
+ /// Gets or sets the target path for this jump list item.
+ /// </summary>
+ public new string Path
+ {
+ get
+ {
+ return base.Path;
+ }
+ set
+ {
+ base.ParsingName = value;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListItemCollection.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListItemCollection.cs
new file mode 100644
index 0000000000..2cfda5c4c0
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListItemCollection.cs
@@ -0,0 +1,126 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ /// <summary>
+ /// Represents a collection of jump list items.
+ /// </summary>
+ /// <typeparam name="T">The type of elements in this collection.</typeparam>
+ internal class JumpListItemCollection<T> : ICollection<T>, INotifyCollectionChanged
+ {
+ private List<T> items = new List<T>();
+
+ /// <summary>
+ /// Occurs anytime a change is made to the underlying collection.
+ /// </summary>
+ public event NotifyCollectionChangedEventHandler CollectionChanged = delegate { };
+
+ /// <summary>
+ /// Gets or sets a value that determines if this collection is read-only.
+ /// </summary>
+ public bool IsReadOnly { get; set; }
+
+ /// <summary>
+ /// Gets a count of the items currently in this collection.
+ /// </summary>
+ public int Count
+ {
+ get { return items.Count; }
+ }
+
+ /// <summary>
+ /// Adds the specified item to this collection.
+ /// </summary>
+ /// <param name="item">The item to add.</param>
+ public void Add(T item)
+ {
+ items.Add(item);
+
+ // Trigger CollectionChanged event
+ CollectionChanged(
+ this,
+ new NotifyCollectionChangedEventArgs(
+ NotifyCollectionChangedAction.Add,
+ item));
+ }
+
+ /// <summary>
+ /// Removes the first instance of the specified item from the collection.
+ /// </summary>
+ /// <param name="item">The item to remove.</param>
+ /// <returns><b>true</b> if an item was removed, otherwise <b>false</b> if no items were removed.</returns>
+ public bool Remove(T item)
+ {
+ bool removed = items.Remove(item);
+
+ if (removed == true)
+ {
+ // Trigger CollectionChanged event
+ CollectionChanged(
+ this,
+ new NotifyCollectionChangedEventArgs(
+ NotifyCollectionChangedAction.Remove,
+ 0));
+ }
+
+ return removed;
+ }
+
+ /// <summary>
+ /// Clears all items from this collection.
+ /// </summary>
+ public void Clear()
+ {
+ items.Clear();
+
+ // Trigger CollectionChanged event
+ CollectionChanged(
+ this,
+ new NotifyCollectionChangedEventArgs(
+ NotifyCollectionChangedAction.Reset));
+ }
+
+ /// <summary>
+ /// Determines if this collection contains the specified item.
+ /// </summary>
+ /// <param name="item">The search item.</param>
+ /// <returns><b>true</b> if an item was found, otherwise <b>false</b>.</returns>
+ public bool Contains(T item)
+ {
+ return items.Contains(item);
+ }
+
+ /// <summary>
+ /// Copies this collection to a compatible one-dimensional array,
+ /// starting at the specified index of the target array.
+ /// </summary>
+ /// <param name="array">The array name.</param>
+ /// <param name="index">The index of the starting element.</param>
+ public void CopyTo(T[] array, int index)
+ {
+ items.CopyTo(array, index);
+ }
+
+ /// <summary>
+ /// Returns an enumerator that iterates through a collection.
+ /// </summary>
+ /// <returns>An enumerator to iterate through this collection.</returns>
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return items.GetEnumerator();
+ }
+
+ /// <summary>
+ /// Returns an enumerator that iterates through a collection of a specified type.
+ /// </summary>
+ /// <returns>An enumerator to iterate through this collection.</returns>
+ IEnumerator<T> IEnumerable<T>.GetEnumerator()
+ {
+ return items.GetEnumerator();
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListLink.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListLink.cs
new file mode 100644
index 0000000000..8aa168c3ea
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListLink.cs
@@ -0,0 +1,201 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Shell;
+using Microsoft.WindowsAPICodePack.Shell.PropertySystem;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ /// <summary>
+ /// Represents a jump list link object.
+ /// </summary>
+ public class JumpListLink : JumpListTask, IJumpListItem, IDisposable
+ {
+ internal static PropertyKey PKEY_Title = SystemProperties.System.Title;
+
+ /// <summary>
+ /// Initializes a new instance of a JumpListLink with the specified path.
+ /// </summary>
+ /// <param name="pathValue">The path to the item. The path is required for the JumpList Link</param>
+ /// <param name="titleValue">The title for the JumpListLink item. The title is required for the JumpList link.</param>
+ public JumpListLink(string pathValue, string titleValue)
+ {
+ if (string.IsNullOrEmpty(pathValue))
+ {
+ throw new ArgumentNullException("pathValue", LocalizedMessages.JumpListLinkPathRequired);
+ }
+
+ if (string.IsNullOrEmpty(titleValue))
+ {
+ throw new ArgumentNullException("titleValue", LocalizedMessages.JumpListLinkTitleRequired);
+ }
+
+ Path = pathValue;
+ Title = titleValue;
+ }
+
+ private string title;
+ /// <summary>
+ /// Gets or sets the link's title
+ /// </summary>
+ public string Title
+ {
+ get { return title; }
+ set
+ {
+ if (string.IsNullOrEmpty(value))
+ {
+ throw new ArgumentNullException("value", LocalizedMessages.JumpListLinkTitleRequired);
+ }
+
+ title = value;
+ }
+ }
+
+ private string path;
+ /// <summary>
+ /// Gets or sets the link's path
+ /// </summary>
+ public string Path
+ {
+ get { return path; }
+ set
+ {
+ if (string.IsNullOrEmpty(value))
+ {
+ throw new ArgumentNullException("value", LocalizedMessages.JumpListLinkTitleRequired);
+ }
+
+ path = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the icon reference (location and index) of the link's icon.
+ /// </summary>
+ public IconReference IconReference { get; set; }
+
+ /// <summary>
+ /// Gets or sets the object's arguments (passed to the command line).
+ /// </summary>
+ public string Arguments { get; set; }
+
+ /// <summary>
+ /// Gets or sets the object's working directory.
+ /// </summary>
+ public string WorkingDirectory { get; set; }
+
+ /// <summary>
+ /// Gets or sets the show command of the lauched application.
+ /// </summary>
+ public WindowShowCommand ShowCommand { get; set; }
+
+ private IPropertyStore nativePropertyStore;
+ private IShellLinkW nativeShellLink;
+ /// <summary>
+ /// Gets an IShellLinkW representation of this object
+ /// </summary>
+ internal override IShellLinkW NativeShellLink
+ {
+ get
+ {
+ if (nativeShellLink != null)
+ {
+ Marshal.ReleaseComObject(nativeShellLink);
+ nativeShellLink = null;
+ }
+
+ nativeShellLink = (IShellLinkW)new CShellLink();
+
+ if (nativePropertyStore != null)
+ {
+ Marshal.ReleaseComObject(nativePropertyStore);
+ nativePropertyStore = null;
+ }
+
+ nativePropertyStore = (IPropertyStore)nativeShellLink;
+
+ nativeShellLink.SetPath(Path);
+
+ if (!string.IsNullOrEmpty(IconReference.ModuleName))
+ {
+ nativeShellLink.SetIconLocation(IconReference.ModuleName, IconReference.ResourceId);
+ }
+
+ if (!string.IsNullOrEmpty(Arguments))
+ {
+ nativeShellLink.SetArguments(Arguments);
+ }
+
+ if (!string.IsNullOrEmpty(WorkingDirectory))
+ {
+ nativeShellLink.SetWorkingDirectory(WorkingDirectory);
+ }
+
+ nativeShellLink.SetShowCmd((uint)ShowCommand);
+
+ using (PropVariant propVariant = new PropVariant(Title))
+ {
+ HResult result = nativePropertyStore.SetValue(ref PKEY_Title, propVariant);
+ if (!CoreErrorHelper.Succeeded(result))
+ {
+ throw new ShellException(result);
+ }
+
+ nativePropertyStore.Commit();
+ }
+
+ return nativeShellLink;
+ }
+ }
+
+ #region IDisposable Members
+
+ /// <summary>
+ /// Release the native and managed objects
+ /// </summary>
+ /// <param name="disposing">Indicates that this is being called from Dispose(), rather than the finalizer.</param>
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ title = null;
+ }
+
+ if (nativePropertyStore != null)
+ {
+ Marshal.ReleaseComObject(nativePropertyStore);
+ nativePropertyStore = null;
+ }
+
+ if (nativeShellLink != null)
+ {
+ Marshal.ReleaseComObject(nativeShellLink);
+ nativeShellLink = null;
+ }
+ }
+
+ /// <summary>
+ /// Release the native objects.
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Implement the finalizer.
+ /// </summary>
+ ~JumpListLink()
+ {
+ Dispose(false);
+ }
+
+ #endregion
+
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListSeparator.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListSeparator.cs
new file mode 100644
index 0000000000..0af5aa6c49
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/JumpListSeparator.cs
@@ -0,0 +1,99 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+using Microsoft.WindowsAPICodePack.Shell;
+using Microsoft.WindowsAPICodePack.Shell.PropertySystem;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ /// <summary>
+ /// Represents a separator in the user task list. The JumpListSeparator control
+ /// can only be used in a user task list.
+ /// </summary>
+ public class JumpListSeparator : JumpListTask, IDisposable
+ {
+ internal static PropertyKey PKEY_AppUserModel_IsDestListSeparator = SystemProperties.System.AppUserModel.IsDestinationListSeparator;
+
+ private IPropertyStore nativePropertyStore;
+ private IShellLinkW nativeShellLink;
+ /// <summary>
+ /// Gets an IShellLinkW representation of this object
+ /// </summary>
+ internal override IShellLinkW NativeShellLink
+ {
+ get
+ {
+ if (nativeShellLink != null)
+ {
+ Marshal.ReleaseComObject(nativeShellLink);
+ nativeShellLink = null;
+ }
+
+ nativeShellLink = (IShellLinkW)new CShellLink();
+
+ if (nativePropertyStore != null)
+ {
+ Marshal.ReleaseComObject(nativePropertyStore);
+ nativePropertyStore = null;
+ }
+
+ nativePropertyStore = (IPropertyStore)nativeShellLink;
+
+ using(PropVariant propVariant = new PropVariant(true))
+ {
+ HResult result = nativePropertyStore.SetValue(ref PKEY_AppUserModel_IsDestListSeparator, propVariant);
+ if (!CoreErrorHelper.Succeeded(result))
+ {
+ throw new ShellException(result);
+ }
+ nativePropertyStore.Commit();
+ }
+
+ return nativeShellLink; ;
+ }
+ }
+
+ #region IDisposable Members
+
+ /// <summary>
+ /// Release the native and managed objects
+ /// </summary>
+ /// <param name="disposing">Indicates that this is being called from Dispose(), rather than the finalizer.</param>
+ protected virtual void Dispose(bool disposing)
+ {
+ if (nativePropertyStore != null)
+ {
+ Marshal.ReleaseComObject(nativePropertyStore);
+ nativePropertyStore = null;
+ }
+
+ if (nativeShellLink != null)
+ {
+ Marshal.ReleaseComObject(nativeShellLink);
+ nativeShellLink = null;
+ }
+ }
+
+ /// <summary>
+ /// Release the native objects.
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Implement the finalizer.
+ /// </summary>
+ ~JumpListSeparator()
+ {
+ Dispose(false);
+ }
+
+ #endregion
+
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnail.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnail.cs
new file mode 100644
index 0000000000..fe565119da
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnail.cs
@@ -0,0 +1,566 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Drawing;
+using System.IO;
+using System.Threading;
+using System.Windows;
+using System.Windows.Forms;
+using System.Windows.Interop;
+using System.Windows.Media.Imaging;
+using Microsoft.WindowsAPICodePack.Shell;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ /// <summary>
+ /// Represents a tabbed thumbnail on the taskbar for a given window or a control.
+ /// </summary>
+ public class TabbedThumbnail : IDisposable
+ {
+ #region Internal members
+
+ // Control properties
+ internal IntPtr WindowHandle { get; set; }
+ internal IntPtr ParentWindowHandle { get; set; }
+
+ // WPF properties
+ internal UIElement WindowsControl { get; set; }
+ internal Window WindowsControlParentWindow { get; set; }
+
+ private TaskbarWindow _taskbarWindow;
+ internal TaskbarWindow TaskbarWindow
+ {
+ get { return _taskbarWindow; }
+ set
+ {
+ _taskbarWindow = value;
+
+ // If we have a TaskbarWindow assigned, set it's icon
+ if (_taskbarWindow != null && _taskbarWindow.TabbedThumbnailProxyWindow != null)
+ {
+ _taskbarWindow.TabbedThumbnailProxyWindow.Icon = Icon;
+ }
+ }
+ }
+
+ private bool _addedToTaskbar;
+ internal bool AddedToTaskbar
+ {
+ get { return _addedToTaskbar; }
+ set
+ {
+ _addedToTaskbar = value;
+
+ // The user has updated the clipping region, so invalidate our existing preview
+ if (ClippingRectangle != null)
+ {
+ TaskbarWindowManager.InvalidatePreview(this.TaskbarWindow);
+ }
+ }
+ }
+
+ internal bool RemovedFromTaskbar { get; set; }
+
+ #endregion
+
+ #region Constructors
+
+ /// <summary>
+ /// Creates a new TabbedThumbnail with the given window handle of the parent and
+ /// a child control/window's handle (e.g. TabPage or Panel)
+ /// </summary>
+ /// <param name="parentWindowHandle">Window handle of the parent window.
+ /// This window has to be a top-level window and the handle cannot be null or IntPtr.Zero</param>
+ /// <param name="windowHandle">Window handle of the child control or window for which a tabbed
+ /// thumbnail needs to be displayed</param>
+ public TabbedThumbnail(IntPtr parentWindowHandle, IntPtr windowHandle)
+ {
+ if (parentWindowHandle == IntPtr.Zero)
+ {
+ throw new ArgumentException(LocalizedMessages.TabbedThumbnailZeroParentHandle, "parentWindowHandle");
+ }
+ if (windowHandle == IntPtr.Zero)
+ {
+ throw new ArgumentException(LocalizedMessages.TabbedThumbnailZeroChildHandle, "windowHandle");
+ }
+
+ WindowHandle = windowHandle;
+ ParentWindowHandle = parentWindowHandle;
+ }
+
+ /// <summary>
+ /// Creates a new TabbedThumbnail with the given window handle of the parent and
+ /// a child control (e.g. TabPage or Panel)
+ /// </summary>
+ /// <param name="parentWindowHandle">Window handle of the parent window.
+ /// This window has to be a top-level window and the handle cannot be null or IntPtr.Zero</param>
+ /// <param name="control">Child control for which a tabbed thumbnail needs to be displayed</param>
+ /// <remarks>This method can also be called when using a WindowsFormHost control in a WPF application.
+ /// Call this method with the main WPF Window's handle, and windowsFormHost.Child control.</remarks>
+ public TabbedThumbnail(IntPtr parentWindowHandle, Control control)
+ {
+ if (parentWindowHandle == IntPtr.Zero)
+ {
+ throw new ArgumentException(LocalizedMessages.TabbedThumbnailZeroParentHandle, "parentWindowHandle");
+ }
+ if (control == null)
+ {
+ throw new ArgumentNullException("control");
+ }
+
+ WindowHandle = control.Handle;
+ ParentWindowHandle = parentWindowHandle;
+ }
+
+ /// <summary>
+ /// Creates a new TabbedThumbnail with the given window handle of the parent and
+ /// a WPF child Window. For WindowsFormHost control, use TabbedThumbnail(IntPtr, Control) overload and pass
+ /// the WindowsFormHost.Child as the second parameter.
+ /// </summary>
+ /// <param name="parentWindow">Parent window for the UIElement control.
+ /// This window has to be a top-level window and the handle cannot be null</param>
+ /// <param name="windowsControl">WPF Control (UIElement) for which a tabbed thumbnail needs to be displayed</param>
+ /// <param name="peekOffset">Offset point used for displaying the peek bitmap. This setting is
+ /// recomended for hidden WPF controls as it is difficult to calculate their offset.</param>
+ public TabbedThumbnail(Window parentWindow, UIElement windowsControl, Vector peekOffset)
+ {
+ if (windowsControl == null)
+ {
+ throw new ArgumentNullException("windowsControl");
+ }
+ if (parentWindow == null)
+ {
+ throw new ArgumentNullException("parentWindow");
+ }
+
+ WindowHandle = IntPtr.Zero;
+
+ WindowsControl = windowsControl;
+ WindowsControlParentWindow = parentWindow;
+ ParentWindowHandle = (new WindowInteropHelper(parentWindow)).Handle;
+ PeekOffset = peekOffset;
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ private string _title = string.Empty;
+ /// <summary>
+ /// Title for the window shown as the taskbar thumbnail.
+ /// </summary>
+ public string Title
+ {
+ get
+ {
+ return _title;
+ }
+ set
+ {
+ if (_title != value)
+ {
+ _title = value;
+ if (TitleChanged != null) { TitleChanged(this, EventArgs.Empty); }
+ }
+ }
+ }
+
+ private string _tooltip = string.Empty;
+ /// <summary>
+ /// Tooltip to be shown for this thumbnail on the taskbar.
+ /// By default this is full title of the window shown on the taskbar.
+ /// </summary>
+ public string Tooltip
+ {
+ get { return _tooltip; }
+ set
+ {
+ if (_tooltip != value)
+ {
+ _tooltip = value;
+ if (TooltipChanged != null) { TooltipChanged(this, EventArgs.Empty); }
+ }
+ }
+ }
+
+ /// <summary>
+ /// Sets the window icon for this thumbnail preview
+ /// </summary>
+ /// <param name="icon">System.Drawing.Icon for the window/control associated with this preview</param>
+ public void SetWindowIcon(Icon icon)
+ {
+ Icon = icon;
+
+ // If we have a TaskbarWindow assigned, set its icon
+ if (TaskbarWindow != null && TaskbarWindow.TabbedThumbnailProxyWindow != null)
+ {
+ TaskbarWindow.TabbedThumbnailProxyWindow.Icon = Icon;
+ }
+ }
+
+ /// <summary>
+ /// Sets the window icon for this thumbnail preview
+ /// </summary>
+ /// <param name="iconHandle">Icon handle (hIcon) for the window/control associated with this preview</param>
+ /// <remarks>This method will not release the icon handle. It is the caller's responsibility to release the icon handle.</remarks>
+ public void SetWindowIcon(IntPtr iconHandle)
+ {
+ Icon = iconHandle != IntPtr.Zero ? System.Drawing.Icon.FromHandle(iconHandle) : null;
+
+ if (TaskbarWindow != null && TaskbarWindow.TabbedThumbnailProxyWindow != null)
+ {
+ TaskbarWindow.TabbedThumbnailProxyWindow.Icon = Icon;
+ }
+ }
+
+ private Rectangle? _clippingRectangle;
+ /// <summary>
+ /// Specifies that only a portion of the window's client area
+ /// should be used in the window's thumbnail.
+ /// <para>A value of null will clear the clipping area and use the default thumbnail.</para>
+ /// </summary>
+ public Rectangle? ClippingRectangle
+ {
+ get { return _clippingRectangle; }
+ set
+ {
+ _clippingRectangle = value;
+
+ // The user has updated the clipping region, so invalidate our existing preview
+ TaskbarWindowManager.InvalidatePreview(this.TaskbarWindow);
+ }
+ }
+
+ internal IntPtr CurrentHBitmap { get; set; }
+
+ internal Icon Icon { get; private set; }
+
+ /// <summary>
+ /// Override the thumbnail and peek bitmap.
+ /// By providing this bitmap manually, Thumbnail Window manager will provide the
+ /// Desktop Window Manager (DWM) this bitmap instead of rendering one automatically.
+ /// Use this property to update the bitmap whenever the control is updated and the user
+ /// needs to be shown a new thumbnail on the taskbar preview (or aero peek).
+ /// </summary>
+ /// <param name="bitmap">The image to use.</param>
+ /// <remarks>
+ /// If the bitmap doesn't have the right dimensions, the DWM may scale it or not
+ /// render certain areas as appropriate - it is the user's responsibility
+ /// to render a bitmap with the proper dimensions.
+ /// </remarks>
+ public void SetImage(Bitmap bitmap)
+ {
+ if (bitmap != null)
+ {
+ SetImage(bitmap.GetHbitmap());
+ }
+ else
+ {
+ SetImage(IntPtr.Zero);
+ }
+ }
+
+ /// <summary>
+ /// Override the thumbnail and peek bitmap.
+ /// By providing this bitmap manually, Thumbnail Window manager will provide the
+ /// Desktop Window Manager (DWM) this bitmap instead of rendering one automatically.
+ /// Use this property to update the bitmap whenever the control is updated and the user
+ /// needs to be shown a new thumbnail on the taskbar preview (or aero peek).
+ /// </summary>
+ /// <param name="bitmapSource">The image to use.</param>
+ /// <remarks>
+ /// If the bitmap doesn't have the right dimensions, the DWM may scale it or not
+ /// render certain areas as appropriate - it is the user's responsibility
+ /// to render a bitmap with the proper dimensions.
+ /// </remarks>
+ public void SetImage(BitmapSource bitmapSource)
+ {
+ if (bitmapSource == null)
+ {
+ SetImage(IntPtr.Zero);
+ return;
+ }
+
+ BmpBitmapEncoder encoder = new BmpBitmapEncoder();
+ encoder.Frames.Add(BitmapFrame.Create(bitmapSource));
+
+ using (MemoryStream memoryStream = new MemoryStream())
+ {
+ encoder.Save(memoryStream);
+ memoryStream.Position = 0;
+
+ using (Bitmap bmp = new Bitmap(memoryStream))
+ {
+ SetImage(bmp.GetHbitmap());
+ }
+ }
+ }
+
+ /// <summary>
+ /// Override the thumbnail and peek bitmap.
+ /// By providing this bitmap manually, Thumbnail Window manager will provide the
+ /// Desktop Window Manager (DWM) this bitmap instead of rendering one automatically.
+ /// Use this property to update the bitmap whenever the control is updated and the user
+ /// needs to be shown a new thumbnail on the taskbar preview (or aero peek).
+ /// </summary>
+ /// <param name="hBitmap">A bitmap handle for the image to use.
+ /// <para>When the TabbedThumbnail is finalized, this class will delete the provided hBitmap.</para></param>
+ /// <remarks>
+ /// If the bitmap doesn't have the right dimensions, the DWM may scale it or not
+ /// render certain areas as appropriate - it is the user's responsibility
+ /// to render a bitmap with the proper dimensions.
+ /// </remarks>
+ internal void SetImage(IntPtr hBitmap)
+ {
+ // Before we set a new bitmap, dispose the old one
+ if (CurrentHBitmap != IntPtr.Zero)
+ {
+ ShellNativeMethods.DeleteObject(CurrentHBitmap);
+ }
+
+ // Set the new bitmap
+ CurrentHBitmap = hBitmap;
+
+ // Let DWM know to invalidate its cached thumbnail/preview and ask us for a new one
+ TaskbarWindowManager.InvalidatePreview(TaskbarWindow);
+ }
+
+ /// <summary>
+ /// Specifies whether a standard window frame will be displayed
+ /// around the bitmap. If the bitmap represents a top-level window,
+ /// you would probably set this flag to <b>true</b>. If the bitmap
+ /// represents a child window (or a frameless window), you would
+ /// probably set this flag to <b>false</b>.
+ /// </summary>
+ public bool DisplayFrameAroundBitmap { get; set; }
+
+ /// <summary>
+ /// Invalidate any existing thumbnail preview. Calling this method
+ /// will force DWM to request a new bitmap next time user previews the thumbnails
+ /// or requests Aero peek preview.
+ /// </summary>
+ public void InvalidatePreview()
+ {
+ // clear current image and invalidate
+ SetImage(IntPtr.Zero);
+ }
+
+ /// <summary>
+ /// Gets or sets the offset used for displaying the peek bitmap. This setting is
+ /// recomended for hidden WPF controls as it is difficult to calculate their offset.
+ /// </summary>
+ public Vector? PeekOffset { get; set; }
+
+ #endregion
+
+
+
+ #region Events
+
+ /// <summary>
+ /// This event is raised when the Title property changes.
+ /// </summary>
+ public event EventHandler TitleChanged;
+
+ /// <summary>
+ /// This event is raised when the Tooltip property changes.
+ /// </summary>
+ public event EventHandler TooltipChanged;
+
+ /// <summary>
+ /// The event that occurs when a tab is closed on the taskbar thumbnail preview.
+ /// </summary>
+ public event EventHandler<TabbedThumbnailClosedEventArgs> TabbedThumbnailClosed;
+
+ /// <summary>
+ /// The event that occurs when a tab is maximized via the taskbar thumbnail preview (context menu).
+ /// </summary>
+ public event EventHandler<TabbedThumbnailEventArgs> TabbedThumbnailMaximized;
+
+ /// <summary>
+ /// The event that occurs when a tab is minimized via the taskbar thumbnail preview (context menu).
+ /// </summary>
+ public event EventHandler<TabbedThumbnailEventArgs> TabbedThumbnailMinimized;
+
+ /// <summary>
+ /// The event that occurs when a tab is activated (clicked) on the taskbar thumbnail preview.
+ /// </summary>
+ public event EventHandler<TabbedThumbnailEventArgs> TabbedThumbnailActivated;
+
+ /// <summary>
+ /// The event that occurs when a thumbnail or peek bitmap is requested by the user.
+ /// </summary>
+ public event EventHandler<TabbedThumbnailBitmapRequestedEventArgs> TabbedThumbnailBitmapRequested;
+
+
+ internal void OnTabbedThumbnailMaximized()
+ {
+ if (TabbedThumbnailMaximized != null)
+ {
+ TabbedThumbnailMaximized(this, GetTabbedThumbnailEventArgs());
+ }
+ else
+ {
+ // No one is listening to these events.
+ // Forward the message to the main window
+ CoreNativeMethods.SendMessage(ParentWindowHandle, WindowMessage.SystemCommand, new IntPtr(TabbedThumbnailNativeMethods.ScMaximize), IntPtr.Zero);
+ }
+ }
+
+ internal void OnTabbedThumbnailMinimized()
+ {
+ if (TabbedThumbnailMinimized != null)
+ {
+ TabbedThumbnailMinimized(this, GetTabbedThumbnailEventArgs());
+ }
+ else
+ {
+ // No one is listening to these events.
+ // Forward the message to the main window
+ CoreNativeMethods.SendMessage(ParentWindowHandle, WindowMessage.SystemCommand, new IntPtr(TabbedThumbnailNativeMethods.ScMinimize), IntPtr.Zero);
+ }
+
+ }
+
+ /// <summary>
+ /// Returns true if the thumbnail was removed from the taskbar; false if it was not.
+ /// </summary>
+ /// <returns>Returns true if the thumbnail was removed from the taskbar; false if it was not.</returns>
+ internal bool OnTabbedThumbnailClosed()
+ {
+ var closedHandler = TabbedThumbnailClosed;
+ if (closedHandler != null)
+ {
+ var closingEvent = GetTabbedThumbnailClosingEventArgs();
+
+ closedHandler(this, closingEvent);
+
+ if (closingEvent.Cancel) { return false; }
+ }
+ else
+ {
+ // No one is listening to these events. Forward the message to the main window
+ CoreNativeMethods.SendMessage(ParentWindowHandle, WindowMessage.NCDestroy, IntPtr.Zero, IntPtr.Zero);
+ }
+
+ // Remove it from the internal list as well as the taskbar
+ TaskbarManager.Instance.TabbedThumbnail.RemoveThumbnailPreview(this);
+ return true;
+ }
+
+ internal void OnTabbedThumbnailActivated()
+ {
+ if (TabbedThumbnailActivated != null)
+ {
+ TabbedThumbnailActivated(this, GetTabbedThumbnailEventArgs());
+ }
+ else
+ {
+ // No one is listening to these events.
+ // Forward the message to the main window
+ CoreNativeMethods.SendMessage(ParentWindowHandle, WindowMessage.ActivateApplication, new IntPtr(1), new IntPtr(Thread.CurrentThread.GetHashCode()));
+ }
+ }
+
+ internal void OnTabbedThumbnailBitmapRequested()
+ {
+ if (TabbedThumbnailBitmapRequested != null)
+ {
+ TabbedThumbnailBitmapRequestedEventArgs eventArgs = null;
+
+ if (this.WindowHandle != IntPtr.Zero)
+ {
+ eventArgs = new TabbedThumbnailBitmapRequestedEventArgs(this.WindowHandle);
+ }
+ else if (this.WindowsControl != null)
+ {
+ eventArgs = new TabbedThumbnailBitmapRequestedEventArgs(this.WindowsControl);
+ }
+
+ TabbedThumbnailBitmapRequested(this, eventArgs);
+ }
+ }
+
+ private TabbedThumbnailClosedEventArgs GetTabbedThumbnailClosingEventArgs()
+ {
+ TabbedThumbnailClosedEventArgs eventArgs = null;
+
+ if (this.WindowHandle != IntPtr.Zero)
+ {
+ eventArgs = new TabbedThumbnailClosedEventArgs(this.WindowHandle);
+ }
+ else if (this.WindowsControl != null)
+ {
+ eventArgs = new TabbedThumbnailClosedEventArgs(this.WindowsControl);
+ }
+
+ return eventArgs;
+ }
+
+ private TabbedThumbnailEventArgs GetTabbedThumbnailEventArgs()
+ {
+ TabbedThumbnailEventArgs eventArgs = null;
+
+ if (this.WindowHandle != IntPtr.Zero)
+ {
+ eventArgs = new TabbedThumbnailEventArgs(this.WindowHandle);
+ }
+ else if (this.WindowsControl != null)
+ {
+ eventArgs = new TabbedThumbnailEventArgs(this.WindowsControl);
+ }
+
+ return eventArgs;
+ }
+
+ #endregion
+
+ #region IDisposable Members
+
+ /// <summary>
+ ///
+ /// </summary>
+ ~TabbedThumbnail()
+ {
+ Dispose(false);
+ }
+
+ /// <summary>
+ /// Release the native objects.
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Release the native objects.
+ /// </summary>
+ /// <param name="disposing"></param>
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ _taskbarWindow = null;
+
+ if (Icon != null) { Icon.Dispose(); }
+ Icon = null;
+
+ _title = null;
+ _tooltip = null;
+ WindowsControl = null;
+ }
+
+ if (CurrentHBitmap != IntPtr.Zero)
+ {
+ ShellNativeMethods.DeleteObject(CurrentHBitmap);
+ CurrentHBitmap = IntPtr.Zero;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailBitmapRequestedEventArgs.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailBitmapRequestedEventArgs.cs
new file mode 100644
index 0000000000..701d0f942f
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailBitmapRequestedEventArgs.cs
@@ -0,0 +1,42 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Drawing;
+using System.Windows;
+using System.Windows.Media.Imaging;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ /// <summary>
+ /// Event args for the TabbedThumbnailBitmapRequested event. The event allows applications to
+ /// provide a bitmap for the tabbed thumbnail's preview and peek. The application should also
+ /// set the Handled property if a custom bitmap is provided.
+ /// </summary>
+ public class TabbedThumbnailBitmapRequestedEventArgs : TabbedThumbnailEventArgs
+ {
+ /// <summary>
+ /// Creates a Event Args for a TabbedThumbnailBitmapRequested event.
+ /// </summary>
+ /// <param name="windowHandle">Window handle for the control/window related to the event</param>
+ public TabbedThumbnailBitmapRequestedEventArgs(IntPtr windowHandle)
+ : base(windowHandle)
+ {
+ }
+
+ /// <summary>
+ /// Creates a Event Args for a TabbedThumbnailBitmapRequested event.
+ /// </summary>
+ /// <param name="windowsControl">WPF Control (UIElement) related to the event</param>
+ public TabbedThumbnailBitmapRequestedEventArgs(UIElement windowsControl)
+ : base(windowsControl)
+ {
+ }
+
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the TabbedThumbnailBitmapRequested event was handled.
+ /// Set this property if the SetImage method is called with a custom bitmap for the thumbnail/peek.
+ /// </summary>
+ public bool Handled { get; set; }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailClosedEventArgs.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailClosedEventArgs.cs
new file mode 100644
index 0000000000..b90a695985
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailClosedEventArgs.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Windows;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ /// <summary>
+ /// Event args for when close is selected on a tabbed thumbnail proxy window.
+ /// </summary>
+ public class TabbedThumbnailClosedEventArgs : TabbedThumbnailEventArgs
+ {
+ /// <summary>
+ /// Creates a Event Args for a specific tabbed thumbnail event.
+ /// </summary>
+ /// <param name="windowHandle">Window handle for the control/window related to the event</param>
+ public TabbedThumbnailClosedEventArgs(IntPtr windowHandle) : base(windowHandle) { }
+
+ /// <summary>
+ /// Creates a Event Args for a specific tabbed thumbnail event.
+ /// </summary>
+ /// <param name="windowsControl">WPF Control (UIElement) related to the event</param>
+ public TabbedThumbnailClosedEventArgs(UIElement windowsControl) : base(windowsControl) { }
+
+ /// <summary>
+ /// If set to true, the proxy window will not be removed from the taskbar.
+ /// </summary>
+ public bool Cancel { get; set; }
+
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailEventArgs.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailEventArgs.cs
new file mode 100644
index 0000000000..8788ae0f11
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailEventArgs.cs
@@ -0,0 +1,46 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Windows;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ /// <summary>
+ /// Event args for various Tabbed Thumbnail related events
+ /// </summary>
+ public class TabbedThumbnailEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Creates a Event Args for a specific tabbed thumbnail event.
+ /// </summary>
+ /// <param name="windowHandle">Window handle for the control/window related to the event</param>
+ public TabbedThumbnailEventArgs(IntPtr windowHandle)
+ {
+ WindowHandle = windowHandle;
+ WindowsControl = null;
+ }
+
+ /// <summary>
+ /// Creates a Event Args for a specific tabbed thumbnail event.
+ /// </summary>
+ /// <param name="windowsControl">WPF Control (UIElement) related to the event</param>
+ public TabbedThumbnailEventArgs(UIElement windowsControl)
+ {
+ WindowHandle = IntPtr.Zero;
+ WindowsControl = windowsControl;
+ }
+
+ /// <summary>
+ /// Gets the Window handle for the specific control/window that is related to this event.
+ /// </summary>
+ /// <remarks>For WPF Controls (UIElement) the WindowHandle will be IntPtr.Zero.
+ /// Check the WindowsControl property to get the specific control associated with this event.</remarks>
+ public IntPtr WindowHandle { get; private set; }
+
+ /// <summary>
+ /// Gets the WPF Control (UIElement) that is related to this event. This property may be null
+ /// for non-WPF applications.
+ /// </summary>
+ public UIElement WindowsControl { get; private set; }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailManager.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailManager.cs
new file mode 100644
index 0000000000..73a7e579db
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailManager.cs
@@ -0,0 +1,464 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Windows;
+using System.Windows.Forms;
+using MS.WindowsAPICodePack.Internal;
+using Microsoft.WindowsAPICodePack.Shell.Interop;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using Microsoft.WindowsAPICodePack.Shell;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ /// <summary>
+ /// Represents the main class for adding and removing tabbed thumbnails on the Taskbar
+ /// for child windows and controls.
+ /// </summary>
+ public class TabbedThumbnailManager
+ {
+ /// <summary>
+ /// Internal dictionary to keep track of the user's window handle and its
+ /// corresponding thumbnail preview objects.
+ /// </summary>
+ private Dictionary<IntPtr, TabbedThumbnail> _tabbedThumbnailCache;
+ private Dictionary<UIElement, TabbedThumbnail> _tabbedThumbnailCacheWPF; // list for WPF controls
+
+ /// <summary>
+ /// Internal constructor that creates a new dictionary for keeping track of the window handles
+ /// and their corresponding thumbnail preview objects.
+ /// </summary>
+ internal TabbedThumbnailManager()
+ {
+ _tabbedThumbnailCache = new Dictionary<IntPtr, TabbedThumbnail>();
+ _tabbedThumbnailCacheWPF = new Dictionary<UIElement, TabbedThumbnail>();
+ }
+
+ /// <summary>
+ /// Adds a new tabbed thumbnail to the taskbar.
+ /// </summary>
+ /// <param name="preview">Thumbnail preview for a specific window handle or control. The preview
+ /// object can be initialized with specific properties for the title, bitmap, and tooltip.</param>
+ /// <exception cref="System.ArgumentException">If the tabbed thumbnail has already been added</exception>
+ public void AddThumbnailPreview(TabbedThumbnail preview)
+ {
+ if (preview == null) { throw new ArgumentNullException("preview"); }
+
+ // UI Element has a windowHandle of zero.
+ if (preview.WindowHandle == IntPtr.Zero)
+ {
+ if (_tabbedThumbnailCacheWPF.ContainsKey(preview.WindowsControl))
+ {
+ throw new ArgumentException(LocalizedMessages.ThumbnailManagerPreviewAdded, "preview");
+ }
+ _tabbedThumbnailCacheWPF.Add(preview.WindowsControl, preview);
+ }
+ else
+ {
+ // Regular control with a valid handle
+ if (_tabbedThumbnailCache.ContainsKey(preview.WindowHandle))
+ {
+ throw new ArgumentException(LocalizedMessages.ThumbnailManagerPreviewAdded, "preview");
+ }
+ _tabbedThumbnailCache.Add(preview.WindowHandle, preview);
+ }
+
+ TaskbarWindowManager.AddTabbedThumbnail(preview);
+
+ preview.InvalidatePreview(); // Note: Why this here?
+ }
+
+ /// <summary>
+ /// Gets the TabbedThumbnail object associated with the given window handle
+ /// </summary>
+ /// <param name="windowHandle">Window handle for the control/window</param>
+ /// <returns>TabbedThumbnail associated with the given window handle</returns>
+ public TabbedThumbnail GetThumbnailPreview(IntPtr windowHandle)
+ {
+ if (windowHandle == IntPtr.Zero)
+ {
+ throw new ArgumentException(LocalizedMessages.ThumbnailManagerInvalidHandle, "windowHandle");
+ }
+
+ TabbedThumbnail thumbnail;
+ return _tabbedThumbnailCache.TryGetValue(windowHandle, out thumbnail) ? thumbnail : null;
+ }
+
+ /// <summary>
+ /// Gets the TabbedThumbnail object associated with the given control
+ /// </summary>
+ /// <param name="control">Specific control for which the preview object is requested</param>
+ /// <returns>TabbedThumbnail associated with the given control</returns>
+ public TabbedThumbnail GetThumbnailPreview(Control control)
+ {
+ if (control == null)
+ {
+ throw new ArgumentNullException("control");
+ }
+
+ return GetThumbnailPreview(control.Handle);
+ }
+
+ /// <summary>
+ /// Gets the TabbedThumbnail object associated with the given WPF Window
+ /// </summary>
+ /// <param name="windowsControl">WPF Control (UIElement) for which the preview object is requested</param>
+ /// <returns>TabbedThumbnail associated with the given WPF Window</returns>
+ public TabbedThumbnail GetThumbnailPreview(UIElement windowsControl)
+ {
+ if (windowsControl == null)
+ {
+ throw new ArgumentNullException("windowsControl");
+ }
+
+ TabbedThumbnail thumbnail;
+ return _tabbedThumbnailCacheWPF.TryGetValue(windowsControl, out thumbnail) ? thumbnail : null;
+ }
+
+ /// <summary>
+ /// Remove the tabbed thumbnail from the taskbar.
+ /// </summary>
+ /// <param name="preview">TabbedThumbnail associated with the control/window that
+ /// is to be removed from the taskbar</param>
+ public void RemoveThumbnailPreview(TabbedThumbnail preview)
+ {
+ if (preview == null)
+ {
+ throw new ArgumentNullException("preview");
+ }
+
+ if (_tabbedThumbnailCache.ContainsKey(preview.WindowHandle))
+ {
+ RemoveThumbnailPreview(preview.WindowHandle);
+ }
+ else if (_tabbedThumbnailCacheWPF.ContainsKey(preview.WindowsControl))
+ {
+ RemoveThumbnailPreview(preview.WindowsControl);
+ }
+ }
+
+ /// <summary>
+ /// Remove the tabbed thumbnail from the taskbar.
+ /// </summary>
+ /// <param name="windowHandle">TabbedThumbnail associated with the window handle that
+ /// is to be removed from the taskbar</param>
+ public void RemoveThumbnailPreview(IntPtr windowHandle)
+ {
+ if (!_tabbedThumbnailCache.ContainsKey(windowHandle))
+ {
+ throw new ArgumentException(LocalizedMessages.ThumbnailManagerControlNotAdded, "windowHandle");
+ }
+
+ TaskbarWindowManager.UnregisterTab(_tabbedThumbnailCache[windowHandle].TaskbarWindow);
+
+ _tabbedThumbnailCache.Remove(windowHandle);
+
+ TaskbarWindow taskbarWindow = TaskbarWindowManager.GetTaskbarWindow(windowHandle, TaskbarProxyWindowType.TabbedThumbnail);
+
+ if (taskbarWindow != null)
+ {
+ if (TaskbarWindowManager._taskbarWindowList.Contains(taskbarWindow))
+ TaskbarWindowManager._taskbarWindowList.Remove(taskbarWindow);
+ taskbarWindow.Dispose();
+ taskbarWindow = null;
+ }
+ }
+
+ /// <summary>
+ /// Remove the tabbed thumbnail from the taskbar.
+ /// </summary>
+ /// <param name="control">TabbedThumbnail associated with the control that
+ /// is to be removed from the taskbar</param>
+ public void RemoveThumbnailPreview(Control control)
+ {
+ if (control == null)
+ {
+ throw new ArgumentNullException("control");
+ }
+
+ IntPtr handle = control.Handle;
+
+ RemoveThumbnailPreview(handle);
+ }
+
+ /// <summary>
+ /// Remove the tabbed thumbnail from the taskbar.
+ /// </summary>
+ /// <param name="windowsControl">TabbedThumbnail associated with the WPF Control (UIElement) that
+ /// is to be removed from the taskbar</param>
+ public void RemoveThumbnailPreview(UIElement windowsControl)
+ {
+ if (windowsControl == null) { throw new ArgumentNullException("windowsControl"); }
+
+ if (!_tabbedThumbnailCacheWPF.ContainsKey(windowsControl))
+ {
+ throw new ArgumentException(LocalizedMessages.ThumbnailManagerControlNotAdded, "windowsControl");
+ }
+
+ TaskbarWindowManager.UnregisterTab(_tabbedThumbnailCacheWPF[windowsControl].TaskbarWindow);
+
+ _tabbedThumbnailCacheWPF.Remove(windowsControl);
+
+ TaskbarWindow taskbarWindow = TaskbarWindowManager.GetTaskbarWindow(windowsControl, TaskbarProxyWindowType.TabbedThumbnail);
+
+ if (taskbarWindow != null)
+ {
+ if (TaskbarWindowManager._taskbarWindowList.Contains(taskbarWindow))
+ {
+ TaskbarWindowManager._taskbarWindowList.Remove(taskbarWindow);
+ }
+ taskbarWindow.Dispose();
+ taskbarWindow = null;
+ }
+ }
+
+ /// <summary>
+ /// Sets the given tabbed thumbnail preview object as being active on the taskbar tabbed thumbnails list.
+ /// Call this method to keep the application and the taskbar in sync as to which window/control
+ /// is currently active (or selected, in the case of tabbed application).
+ /// </summary>
+ /// <param name="preview">TabbedThumbnail for the specific control/indow that is currently active in the application</param>
+ /// <exception cref="System.ArgumentException">If the control/window is not yet added to the tabbed thumbnails list</exception>
+ public void SetActiveTab(TabbedThumbnail preview)
+ {
+ if (preview == null) { throw new ArgumentNullException("preview"); }
+
+ if (preview.WindowHandle != IntPtr.Zero)
+ {
+ if (!_tabbedThumbnailCache.ContainsKey(preview.WindowHandle))
+ {
+ throw new ArgumentException(LocalizedMessages.ThumbnailManagerPreviewNotAdded, "preview");
+ }
+ TaskbarWindowManager.SetActiveTab(_tabbedThumbnailCache[preview.WindowHandle].TaskbarWindow);
+ }
+ else if (preview.WindowsControl != null)
+ {
+ if (!_tabbedThumbnailCacheWPF.ContainsKey(preview.WindowsControl))
+ {
+ throw new ArgumentException(LocalizedMessages.ThumbnailManagerPreviewNotAdded, "preview");
+ }
+ TaskbarWindowManager.SetActiveTab(_tabbedThumbnailCacheWPF[preview.WindowsControl].TaskbarWindow);
+ }
+ }
+
+ /// <summary>
+ /// Sets the given window handle as being active on the taskbar tabbed thumbnails list.
+ /// Call this method to keep the application and the taskbar in sync as to which window/control
+ /// is currently active (or selected, in the case of tabbed application).
+ /// </summary>
+ /// <param name="windowHandle">Window handle for the control/window that is currently active in the application</param>
+ /// <exception cref="System.ArgumentException">If the control/window is not yet added to the tabbed thumbnails list</exception>
+ public void SetActiveTab(IntPtr windowHandle)
+ {
+ if (!_tabbedThumbnailCache.ContainsKey(windowHandle))
+ {
+ throw new ArgumentException(LocalizedMessages.ThumbnailManagerPreviewNotAdded, "windowHandle");
+ }
+ TaskbarWindowManager.SetActiveTab(_tabbedThumbnailCache[windowHandle].TaskbarWindow);
+ }
+
+ /// <summary>
+ /// Sets the given Control/Form window as being active on the taskbar tabbed thumbnails list.
+ /// Call this method to keep the application and the taskbar in sync as to which window/control
+ /// is currently active (or selected, in the case of tabbed application).
+ /// </summary>
+ /// <param name="control">Control/Form that is currently active in the application</param>
+ /// <exception cref="System.ArgumentException">If the control/window is not yet added to the tabbed thumbnails list</exception>
+ public void SetActiveTab(Control control)
+ {
+ if (control == null)
+ {
+ throw new ArgumentNullException("control");
+ }
+ SetActiveTab(control.Handle);
+ }
+
+ /// <summary>
+ /// Sets the given WPF window as being active on the taskbar tabbed thumbnails list.
+ /// Call this method to keep the application and the taskbar in sync as to which window/control
+ /// is currently active (or selected, in the case of tabbed application).
+ /// </summary>
+ /// <param name="windowsControl">WPF control that is currently active in the application</param>
+ /// <exception cref="System.ArgumentException">If the control/window is not yet added to the tabbed thumbnails list</exception>
+ public void SetActiveTab(UIElement windowsControl)
+ {
+ if (windowsControl == null)
+ {
+ throw new ArgumentNullException("windowsControl");
+ }
+
+ if (!_tabbedThumbnailCacheWPF.ContainsKey(windowsControl))
+ {
+ throw new ArgumentException(LocalizedMessages.ThumbnailManagerPreviewNotAdded, "windowsControl");
+ }
+ TaskbarWindowManager.SetActiveTab(_tabbedThumbnailCacheWPF[windowsControl].TaskbarWindow);
+
+ }
+
+ /// <summary>
+ /// Determines whether the given preview has been added to the taskbar's tabbed thumbnail list.
+ /// </summary>
+ /// <param name="preview">The preview to locate on the taskbar's tabbed thumbnail list</param>
+ /// <returns>true if the tab is already added on the taskbar; otherwise, false.</returns>
+ public bool IsThumbnailPreviewAdded(TabbedThumbnail preview)
+ {
+ if (preview == null)
+ {
+ throw new ArgumentNullException("preview");
+ }
+
+ if (preview.WindowHandle != IntPtr.Zero && _tabbedThumbnailCache.ContainsKey(preview.WindowHandle))
+ {
+ return true;
+ }
+ else if (preview.WindowsControl != null && _tabbedThumbnailCacheWPF.ContainsKey(preview.WindowsControl))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ /// <summary>
+ /// Determines whether the given window has been added to the taskbar's tabbed thumbnail list.
+ /// </summary>
+ /// <param name="windowHandle">The window to locate on the taskbar's tabbed thumbnail list</param>
+ /// <returns>true if the tab is already added on the taskbar; otherwise, false.</returns>
+ public bool IsThumbnailPreviewAdded(IntPtr windowHandle)
+ {
+ if (windowHandle == IntPtr.Zero)
+ {
+ throw new ArgumentException(LocalizedMessages.ThumbnailManagerInvalidHandle, "windowHandle");
+ }
+
+ return _tabbedThumbnailCache.ContainsKey(windowHandle);
+ }
+
+ /// <summary>
+ /// Determines whether the given control has been added to the taskbar's tabbed thumbnail list.
+ /// </summary>
+ /// <param name="control">The preview to locate on the taskbar's tabbed thumbnail list</param>
+ /// <returns>true if the tab is already added on the taskbar; otherwise, false.</returns>
+ public bool IsThumbnailPreviewAdded(Control control)
+ {
+ if (control == null)
+ {
+ throw new ArgumentNullException("control");
+ }
+
+ return _tabbedThumbnailCache.ContainsKey(control.Handle);
+ }
+
+ /// <summary>
+ /// Determines whether the given control has been added to the taskbar's tabbed thumbnail list.
+ /// </summary>
+ /// <param name="control">The preview to locate on the taskbar's tabbed thumbnail list</param>
+ /// <returns>true if the tab is already added on the taskbar; otherwise, false.</returns>
+ public bool IsThumbnailPreviewAdded(UIElement control)
+ {
+ if (control == null)
+ {
+ throw new ArgumentNullException("control");
+ }
+
+ return _tabbedThumbnailCacheWPF.ContainsKey(control);
+ }
+
+ /// <summary>
+ /// Invalidates all the tabbed thumbnails. This will force the Desktop Window Manager
+ /// to not use the cached thumbnail or preview or aero peek and request a new one next time.
+ /// </summary>
+ /// <remarks>This method should not be called frequently.
+ /// Doing so can lead to poor performance as new bitmaps are created and retrieved.</remarks>
+ public void InvalidateThumbnails()
+ {
+ // Invalidate all the previews currently in our cache.
+ // This will ensure we get updated bitmaps next time
+
+ foreach (TabbedThumbnail thumbnail in _tabbedThumbnailCache.Values)
+ {
+ TaskbarWindowManager.InvalidatePreview(thumbnail.TaskbarWindow);
+ thumbnail.SetImage(IntPtr.Zero); // TODO: Investigate this, and why it needs to be called.
+ }
+
+ foreach (TabbedThumbnail thumbnail in _tabbedThumbnailCacheWPF.Values)
+ {
+ TaskbarWindowManager.InvalidatePreview(thumbnail.TaskbarWindow);
+ thumbnail.SetImage(IntPtr.Zero);
+ }
+ }
+
+ /// <summary>
+ /// Clear a clip that is already in place and return to the default display of the thumbnail.
+ /// </summary>
+ /// <param name="windowHandle">The handle to a window represented in the taskbar. This has to be a top-level window.</param>
+ public static void ClearThumbnailClip(IntPtr windowHandle)
+ {
+ TaskbarList.Instance.SetThumbnailClip(windowHandle, IntPtr.Zero);
+ }
+
+ /// <summary>
+ /// Selects a portion of a window's client area to display as that window's thumbnail in the taskbar.
+ /// </summary>
+ /// <param name="windowHandle">The handle to a window represented in the taskbar. This has to be a top-level window.</param>
+ /// <param name="clippingRectangle">Rectangle structure that specifies a selection within the window's client area,
+ /// relative to the upper-left corner of that client area.
+ /// <para>If this parameter is null, the clipping area will be cleared and the default display of the thumbnail will be used instead.</para></param>
+ public void SetThumbnailClip(IntPtr windowHandle, Rectangle? clippingRectangle)
+ {
+ if (clippingRectangle == null)
+ {
+ ClearThumbnailClip(windowHandle);
+ return;
+ }
+
+ NativeRect rect = new NativeRect();
+ rect.Left = clippingRectangle.Value.Left;
+ rect.Top = clippingRectangle.Value.Top;
+ rect.Right = clippingRectangle.Value.Right;
+ rect.Bottom = clippingRectangle.Value.Bottom;
+
+ IntPtr rectPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(rect));
+ try
+ {
+ Marshal.StructureToPtr(rect, rectPtr, true);
+ TaskbarList.Instance.SetThumbnailClip(windowHandle, rectPtr);
+ }
+ finally
+ {
+ Marshal.FreeCoTaskMem(rectPtr);
+ }
+ }
+
+ /// <summary>
+ /// Moves an existing thumbnail to a new position in the application's group.
+ /// </summary>
+ /// <param name="previewToChange">Preview for the window whose order is being changed.
+ /// This value is required, must already be added via AddThumbnailPreview method, and cannot be null.</param>
+ /// <param name="insertBeforePreview">The preview of the tab window whose thumbnail that previewToChange is inserted to the left of.
+ /// This preview must already be added via AddThumbnailPreview. If this value is null, the previewToChange tab is added to the end of the list.
+ /// </param>
+ public static void SetTabOrder(TabbedThumbnail previewToChange, TabbedThumbnail insertBeforePreview)
+ {
+ if (previewToChange == null)
+ {
+ throw new ArgumentNullException("previewToChange");
+ }
+
+ IntPtr handleToReorder = previewToChange.TaskbarWindow.WindowToTellTaskbarAbout;
+
+ if (insertBeforePreview == null)
+ {
+ TaskbarList.Instance.SetTabOrder(handleToReorder, IntPtr.Zero);
+ }
+ else
+ {
+ IntPtr handleBefore = insertBeforePreview.TaskbarWindow.WindowToTellTaskbarAbout;
+ TaskbarList.Instance.SetTabOrder(handleToReorder, handleBefore);
+ }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailProxyWindow.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailProxyWindow.cs
new file mode 100644
index 0000000000..c71bebe881
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailProxyWindow.cs
@@ -0,0 +1,90 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Windows;
+using System.Windows.Forms;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ internal sealed class TabbedThumbnailProxyWindow : Form, IDisposable
+ {
+
+ internal TabbedThumbnailProxyWindow(TabbedThumbnail preview)
+ {
+ TabbedThumbnail = preview;
+ Size = new System.Drawing.Size(1, 1);
+
+ if (!string.IsNullOrEmpty(preview.Title))
+ {
+ Text = preview.Title;
+ }
+
+ if (preview.WindowsControl != null)
+ {
+ WindowsControl = preview.WindowsControl;
+ }
+ }
+
+ internal TabbedThumbnail TabbedThumbnail { get; private set; }
+
+ internal UIElement WindowsControl { get; private set; }
+
+ internal IntPtr WindowToTellTaskbarAbout { get { return this.Handle; } }
+
+ protected override void WndProc(ref Message m)
+ {
+ bool handled = false;
+
+ if (this.TabbedThumbnail != null)
+ {
+ handled = TaskbarWindowManager.DispatchMessage(ref m, this.TabbedThumbnail.TaskbarWindow);
+ }
+
+ // If it's a WM_Destroy message, then also forward it to the base class (our native window)
+ if ((m.Msg == (int)WindowMessage.Destroy) ||
+ (m.Msg == (int)WindowMessage.NCDestroy) ||
+ ((m.Msg == (int)WindowMessage.SystemCommand) && (((int)m.WParam) == TabbedThumbnailNativeMethods.ScClose)))
+ {
+ base.WndProc(ref m);
+ }
+ else if (!handled) { base.WndProc(ref m); }
+ }
+
+ #region IDisposable Members
+
+ /// <summary>
+ ///
+ /// </summary>
+ ~TabbedThumbnailProxyWindow()
+ {
+ Dispose(false);
+ }
+
+ /// <summary>
+ /// Release the native objects.
+ /// </summary>
+ void IDisposable.Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ // Dispose managed resources
+ if (TabbedThumbnail != null) { TabbedThumbnail.Dispose(); }
+
+ TabbedThumbnail = null;
+
+ WindowsControl = null;
+ }
+
+ base.Dispose(disposing);
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailScreenCapture.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailScreenCapture.cs
new file mode 100644
index 0000000000..041437e308
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TabbedThumbnailScreenCapture.cs
@@ -0,0 +1,181 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Drawing;
+using System.IO;
+using System.Windows;
+using System.Windows.Interop;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using Microsoft.WindowsAPICodePack.Shell;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ /// <summary>
+ /// Helper class to capture a control or window as System.Drawing.Bitmap
+ /// </summary>
+ public static class TabbedThumbnailScreenCapture
+ {
+ /// <summary>
+ /// Captures a screenshot of the specified window at the specified
+ /// bitmap size. <para/>NOTE: This method will not accurately capture controls
+ /// that are hidden or obstructed (partially or completely) by another control (e.g. hidden tabs,
+ /// or MDI child windows that are obstructed by other child windows/forms).
+ /// </summary>
+ /// <param name="windowHandle">The window handle.</param>
+ /// <param name="bitmapSize">The requested bitmap size.</param>
+ /// <returns>A screen capture of the window.</returns>
+ public static Bitmap GrabWindowBitmap(IntPtr windowHandle, System.Drawing.Size bitmapSize)
+ {
+ if (bitmapSize.Height <= 0 || bitmapSize.Width <= 0) { return null; }
+
+ IntPtr windowDC = IntPtr.Zero;
+
+ try
+ {
+ windowDC = TabbedThumbnailNativeMethods.GetWindowDC(windowHandle);
+
+ System.Drawing.Size realWindowSize;
+ TabbedThumbnailNativeMethods.GetClientSize(windowHandle, out realWindowSize);
+
+ if (realWindowSize == System.Drawing.Size.Empty)
+ {
+ realWindowSize = new System.Drawing.Size(200, 200);
+ }
+
+ System.Drawing.Size size = (bitmapSize == System.Drawing.Size.Empty) ?
+ realWindowSize : bitmapSize;
+
+ Bitmap targetBitmap = null;
+ try
+ {
+
+
+ targetBitmap = new Bitmap(size.Width, size.Height);
+
+ using (Graphics targetGr = Graphics.FromImage(targetBitmap))
+ {
+ IntPtr targetDC = targetGr.GetHdc();
+ uint operation = 0x00CC0020 /*SRCCOPY*/;
+
+ System.Drawing.Size ncArea = WindowUtilities.GetNonClientArea(windowHandle);
+
+ bool success = TabbedThumbnailNativeMethods.StretchBlt(
+ targetDC, 0, 0, targetBitmap.Width, targetBitmap.Height,
+ windowDC, ncArea.Width, ncArea.Height, realWindowSize.Width,
+ realWindowSize.Height, operation);
+
+ targetGr.ReleaseHdc(targetDC);
+
+ if (!success) { return null; }
+
+ return targetBitmap;
+ }
+ }
+ catch
+ {
+ if (targetBitmap != null) { targetBitmap.Dispose(); }
+ throw;
+ }
+ }
+ finally
+ {
+ if (windowDC != IntPtr.Zero)
+ {
+ TabbedThumbnailNativeMethods.ReleaseDC(windowHandle, windowDC);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Grabs a snapshot of a WPF UIElement and returns the image as Bitmap.
+ /// </summary>
+ /// <param name="element">Represents the element to take the snapshot from.</param>
+ /// <param name="dpiX">Represents the X DPI value used to capture this snapshot.</param>
+ /// <param name="dpiY">Represents the Y DPI value used to capture this snapshot.</param>
+ /// <param name="width">The requested bitmap width.</param>
+ /// <param name="height">The requested bitmap height.</param>
+ /// <returns>Returns the bitmap (PNG format).</returns>
+ public static Bitmap GrabWindowBitmap(UIElement element, int dpiX, int dpiY, int width, int height)
+ {
+ // Special case for HwndHost controls
+ HwndHost host = element as HwndHost;
+ if (host != null)
+ {
+ IntPtr handle = host.Handle;
+ return GrabWindowBitmap(handle, new System.Drawing.Size(width, height));
+ }
+
+ Rect bounds = VisualTreeHelper.GetDescendantBounds(element);
+
+ // create the renderer.
+ if (bounds.Height == 0 || bounds.Width == 0)
+ {
+ return null; // 0 sized element. Probably hidden
+ }
+
+ RenderTargetBitmap rendertarget = new RenderTargetBitmap((int)(bounds.Width * dpiX / 96.0),
+ (int)(bounds.Height * dpiY / 96.0), dpiX, dpiY, PixelFormats.Default);
+
+ DrawingVisual dv = new DrawingVisual();
+ using (DrawingContext ctx = dv.RenderOpen())
+ {
+ VisualBrush vb = new VisualBrush(element);
+ ctx.DrawRectangle(vb, null, new Rect(new System.Windows.Point(), bounds.Size));
+ }
+
+ rendertarget.Render(dv);
+
+ BitmapEncoder bmpe = new PngBitmapEncoder();
+ bmpe.Frames.Add(BitmapFrame.Create(rendertarget));
+
+ Bitmap bmp;
+ // Create a MemoryStream with the image.
+ using (MemoryStream fl = new MemoryStream())
+ {
+ bmpe.Save(fl);
+ fl.Position = 0;
+ bmp = new Bitmap(fl);
+ }
+
+ return (Bitmap)bmp.GetThumbnailImage(width, height, null, IntPtr.Zero);
+ }
+
+ /// <summary>
+ /// Resizes the given bitmap while maintaining the aspect ratio.
+ /// </summary>
+ /// <param name="originalHBitmap">Original/source bitmap</param>
+ /// <param name="newWidth">Maximum width for the new image</param>
+ /// <param name="maxHeight">Maximum height for the new image</param>
+ /// <param name="resizeIfWider">If true and requested image is wider than the source, the new image is resized accordingly.</param>
+ /// <returns></returns>
+ internal static Bitmap ResizeImageWithAspect(IntPtr originalHBitmap, int newWidth, int maxHeight, bool resizeIfWider)
+ {
+ Bitmap originalBitmap = Bitmap.FromHbitmap(originalHBitmap);
+
+ try
+ {
+ if (resizeIfWider && originalBitmap.Width <= newWidth)
+ {
+ newWidth = originalBitmap.Width;
+ }
+
+ int newHeight = originalBitmap.Height * newWidth / originalBitmap.Width;
+
+ if (newHeight > maxHeight) // Height resize if necessary
+ {
+ newWidth = originalBitmap.Width * maxHeight / originalBitmap.Height;
+ newHeight = maxHeight;
+ }
+
+ // Create the new image with the sizes we've calculated
+ return (Bitmap)originalBitmap.GetThumbnailImage(newWidth, newHeight, null, IntPtr.Zero);
+ }
+ finally
+ {
+ originalBitmap.Dispose();
+ originalBitmap = null;
+ }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarEnums.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarEnums.cs
new file mode 100644
index 0000000000..5fafb2f4ca
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarEnums.cs
@@ -0,0 +1,65 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+
+ internal enum TaskbarProxyWindowType
+ {
+ TabbedThumbnail,
+ ThumbnailToolbar,
+ }
+
+ /// <summary>
+ /// Known category to display
+ /// </summary>
+ public enum JumpListKnownCategoryType
+ {
+ /// <summary>
+ /// Don't display either known category. You must have at least one
+ /// user task or custom category link in order to not see the
+ /// default 'Recent' known category
+ /// </summary>
+ Neither = 0,
+
+ /// <summary>
+ /// Display the 'Recent' known category
+ /// </summary>
+ Recent,
+
+ /// <summary>
+ /// Display the 'Frequent' known category
+ /// </summary>
+ Frequent,
+ }
+
+ /// <summary>
+ /// Represents the thumbnail progress bar state.
+ /// </summary>
+ public enum TaskbarProgressBarState
+ {
+ /// <summary>
+ /// No progress is displayed.
+ /// </summary>
+ NoProgress = 0,
+
+ /// <summary>
+ /// The progress is indeterminate (marquee).
+ /// </summary>
+ Indeterminate = 0x1,
+
+ /// <summary>
+ /// Normal progress is displayed.
+ /// </summary>
+ Normal = 0x2,
+
+ /// <summary>
+ /// An error occurred (red).
+ /// </summary>
+ Error = 0x4,
+
+ /// <summary>
+ /// The operation is paused (yellow).
+ /// </summary>
+ Paused = 0x8
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarInterfaces.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarInterfaces.cs
new file mode 100644
index 0000000000..efa1d64a63
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarInterfaces.cs
@@ -0,0 +1,25 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using Microsoft.WindowsAPICodePack.Shell;
+using Microsoft.WindowsAPICodePack.Shell.PropertySystem;
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ /// <summary>
+ /// Interface for jump list items
+ /// </summary>
+ public interface IJumpListItem
+ {
+ /// <summary>
+ /// Gets or sets this item's path
+ /// </summary>
+ string Path { get; set; }
+ }
+
+ /// <summary>
+ /// Interface for jump list tasks
+ /// </summary>
+ public abstract class JumpListTask
+ {
+ internal abstract IShellLinkW NativeShellLink { get; }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarList.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarList.cs
new file mode 100644
index 0000000000..a6ee9f4617
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarList.cs
@@ -0,0 +1,33 @@
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ /// <summary>
+ /// Provides internal access to the functions provided by the ITaskbarList4 interface,
+ /// without being forced to refer to it through another singleton.
+ /// </summary>
+ internal static class TaskbarList
+ {
+ private static object _syncLock = new object();
+
+ private static ITaskbarList4 _taskbarList;
+ internal static ITaskbarList4 Instance
+ {
+ get
+ {
+ if (_taskbarList == null)
+ {
+ lock (_syncLock)
+ {
+ if (_taskbarList == null)
+ {
+ _taskbarList = (ITaskbarList4)new CTaskbarList();
+ _taskbarList.HrInit();
+ }
+ }
+ }
+
+ return _taskbarList;
+ }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarManager.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarManager.cs
new file mode 100644
index 0000000000..80f1677eb0
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarManager.cs
@@ -0,0 +1,317 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Diagnostics;
+using System.Windows.Interop;
+using MS.WindowsAPICodePack.Internal;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ /// <summary>
+ /// Represents an instance of the Windows taskbar
+ /// </summary>
+ public class TaskbarManager
+ {
+ // Hide the default constructor
+ private TaskbarManager()
+ {
+ CoreHelpers.ThrowIfNotWin7();
+ }
+
+ // Best practice recommends defining a private object to lock on
+ private static object _syncLock = new object();
+
+ private static TaskbarManager _instance;
+ /// <summary>
+ /// Represents an instance of the Windows Taskbar
+ /// </summary>
+ public static TaskbarManager Instance
+ {
+ get
+ {
+ if (_instance == null)
+ {
+ lock (_syncLock)
+ {
+ if (_instance == null)
+ {
+ _instance = new TaskbarManager();
+ }
+ }
+ }
+
+ return _instance;
+ }
+ }
+
+ /// <summary>
+ /// Applies an overlay to a taskbar button of the main application window to indicate application status or a notification to the user.
+ /// </summary>
+ /// <param name="icon">The overlay icon</param>
+ /// <param name="accessibilityText">String that provides an alt text version of the information conveyed by the overlay, for accessibility purposes</param>
+ public void SetOverlayIcon(System.Drawing.Icon icon, string accessibilityText)
+ {
+ TaskbarList.Instance.SetOverlayIcon(
+ OwnerHandle,
+ icon != null ? icon.Handle : IntPtr.Zero,
+ accessibilityText);
+ }
+
+ /// <summary>
+ /// Applies an overlay to a taskbar button of the given window handle to indicate application status or a notification to the user.
+ /// </summary>
+ /// <param name="windowHandle">The handle of the window whose associated taskbar button receives the overlay. This handle must belong to a calling process associated with the button's application and must be a valid HWND or the call is ignored.</param>
+ /// <param name="icon">The overlay icon</param>
+ /// <param name="accessibilityText">String that provides an alt text version of the information conveyed by the overlay, for accessibility purposes</param>
+ public void SetOverlayIcon(IntPtr windowHandle, System.Drawing.Icon icon, string accessibilityText)
+ {
+ TaskbarList.Instance.SetOverlayIcon(
+ windowHandle,
+ icon != null ? icon.Handle : IntPtr.Zero,
+ accessibilityText);
+ }
+
+ /// <summary>
+ /// Applies an overlay to a taskbar button of the given WPF window to indicate application status or a notification to the user.
+ /// </summary>
+ /// <param name="window">The window whose associated taskbar button receives the overlay. This window belong to a calling process associated with the button's application and must be already loaded.</param>
+ /// <param name="icon">The overlay icon</param>
+ /// <param name="accessibilityText">String that provides an alt text version of the information conveyed by the overlay, for accessibility purposes</param>
+ public void SetOverlayIcon(System.Windows.Window window, System.Drawing.Icon icon, string accessibilityText)
+ {
+ TaskbarList.Instance.SetOverlayIcon(
+ (new WindowInteropHelper(window)).Handle,
+ icon != null ? icon.Handle : IntPtr.Zero,
+ accessibilityText);
+ }
+
+ /// <summary>
+ /// Displays or updates a progress bar hosted in a taskbar button of the main application window
+ /// to show the specific percentage completed of the full operation.
+ /// </summary>
+ /// <param name="currentValue">An application-defined value that indicates the proportion of the operation that has been completed at the time the method is called.</param>
+ /// <param name="maximumValue">An application-defined value that specifies the value currentValue will have when the operation is complete.</param>
+ public void SetProgressValue(int currentValue, int maximumValue)
+ {
+ TaskbarList.Instance.SetProgressValue(
+ OwnerHandle,
+ Convert.ToUInt32(currentValue),
+ Convert.ToUInt32(maximumValue));
+ }
+
+ /// <summary>
+ /// Displays or updates a progress bar hosted in a taskbar button of the given window handle
+ /// to show the specific percentage completed of the full operation.
+ /// </summary>
+ /// <param name="windowHandle">The handle of the window whose associated taskbar button is being used as a progress indicator.
+ /// This window belong to a calling process associated with the button's application and must be already loaded.</param>
+ /// <param name="currentValue">An application-defined value that indicates the proportion of the operation that has been completed at the time the method is called.</param>
+ /// <param name="maximumValue">An application-defined value that specifies the value currentValue will have when the operation is complete.</param>
+ public void SetProgressValue(int currentValue, int maximumValue, IntPtr windowHandle)
+ {
+ TaskbarList.Instance.SetProgressValue(
+ windowHandle,
+ Convert.ToUInt32(currentValue),
+ Convert.ToUInt32(maximumValue));
+ }
+
+ /// <summary>
+ /// Displays or updates a progress bar hosted in a taskbar button of the given WPF window
+ /// to show the specific percentage completed of the full operation.
+ /// </summary>
+ /// <param name="window">The window whose associated taskbar button is being used as a progress indicator.
+ /// This window belong to a calling process associated with the button's application and must be already loaded.</param>
+ /// <param name="currentValue">An application-defined value that indicates the proportion of the operation that has been completed at the time the method is called.</param>
+ /// <param name="maximumValue">An application-defined value that specifies the value currentValue will have when the operation is complete.</param>
+ public void SetProgressValue(int currentValue, int maximumValue, System.Windows.Window window)
+ {
+ TaskbarList.Instance.SetProgressValue(
+ (new WindowInteropHelper(window)).Handle,
+ Convert.ToUInt32(currentValue),
+ Convert.ToUInt32(maximumValue));
+ }
+
+ /// <summary>
+ /// Sets the type and state of the progress indicator displayed on a taskbar button of the main application window.
+ /// </summary>
+ /// <param name="state">Progress state of the progress button</param>
+ public void SetProgressState(TaskbarProgressBarState state)
+ {
+ TaskbarList.Instance.SetProgressState(OwnerHandle, (TaskbarProgressBarStatus)state);
+ }
+
+ /// <summary>
+ /// Sets the type and state of the progress indicator displayed on a taskbar button
+ /// of the given window handle
+ /// </summary>
+ /// <param name="windowHandle">The handle of the window whose associated taskbar button is being used as a progress indicator.
+ /// This window belong to a calling process associated with the button's application and must be already loaded.</param>
+ /// <param name="state">Progress state of the progress button</param>
+ public void SetProgressState(TaskbarProgressBarState state, IntPtr windowHandle)
+ {
+ TaskbarList.Instance.SetProgressState(windowHandle, (TaskbarProgressBarStatus)state);
+ }
+
+ /// <summary>
+ /// Sets the type and state of the progress indicator displayed on a taskbar button
+ /// of the given WPF window
+ /// </summary>
+ /// <param name="window">The window whose associated taskbar button is being used as a progress indicator.
+ /// This window belong to a calling process associated with the button's application and must be already loaded.</param>
+ /// <param name="state">Progress state of the progress button</param>
+ public void SetProgressState(TaskbarProgressBarState state, System.Windows.Window window)
+ {
+ TaskbarList.Instance.SetProgressState(
+ (new WindowInteropHelper(window)).Handle,
+ (TaskbarProgressBarStatus)state);
+ }
+
+ private TabbedThumbnailManager _tabbedThumbnail;
+ /// <summary>
+ /// Gets the Tabbed Thumbnail manager class for adding/updating
+ /// tabbed thumbnail previews.
+ /// </summary>
+ public TabbedThumbnailManager TabbedThumbnail
+ {
+ get
+ {
+ if (_tabbedThumbnail == null)
+ {
+ _tabbedThumbnail = new TabbedThumbnailManager();
+ }
+ return _tabbedThumbnail;
+ }
+ }
+
+ private ThumbnailToolBarManager _thumbnailToolBarManager;
+ /// <summary>
+ /// Gets the Thumbnail toolbar manager class for adding/updating
+ /// toolbar buttons.
+ /// </summary>
+ public ThumbnailToolBarManager ThumbnailToolBars
+ {
+ get
+ {
+ if (_thumbnailToolBarManager == null)
+ {
+ _thumbnailToolBarManager = new ThumbnailToolBarManager();
+ }
+
+ return _thumbnailToolBarManager;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the application user model id. Use this to explicitly
+ /// set the application id when generating custom jump lists
+ /// </summary>
+ public string ApplicationId
+ {
+ get
+ {
+ return GetCurrentProcessAppId();
+ }
+ set
+ {
+ if (string.IsNullOrEmpty(value))
+ {
+ throw new ArgumentNullException("value");
+ }
+
+ SetCurrentProcessAppId(value);
+ ApplicationIdSetProcessWide = true;
+ }
+ }
+
+ private IntPtr _ownerHandle;
+ /// <summary>
+ /// Sets the handle of the window whose taskbar button will be used
+ /// to display progress.
+ /// </summary>
+ internal IntPtr OwnerHandle
+ {
+ get
+ {
+ if (_ownerHandle == IntPtr.Zero)
+ {
+ Process currentProcess = Process.GetCurrentProcess();
+
+ if (currentProcess == null || currentProcess.MainWindowHandle == IntPtr.Zero)
+ {
+ throw new InvalidOperationException(LocalizedMessages.TaskbarManagerValidWindowRequired);
+ }
+
+ _ownerHandle = currentProcess.MainWindowHandle;
+ }
+
+ return _ownerHandle;
+ }
+ }
+
+ /// <summary>
+ /// Sets the application user model id for an individual window
+ /// </summary>
+ /// <param name="appId">The app id to set</param>
+ /// <param name="windowHandle">Window handle for the window that needs a specific application id</param>
+ /// <remarks>AppId specifies a unique Application User Model ID (AppID) for the application or individual
+ /// top-level window whose taskbar button will hold the custom JumpList built through the methods <see cref="Microsoft.WindowsAPICodePack.Taskbar.JumpList"/> class.
+ /// By setting an appId for a specific window, the window will not be grouped with it's parent window/application. Instead it will have it's own taskbar button.</remarks>
+ public void SetApplicationIdForSpecificWindow(IntPtr windowHandle, string appId)
+ {
+ // Left as instance method, to follow singleton pattern.
+ TaskbarNativeMethods.SetWindowAppId(windowHandle, appId);
+ }
+
+ /// <summary>
+ /// Sets the application user model id for a given window
+ /// </summary>
+ /// <param name="appId">The app id to set</param>
+ /// <param name="window">Window that needs a specific application id</param>
+ /// <remarks>AppId specifies a unique Application User Model ID (AppID) for the application or individual
+ /// top-level window whose taskbar button will hold the custom JumpList built through the methods <see cref="Microsoft.WindowsAPICodePack.Taskbar.JumpList"/> class.
+ /// By setting an appId for a specific window, the window will not be grouped with it's parent window/application. Instead it will have it's own taskbar button.</remarks>
+ public void SetApplicationIdForSpecificWindow(System.Windows.Window window, string appId)
+ {
+ // Left as instance method, to follow singleton pattern.
+ TaskbarNativeMethods.SetWindowAppId((new WindowInteropHelper(window)).Handle, appId);
+ }
+
+ /// <summary>
+ /// Sets the current process' explicit application user model id.
+ /// </summary>
+ /// <param name="appId">The application id.</param>
+ private void SetCurrentProcessAppId(string appId)
+ {
+ TaskbarNativeMethods.SetCurrentProcessExplicitAppUserModelID(appId);
+ }
+
+ /// <summary>
+ /// Gets the current process' explicit application user model id.
+ /// </summary>
+ /// <returns>The app id or null if no app id has been defined.</returns>
+ private string GetCurrentProcessAppId()
+ {
+ string appId = string.Empty;
+ TaskbarNativeMethods.GetCurrentProcessExplicitAppUserModelID(out appId);
+ return appId;
+ }
+
+ /// <summary>
+ /// Indicates if the user has set the application id for the whole process (all windows)
+ /// </summary>
+ internal bool ApplicationIdSetProcessWide { get; private set; }
+
+ /// <summary>
+ /// Indicates whether this feature is supported on the current platform.
+ /// </summary>
+ public static bool IsPlatformSupported
+ {
+ get
+ {
+ // We need Windows 7 onwards ...
+ return CoreHelpers.RunningOnWin7;
+ }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarWindow.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarWindow.cs
new file mode 100644
index 0000000000..c14166267d
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarWindow.cs
@@ -0,0 +1,214 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Windows;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ internal class TaskbarWindow : IDisposable
+ {
+ internal TabbedThumbnailProxyWindow TabbedThumbnailProxyWindow { get; set; }
+
+ internal ThumbnailToolbarProxyWindow ThumbnailToolbarProxyWindow { get; set; }
+
+ internal bool EnableTabbedThumbnails { get; set; }
+
+ internal bool EnableThumbnailToolbars { get; set; }
+
+ internal IntPtr UserWindowHandle { get; set; }
+
+ internal UIElement WindowsControl { get; set; }
+
+ private TabbedThumbnail _tabbedThumbnailPreview;
+ internal TabbedThumbnail TabbedThumbnail
+ {
+ get { return _tabbedThumbnailPreview; }
+ set
+ {
+ if (_tabbedThumbnailPreview != null)
+ {
+ throw new InvalidOperationException(LocalizedMessages.TaskbarWindowValueSet);
+ }
+
+ TabbedThumbnailProxyWindow = new TabbedThumbnailProxyWindow(value);
+ _tabbedThumbnailPreview = value;
+ _tabbedThumbnailPreview.TaskbarWindow = this;
+ }
+ }
+
+ private ThumbnailToolBarButton[] _thumbnailButtons;
+ internal ThumbnailToolBarButton[] ThumbnailButtons
+ {
+ get { return _thumbnailButtons; }
+ set
+ {
+ _thumbnailButtons = value;
+ UpdateHandles();
+ }
+ }
+
+ private void UpdateHandles()
+ {
+ foreach (ThumbnailToolBarButton button in _thumbnailButtons)
+ {
+ button.WindowHandle = WindowToTellTaskbarAbout;
+ button.AddedToTaskbar = false;
+ }
+ }
+
+
+ // TODO: Verify the logic of this property. There are situations where this will throw InvalidOperationException when it shouldn't.
+ internal IntPtr WindowToTellTaskbarAbout
+ {
+ get
+ {
+ if (EnableThumbnailToolbars && !EnableTabbedThumbnails && ThumbnailToolbarProxyWindow != null)
+ {
+ return ThumbnailToolbarProxyWindow.WindowToTellTaskbarAbout;
+ }
+ else if (!EnableThumbnailToolbars && EnableTabbedThumbnails && TabbedThumbnailProxyWindow != null)
+ {
+ return TabbedThumbnailProxyWindow.WindowToTellTaskbarAbout;
+ }
+ // Bug: What should happen when TabedThumbnailProxyWindow IS null, but it is enabled?
+ // This occurs during the TabbedThumbnailProxyWindow constructor at line 31.
+ else if (EnableTabbedThumbnails && EnableThumbnailToolbars && TabbedThumbnailProxyWindow != null)
+ {
+ return TabbedThumbnailProxyWindow.WindowToTellTaskbarAbout;
+ }
+
+ throw new InvalidOperationException();
+ }
+ }
+
+ internal void SetTitle(string title)
+ {
+ if (TabbedThumbnailProxyWindow == null)
+ {
+ throw new InvalidOperationException(LocalizedMessages.TasbarWindowProxyWindowSet);
+ }
+ TabbedThumbnailProxyWindow.Text = title;
+ }
+
+ internal TaskbarWindow(IntPtr userWindowHandle, params ThumbnailToolBarButton[] buttons)
+ {
+ if (userWindowHandle == IntPtr.Zero)
+ {
+ throw new ArgumentException(LocalizedMessages.CommonFileDialogInvalidHandle, "userWindowHandle");
+ }
+
+ if (buttons == null || buttons.Length == 0)
+ {
+ throw new ArgumentException(LocalizedMessages.TaskbarWindowEmptyButtonArray, "buttons");
+ }
+
+ // Create our proxy window
+ ThumbnailToolbarProxyWindow = new ThumbnailToolbarProxyWindow(userWindowHandle, buttons);
+ ThumbnailToolbarProxyWindow.TaskbarWindow = this;
+
+ // Set our current state
+ EnableThumbnailToolbars = true;
+ EnableTabbedThumbnails = false;
+
+ //
+ this.ThumbnailButtons = buttons;
+ UserWindowHandle = userWindowHandle;
+ WindowsControl = null;
+ }
+
+ internal TaskbarWindow(System.Windows.UIElement windowsControl, params ThumbnailToolBarButton[] buttons)
+ {
+ if (windowsControl == null)
+ {
+ throw new ArgumentNullException("windowsControl");
+ }
+
+ if (buttons == null || buttons.Length == 0)
+ {
+ throw new ArgumentException(LocalizedMessages.TaskbarWindowEmptyButtonArray, "buttons");
+ }
+
+ // Create our proxy window
+ ThumbnailToolbarProxyWindow = new ThumbnailToolbarProxyWindow(windowsControl, buttons);
+ ThumbnailToolbarProxyWindow.TaskbarWindow = this;
+
+ // Set our current state
+ EnableThumbnailToolbars = true;
+ EnableTabbedThumbnails = false;
+
+ this.ThumbnailButtons = buttons;
+ UserWindowHandle = IntPtr.Zero;
+ WindowsControl = windowsControl;
+ }
+
+ internal TaskbarWindow(TabbedThumbnail preview)
+ {
+ if (preview == null) { throw new ArgumentNullException("preview"); }
+
+ // Create our proxy window
+ // Bug: This is only called in this constructor. Which will cause the property
+ // to fail if TaskbarWindow is initialized from a different constructor.
+ TabbedThumbnailProxyWindow = new TabbedThumbnailProxyWindow(preview);
+
+ // set our current state
+ EnableThumbnailToolbars = false;
+ EnableTabbedThumbnails = true;
+
+ // copy values
+ UserWindowHandle = preview.WindowHandle;
+ WindowsControl = preview.WindowsControl;
+ TabbedThumbnail = preview;
+ }
+
+ #region IDisposable Members
+
+ /// <summary>
+ ///
+ /// </summary>
+ ~TaskbarWindow()
+ {
+ Dispose(false);
+ }
+
+ /// <summary>
+ /// Release the native objects.
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ public void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ // Dispose managed resources
+ if (_tabbedThumbnailPreview != null)
+ {
+ _tabbedThumbnailPreview.Dispose();
+ }
+ _tabbedThumbnailPreview = null;
+
+ if (ThumbnailToolbarProxyWindow != null)
+ {
+ ThumbnailToolbarProxyWindow.Dispose();
+ }
+ ThumbnailToolbarProxyWindow = null;
+
+ if (TabbedThumbnailProxyWindow != null)
+ {
+ TabbedThumbnailProxyWindow.Dispose();
+ }
+ TabbedThumbnailProxyWindow = null;
+
+ // Don't dispose the thumbnail buttons as they might be used in another window.
+ // Setting them to null will indicate we don't need use anymore.
+ _thumbnailButtons = null;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarWindowManager.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarWindowManager.cs
new file mode 100644
index 0000000000..e750b1be7d
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/TaskbarWindowManager.cs
@@ -0,0 +1,794 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Windows.Forms;
+using System.Windows.Media;
+using Microsoft.WindowsAPICodePack.Shell;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ internal static class TaskbarWindowManager
+ {
+ internal static List<TaskbarWindow> _taskbarWindowList = new List<TaskbarWindow>();
+
+ private static bool _buttonsAdded;
+
+ internal static void AddThumbnailButtons(IntPtr userWindowHandle, params ThumbnailToolBarButton[] buttons)
+ {
+ // Try to get an existing taskbar window for this user windowhandle
+ TaskbarWindow taskbarWindow = GetTaskbarWindow(userWindowHandle, TaskbarProxyWindowType.ThumbnailToolbar);
+ TaskbarWindow temp = null;
+ try
+ {
+ AddThumbnailButtons(
+ taskbarWindow ?? (temp = new TaskbarWindow(userWindowHandle, buttons)),
+ taskbarWindow == null,
+ buttons);
+ }
+ catch
+ {
+ if (temp != null) { temp.Dispose(); }
+ throw;
+ }
+ }
+
+ internal static void AddThumbnailButtons(System.Windows.UIElement control, params ThumbnailToolBarButton[] buttons)
+ {
+ // Try to get an existing taskbar window for this user uielement
+ TaskbarWindow taskbarWindow = GetTaskbarWindow(control, TaskbarProxyWindowType.ThumbnailToolbar);
+ TaskbarWindow temp = null;
+ try
+ {
+ AddThumbnailButtons(
+ taskbarWindow ?? (temp = new TaskbarWindow(control, buttons)),
+ taskbarWindow == null,
+ buttons);
+ }
+ catch
+ {
+ if (temp != null) { temp.Dispose(); }
+ throw;
+ }
+ }
+
+ private static void AddThumbnailButtons(TaskbarWindow taskbarWindow, bool add, params ThumbnailToolBarButton[] buttons)
+ {
+ if (add)
+ {
+ _taskbarWindowList.Add(taskbarWindow);
+ }
+ else if (taskbarWindow.ThumbnailButtons == null)
+ {
+ taskbarWindow.ThumbnailButtons = buttons;
+ }
+ else
+ {
+ // We already have buttons assigned
+ throw new InvalidOperationException(LocalizedMessages.TaskbarWindowManagerButtonsAlreadyAdded);
+ }
+ }
+
+ internal static void AddTabbedThumbnail(TabbedThumbnail preview)
+ {
+ // Create a TOP-LEVEL proxy window for the user's source window/control
+ TaskbarWindow taskbarWindow = null;
+
+ // get the TaskbarWindow for UIElement/WindowHandle respectfully.
+ if (preview.WindowHandle == IntPtr.Zero)
+ {
+ taskbarWindow = GetTaskbarWindow(preview.WindowsControl, TaskbarProxyWindowType.TabbedThumbnail);
+ }
+ else
+ {
+ taskbarWindow = GetTaskbarWindow(preview.WindowHandle, TaskbarProxyWindowType.TabbedThumbnail);
+ }
+
+ //create taskbar, or set its TabbedThumbnail
+ if (taskbarWindow == null)
+ {
+ taskbarWindow = new TaskbarWindow(preview);
+ _taskbarWindowList.Add(taskbarWindow);
+ }
+ else if (taskbarWindow.TabbedThumbnail == null)
+ {
+ taskbarWindow.TabbedThumbnail = preview;
+ }
+
+ // Listen for Title changes
+ preview.TitleChanged += new EventHandler(thumbnailPreview_TitleChanged);
+ preview.TooltipChanged += new EventHandler(thumbnailPreview_TooltipChanged);
+
+ // Get/Set properties for proxy window
+ IntPtr windowHandle = taskbarWindow.WindowToTellTaskbarAbout;
+
+ // Register this new tab and set it as being active.
+ TaskbarList.Instance.RegisterTab(windowHandle, preview.ParentWindowHandle);
+ TaskbarList.Instance.SetTabOrder(windowHandle, IntPtr.Zero);
+ TaskbarList.Instance.SetTabActive(windowHandle, preview.ParentWindowHandle, 0);
+
+ // We need to make sure we can set these properties even when running with admin
+ TabbedThumbnailNativeMethods.ChangeWindowMessageFilter(
+ TabbedThumbnailNativeMethods.WmDwmSendIconicThumbnail,
+ TabbedThumbnailNativeMethods.MsgfltAdd);
+
+ TabbedThumbnailNativeMethods.ChangeWindowMessageFilter(
+ TabbedThumbnailNativeMethods.WmDwmSendIconicLivePreviewBitmap,
+ TabbedThumbnailNativeMethods.MsgfltAdd);
+
+ // BUG: There should be somewhere to disable CustomWindowPreview. I didn't find it.
+ TabbedThumbnailNativeMethods.EnableCustomWindowPreview(windowHandle, true);
+
+ // Make sure we use the initial title set by the user
+ // Trigger a "fake" title changed event, so the title is set on the taskbar thumbnail.
+ // Empty/null title will be ignored.
+ thumbnailPreview_TitleChanged(preview, EventArgs.Empty);
+ thumbnailPreview_TooltipChanged(preview, EventArgs.Empty);
+
+ // Indicate to the preview that we've added it on the taskbar
+ preview.AddedToTaskbar = true;
+ }
+
+ internal static TaskbarWindow GetTaskbarWindow(System.Windows.UIElement windowsControl, TaskbarProxyWindowType taskbarProxyWindowType)
+ {
+ if (windowsControl == null) { throw new ArgumentNullException("windowsControl"); }
+
+ TaskbarWindow toReturn = _taskbarWindowList.FirstOrDefault(window =>
+ {
+ return (window.TabbedThumbnail != null && window.TabbedThumbnail.WindowsControl == windowsControl) ||
+ (window.ThumbnailToolbarProxyWindow != null &&
+ window.ThumbnailToolbarProxyWindow.WindowsControl == windowsControl);
+ });
+
+ if (toReturn != null)
+ {
+ if (taskbarProxyWindowType == TaskbarProxyWindowType.ThumbnailToolbar)
+ {
+ toReturn.EnableThumbnailToolbars = true;
+ }
+ else if (taskbarProxyWindowType == TaskbarProxyWindowType.TabbedThumbnail)
+ {
+ toReturn.EnableTabbedThumbnails = true;
+ }
+ }
+
+ return toReturn;
+ }
+
+ internal static TaskbarWindow GetTaskbarWindow(IntPtr userWindowHandle, TaskbarProxyWindowType taskbarProxyWindowType)
+ {
+ if (userWindowHandle == IntPtr.Zero)
+ {
+ throw new ArgumentException(LocalizedMessages.CommonFileDialogInvalidHandle, "userWindowHandle");
+ }
+
+ TaskbarWindow toReturn = _taskbarWindowList.FirstOrDefault(window => window.UserWindowHandle == userWindowHandle);
+
+ // If its not in the list, return null so it can be added.
+ if (toReturn != null)
+ {
+ if (taskbarProxyWindowType == TaskbarProxyWindowType.ThumbnailToolbar)
+ {
+ toReturn.EnableThumbnailToolbars = true;
+ }
+ else if (taskbarProxyWindowType == TaskbarProxyWindowType.TabbedThumbnail)
+ {
+ toReturn.EnableTabbedThumbnails = true;
+ }
+ }
+
+ return toReturn;
+ }
+
+ #region Message dispatch methods
+ private static void DispatchTaskbarButtonMessages(ref System.Windows.Forms.Message m, TaskbarWindow taskbarWindow)
+ {
+ if (m.Msg == (int)TaskbarNativeMethods.WmTaskbarButtonCreated)
+ {
+ AddButtons(taskbarWindow);
+ }
+ else
+ {
+ if (!_buttonsAdded)
+ {
+ AddButtons(taskbarWindow);
+ }
+
+ if (m.Msg == TaskbarNativeMethods.WmCommand &&
+ CoreNativeMethods.GetHiWord(m.WParam.ToInt64(), 16) == ThumbButton.Clicked)
+ {
+ int buttonId = CoreNativeMethods.GetLoWord(m.WParam.ToInt64());
+
+ var buttonsFound =
+ from b in taskbarWindow.ThumbnailButtons
+ where b.Id == buttonId
+ select b;
+
+ foreach (ThumbnailToolBarButton button in buttonsFound)
+ {
+ button.FireClick(taskbarWindow);
+ }
+ }
+ }
+ }
+
+ private static bool DispatchActivateMessage(ref System.Windows.Forms.Message m, TaskbarWindow taskbarWindow)
+ {
+ if (m.Msg == (int)WindowMessage.Activate)
+ {
+ // Raise the event
+ taskbarWindow.TabbedThumbnail.OnTabbedThumbnailActivated();
+ SetActiveTab(taskbarWindow);
+ return true;
+ }
+ return false;
+ }
+
+ private static bool DispatchSendIconThumbnailMessage(ref System.Windows.Forms.Message m, TaskbarWindow taskbarWindow)
+ {
+ if (m.Msg == (int)TaskbarNativeMethods.WmDwmSendIconThumbnail)
+ {
+ int width = (int)((long)m.LParam >> 16);
+ int height = (int)(((long)m.LParam) & (0xFFFF));
+ Size requestedSize = new Size(width, height);
+
+ // Fire an event to let the user update their bitmap
+ taskbarWindow.TabbedThumbnail.OnTabbedThumbnailBitmapRequested();
+
+ IntPtr hBitmap = IntPtr.Zero;
+
+ // Default size for the thumbnail
+ Size realWindowSize = new Size(200, 200);
+
+ // Get the size of teh control or UIElement
+ if (taskbarWindow.TabbedThumbnail.WindowHandle != IntPtr.Zero)
+ {
+ TabbedThumbnailNativeMethods.GetClientSize(taskbarWindow.TabbedThumbnail.WindowHandle, out realWindowSize);
+ }
+ else if (taskbarWindow.TabbedThumbnail.WindowsControl != null)
+ {
+ realWindowSize = new Size(
+ Convert.ToInt32(taskbarWindow.TabbedThumbnail.WindowsControl.RenderSize.Width),
+ Convert.ToInt32(taskbarWindow.TabbedThumbnail.WindowsControl.RenderSize.Height));
+ }
+
+ if (realWindowSize.Height == -1 && realWindowSize.Width == -1)
+ {
+ realWindowSize.Width = realWindowSize.Height = 199;
+ }
+
+ // capture the bitmap for the given control
+ // If the user has already specified us a bitmap to use, use that.
+ if (taskbarWindow.TabbedThumbnail.ClippingRectangle != null &&
+ taskbarWindow.TabbedThumbnail.ClippingRectangle.Value != Rectangle.Empty)
+ {
+ if (taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero)
+ {
+ hBitmap = GrabBitmap(taskbarWindow, realWindowSize);
+ }
+ else
+ {
+ hBitmap = taskbarWindow.TabbedThumbnail.CurrentHBitmap;
+ }
+
+ // Clip the bitmap we just got.
+ Bitmap bmp = Bitmap.FromHbitmap(hBitmap);
+
+ Rectangle clippingRectangle = taskbarWindow.TabbedThumbnail.ClippingRectangle.Value;
+
+ // If our clipping rect is out of bounds, update it
+ if (clippingRectangle.Height > requestedSize.Height)
+ {
+ clippingRectangle.Height = requestedSize.Height;
+ }
+ if (clippingRectangle.Width > requestedSize.Width)
+ {
+ clippingRectangle.Width = requestedSize.Width;
+ }
+
+ // NOTE: Is this a memory leak?
+ bmp = bmp.Clone(clippingRectangle, bmp.PixelFormat);
+
+ // Make sure we dispose the bitmap before assigning, otherwise we'll have a memory leak
+ if (hBitmap != IntPtr.Zero && taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero)
+ {
+ ShellNativeMethods.DeleteObject(hBitmap);
+ }
+ hBitmap = bmp.GetHbitmap();
+ bmp.Dispose();
+ }
+ else
+ {
+ // Else, user didn't want any clipping, if they haven't provided us a bitmap,
+ // use the screencapture utility and capture it.
+
+ hBitmap = taskbarWindow.TabbedThumbnail.CurrentHBitmap;
+
+ // If no bitmap, capture one using the utility
+ if (hBitmap == IntPtr.Zero)
+ {
+ hBitmap = GrabBitmap(taskbarWindow, realWindowSize);
+ }
+ }
+
+ // Only set the thumbnail if it's not null.
+ // If it's null (either we didn't get the bitmap or size was 0),
+ // let DWM handle it
+ if (hBitmap != IntPtr.Zero)
+ {
+ Bitmap temp = TabbedThumbnailScreenCapture.ResizeImageWithAspect(
+ hBitmap, requestedSize.Width, requestedSize.Height, true);
+
+ if (taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero)
+ {
+ ShellNativeMethods.DeleteObject(hBitmap);
+ }
+
+ hBitmap = temp.GetHbitmap();
+ TabbedThumbnailNativeMethods.SetIconicThumbnail(taskbarWindow.WindowToTellTaskbarAbout, hBitmap);
+ temp.Dispose();
+ }
+
+ // If the bitmap we have is not coming from the user (i.e. we created it here),
+ // then make sure we delete it as we don't need it now.
+ if (taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero)
+ {
+ ShellNativeMethods.DeleteObject(hBitmap);
+ }
+
+ return true;
+ }
+ return false;
+ }
+
+ private static bool DispatchLivePreviewBitmapMessage(ref System.Windows.Forms.Message m, TaskbarWindow taskbarWindow)
+ {
+ if (m.Msg == (int)TaskbarNativeMethods.WmDwmSendIconicLivePreviewBitmap)
+ {
+ // Try to get the width/height
+ int width = (int)(((long)m.LParam) >> 16);
+ int height = (int)(((long)m.LParam) & (0xFFFF));
+
+ // Default size for the thumbnail
+ Size realWindowSize = new Size(200, 200);
+
+ if (taskbarWindow.TabbedThumbnail.WindowHandle != IntPtr.Zero)
+ {
+ TabbedThumbnailNativeMethods.GetClientSize(taskbarWindow.TabbedThumbnail.WindowHandle, out realWindowSize);
+ }
+ else if (taskbarWindow.TabbedThumbnail.WindowsControl != null)
+ {
+ realWindowSize = new Size(
+ Convert.ToInt32(taskbarWindow.TabbedThumbnail.WindowsControl.RenderSize.Width),
+ Convert.ToInt32(taskbarWindow.TabbedThumbnail.WindowsControl.RenderSize.Height));
+ }
+
+ // If we don't have a valid height/width, use the original window's size
+ if (width <= 0)
+ {
+ width = realWindowSize.Width;
+ }
+ if (height <= 0)
+ {
+ height = realWindowSize.Height;
+ }
+
+ // Fire an event to let the user update their bitmap
+ // Raise the event
+ taskbarWindow.TabbedThumbnail.OnTabbedThumbnailBitmapRequested();
+
+ // capture the bitmap for the given control
+ // If the user has already specified us a bitmap to use, use that.
+ IntPtr hBitmap = taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero ? GrabBitmap(taskbarWindow, realWindowSize) : taskbarWindow.TabbedThumbnail.CurrentHBitmap;
+
+ // If we have a valid parent window handle,
+ // calculate the offset so we can place the "peek" bitmap
+ // correctly on the app window
+ if (taskbarWindow.TabbedThumbnail.ParentWindowHandle != IntPtr.Zero && taskbarWindow.TabbedThumbnail.WindowHandle != IntPtr.Zero)
+ {
+ System.Drawing.Point offset = new System.Drawing.Point();
+
+ // if we don't have a offset specified already by the user...
+ if (!taskbarWindow.TabbedThumbnail.PeekOffset.HasValue)
+ {
+ offset = WindowUtilities.GetParentOffsetOfChild(taskbarWindow.TabbedThumbnail.WindowHandle, taskbarWindow.TabbedThumbnail.ParentWindowHandle);
+ }
+ else
+ {
+ offset = new System.Drawing.Point(Convert.ToInt32(taskbarWindow.TabbedThumbnail.PeekOffset.Value.X),
+ Convert.ToInt32(taskbarWindow.TabbedThumbnail.PeekOffset.Value.Y));
+ }
+
+ // Only set the peek bitmap if it's not null.
+ // If it's null (either we didn't get the bitmap or size was 0),
+ // let DWM handle it
+ if (hBitmap != IntPtr.Zero)
+ {
+ if (offset.X >= 0 && offset.Y >= 0)
+ {
+ TabbedThumbnailNativeMethods.SetPeekBitmap(
+ taskbarWindow.WindowToTellTaskbarAbout,
+ hBitmap, offset,
+ taskbarWindow.TabbedThumbnail.DisplayFrameAroundBitmap);
+ }
+ }
+
+ // If the bitmap we have is not coming from the user (i.e. we created it here),
+ // then make sure we delete it as we don't need it now.
+ if (taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero)
+ {
+ ShellNativeMethods.DeleteObject(hBitmap);
+ }
+
+ return true;
+ }
+ // Else, we don't have a valid window handle from the user. This is mostly likely because
+ // we have a WPF UIElement control. If that's the case, use a different screen capture method
+ // and also couple of ways to try to calculate the control's offset w.r.t it's parent.
+ else if (taskbarWindow.TabbedThumbnail.ParentWindowHandle != IntPtr.Zero &&
+ taskbarWindow.TabbedThumbnail.WindowsControl != null)
+ {
+ System.Windows.Point offset;
+
+ if (!taskbarWindow.TabbedThumbnail.PeekOffset.HasValue)
+ {
+ // Calculate the offset for a WPF UIElement control
+ // For hidden controls, we can't seem to perform the transform.
+ GeneralTransform objGeneralTransform = taskbarWindow.TabbedThumbnail.WindowsControl.TransformToVisual(taskbarWindow.TabbedThumbnail.WindowsControlParentWindow);
+ offset = objGeneralTransform.Transform(new System.Windows.Point(0, 0));
+ }
+ else
+ {
+ offset = new System.Windows.Point(taskbarWindow.TabbedThumbnail.PeekOffset.Value.X, taskbarWindow.TabbedThumbnail.PeekOffset.Value.Y);
+ }
+
+ // Only set the peek bitmap if it's not null.
+ // If it's null (either we didn't get the bitmap or size was 0),
+ // let DWM handle it
+ if (hBitmap != IntPtr.Zero)
+ {
+ if (offset.X >= 0 && offset.Y >= 0)
+ {
+ TabbedThumbnailNativeMethods.SetPeekBitmap(
+ taskbarWindow.WindowToTellTaskbarAbout,
+ hBitmap, new System.Drawing.Point((int)offset.X, (int)offset.Y),
+ taskbarWindow.TabbedThumbnail.DisplayFrameAroundBitmap);
+ }
+ else
+ {
+ TabbedThumbnailNativeMethods.SetPeekBitmap(
+ taskbarWindow.WindowToTellTaskbarAbout,
+ hBitmap,
+ taskbarWindow.TabbedThumbnail.DisplayFrameAroundBitmap);
+ }
+ }
+
+ // If the bitmap we have is not coming from the user (i.e. we created it here),
+ // then make sure we delete it as we don't need it now.
+ if (taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero)
+ {
+ ShellNativeMethods.DeleteObject(hBitmap);
+ }
+
+ return true;
+ }
+ else
+ {
+ // Else (no parent specified), just set the bitmap. It would take over the entire
+ // application window (would work only if you are a MDI app)
+
+ // Only set the peek bitmap if it's not null.
+ // If it's null (either we didn't get the bitmap or size was 0),
+ // let DWM handle it
+ if (hBitmap != null)
+ {
+ TabbedThumbnailNativeMethods.SetPeekBitmap(taskbarWindow.WindowToTellTaskbarAbout, hBitmap, taskbarWindow.TabbedThumbnail.DisplayFrameAroundBitmap);
+ }
+
+ // If the bitmap we have is not coming from the user (i.e. we created it here),
+ // then make sure we delete it as we don't need it now.
+ if (taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero)
+ {
+ ShellNativeMethods.DeleteObject(hBitmap);
+ }
+
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static bool DispatchDestroyMessage(ref System.Windows.Forms.Message m, TaskbarWindow taskbarWindow)
+ {
+ if (m.Msg == (int)WindowMessage.Destroy)
+ {
+ TaskbarList.Instance.UnregisterTab(taskbarWindow.WindowToTellTaskbarAbout);
+
+ taskbarWindow.TabbedThumbnail.RemovedFromTaskbar = true;
+
+ return true;
+ }
+ return false;
+ }
+
+ private static bool DispatchNCDestroyMessage(ref System.Windows.Forms.Message m, TaskbarWindow taskbarWindow)
+ {
+ if (m.Msg == (int)WindowMessage.NCDestroy)
+ {
+ // Raise the event
+ taskbarWindow.TabbedThumbnail.OnTabbedThumbnailClosed();
+
+ // Remove the taskbar window from our internal list
+ if (_taskbarWindowList.Contains(taskbarWindow))
+ {
+ _taskbarWindowList.Remove(taskbarWindow);
+ }
+
+ taskbarWindow.Dispose();
+
+ return true;
+ }
+ return false;
+ }
+
+ private static bool DispatchSystemCommandMessage(ref System.Windows.Forms.Message m, TaskbarWindow taskbarWindow)
+ {
+ if (m.Msg == (int)WindowMessage.SystemCommand)
+ {
+ if (((int)m.WParam) == TabbedThumbnailNativeMethods.ScClose)
+ {
+ // Raise the event
+ if (taskbarWindow.TabbedThumbnail.OnTabbedThumbnailClosed())
+ {
+ // Remove the taskbar window from our internal list
+ if (_taskbarWindowList.Contains(taskbarWindow))
+ {
+ _taskbarWindowList.Remove(taskbarWindow);
+ }
+
+ taskbarWindow.Dispose();
+ taskbarWindow = null;
+ }
+ }
+ else if (((int)m.WParam) == TabbedThumbnailNativeMethods.ScMaximize)
+ {
+ // Raise the event
+ taskbarWindow.TabbedThumbnail.OnTabbedThumbnailMaximized();
+ }
+ else if (((int)m.WParam) == TabbedThumbnailNativeMethods.ScMinimize)
+ {
+ // Raise the event
+ taskbarWindow.TabbedThumbnail.OnTabbedThumbnailMinimized();
+ }
+
+ return true;
+ }
+ return false;
+ }
+
+ #endregion
+
+ /// <summary>
+ /// Dispatches a window message so that the appropriate events
+ /// can be invoked. This is used for the Taskbar's thumbnail toolbar feature.
+ /// </summary>
+ /// <param name="m">The window message, typically obtained
+ /// from a Windows Forms or WPF window procedure.</param>
+ /// <param name="taskbarWindow">Taskbar window for which we are intercepting the messages</param>
+ /// <returns>Returns true if this method handles the window message</returns>
+ internal static bool DispatchMessage(ref System.Windows.Forms.Message m, TaskbarWindow taskbarWindow)
+ {
+ if (taskbarWindow.EnableThumbnailToolbars)
+ {
+ DispatchTaskbarButtonMessages(ref m, taskbarWindow);
+ }
+
+ // If we are removed from the taskbar, ignore all the messages
+ if (taskbarWindow.EnableTabbedThumbnails)
+ {
+ if (taskbarWindow.TabbedThumbnail == null ||
+ taskbarWindow.TabbedThumbnail.RemovedFromTaskbar)
+ {
+ return false;
+ }
+
+ if (DispatchActivateMessage(ref m, taskbarWindow))
+ {
+ return true;
+ }
+
+ if (DispatchSendIconThumbnailMessage(ref m, taskbarWindow))
+ {
+ return true;
+ }
+
+ if (DispatchLivePreviewBitmapMessage(ref m, taskbarWindow))
+ {
+ return true;
+ }
+
+ if (DispatchDestroyMessage(ref m, taskbarWindow))
+ {
+ return true;
+ }
+
+ if (DispatchNCDestroyMessage(ref m, taskbarWindow))
+ {
+ return true;
+ }
+
+ if (DispatchSystemCommandMessage(ref m, taskbarWindow))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /// <summary>
+ /// Helper function to capture a bitmap for a given window handle or incase of WPF app,
+ /// an UIElement.
+ /// </summary>
+ /// <param name="taskbarWindow">The proxy window for which a bitmap needs to be created</param>
+ /// <param name="requestedSize">Size for the requested bitmap image</param>
+ /// <returns>Bitmap captured from the window handle or UIElement. Null if the window is hidden or it's size is zero.</returns>
+ private static IntPtr GrabBitmap(TaskbarWindow taskbarWindow, System.Drawing.Size requestedSize)
+ {
+ IntPtr hBitmap = IntPtr.Zero;
+
+ if (taskbarWindow.TabbedThumbnail.WindowHandle != IntPtr.Zero)
+ { //TabbedThumbnail is linked to WinformsControl
+ if (taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero)
+ {
+ using (Bitmap bmp = TabbedThumbnailScreenCapture.GrabWindowBitmap(
+ taskbarWindow.TabbedThumbnail.WindowHandle, requestedSize))
+ {
+
+ hBitmap = bmp.GetHbitmap();
+ }
+ }
+ else
+ {
+ using (Image img = Image.FromHbitmap(taskbarWindow.TabbedThumbnail.CurrentHBitmap))
+ {
+ using (Bitmap bmp = new Bitmap(img, requestedSize))
+ {
+ hBitmap = bmp != null ? bmp.GetHbitmap() : IntPtr.Zero;
+ }
+ }
+ }
+ }
+ else if (taskbarWindow.TabbedThumbnail.WindowsControl != null)
+ { //TabbedThumbnail is linked to a WPF UIElement
+ if (taskbarWindow.TabbedThumbnail.CurrentHBitmap == IntPtr.Zero)
+ {
+ Bitmap bmp = TabbedThumbnailScreenCapture.GrabWindowBitmap(
+ taskbarWindow.TabbedThumbnail.WindowsControl,
+ 96, 96, requestedSize.Width, requestedSize.Height);
+
+ if (bmp != null)
+ {
+ hBitmap = bmp.GetHbitmap();
+ bmp.Dispose();
+ }
+ }
+ else
+ {
+ using (Image img = Image.FromHbitmap(taskbarWindow.TabbedThumbnail.CurrentHBitmap))
+ {
+ using (Bitmap bmp = new Bitmap(img, requestedSize))
+ {
+
+ hBitmap = bmp != null ? bmp.GetHbitmap() : IntPtr.Zero;
+ }
+ }
+ }
+ }
+
+ return hBitmap;
+ }
+
+ internal static void SetActiveTab(TaskbarWindow taskbarWindow)
+ {
+ if (taskbarWindow != null)
+ {
+ TaskbarList.Instance.SetTabActive(
+ taskbarWindow.WindowToTellTaskbarAbout,
+ taskbarWindow.TabbedThumbnail.ParentWindowHandle, 0);
+ }
+ }
+
+ internal static void UnregisterTab(TaskbarWindow taskbarWindow)
+ {
+ if (taskbarWindow != null)
+ {
+ TaskbarList.Instance.UnregisterTab(taskbarWindow.WindowToTellTaskbarAbout);
+ }
+ }
+
+ internal static void InvalidatePreview(TaskbarWindow taskbarWindow)
+ {
+ if (taskbarWindow != null)
+ {
+ TabbedThumbnailNativeMethods.DwmInvalidateIconicBitmaps(
+ taskbarWindow.WindowToTellTaskbarAbout);
+ }
+ }
+
+ private static void AddButtons(TaskbarWindow taskbarWindow)
+ {
+ // Add the buttons
+ // Get the array of thumbnail buttons in native format
+ ThumbButton[] nativeButtons = (from thumbButton in taskbarWindow.ThumbnailButtons
+ select thumbButton.Win32ThumbButton).ToArray();
+
+ // Add the buttons on the taskbar
+ HResult hr = TaskbarList.Instance.ThumbBarAddButtons(taskbarWindow.WindowToTellTaskbarAbout, (uint)taskbarWindow.ThumbnailButtons.Length, nativeButtons);
+
+ if (!CoreErrorHelper.Succeeded(hr))
+ {
+ throw new ShellException(hr);
+ }
+
+ _buttonsAdded = true;
+
+ foreach (ThumbnailToolBarButton button in taskbarWindow.ThumbnailButtons)
+ {
+ button.AddedToTaskbar = _buttonsAdded;
+ }
+ }
+
+ #region Event handlers
+
+ private static void thumbnailPreview_TooltipChanged(object sender, EventArgs e)
+ {
+ TabbedThumbnail preview = sender as TabbedThumbnail;
+
+ TaskbarWindow taskbarWindow = null;
+
+ if (preview.WindowHandle == IntPtr.Zero)
+ {
+ taskbarWindow = GetTaskbarWindow(preview.WindowsControl, TaskbarProxyWindowType.TabbedThumbnail);
+ }
+ else
+ {
+ taskbarWindow = GetTaskbarWindow(preview.WindowHandle, TaskbarProxyWindowType.TabbedThumbnail);
+ }
+
+ // Update the proxy window for the tabbed thumbnail
+ if (taskbarWindow != null)
+ {
+ TaskbarList.Instance.SetThumbnailTooltip(taskbarWindow.WindowToTellTaskbarAbout, preview.Tooltip);
+ }
+ }
+
+ private static void thumbnailPreview_TitleChanged(object sender, EventArgs e)
+ {
+ TabbedThumbnail preview = sender as TabbedThumbnail;
+
+ TaskbarWindow taskbarWindow = null;
+
+ if (preview.WindowHandle == IntPtr.Zero)
+ {
+ taskbarWindow = GetTaskbarWindow(preview.WindowsControl, TaskbarProxyWindowType.TabbedThumbnail);
+ }
+ else
+ {
+ taskbarWindow = GetTaskbarWindow(preview.WindowHandle, TaskbarProxyWindowType.TabbedThumbnail);
+ }
+
+ // Update the proxy window for the tabbed thumbnail
+ if (taskbarWindow != null)
+ {
+ taskbarWindow.SetTitle(preview.Title);
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/ThumbnailButton.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/ThumbnailButton.cs
new file mode 100644
index 0000000000..8ad48d238c
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/ThumbnailButton.cs
@@ -0,0 +1,362 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Drawing;
+using Microsoft.WindowsAPICodePack.Shell;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ /// <summary>
+ /// Represents a taskbar thumbnail button in the thumbnail toolbar.
+ /// </summary>
+ public sealed class ThumbnailToolBarButton : IDisposable
+ {
+ private static uint nextId = 101;
+ private ThumbButton win32ThumbButton;
+
+ /// <summary>
+ /// The event that occurs when the taskbar thumbnail button
+ /// is clicked.
+ /// </summary>
+ public event EventHandler<ThumbnailButtonClickedEventArgs> Click;
+
+ // Internal bool to track whether we should be updating the taskbar
+ // if any of our properties change or if it's just an internal update
+ // on the properties (via the constructor)
+ private bool internalUpdate = false;
+
+ /// <summary>
+ /// Initializes an instance of this class
+ /// </summary>
+ /// <param name="icon">The icon to use for this button</param>
+ /// <param name="tooltip">The tooltip string to use for this button.</param>
+ public ThumbnailToolBarButton(Icon icon, string tooltip)
+ {
+ // Start internal update (so we don't accidently update the taskbar
+ // via the native API)
+ internalUpdate = true;
+
+ // Set our id
+ Id = nextId;
+
+ // increment the ID
+ if (nextId == Int32.MaxValue)
+ nextId = 101; // our starting point
+ else
+ nextId++;
+
+ // Set user settings
+ Icon = icon;
+ Tooltip = tooltip;
+
+ // Defaults
+ Enabled = true;
+
+ // Create a native
+ win32ThumbButton = new ThumbButton();
+
+ // End our internal update
+ internalUpdate = false;
+ }
+
+ #region Public properties
+
+ /// <summary>
+ /// Gets thumbnail button's id.
+ /// </summary>
+ internal uint Id { get; set; }
+
+ private Icon icon;
+ /// <summary>
+ /// Gets or sets the thumbnail button's icon.
+ /// </summary>
+ public Icon Icon
+ {
+ get
+ {
+ return icon;
+ }
+ set
+ {
+ if (icon != value)
+ {
+ icon = value;
+ UpdateThumbnailButton();
+ }
+ }
+ }
+
+ private string tooltip;
+ /// <summary>
+ /// Gets or sets the thumbnail button's tooltip.
+ /// </summary>
+ public string Tooltip
+ {
+ get
+ {
+ return tooltip;
+ }
+ set
+ {
+ if (tooltip != value)
+ {
+ tooltip = value;
+ UpdateThumbnailButton();
+ }
+ }
+ }
+
+ private bool visible = true;
+ /// <summary>
+ /// Gets or sets the thumbnail button's visibility. Default is true.
+ /// </summary>
+ public bool Visible
+ {
+ get
+ {
+ return (this.Flags & ThumbButtonOptions.Hidden) == 0;
+ }
+ set
+ {
+ if (visible != value)
+ {
+ visible = value;
+
+ if (value)
+ {
+ this.Flags &= ~(ThumbButtonOptions.Hidden);
+ }
+ else
+ {
+ this.Flags |= ThumbButtonOptions.Hidden;
+ }
+
+ UpdateThumbnailButton();
+ }
+
+ }
+ }
+
+ private bool enabled = true;
+ /// <summary>
+ /// Gets or sets the thumbnail button's enabled state. If the button is disabled, it is present,
+ /// but has a visual state that indicates that it will not respond to user action. Default is true.
+ /// </summary>
+ public bool Enabled
+ {
+ get
+ {
+ return (this.Flags & ThumbButtonOptions.Disabled) == 0;
+ }
+ set
+ {
+ if (value != enabled)
+ {
+ enabled = value;
+
+ if (value)
+ {
+ this.Flags &= ~(ThumbButtonOptions.Disabled);
+ }
+ else
+ {
+ this.Flags |= ThumbButtonOptions.Disabled;
+ }
+
+ UpdateThumbnailButton();
+ }
+ }
+ }
+
+ private bool dismissOnClick;
+ /// <summary>
+ /// Gets or sets the property that describes the behavior when the button is clicked.
+ /// If set to true, the taskbar button's flyout will close immediately. Default is false.
+ /// </summary>
+ public bool DismissOnClick
+ {
+ get
+ {
+ return (this.Flags & ThumbButtonOptions.DismissOnClick) == 0;
+ }
+ set
+ {
+ if (value != dismissOnClick)
+ {
+ dismissOnClick = value;
+
+ if (value)
+ {
+ this.Flags |= ThumbButtonOptions.DismissOnClick;
+ }
+ else
+ {
+ this.Flags &= ~(ThumbButtonOptions.DismissOnClick);
+ }
+
+ UpdateThumbnailButton();
+ }
+ }
+ }
+
+ private bool isInteractive = true;
+ /// <summary>
+ /// Gets or sets the property that describes whether the button is interactive with the user. Default is true.
+ /// </summary>
+ /// <remarks>
+ /// Non-interactive buttons don't display any hover behavior nor do they raise click events.
+ /// They are intended to be used as status icons. This is mostly similar to being not Enabled,
+ /// but the image is not desaturated.
+ /// </remarks>
+ public bool IsInteractive
+ {
+ get
+ {
+ return (this.Flags & ThumbButtonOptions.NonInteractive) == 0;
+ }
+ set
+ {
+ if (value != isInteractive)
+ {
+ isInteractive = value;
+
+ if (value)
+ {
+ this.Flags &= ~(ThumbButtonOptions.NonInteractive);
+ }
+ else
+ {
+ this.Flags |= ThumbButtonOptions.NonInteractive;
+ }
+
+ UpdateThumbnailButton();
+ }
+ }
+ }
+
+ #endregion
+
+ #region Internal Methods
+
+ /// <summary>
+ /// Native flags enum (used when creating the native button)
+ /// </summary>
+ internal ThumbButtonOptions Flags { get; set; }
+
+ /// <summary>
+ /// Native representation of the thumbnail button
+ /// </summary>
+ internal ThumbButton Win32ThumbButton
+ {
+ get
+ {
+ win32ThumbButton.Id = Id;
+ win32ThumbButton.Tip = Tooltip;
+ win32ThumbButton.Icon = Icon != null ? Icon.Handle : IntPtr.Zero;
+ win32ThumbButton.Flags = Flags;
+
+ win32ThumbButton.Mask = ThumbButtonMask.THB_FLAGS;
+ if (Tooltip != null)
+ {
+ win32ThumbButton.Mask |= ThumbButtonMask.Tooltip;
+ }
+ if (Icon != null)
+ {
+ win32ThumbButton.Mask |= ThumbButtonMask.Icon;
+ }
+
+ return win32ThumbButton;
+ }
+ }
+
+ /// <summary>
+ /// The window manager should call this method to raise the public click event to all
+ /// the subscribers.
+ /// </summary>
+ /// <param name="taskbarWindow">Taskbar Window associated with this button</param>
+ internal void FireClick(TaskbarWindow taskbarWindow)
+ {
+ if (Click != null && taskbarWindow != null)
+ {
+ if (taskbarWindow.UserWindowHandle != IntPtr.Zero)
+ {
+ Click(this, new ThumbnailButtonClickedEventArgs(taskbarWindow.UserWindowHandle, this));
+ }
+ else if (taskbarWindow.WindowsControl != null)
+ {
+ Click(this, new ThumbnailButtonClickedEventArgs(taskbarWindow.WindowsControl, this));
+ }
+ }
+ }
+
+ /// <summary>
+ /// Handle to the window to which this button is for (on the taskbar).
+ /// </summary>
+ internal IntPtr WindowHandle
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Indicates if this button was added to the taskbar. If it's not yet added,
+ /// then we can't do any updates on it.
+ /// </summary>
+ internal bool AddedToTaskbar
+ {
+ get;
+ set;
+ }
+
+ internal void UpdateThumbnailButton()
+ {
+ if (internalUpdate || !AddedToTaskbar) { return; }
+
+ // Get the array of thumbnail buttons in native format
+ ThumbButton[] nativeButtons = { Win32ThumbButton };
+
+ HResult hr = TaskbarList.Instance.ThumbBarUpdateButtons(WindowHandle, 1, nativeButtons);
+
+ if (!CoreErrorHelper.Succeeded(hr)) { throw new ShellException(hr); }
+ }
+
+ #endregion
+
+ #region IDisposable Members
+
+ /// <summary>
+ ///
+ /// </summary>
+ ~ThumbnailToolBarButton()
+ {
+ Dispose(false);
+ }
+
+ /// <summary>
+ /// Release the native objects.
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Release the native objects.
+ /// </summary>
+ /// <param name="disposing"></param>
+ public void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ // Dispose managed resources
+ Icon.Dispose();
+ tooltip = null;
+ }
+ }
+
+ #endregion
+ }
+
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/ThumbnailButtonClickedEventArgs.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/ThumbnailButtonClickedEventArgs.cs
new file mode 100644
index 0000000000..87b6549830
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/ThumbnailButtonClickedEventArgs.cs
@@ -0,0 +1,55 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Windows;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ /// <summary>
+ /// Event args for TabbedThumbnailButton.Click event
+ /// </summary>
+ public class ThumbnailButtonClickedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Creates a Event Args for the TabbedThumbnailButton.Click event
+ /// </summary>
+ /// <param name="windowHandle">Window handle for the control/window related to the event</param>
+ /// <param name="button">Thumbnail toolbar button that was clicked</param>
+ public ThumbnailButtonClickedEventArgs(IntPtr windowHandle, ThumbnailToolBarButton button)
+ {
+ ThumbnailButton = button;
+ WindowHandle = windowHandle;
+ WindowsControl = null;
+ }
+
+ /// <summary>
+ /// Creates a Event Args for the TabbedThumbnailButton.Click event
+ /// </summary>
+ /// <param name="windowsControl">WPF Control (UIElement) related to the event</param>
+ /// <param name="button">Thumbnail toolbar button that was clicked</param>
+ public ThumbnailButtonClickedEventArgs(UIElement windowsControl, ThumbnailToolBarButton button)
+ {
+ ThumbnailButton = button;
+ WindowHandle = IntPtr.Zero;
+ WindowsControl = windowsControl;
+ }
+
+ /// <summary>
+ /// Gets the Window handle for the specific control/window that is related to this event.
+ /// </summary>
+ /// <remarks>For WPF Controls (UIElement) the WindowHandle will be IntPtr.Zero.
+ /// Check the WindowsControl property to get the specific control associated with this event.</remarks>
+ public IntPtr WindowHandle { get; private set; }
+
+ /// <summary>
+ /// Gets the WPF Control (UIElement) that is related to this event. This property may be null
+ /// for non-WPF applications.
+ /// </summary>
+ public UIElement WindowsControl { get; private set; }
+
+ /// <summary>
+ /// Gets the ThumbnailToolBarButton that was clicked
+ /// </summary>
+ public ThumbnailToolBarButton ThumbnailButton { get; private set; }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/ThumbnailToolbarManager.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/ThumbnailToolbarManager.cs
new file mode 100644
index 0000000000..793b2b162a
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/ThumbnailToolbarManager.cs
@@ -0,0 +1,77 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Windows;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ /// <summary>
+ /// Thumbnail toolbar manager class for adding a thumbnail toolbar with a specified set of buttons
+ /// to the thumbnail image of a window in a taskbar button flyout.
+ /// </summary>
+ public class ThumbnailToolBarManager
+ {
+ internal ThumbnailToolBarManager()
+ {
+ // Hide the public constructor so users can't create an instance of this class.
+ }
+
+ /// <summary>
+ /// Adds thumbnail toolbar for the specified window.
+ /// </summary>
+ /// <param name="windowHandle">Window handle for which the thumbnail toolbar buttons need to be added</param>
+ /// <param name="buttons">Thumbnail buttons for the window's thumbnail toolbar</param>
+ /// <exception cref="System.ArgumentException">If the number of buttons exceed the maximum allowed capacity (7).</exception>
+ /// <exception cref="System.ArgumentException">If the Window Handle passed in invalid</exception>
+ /// <remarks>After a toolbar has been added to a thumbnail, buttons can be altered only through various
+ /// properties on the <see cref="T:Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolBarButton"/>. While individual buttons cannot be added or removed,
+ /// they can be shown and hidden through <see cref="P:Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolBarButton.Visible"/> as needed.
+ /// The toolbar itself cannot be removed without re-creating the window itself.
+ /// </remarks>
+ public void AddButtons(IntPtr windowHandle, params ThumbnailToolBarButton[] buttons)
+ {
+ if (windowHandle == IntPtr.Zero)
+ {
+ throw new ArgumentException(LocalizedMessages.ThumbnailManagerInvalidHandle, "windowHandle");
+ }
+ VerifyButtons(buttons);
+
+ // Add the buttons to our window manager, which will also create a proxy window
+ TaskbarWindowManager.AddThumbnailButtons(windowHandle, buttons);
+ }
+
+ /// <summary>
+ /// Adds thumbnail toolbar for the specified WPF Control.
+ /// </summary>
+ /// <param name="control">WPF Control for which the thumbnail toolbar buttons need to be added</param>
+ /// <param name="buttons">Thumbnail buttons for the window's thumbnail toolbar</param>
+ /// <exception cref="System.ArgumentException">If the number of buttons exceed the maximum allowed capacity (7).</exception>
+ /// <exception cref="System.ArgumentNullException">If the control passed in null</exception>
+ /// <remarks>After a toolbar has been added to a thumbnail, buttons can be altered only through various
+ /// properties on the ThumbnailToolBarButton. While individual buttons cannot be added or removed,
+ /// they can be shown and hidden through ThumbnailToolBarButton.Visible as needed.
+ /// The toolbar itself cannot be removed without re-creating the window itself.
+ /// </remarks>
+ public void AddButtons(UIElement control, params ThumbnailToolBarButton[] buttons)
+ {
+ if (control == null) { throw new ArgumentNullException("control"); }
+ VerifyButtons(buttons);
+
+ // Add the buttons to our window manager, which will also create a proxy window
+ TaskbarWindowManager.AddThumbnailButtons(control, buttons);
+ }
+
+ private static void VerifyButtons(params ThumbnailToolBarButton[] buttons)
+ {
+ if (buttons != null && buttons.Length == 0)
+ {
+ throw new ArgumentException(LocalizedMessages.ThumbnailToolbarManagerNullEmptyArray, "buttons");
+ }
+ if (buttons.Length > 7)
+ {
+ throw new ArgumentException(LocalizedMessages.ThumbnailToolbarManagerMaxButtons, "buttons");
+ }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/ThumbnailToolbarProxyWindow.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/ThumbnailToolbarProxyWindow.cs
new file mode 100644
index 0000000000..012f0ad355
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/ThumbnailToolbarProxyWindow.cs
@@ -0,0 +1,125 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Windows.Forms;
+using Microsoft.WindowsAPICodePack.Shell.Resources;
+using MS.WindowsAPICodePack.Internal;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ internal class ThumbnailToolbarProxyWindow : NativeWindow, IDisposable
+ {
+ private ThumbnailToolBarButton[] _thumbnailButtons;
+ private IntPtr _internalWindowHandle;
+
+ internal System.Windows.UIElement WindowsControl { get; set; }
+
+ internal IntPtr WindowToTellTaskbarAbout
+ {
+ get
+ {
+ return _internalWindowHandle != IntPtr.Zero ? _internalWindowHandle : this.Handle;
+ }
+ }
+
+ internal TaskbarWindow TaskbarWindow { get; set; }
+
+ internal ThumbnailToolbarProxyWindow(IntPtr windowHandle, ThumbnailToolBarButton[] buttons)
+ {
+ if (windowHandle == IntPtr.Zero)
+ {
+ throw new ArgumentException(LocalizedMessages.CommonFileDialogInvalidHandle, "windowHandle");
+ }
+ if (buttons != null && buttons.Length == 0)
+ {
+ throw new ArgumentException(LocalizedMessages.ThumbnailToolbarManagerNullEmptyArray, "buttons");
+ }
+
+ _internalWindowHandle = windowHandle;
+ _thumbnailButtons = buttons;
+
+ // Set the window handle on the buttons (for future updates)
+ Array.ForEach(_thumbnailButtons, new Action<ThumbnailToolBarButton>(UpdateHandle));
+
+ // Assign the window handle (coming from the user) to this native window
+ // so we can intercept the window messages sent from the taskbar to this window.
+ this.AssignHandle(windowHandle);
+ }
+
+ internal ThumbnailToolbarProxyWindow(System.Windows.UIElement windowsControl, ThumbnailToolBarButton[] buttons)
+ {
+ if (windowsControl == null) { throw new ArgumentNullException("windowsControl"); }
+ if (buttons != null && buttons.Length == 0)
+ {
+ throw new ArgumentException(LocalizedMessages.ThumbnailToolbarManagerNullEmptyArray, "buttons");
+ }
+
+ _internalWindowHandle = IntPtr.Zero;
+ WindowsControl = windowsControl;
+ _thumbnailButtons = buttons;
+
+ // Set the window handle on the buttons (for future updates)
+ Array.ForEach(_thumbnailButtons, new Action<ThumbnailToolBarButton>(UpdateHandle));
+ }
+
+ private void UpdateHandle(ThumbnailToolBarButton button)
+ {
+ button.WindowHandle = _internalWindowHandle;
+ button.AddedToTaskbar = false;
+ }
+
+ protected override void WndProc(ref Message m)
+ {
+ bool handled = false;
+
+ handled = TaskbarWindowManager.DispatchMessage(ref m, this.TaskbarWindow);
+
+ // If it's a WM_Destroy message, then also forward it to the base class (our native window)
+ if ((m.Msg == (int)WindowMessage.Destroy) ||
+ (m.Msg == (int)WindowMessage.NCDestroy) ||
+ ((m.Msg == (int)WindowMessage.SystemCommand) && (((int)m.WParam) == TabbedThumbnailNativeMethods.ScClose)))
+ {
+ base.WndProc(ref m);
+ }
+ else if (!handled)
+ {
+ base.WndProc(ref m);
+ }
+ }
+
+ #region IDisposable Members
+
+ /// <summary>
+ ///
+ /// </summary>
+ ~ThumbnailToolbarProxyWindow()
+ {
+ Dispose(false);
+ }
+
+ /// <summary>
+ /// Release the native objects.
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ public void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ // Dispose managed resources
+
+ // Don't dispose the thumbnail buttons
+ // as they might be used in another window.
+ // Setting them to null will indicate we don't need use anymore.
+ _thumbnailButtons = null;
+ }
+ }
+
+ #endregion
+
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/UserRemovedJumpListItemsEventArg.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/UserRemovedJumpListItemsEventArg.cs
new file mode 100644
index 0000000000..2520f5b1dd
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Taskbar/UserRemovedJumpListItemsEventArg.cs
@@ -0,0 +1,29 @@
+//Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using System.Collections;
+
+namespace Microsoft.WindowsAPICodePack.Taskbar
+{
+ /// <summary>
+ /// Event arguments for when the user is notified of items
+ /// that have been removed from the taskbar destination list
+ /// </summary>
+ public class UserRemovedJumpListItemsEventArgs : EventArgs
+ {
+ private readonly IEnumerable _removedItems;
+
+ internal UserRemovedJumpListItemsEventArgs(IEnumerable RemovedItems)
+ {
+ _removedItems = RemovedItems;
+ }
+
+ /// <summary>
+ /// The collection of removed items based on path.
+ /// </summary>
+ public IEnumerable RemovedItems
+ {
+ get { return _removedItems; }
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/.gitignore b/main/src/addins/WindowsPlatform/WindowsPlatform/.gitignore
index 454fe51708..454fe51708 100644
--- a/main/src/addins/WindowsPlatform/.gitignore
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/.gitignore
diff --git a/main/src/addins/WindowsPlatform/AddinInfo.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/AddinInfo.cs
index 5e380e8435..5e380e8435 100644
--- a/main/src/addins/WindowsPlatform/AddinInfo.cs
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/AddinInfo.cs
diff --git a/main/src/addins/WindowsPlatform/AssemblyInfo.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/AssemblyInfo.cs
index ac26319c43..ac26319c43 100644
--- a/main/src/addins/WindowsPlatform/AssemblyInfo.cs
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/AssemblyInfo.cs
diff --git a/main/src/addins/WindowsPlatform/ChangeLog b/main/src/addins/WindowsPlatform/WindowsPlatform/ChangeLog
index 909021cd2c..909021cd2c 100644
--- a/main/src/addins/WindowsPlatform/ChangeLog
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/ChangeLog
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform/CustomDialogs/CustomCommonFileDialogComboBox.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/CustomDialogs/CustomCommonFileDialogComboBox.cs
new file mode 100644
index 0000000000..f4779063ef
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/CustomDialogs/CustomCommonFileDialogComboBox.cs
@@ -0,0 +1,83 @@
+//
+// CustomCommonFileDialogComboBox.cs
+//
+// Author:
+// Marius Ungureanu <marius.ungureanu@xamarin.com>
+//
+// Copyright (c) 2014 Marius Ungureanu
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using Microsoft.WindowsAPICodePack.Dialogs.Controls;
+using Microsoft.WindowsAPICodePack.Dialogs;
+using System.Diagnostics;
+
+namespace MonoDevelop.Platform
+{
+ public class CustomCommonFileDialogComboBox : CommonFileDialogComboBox
+ {
+ int oldCount;
+
+ public CustomCommonFileDialogComboBox ()
+ {
+ }
+
+ public CustomCommonFileDialogComboBox (string name) : base (name)
+ {
+ }
+
+ internal override void Attach (IFileDialogCustomize dialog)
+ {
+ base.Attach (dialog);
+
+ // Keep track of old selection.
+ SelectedIndexChanged += delegate {
+ oldCount = Items.Count;
+ };
+ }
+
+ internal void Update(IFileDialogCustomize dialog)
+ {
+ Debug.Assert(dialog != null, "CommonFileDialogComboBox.Attach: dialog parameter can not be null");
+
+ // Remove the control items.
+ // Don't do RemoveAllControlItems. It's not implemented natively.
+ for (int index = 0; index < oldCount; ++index)
+ dialog.RemoveControlItem (Id, index);
+
+ // Re-add the combo box items
+ for (int index = 0; index < Items.Count; ++index) {
+ string text = Items [index].Text;
+
+ dialog.AddControlItem (Id, index, text);
+ }
+
+ // If we didn't, go select.
+ if (Enabled) {
+ SelectedIndex = 0;
+ ApplyPropertyChange ("SelectedIndex");
+ }
+
+ oldCount = Items.Count;
+
+ // Sync additional properties
+ SyncUnmanagedProperties ();
+ }
+ }
+}
+
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform/CustomDialogs/CustomCommonOpenFileDialog.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/CustomDialogs/CustomCommonOpenFileDialog.cs
new file mode 100644
index 0000000000..2f60cff9d6
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/CustomDialogs/CustomCommonOpenFileDialog.cs
@@ -0,0 +1,44 @@
+//
+// CustomCommonOpenFileDialog.cs
+//
+// Author:
+// Marius Ungureanu <marius.ungureanu@xamarin.com>
+//
+// Copyright (c) 2014 Marius Ungureanu
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using Microsoft.WindowsAPICodePack.Dialogs;
+
+
+namespace MonoDevelop.Platform
+{
+ public class CustomCommonOpenFileDialog : CommonOpenFileDialog
+ {
+ public override void ApplyControlPropertyChange (string propertyName, DialogControl control)
+ {
+ base.ApplyControlPropertyChange (propertyName, control);
+
+ var combo = control as CustomCommonFileDialogComboBox;
+ if (combo != null && propertyName == "Items")
+ combo.Update (customize);
+ }
+ }
+}
+
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/AddFileDialogHandler.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/AddFileDialogHandler.cs
new file mode 100644
index 0000000000..3b9b251f4c
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/AddFileDialogHandler.cs
@@ -0,0 +1,73 @@
+//
+// AddFileDialogHandler.cs
+//
+// Authors:
+// Carlos Alberto Cortez <calberto.cortez@gmail.com>
+// Michael Hutchinson <m.j.hutchinson@gmail.com>
+// Marius Ungureanu <marius.ungureanu@xamarin.com>
+//
+// Copyright (c) 2011 Novell, Inc. (http://wwww.novell.com)
+// Copyright (C) 2014 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using MonoDevelop.Ide;
+using MonoDevelop.Ide.Extensions;
+using MonoDevelop.Platform;
+using Microsoft.WindowsAPICodePack.Dialogs;
+using Microsoft.WindowsAPICodePack.Dialogs.Controls;
+using MonoDevelop.Core;
+
+namespace MonoDevelop.Platform
+{
+ class AddFileDialogHandler: IAddFileDialogHandler
+ {
+ public bool Run (AddFileDialogData data)
+ {
+ var parent = data.TransientFor ?? MessageService.RootWindow;
+ var dialog = new CommonOpenFileDialog ();
+ SelectFileDialogHandler.SetCommonFormProperties (data, dialog);
+
+ var buildActionCombo = new CommonFileDialogComboBox ();
+ var group = new CommonFileDialogGroupBox ("overridebuildaction", "Override build action:");
+ buildActionCombo.Items.Add (new CommonFileDialogComboBoxItem (GettextCatalog.GetString ("Default")));
+ foreach (var ba in data.BuildActions) {
+ if (ba == "--")
+ continue;
+
+ buildActionCombo.Items.Add (new CommonFileDialogComboBoxItem (ba));
+ }
+
+ buildActionCombo.SelectedIndex = 0;
+ group.Items.Add (buildActionCombo);
+ dialog.Controls.Add (group);
+
+ if (!GdkWin32.RunModalWin32Dialog (dialog, parent))
+ return false;
+
+ SelectFileDialogHandler.GetCommonFormProperties (data, dialog);
+ var idx = buildActionCombo.SelectedIndex;
+ if (idx > 0)
+ data.OverrideAction = buildActionCombo.Items [idx].Text;
+
+ return true;
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/OpenFileDialogHandler.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/OpenFileDialogHandler.cs
new file mode 100644
index 0000000000..f6f0f6d0ab
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/OpenFileDialogHandler.cs
@@ -0,0 +1,245 @@
+//
+// OpenFileDialogHandler.cs
+//
+// Authors:
+// Carlos Alberto Cortez <calberto.cortez@gmail.com>
+// Michael Hutchinson <m.j.hutchinson@gmail.com>
+// Marius Ungureanu <marius.ungureanu@xamarin.com>
+//
+// Copyright (c) 2011 Novell, Inc.
+// Copyright (C) 2014 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using Microsoft.WindowsAPICodePack.Dialogs;
+using Microsoft.WindowsAPICodePack.Dialogs.Controls;
+using MonoDevelop.Core;
+using MonoDevelop.Ide;
+using MonoDevelop.Ide.Extensions;
+using MonoDevelop.Ide.Gui;
+using MonoDevelop.Projects.Text;
+using Microsoft.WindowsAPICodePack.Shell;
+using System.Windows;
+using Gtk;
+
+namespace MonoDevelop.Platform
+{
+ public class OpenFileDialogHandler : IOpenFileDialogHandler
+ {
+ public bool Run (OpenFileDialogData data)
+ {
+ var parent = data.TransientFor ?? MessageService.RootWindow;
+ CommonFileDialog dialog;
+ if (data.Action == FileChooserAction.Open)
+ dialog = new CustomCommonOpenFileDialog ();
+ else
+ dialog = new CommonSaveFileDialog ();
+
+ SelectFileDialogHandler.SetCommonFormProperties (data, dialog);
+
+ CustomCommonFileDialogComboBox encodingCombo = null;
+ if (data.ShowEncodingSelector) {
+ var group = new CommonFileDialogGroupBox ("encoding", "Encoding:");
+ encodingCombo = new CustomCommonFileDialogComboBox ();
+
+ BuildEncodingsCombo (encodingCombo, data.Action != FileChooserAction.Save, data.Encoding);
+ group.Items.Add (encodingCombo);
+ dialog.Controls.Add (group);
+
+ encodingCombo.SelectedIndexChanged += (sender, e) => {
+ if (encodingCombo.SelectedIndex == encodingCombo.Items.Count - 1) {
+ var dlg = new System.Windows.Window {
+ Title = "Choose encodings",
+ Content = new SelectEncodingControl(),
+ SizeToContent = SizeToContent.WidthAndHeight
+ };
+ if (dlg.ShowDialog ().Value) {
+ BuildEncodingsCombo (encodingCombo, data.Action != FileChooserAction.Save, data.Encoding);
+ dialog.ApplyControlPropertyChange ("Items", encodingCombo);
+ }
+ }
+ };
+ }
+
+ CustomCommonFileDialogComboBox viewerCombo = null;
+ CommonFileDialogCheckBox closeSolution = null;
+ if (data.ShowViewerSelector && data.Action == FileChooserAction.Open) {
+ var group = new CommonFileDialogGroupBox ("openWith", "Open with:");
+
+ viewerCombo = new CustomCommonFileDialogComboBox {
+ Enabled = false
+ };
+ group.Items.Add (viewerCombo);
+ dialog.Controls.Add (group);
+
+ if (IdeApp.Workspace.IsOpen) {
+ var group2 = new CommonFileDialogGroupBox ();
+
+ // "Close current workspace" is too long and splits the text on 2 lines.
+ closeSolution = new CommonFileDialogCheckBox ("Close workspace", true) {
+ Visible = false
+ };
+ group2.Items.Add (closeSolution);
+ dialog.Controls.Add (group2);
+ }
+
+ dialog.SelectionChanged += (sender, e) => {
+ try {
+ var files = GetSelectedItems (dialog);
+ var file = files.Count == 0 ? null : files[0];
+ bool hasBench = FillViewers (viewerCombo, file);
+ if (closeSolution != null)
+ closeSolution.Visible = hasBench;
+ dialog.ApplyControlPropertyChange ("Items", viewerCombo);
+ } catch (Exception ex) {
+ LoggingService.LogError (e.ToString ());
+ }
+ };
+ }
+
+ if (!GdkWin32.RunModalWin32Dialog (dialog, parent))
+ return false;
+
+ SelectFileDialogHandler.GetCommonFormProperties (data, dialog);
+ if (encodingCombo != null)
+ data.Encoding = ((EncodingComboItem)encodingCombo.Items [encodingCombo.SelectedIndex]).Encoding;
+
+ if (viewerCombo != null) {
+ if (closeSolution != null)
+ data.CloseCurrentWorkspace = closeSolution.Visible && closeSolution.IsChecked;
+ data.SelectedViewer = ((ViewerComboItem)viewerCombo.Items [viewerCombo.SelectedIndex]).Viewer;
+ }
+
+ return true;
+ }
+
+ //for some reason, the API pack doesn't expose this method from the COM interface
+ static List<string> GetSelectedItems (CommonFileDialog dialog)
+ {
+ var filenames = new List<string> ();
+ var nativeDialog = (IFileOpenDialog)dialog.nativeDialog;
+ IShellItemArray resultsArray;
+ uint count;
+
+ try {
+ nativeDialog.GetSelectedItems (out resultsArray);
+ } catch (Exception ex) {
+ //we get E_FAIL when there is no selection
+ var ce = ex.InnerException as COMException;
+ if (ce != null && ce.ErrorCode == -2147467259)
+ return filenames;
+ throw;
+ }
+
+ var hr = (int)resultsArray.GetCount (out count);
+ if (hr != 0)
+ throw Marshal.GetExceptionForHR (hr);
+
+ for (int i = 0; i < count; ++i) {
+ var item = CommonFileDialog.GetShellItemAt (resultsArray, i);
+ string val = CommonFileDialog.GetFileNameFromShellItem (item);
+ filenames.Add (val);
+ }
+
+ return filenames;
+ }
+
+ static void BuildEncodingsCombo (CustomCommonFileDialogComboBox combo, bool showAutoDetected, Encoding selectedEncoding)
+ {
+ combo.Items.Clear ();
+ int i = 0;
+
+ if (showAutoDetected) {
+ combo.Items.Add (new EncodingComboItem (null, GettextCatalog.GetString ("Auto Detected")));
+ combo.SelectedIndex = 0;
+ i = 1;
+ }
+
+ var encodings = TextEncoding.ConversionEncodings;
+ foreach (var e in encodings) {
+ var mdEnc = TextEncoding.SupportedEncodings.FirstOrDefault (t => t.CodePage == e.CodePage);
+ string name = mdEnc != null
+ ? mdEnc.Name + " (" + mdEnc.Id + ")"
+ : e.Name + " (" + e.Id + ")";
+ var item = new EncodingComboItem (Encoding.GetEncoding (e.CodePage), name);
+ combo.Items.Add (item);
+ if (e.Equals (selectedEncoding))
+ combo.SelectedIndex = i;
+ i++;
+ }
+ if (combo.SelectedIndex == -1)
+ combo.SelectedIndex = 0;
+ combo.Items.Add (new EncodingComboItem (null, GettextCatalog.GetString ("Add or Remove...")));
+ }
+
+ class EncodingComboItem : CommonFileDialogComboBoxItem
+ {
+ public EncodingComboItem (Encoding encoding, string label) : base (label)
+ {
+ Encoding = encoding;
+ }
+
+ public Encoding Encoding {
+ get; private set;
+ }
+ }
+
+ static bool FillViewers (CustomCommonFileDialogComboBox combo, string fileName)
+ {
+ combo.Items.Clear ();
+
+ if (String.IsNullOrEmpty (fileName) || Directory.Exists (fileName)) {
+ combo.Enabled = false;
+ return false;
+ }
+
+ bool hasBench = false;
+ var projectService = IdeApp.Services.ProjectService;
+ if (projectService.IsWorkspaceItemFile (fileName) || projectService.IsSolutionItemFile (fileName)) {
+ hasBench = true;
+ combo.Items.Add (new ViewerComboItem (null, GettextCatalog.GetString ("Solution Workbench")));
+ }
+
+ foreach (var vw in DisplayBindingService.GetFileViewers (fileName, null))
+ if (!vw.IsExternal)
+ combo.Items.Add (new ViewerComboItem (vw, vw.Title));
+
+ combo.Enabled = combo.Items.Count >= 1;
+ return hasBench;
+ }
+
+ class ViewerComboItem : CommonFileDialogComboBoxItem
+ {
+ public ViewerComboItem (FileViewer viewer, string label) : base (label)
+ {
+ Viewer = viewer;
+ }
+
+ public FileViewer Viewer {
+ get; private set;
+ }
+ }
+ }
+}
+
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/SelectEncodingControl.xaml b/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/SelectEncodingControl.xaml
new file mode 100644
index 0000000000..c4485e1df4
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/SelectEncodingControl.xaml
@@ -0,0 +1,67 @@
+<UserControl x:Class="MonoDevelop.Platform.SelectEncodingControl"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ mc:Ignorable="d"
+ d:DesignHeight="400" d:DesignWidth="600">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="30*"/>
+ <ColumnDefinition Width="31*"/>
+ <ColumnDefinition Width="90*"/>
+ <ColumnDefinition Width="102*"/>
+ <ColumnDefinition Width="347*"/>
+ </Grid.ColumnDefinitions>
+ <Label Content="Available encodings" HorizontalAlignment="Left" Margin="12,12,0,348" Grid.ColumnSpan="3"/>
+ <ListBox Name="availableLst" Loaded="availableLst_Loaded" SelectionChanged="ListBox_SelectionChanged" HorizontalAlignment="Left"
+ Height="300" Margin="10,52,0,0" VerticalAlignment="Top" Width="235" Grid.ColumnSpan="4">
+ <ListBox.ItemTemplate>
+ <DataTemplate>
+ <TextBlock>
+ <TextBlock.Text>
+ <MultiBinding StringFormat="{}{0} ({1})">
+ <Binding Path="Name"/>
+ <Binding Path="Id"/>
+ </MultiBinding>
+ </TextBlock.Text>
+ </TextBlock>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
+ <Label Content="Encodings shown in menu" HorizontalAlignment="Left" Margin="57,12,0,348" Grid.Column="4"/>
+ <ListBox Name="shownLst" Loaded="shownLst_Loaded" SelectionChanged="ListBox_SelectionChanged" HorizontalAlignment="Left"
+ Height="300" Margin="57,52,0,0" VerticalAlignment="Top" Width="235" Grid.Column="4">
+ <ListBox.ItemTemplate>
+ <DataTemplate>
+ <TextBlock>
+ <TextBlock.Text>
+ <MultiBinding StringFormat="{}{0} ({1})">
+ <Binding Path="Name"/>
+ <Binding Path="Id"/>
+ </MultiBinding>
+ </TextBlock.Text>
+ </TextBlock>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
+ <Button Name="btnUp" Margin="305,150,10,0" VerticalAlignment="Top" Grid.Column="4" Width="32" Height="32"
+ Click="btnUp_Click">
+ <Path Fill="Black" Data="M 0 6 L 12 6 L 6 0 Z"/>
+ </Button>
+ <Button Name="btnDown" Margin="305,218,10,0" VerticalAlignment="Top" Grid.Column="4" Height="32"
+ Click="btnDown_Click">
+ <Path Fill="Black" Data="M 6 6 L 0 0 L 12 0 Z"/>
+ </Button>
+ <Button Name="btnRight" HorizontalAlignment="Left" Margin="10,150,0,218" Width="32" Grid.Column="4"
+ Click="btnRight_Click">
+ <Path Fill="Black" Data="M 6 6 L 0 0 L 0 12 Z"/>
+ </Button>
+ <Button Name="btnLeft" HorizontalAlignment="Left" Margin="10,218,0,150" Width="32" Grid.Column="4"
+ Click="btnLeft_Click">
+ <Path Fill="Black" Data="M 0 6 L 6 12 L 6 0 Z"/>
+ </Button>
+ <Button Click="btnOk_Click" Content="Ok" Grid.Column="4" Margin="264,368,10,12"/>
+ <Button Click="btnCancel_Click" Content="Cancel" Grid.Column="4" Margin="172,368,100,12"/>
+ </Grid>
+</UserControl>
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/SelectEncodingControl.xaml.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/SelectEncodingControl.xaml.cs
new file mode 100644
index 0000000000..8420545630
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/SelectEncodingControl.xaml.cs
@@ -0,0 +1,84 @@
+using MonoDevelop.Projects.Text;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+using MonoDevelop.Ide;
+
+namespace MonoDevelop.Platform
+{
+ /// <summary>
+ /// Interaction logic for SelectEncodingControl.xaml
+ /// </summary>
+ public partial class SelectEncodingControl : UserControl
+ {
+ public SelectEncodingControl ()
+ {
+ InitializeComponent ();
+ DataContext = this;
+ }
+
+ readonly ObservableCollection<TextEncoding> AvailableEncodings = new ObservableCollection<TextEncoding> (TextEncoding.SupportedEncodings);
+ readonly ObservableCollection<TextEncoding> ShownEncodings = new ObservableCollection<TextEncoding> (TextEncoding.ConversionEncodings);
+
+ void ListBox_SelectionChanged (object sender, SelectionChangedEventArgs e)
+ {
+ UpdateButtons ();
+ }
+
+ void shownLst_Loaded (object sender, RoutedEventArgs e)
+ {
+ availableLst.ItemsSource = AvailableEncodings;
+ UpdateButtons ();
+ }
+
+ void availableLst_Loaded (object sender, RoutedEventArgs e)
+ {
+ shownLst.ItemsSource = ShownEncodings;
+ UpdateButtons ();
+ }
+
+ void UpdateButtons ()
+ {
+ btnLeft.IsEnabled = shownLst.SelectedIndex != -1;
+ btnRight.IsEnabled = availableLst.SelectedIndex != -1;
+ btnUp.IsEnabled = shownLst.SelectedIndex != -1 && shownLst.SelectedIndex != 0;
+ btnDown.IsEnabled = shownLst.SelectedIndex != -1 && shownLst.SelectedIndex != ShownEncodings.Count - 1;
+ }
+
+ void btnDown_Click (object sender, RoutedEventArgs e)
+ {
+ ShownEncodings.Move (shownLst.SelectedIndex, shownLst.SelectedIndex + 1);
+ }
+
+ void btnUp_Click (object sender, RoutedEventArgs e)
+ {
+ ShownEncodings.Move (shownLst.SelectedIndex, shownLst.SelectedIndex - 1);
+ }
+
+ void btnRight_Click (object sender, RoutedEventArgs e)
+ {
+ ShownEncodings.Add ((TextEncoding)availableLst.SelectedItem);
+ AvailableEncodings.RemoveAt (availableLst.SelectedIndex);
+ }
+
+ void btnLeft_Click (object sender, RoutedEventArgs e)
+ {
+ AvailableEncodings.Add ((TextEncoding)shownLst.SelectedItem);
+ ShownEncodings.RemoveAt (shownLst.SelectedIndex);
+ }
+
+ void btnOk_Click (object sender, RoutedEventArgs e)
+ {
+ TextEncoding.ConversionEncodings = ShownEncodings.ToArray ();
+ ((Window)Parent).DialogResult = true;
+ ((Window)Parent).Close ();
+ }
+
+ void btnCancel_Click (object sender, RoutedEventArgs e)
+ {
+ ((Window)Parent).DialogResult = false;
+ ((Window)Parent).Close ();
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/SelectFileDialogHandler.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/SelectFileDialogHandler.cs
new file mode 100644
index 0000000000..a134c76a05
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/SelectFileDialogHandler.cs
@@ -0,0 +1,130 @@
+//
+// SelectFileDialogHandler.cs
+//
+// Author:
+// Carlos Alberto Cortez <calberto.cortez@gmail.com>
+// Michael Hutchinson <m.j.hutchinson@gmail.com>
+// Marius Ungureanu <marius.ungureanu@xamarin.com>
+//
+// Copyright (c) 2011 Novell, Inc. (http://wwww.novell.com)
+// Copyright (C) 2014 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.IO;
+using System.Linq;
+using Gtk;
+using Microsoft.WindowsAPICodePack.Dialogs;
+using MonoDevelop.Components.Extensions;
+using MonoDevelop.Core;
+using MonoDevelop.Ide;
+
+namespace MonoDevelop.Platform
+{
+ class SelectFileDialogHandler : ISelectFileDialogHandler
+ {
+ public bool Run (SelectFileDialogData data)
+ {
+ var parent = data.TransientFor ?? MessageService.RootWindow;
+
+ CommonFileDialog dialog;
+ if (data.Action == FileChooserAction.Open || data.Action == FileChooserAction.SelectFolder)
+ dialog = new CustomCommonOpenFileDialog ();
+ else
+ dialog = new CommonSaveFileDialog ();
+
+ SetCommonFormProperties (data, dialog);
+
+ if (!GdkWin32.RunModalWin32Dialog (dialog, parent))
+ return false;
+
+ GetCommonFormProperties (data, dialog);
+
+ return true;
+ }
+
+ internal static void SetCommonFormProperties (SelectFileDialogData data, CommonFileDialog dialog)
+ {
+ if (!string.IsNullOrEmpty (data.Title))
+ dialog.Title = data.Title;
+
+ dialog.InitialDirectory = data.CurrentFolder;
+
+ var fileDialog = dialog as CommonOpenFileDialog;
+ if (fileDialog != null) {
+ fileDialog.Multiselect = data.SelectMultiple;
+ if (data.Action == FileChooserAction.SelectFolder) {
+ fileDialog.IsFolderPicker = true;
+ return;
+ }
+ }
+
+ SetFilters (data, dialog);
+
+ dialog.DefaultFileName = data.InitialFileName;
+ }
+
+ internal static void GetCommonFormProperties (SelectFileDialogData data, CommonFileDialog dialog)
+ {
+ var fileDialog = dialog as CommonOpenFileDialog;
+ if (fileDialog != null)
+ data.SelectedFiles = fileDialog.FileNames.Select (f => (FilePath) f).ToArray ();
+ else
+ data.SelectedFiles = new[] {(FilePath) dialog.FileName};
+ }
+
+ static void SetFilters (SelectFileDialogData data, CommonFileDialog dialog)
+ {
+ foreach (var f in data.Filters)
+ dialog.Filters.Add (new CommonFileDialogFilter (f.Name, string.Join (",", f.Patterns)));
+
+ SetDefaultExtension (data, dialog);
+ }
+
+ static void SetDefaultExtension (SelectFileDialogData data, CommonFileDialog dialog)
+ {
+ var defExt = data.DefaultFilter == null ? null : data.DefaultFilter.Patterns.FirstOrDefault ();
+ if (defExt == null)
+ return;
+
+ // FileDialog doesn't show the file extension when saving a file,
+ // so we try to look for the precise filter if none was specified.
+ if (!string.IsNullOrEmpty (data.InitialFileName) && data.Action == FileChooserAction.Save && defExt == "*") {
+ string ext = Path.GetExtension (data.InitialFileName);
+ if (!string.IsNullOrEmpty (ext)) {
+ var pattern = "*" + ext;
+ foreach (var f in data.Filters) {
+ foreach (var p in f.Patterns) {
+ if (string.Equals (p, pattern, StringComparison.OrdinalIgnoreCase)) {
+ dialog.DefaultExtension = p.TrimStart ('*', '.');
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ defExt = defExt.Trim();
+ defExt = defExt.Replace("*.", null);
+ defExt = defExt.Replace(".", null);
+
+ dialog.DefaultExtension = defExt;
+ }
+ }
+}
diff --git a/main/src/addins/WindowsPlatform/Enums.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/Enums.cs
index 489c9def44..489c9def44 100644
--- a/main/src/addins/WindowsPlatform/Enums.cs
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/Enums.cs
diff --git a/main/src/addins/WindowsPlatform/GdkWin32.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/GdkWin32.cs
index 0f2719a014..b6b1171cab 100644
--- a/main/src/addins/WindowsPlatform/GdkWin32.cs
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/GdkWin32.cs
@@ -25,18 +25,20 @@
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using System.Windows.Forms;
-using Microsoft.WindowsAPICodePack.Dialogs;
+//
+
+using System;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Windows.Forms;
+using Microsoft.WindowsAPICodePack.Dialogs;
using MonoDevelop.Core;
-using CustomControls.OS;
-
-namespace MonoDevelop.Platform
-{
+using CustomControls.OS;
+using System.Windows;
+using System.Windows.Interop;
+
+namespace MonoDevelop.Platform
+{
public static class GdkWin32
{
static readonly uint GotGdkEventsMessage = RegisterWindowMessage ("GDK_WIN32_GOT_EVENTS");
@@ -74,36 +76,63 @@ namespace MonoDevelop.Platform
public static bool RunModalWin32Dialog (CommonFileDialog dialog, Gtk.Window parent)
{
- while (Gtk.Application.EventsPending ())
+ while (Gtk.Application.EventsPending ())
+ Gtk.Application.RunIteration ();
+
+ IntPtr ph = HgdiobjGet (parent.GdkWindow);
+
+ IntPtr hdlg = IntPtr.Zero;
+ dialog.DialogOpening += delegate {
+ try {
+ hdlg = GetDialogHandle (dialog);
+ SetGtkDialogHook (hdlg);
+ } catch (Exception ex) {
+ LoggingService.LogError ("Failed to hook win32 dialog messages", ex);
+ }
+ };
+
+ bool result;
+ try {
+ result = dialog.ShowDialog (ph) == CommonFileDialogResult.Ok;
+ } finally {
+ if (hdlg != IntPtr.Zero)
+ ClearGtkDialogHook (hdlg);
+ }
+ return result;
+ }
+
+ public static bool RunModalWPFDialog (Window dialog, Gtk.Window parent)
+ {
+ while (Gtk.Application.EventsPending ())
Gtk.Application.RunIteration ();
- IntPtr ph = HgdiobjGet (parent.GdkWindow);
-
- IntPtr hdlg = IntPtr.Zero;
- dialog.DialogOpening += delegate {
- try {
- hdlg = GetDialogHandle (dialog);
- SetGtkDialogHook (hdlg);
- } catch (Exception ex) {
- LoggingService.LogError ("Failed to hook win32 dialog messages", ex);
- }
- };
-
- bool result;
- try {
- result = dialog.ShowDialog (ph) == CommonFileDialogResult.Ok;
- } finally {
- if (hdlg != IntPtr.Zero)
- ClearGtkDialogHook (hdlg);
- }
- return result;
+ IntPtr ph = HgdiobjGet (parent.GdkWindow);
+
+ IntPtr hdlg = IntPtr.Zero;
+ dialog.Loaded += delegate {
+ try {
+ hdlg = new WindowInteropHelper (dialog).Handle;
+ SetGtkDialogHook (hdlg);
+ } catch (Exception ex) {
+ LoggingService.LogError ("Failed to hook win32 dialog messages", ex);
+ }
+ };
+
+ bool result;
+ try {
+ result = dialog.ShowDialog ().Value;
+ } finally {
+ if (hdlg != IntPtr.Zero)
+ ClearGtkDialogHook (hdlg);
+ }
+ return result;
}
internal class SpecialForm : Form
- {
- public virtual DialogResult ShowMagicDialog ()
- {
- return ShowDialog ();
+ {
+ public virtual DialogResult ShowMagicDialog ()
+ {
+ return ShowDialog ();
}
protected override void WndProc (ref Message m)
@@ -143,89 +172,89 @@ namespace MonoDevelop.Platform
}
// logic based on run_mainloop_hook in gtkprintoperation-win32.c
- static IntPtr GtkWindowProc (IntPtr hdlg, uint uiMsg, IntPtr wParam, IntPtr lParam)
- {
- if (uiMsg == GotGdkEventsMessage) {
- while (Gtk.Application.EventsPending ())
- Gtk.Application.RunIteration ();
- return IntPtr.Zero;
- }
- return CallWindowProc (dialogWndProc, hdlg, uiMsg, wParam, lParam);
+ static IntPtr GtkWindowProc (IntPtr hdlg, uint uiMsg, IntPtr wParam, IntPtr lParam)
+ {
+ if (uiMsg == GotGdkEventsMessage) {
+ while (Gtk.Application.EventsPending ())
+ Gtk.Application.RunIteration ();
+ return IntPtr.Zero;
+ }
+ return CallWindowProc (dialogWndProc, hdlg, uiMsg, wParam, lParam);
}
- static IntPtr GetDialogHandle (CommonFileDialog dialog)
- {
- var f = typeof (CommonFileDialog).GetField ("nativeDialog", BindingFlags.NonPublic | BindingFlags.Instance);
- var obj = f.GetValue (dialog);
- var ow = (IOleWindow) obj;
- IntPtr handle;
- var hr = ow.GetWindow (out handle);
- if (hr != 0)
- throw Marshal.GetExceptionForHR (hr);
- return handle;
+ static IntPtr GetDialogHandle (CommonFileDialog dialog)
+ {
+ var f = typeof (CommonFileDialog).GetField ("nativeDialog", BindingFlags.NonPublic | BindingFlags.Instance);
+ var obj = f.GetValue (dialog);
+ var ow = (IOleWindow) obj;
+ IntPtr handle;
+ var hr = ow.GetWindow (out handle);
+ if (hr != 0)
+ throw Marshal.GetExceptionForHR (hr);
+ return handle;
}
- static void SetGtkDialogHook (IntPtr hdlg, bool overrideWndProc = true)
- {
- if (dialogHookSet)
- throw new InvalidOperationException ("There is already an active hook");
- gdk_win32_set_modal_dialog_libgtk_only (hdlg);
+ static void SetGtkDialogHook (IntPtr hdlg, bool overrideWndProc = true)
+ {
+ if (dialogHookSet)
+ throw new InvalidOperationException ("There is already an active hook");
+ gdk_win32_set_modal_dialog_libgtk_only (hdlg);
dialogHookSet = true;
- if (overrideWndProc) {
+ if (overrideWndProc) {
dialogWndProc = GetWindowLongPtr (hdlg, DWLP_DLGPROC);
SetWindowLongPtr (hdlg, DWLP_DLGPROC, Marshal.GetFunctionPointerForDelegate (GtkWindowProcDelegate));
- }
+ }
}
- static void ClearGtkDialogHook (IntPtr hdlg)
- {
- gdk_win32_set_modal_dialog_libgtk_only (IntPtr.Zero);
- if (dialogWndProc != IntPtr.Zero) {
+ static void ClearGtkDialogHook (IntPtr hdlg)
+ {
+ gdk_win32_set_modal_dialog_libgtk_only (IntPtr.Zero);
+ if (dialogWndProc != IntPtr.Zero) {
SetWindowLongPtr (hdlg, DWLP_DLGPROC, dialogWndProc);
dialogWndProc = IntPtr.Zero;
- }
- dialogHookSet = false;
+ }
+ dialogHookSet = false;
}
static IntPtr dialogWndProc;
- static bool dialogHookSet;
-
+ static bool dialogHookSet;
+
static readonly WindowProc GtkWindowProcDelegate = GtkWindowProc;
static readonly int DWLP_DLGPROC = IntPtr.Size; // DWLP_MSGRESULT + sizeof(LRESULT);
- [DllImport(Win32.USER32)]
- static extern IntPtr CallWindowProc (IntPtr lpPrevWndFunc, IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
-
- static IntPtr SetWindowLongPtr (IntPtr hWnd, int nIndex, IntPtr dwNewLong)
- {
- if (IntPtr.Size == 4)
- return SetWindowLongPtr32 (hWnd, nIndex, dwNewLong);
- return SetWindowLongPtr64 (hWnd, nIndex, dwNewLong);
- }
-
- [DllImport (Win32.USER32, EntryPoint="SetWindowLongPtr")]
+ [DllImport(Win32.USER32)]
+ static extern IntPtr CallWindowProc (IntPtr lpPrevWndFunc, IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
+
+ static IntPtr SetWindowLongPtr (IntPtr hWnd, int nIndex, IntPtr dwNewLong)
+ {
+ if (IntPtr.Size == 4)
+ return SetWindowLongPtr32 (hWnd, nIndex, dwNewLong);
+ return SetWindowLongPtr64 (hWnd, nIndex, dwNewLong);
+ }
+
+ [DllImport (Win32.USER32, EntryPoint="SetWindowLongPtr")]
static extern IntPtr SetWindowLongPtr64 (IntPtr hWnd, int nIndex, IntPtr dwNewLong);
- [DllImport(Win32.USER32, EntryPoint="SetWindowLong")]
- static extern IntPtr SetWindowLongPtr32 (IntPtr hWnd, int nIndex, IntPtr dwNewLong);
-
- static IntPtr GetWindowLongPtr (IntPtr hWnd, int nIndex)
- {
- if (IntPtr.Size == 4)
- return GetWindowLongPtr32 (hWnd, nIndex);
- return GetWindowLongPtr64 (hWnd, nIndex);
- }
-
- [DllImport (Win32.USER32, EntryPoint="GetWindowLongPtr")]
+ [DllImport(Win32.USER32, EntryPoint="SetWindowLong")]
+ static extern IntPtr SetWindowLongPtr32 (IntPtr hWnd, int nIndex, IntPtr dwNewLong);
+
+ static IntPtr GetWindowLongPtr (IntPtr hWnd, int nIndex)
+ {
+ if (IntPtr.Size == 4)
+ return GetWindowLongPtr32 (hWnd, nIndex);
+ return GetWindowLongPtr64 (hWnd, nIndex);
+ }
+
+ [DllImport (Win32.USER32, EntryPoint="GetWindowLongPtr")]
static extern IntPtr GetWindowLongPtr64 (IntPtr hWnd, int nIndex);
- [DllImport(Win32.USER32, EntryPoint="GetWindowLong")]
+ [DllImport(Win32.USER32, EntryPoint="GetWindowLong")]
static extern IntPtr GetWindowLongPtr32 (IntPtr hWnd, int nIndex);
delegate IntPtr WindowProc (IntPtr hdlg, uint uiMsg, IntPtr wParam, IntPtr lParam);
- }
-
-
+ }
+
+
[ComImport]
[Guid("00000114-0000-0000-C000-000000000046")]
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
@@ -255,7 +284,7 @@ namespace MonoDevelop.Platform
int Show ([In] IntPtr parent);
}
- public class GtkWin32Proxy : IWin32Window
+ public class GtkWin32Proxy : System.Windows.Forms.IWin32Window
{
public GtkWin32Proxy (Gtk.Window gtkWindow)
{
@@ -263,5 +292,5 @@ namespace MonoDevelop.Platform
}
public IntPtr Handle { get; private set; }
- }
+ }
} \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/JumpList.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/JumpList.cs
index 3a3a442a92..3a3a442a92 100644
--- a/main/src/addins/WindowsPlatform/JumpList.cs
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/JumpList.cs
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform/Makefile.am b/main/src/addins/WindowsPlatform/WindowsPlatform/Makefile.am
new file mode 100644
index 0000000000..24e07e9bf5
--- /dev/null
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/Makefile.am
@@ -0,0 +1,5 @@
+include $(top_srcdir)/xbuild.include
+
+if ! ENABLE_WINDOWSPLATFORM
+SKIP=y
+endif
diff --git a/main/src/addins/WindowsPlatform/RecentFiles.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/RecentFiles.cs
index 907295feca..907295feca 100644
--- a/main/src/addins/WindowsPlatform/RecentFiles.cs
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/RecentFiles.cs
diff --git a/main/src/addins/WindowsPlatform/Win32.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/Win32.cs
index a60ea0ad4e..d6a21f261e 100644
--- a/main/src/addins/WindowsPlatform/Win32.cs
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/Win32.cs
@@ -36,6 +36,7 @@ namespace CustomControls.OS
public const uint FILE_ATTRIBUTES_NORMAL = 0x80;
internal const string USER32 = "user32.dll";
internal const string SHELL32 = "shell32.dll";
+ internal const string SHLWAPI = "Shlwapi.dll";
#region Delegates
public delegate bool EnumWindowsCallBack(IntPtr hWnd, int lParam);
@@ -97,6 +98,9 @@ namespace CustomControls.OS
[DllImport(Win32.SHELL32, CharSet = CharSet.Unicode)]
public static extern IntPtr SHGetFileInfoW([In] string pszPath, uint dwFileAttributes, [In, Out] ref SHFILEINFO psfi, uint cbSizeFileInfo, uint uFlags);
#endregion
+
+ [DllImport (Win32.SHLWAPI, SetLastError = true, CharSet = CharSet.Unicode)]
+ public static extern int AssocQueryStringW (AssociationFlags flags, AssociationString str, string assoc, string extra, StringBuilder outBuffer, ref int outBufferSize);
}
[AttributeUsage(AttributeTargets.Class |
@@ -113,4 +117,46 @@ namespace CustomControls.OS
}
#endregion
}
+
+ [Flags]
+ public enum AssociationFlags {
+ None = 0x00000000,
+ InitNoRemapClsid = 0x00000001,
+ InitByExeName = 0x00000002,
+ OpenByExeName = 0x00000002,
+ InitDefaultToStar = 0x00000004,
+ InitDefaultToFolder = 0x00000008,
+ NoUserSettings = 0x00000010,
+ NoTruncate = 0x00000020,
+ Verify = 0x00000040,
+ RemapRunDll = 0x00000080,
+ NoFixups = 0x00000100,
+ IgnoreBaseClass = 0x00000200,
+ InitIgnoreUnknown = 0x00000400,
+ InitFixedProgid = 0x00000800,
+ IsProtocol = 0x00001000
+ }
+
+ public enum AssociationString {
+ Command = 1,
+ Executable,
+ FriendlyDocName,
+ FriendlyAppName,
+ NoOpen,
+ ShellNewValue,
+ DdeCommand,
+ DdeIfExec,
+ DdeApplication,
+ DdeTopic,
+ InfoTip,
+ QuickTip,
+ Tileinfo,
+ ContentType,
+ DefaultIcon,
+ ShellExtension,
+ DropTrget,
+ DelegateExecute,
+ SupportedUriProtocols,
+ MaxString
+ }
}
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform.addin.xml b/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.addin.xml
index 9339f30ebd..eb5e33cc5f 100644
--- a/main/src/addins/WindowsPlatform/WindowsPlatform.addin.xml
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.addin.xml
@@ -15,12 +15,12 @@
<Extension path = "/MonoDevelop/Core/PasswordProvider">
<Class class = "MonoDevelop.Platform.Windows.WindowsSecureStoragePasswordProvider" />
</Extension>
-<!--
- <Extension path = "/MonoDevelop/Components/DialogHandlers">
- <Class class = "MonoDevelop.Platform.SelectFileDialogHandler"/>
- <Class class = "MonoDevelop.Platform.AddFileDialogHandler"/>
- <Class class = "MonoDevelop.Platform.OpenFileDialogHandler"/>
- </Extension>
--->
+ <Extension path = "/MonoDevelop/Components/DialogHandlers">
+ <Condition id="Platform" value="windows" minVersion="6.0">
+ <Class class = "MonoDevelop.Platform.SelectFileDialogHandler"/>
+ <Class class = "MonoDevelop.Platform.AddFileDialogHandler"/>
+ <Class class = "MonoDevelop.Platform.OpenFileDialogHandler"/>
+ </Condition>
+ </Extension>
</ExtensionModel>
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.cs
index 0e6a9ece4d..4392189f51 100644
--- a/main/src/addins/WindowsPlatform/WindowsPlatform.cs
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.cs
@@ -235,5 +235,162 @@ namespace MonoDevelop.Platform
{
return new WindowsRecentFiles ();
}
+
+ public static string QueryAssociationString (string assoc, AssociationString str, AssociationFlags flags, string extra = null)
+ {
+ if (assoc == null)
+ throw new ArgumentNullException("assoc");
+
+ flags |= AssociationFlags.NoTruncate;
+
+ const uint E_POINTER = 0x80004003;
+
+ var builder = new StringBuilder (512);
+ int size = builder.Length;
+
+ var result = Win32.AssocQueryStringW (flags, str, assoc, extra, builder, ref size);
+
+ if (result == unchecked((int)E_POINTER)) {
+ builder.Length = size;
+ result = Win32.AssocQueryStringW (flags, str, assoc, extra, builder, ref size);
+ }
+ Marshal.ThrowExceptionForHR (result);
+ return builder.ToString ();
+ }
+
+ static string GetDefaultApp (string extension)
+ {
+ string appDefault = null;
+ using (RegistryKey RegKey = Registry.ClassesRoot.OpenSubKey (extension)) {
+ if (RegKey != null)
+ appDefault = (string)RegKey.GetValue ("", null);
+ }
+ return appDefault;
+ }
+
+ public override IEnumerable<DesktopApplication> GetApplications (string filename)
+ {
+ string extension = Path.GetExtension (filename);
+ if (string.IsNullOrEmpty (extension))
+ yield break;
+ string defaultApp = GetDefaultApp (extension);
+
+ foreach (var app in GetAppsByProgID (extension, defaultApp))
+ yield return app;
+
+ foreach (var app in GetAppsByExeName (extension, defaultApp))
+ yield return app;
+ }
+
+ const string assocBaseKey = @"Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\";
+
+ static IEnumerable<DesktopApplication> GetAppsByProgID (string extension, string defaultApp)
+ {
+ var progIDs = new HashSet<string> ();
+
+ using (RegistryKey RegKey = Registry.CurrentUser.OpenSubKey (assocBaseKey + extension + @"\OpenWithProgids")) {
+ if (RegKey != null) {
+ foreach (string progID in RegKey.GetValueNames ()) {
+ if (progIDs.Add (progID)) {
+ var app = WindowsAppFromProgID (progID, defaultApp);
+ if (app != null)
+ yield return app;
+ }
+ }
+ }
+ }
+
+ using (RegistryKey RegKey = Registry.ClassesRoot.OpenSubKey (extension + @"\OpenWithProgids")) {
+ if (RegKey != null) {
+ foreach (string progID in RegKey.GetValueNames ()) {
+ if (progIDs.Add (progID)) {
+ var app = WindowsAppFromProgID (progID, defaultApp);
+ if (app != null)
+ yield return app;
+ }
+ }
+ }
+ }
+ }
+
+ static IEnumerable<DesktopApplication> GetAppsByExeName (string extension, string defaultApp)
+ {
+ var exeNames = new HashSet<string> ();
+
+ using (RegistryKey RegKey = Registry.CurrentUser.OpenSubKey (assocBaseKey + extension + @"\OpenWithList")) {
+ if (RegKey != null) {
+ string MRUList = (string)RegKey.GetValue ("MRUList");
+ if(MRUList != null){
+ foreach (char c in MRUList.ToString()) {
+ string exeName = RegKey.GetValue (c.ToString ()).ToString ();
+ if (exeNames.Add (exeName)) {
+ var app = WindowsAppFromExeName (exeName, defaultApp);
+ if (app != null)
+ yield return app;
+ }
+ }
+ }
+ }
+ }
+
+ using (RegistryKey RegKey = Registry.ClassesRoot.OpenSubKey (extension + @"\OpenWithList")) {
+ if (RegKey != null) {
+ foreach (string exeName in RegKey.GetSubKeyNames ()) {
+ if (exeNames.Add (exeName)) {
+ var app = WindowsAppFromExeName (exeName, defaultApp);
+ if (app != null)
+ yield return app;
+ }
+ }
+ }
+ }
+ }
+
+ static WindowsDesktopApplication WindowsAppFromProgID (string progID, string defaultApp)
+ {
+ try {
+ string displayName = QueryAssociationString (progID, AssociationString.FriendlyAppName, AssociationFlags.None, "open");
+ string exePath = QueryAssociationString (progID, AssociationString.Executable, AssociationFlags.None, "open");
+ if(System.Reflection.Assembly.GetEntryAssembly ().Location == exePath)
+ return null;
+ return new WindowsDesktopApplication (progID, displayName, exePath, progID.Equals (defaultApp));
+ } catch (Exception ex) {
+ LoggingService.LogError (string.Format ("Failed to read info for ProgID '{0}'", progID), ex);
+ return null;
+ }
+ }
+
+ static WindowsDesktopApplication WindowsAppFromExeName (string exeName, string defaultApp)
+ {
+ try {
+ string displayName = QueryAssociationString (exeName, AssociationString.FriendlyAppName, AssociationFlags.OpenByExeName, "open");
+ string exePath = QueryAssociationString (exeName, AssociationString.Executable, AssociationFlags.OpenByExeName, "open");
+ if(System.Reflection.Assembly.GetEntryAssembly ().Location == exePath)
+ return null;
+ return new WindowsDesktopApplication (exeName, displayName, exePath, exeName.Equals (defaultApp));
+ } catch (Exception ex) {
+ LoggingService.LogError (string.Format ("Failed to read info for ExeName '{0}'", exeName), ex);
+ return null;
+ }
+ }
+
+ class WindowsDesktopApplication : DesktopApplication
+ {
+ public WindowsDesktopApplication (string id, string displayName, string exePath, bool isDefault) : base (id, displayName, isDefault)
+ {
+ this.ExePath = exePath;
+ }
+
+ public string ExePath { get; private set; }
+
+ public override void Launch (params string[] files)
+ {
+ var pab = new ProcessArgumentBuilder ();
+ foreach (string file in files) {
+ pab.AddQuoted (file);
+ Process.Start (ExePath, pab.ToString ());
+ }
+ }
+ }
}
}
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform.csproj b/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.csproj
index 8afdbcc4ec..1efea843eb 100644
--- a/main/src/addins/WindowsPlatform/WindowsPlatform.csproj
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.csproj
@@ -14,18 +14,18 @@
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
- <OutputPath>..\..\..\build\bin</OutputPath>
+ <OutputPath>..\..\..\..\build\bin</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<NoWarn>1591;1573</NoWarn>
- <DocumentationFile>..\..\..\build\AddIns\WindowsPlatform.xml</DocumentationFile>
+ <DocumentationFile>..\..\..\..\build\AddIns\WindowsPlatform\WindowsPlatform.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
- <OutputPath>..\..\..\build\bin</OutputPath>
+ <OutputPath>..\..\..\..\build\bin</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
@@ -43,70 +43,48 @@
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
- <Reference Include="Microsoft.WindowsAPICodePack">
- <HintPath>Microsoft.WindowsAPICodePack.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.WindowsAPICodePack.Shell">
- <HintPath>Microsoft.WindowsAPICodePack.Shell.dll</HintPath>
- </Reference>
<Reference Include="PresentationFramework" />
<Reference Include="PresentationCore" />
<Reference Include="System.Xaml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
+ <ProjectReference Include="..\..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
<Project>{7525BB88-6142-4A26-93B9-A30C6983390A}</Project>
<Name>MonoDevelop.Core</Name>
<Private>False</Private>
</ProjectReference>
- <ProjectReference Include="..\..\core\MonoDevelop.Ide\MonoDevelop.Ide.csproj">
+ <ProjectReference Include="..\..\..\core\MonoDevelop.Ide\MonoDevelop.Ide.csproj">
<Project>{27096E7F-C91C-4AC6-B289-6897A701DF21}</Project>
<Name>MonoDevelop.Ide</Name>
<Private>False</Private>
</ProjectReference>
- <ProjectReference Include="..\..\..\external\mono-addins\Mono.Addins\Mono.Addins.csproj">
+ <ProjectReference Include="..\..\..\..\external\mono-addins\Mono.Addins\Mono.Addins.csproj">
<Project>{91DD5A2D-9FE3-4C3C-9253-876141874DAD}</Project>
<Name>Mono.Addins</Name>
<Private>False</Private>
</ProjectReference>
- <ProjectReference Include="..\..\..\external\xwt\Xwt\Xwt.csproj">
+ <ProjectReference Include="..\..\..\..\external\xwt\Xwt\Xwt.csproj">
<Project>{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}</Project>
<Name>Xwt</Name>
<Private>False</Private>
</ProjectReference>
+ <ProjectReference Include="..\WindowsAPICodePack\Core\Core.csproj">
+ <Project>{2E1FB0DF-F9BB-4909-9F32-2D9D022A8E57}</Project>
+ <Name>Core</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\WindowsAPICodePack\Shell\Shell.csproj">
+ <Project>{AA0C00CB-8699-4F37-BFAE-40CA87ACC06D}</Project>
+ <Name>Shell</Name>
+ </ProjectReference>
</ItemGroup>
<ItemGroup>
- <Compile Include="Dialogs\CustomAddFilesDialog.cs">
- <SubType>UserControl</SubType>
- </Compile>
- <Compile Include="Dialogs\CustomAddFilesDialog.Designer.cs">
- <DependentUpon>CustomAddFilesDialog.cs</DependentUpon>
- </Compile>
- <Compile Include="Dialogs\EncodingSelectionForm.cs">
- <SubType>Form</SubType>
- </Compile>
- <Compile Include="Dialogs\EncodingSelectionForm.Designer.cs">
- <DependentUpon>EncodingSelectionForm.cs</DependentUpon>
- </Compile>
- <Compile Include="Dialogs\OpenFileDialogEx.cs">
- <SubType>UserControl</SubType>
- </Compile>
- <Compile Include="Dialogs\OpenFileDialogEx.Designer.cs">
- <DependentUpon>OpenFileDialogEx.cs</DependentUpon>
- </Compile>
<Compile Include="Dialogs\AddFileDialogHandler.cs" />
- <Compile Include="Dialogs\SelectFileDialogHandler.cs" />
- <Compile Include="Dialogs\WinFormsRoot.cs">
- <SubType>Form</SubType>
+ <Compile Include="Dialogs\SelectEncodingControl.xaml.cs">
+ <DependentUpon>SelectEncodingControl.xaml</DependentUpon>
</Compile>
+ <Compile Include="Dialogs\SelectFileDialogHandler.cs" />
<Compile Include="Dialogs\OpenFileDialogHandler.cs" />
- <Compile Include="Dialogs\CustomOpenFileDialog.cs">
- <SubType>UserControl</SubType>
- </Compile>
- <Compile Include="Dialogs\EncodingComboBox.cs">
- <SubType>Component</SubType>
- </Compile>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Enums.cs" />
<Compile Include="GdkWin32.cs" />
@@ -120,23 +98,19 @@
</Compile>
<Compile Include="WindowsSecureStoragePasswordProvider.cs" />
<Compile Include="AddinInfo.cs" />
+ <Compile Include="CustomDialogs\CustomCommonOpenFileDialog.cs" />
+ <Compile Include="CustomDialogs\CustomCommonFileDialogComboBox.cs" />
</ItemGroup>
<ItemGroup>
- <EmbeddedResource Include="Dialogs\CustomAddFilesDialog.resx">
- <DependentUpon>CustomAddFilesDialog.cs</DependentUpon>
- <SubType>Designer</SubType>
- </EmbeddedResource>
- <EmbeddedResource Include="Dialogs\EncodingSelectionForm.resx">
- <DependentUpon>EncodingSelectionForm.cs</DependentUpon>
- </EmbeddedResource>
- <EmbeddedResource Include="Dialogs\OpenFileDialogEx.resx">
- <DependentUpon>OpenFileDialogEx.cs</DependentUpon>
- <SubType>Designer</SubType>
- </EmbeddedResource>
<EmbeddedResource Include="WindowsPlatform.addin.xml">
<LogicalName>WindowsPlatform.addin.xml</LogicalName>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <ItemGroup />
+ <ItemGroup>
+ <Page Include="Dialogs\SelectEncodingControl.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ </ItemGroup>
</Project> \ No newline at end of file
diff --git a/main/src/addins/WindowsPlatform/WindowsProxyCredentialProvider.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsProxyCredentialProvider.cs
index 825772b82e..598f796ce0 100644
--- a/main/src/addins/WindowsPlatform/WindowsProxyCredentialProvider.cs
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsProxyCredentialProvider.cs
@@ -38,18 +38,58 @@ namespace MonoDevelop.Platform.Windows
{
public class WindowsProxyCredentialProvider : ICredentialProvider
{
- public ICredentials GetCredentials (Uri uri, IWebProxy proxy, CredentialType credentialType, ICredentials existingCredential, bool retrying)
+ object guiLock = new object();
+
+ public ICredentials GetCredentials (Uri uri, IWebProxy proxy, CredentialType credentialType, bool retrying)
{
if (uri == null)
throw new ArgumentNullException ("uri");
- NetworkCredential currentCredentials = null;
- if (existingCredential != null)
- currentCredentials = Utility.GetCredentialsForUriFromICredentials (uri, existingCredential);
+ // if looking for proxy credentials, we care about the proxy's URL, not the request URL
+ if (credentialType == CredentialType.ProxyCredentials) {
+ var proxyUri = proxy.GetProxy (uri);
+ if (proxyUri != null)
+ uri = proxyUri;
+ }
+
+ lock (guiLock) {
+ // If this is the first attempt, return any stored credentials. If they fail, we'll be called again.
+ if (!retrying) {
+ var creds = GetExistingCredentials (uri, credentialType);
+ if (creds != null)
+ return creds;
+ }
+
+ return GetCredentialsFromUser (uri, proxy, credentialType);
+ }
+ }
+
+ static ICredentials GetExistingCredentials (Uri uri, CredentialType credentialType)
+ {
+ var rootUri = new Uri (uri.GetComponents (UriComponents.SchemeAndServer, UriFormat.SafeUnescaped));
+ var existing =
+ PasswordService.GetWebUserNameAndPassword (uri) ??
+ PasswordService.GetWebUserNameAndPassword (rootUri);
+
+ return existing != null ? new NetworkCredential (existing.Item1, existing.Item2) : null;
+ }
+
+ static ICredentials GetCredentialsFromUser (Uri uri, IWebProxy proxy, CredentialType credentialType)
+ {
+ NetworkCredential result = null;
+
+ DispatchService.GuiSyncDispatch (() => {
+ var form = new PlaceholderForm (credentialType, uri, null);
+ if (GdkWin32.RunModalWin32Form (form, IdeApp.Workbench.RootWindow))
+ result = new NetworkCredential (form.Username, form.Password, form.Domain);
+ });
- var form = new PlaceholderForm (credentialType, uri, currentCredentials);
- var result = GdkWin32.RunModalWin32Form (form, IdeApp.Workbench.RootWindow);
- return result ? new NetworkCredential (form.Username, form.Password, form.Domain) : null;
+ // store the obtained credentials in the auth store
+ // but don't store for the root url since it may have other credentials
+ if (result != null)
+ PasswordService.AddWebUserNameAndPassword (uri, result.UserName, result.Password);
+
+ return result;
}
}
@@ -74,9 +114,21 @@ namespace MonoDevelop.Platform.Windows
public override DialogResult ShowMagicDialog ()
{
+ var message = type == CredentialType.ProxyCredentials
+ ? GettextCatalog.GetString (
+ "{0} needs credentials to access the proxy server {1}.",
+ BrandingService.ApplicationName,
+ uri.Host
+ )
+ : GettextCatalog.GetString (
+ "{0} needs credentials to access {1}.",
+ BrandingService.ApplicationName,
+ uri.Host
+ );
+
var credUiInfo = new Native.CredentialUiInfo {
- MessageText = GettextCatalog.GetString ("{1} needs {2} credentials to access {0}.", uri.Host, BrandingService.ApplicationName, type == CredentialType.ProxyCredentials ? "proxy" : "request"),
- CaptionText = GettextCatalog.GetString ("{0} needs {1} credentials", BrandingService.ApplicationName, type == CredentialType.ProxyCredentials ? "proxy" : "request"),
+ MessageText = message,
+ CaptionText = GettextCatalog.GetString ("Credentials Required"),
StructureSize = Marshal.SizeOf (typeof (Native.CredentialUiInfo)),
ParentWindow = GdkWin32.HgdiobjGet (IdeApp.Workbench.RootWindow.GdkWindow)
};
diff --git a/main/src/addins/WindowsPlatform/WindowsSecureStoragePasswordProvider.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsSecureStoragePasswordProvider.cs
index 34dafdab03..34dafdab03 100644
--- a/main/src/addins/WindowsPlatform/WindowsSecureStoragePasswordProvider.cs
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsSecureStoragePasswordProvider.cs
diff --git a/main/src/addins/WindowsPlatform/structs.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/structs.cs
index b39f00b566..b39f00b566 100644
--- a/main/src/addins/WindowsPlatform/structs.cs
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/structs.cs