├── .gitattributes
├── .gitignore
├── .gitmodules
├── Docs
├── AdvancedInstaller.png
├── BridgeVsOption.PNG
├── ErrorReports.PNG
├── Example.gif
├── PoweredByNDepend.png
├── Registry.PNG
├── SInject.png
├── VsRestart.PNG
├── VsRestartQuit.PNG
└── jetbrains-variant-2.png
├── LICENSE
├── Lib
├── Typemock
│ ├── AutoDeploy
│ │ ├── Configuration.dll
│ │ ├── TypeMock.CLI.Common.dll
│ │ ├── TypeMock.Dll
│ │ ├── TypeMock.Integration.Dll
│ │ ├── TypeMock.Integration.XML
│ │ ├── TypeMock.MSBuild.Tasks
│ │ ├── TypeMock.MSBuild.Tasks.xsd
│ │ ├── TypeMock.MSBuild.dll
│ │ ├── TypeMock.XML
│ │ ├── Typemock.ArrangeActAssert.Dll
│ │ ├── Typemock.ArrangeActAssert.XML
│ │ ├── Typemock.Interceptors.dll
│ │ ├── typemockconfig.xml
│ │ ├── x64
│ │ │ ├── Armadillo.Sandbox.Interception.dll
│ │ │ ├── MockWeaver.dll
│ │ │ ├── OpenCover.Profiler.dll
│ │ │ └── ProfileLinker.dll
│ │ └── x86
│ │ │ ├── Armadillo.Sandbox.Interception.dll
│ │ │ ├── MockWeaver.dll
│ │ │ ├── OpenCover.Profiler.dll
│ │ │ └── ProfileLinker.dll
│ ├── TMockRunner.exe
│ └── TMockRunner.exe.config
└── VS2017
│ └── Microsoft.VisualStudio.DebuggerVisualizers.dll
├── README.md
├── Src
├── .nuget
│ ├── NuGet.Config
│ ├── NuGet.exe
│ └── NuGet.targets
├── BridgeVs.AsyncVsPackage
│ ├── Bridge.png
│ ├── BridgeVs.VisualStudio.AsyncExtension.csproj
│ ├── BridgeVsExtension.cs
│ ├── Command
│ │ └── BridgeCommand.cs
│ ├── Configuration
│ │ ├── MsBuildVersionHelper.cs
│ │ ├── PackageConfigurator.cs
│ │ ├── Resources.resx
│ │ └── Resources1.Designer.cs
│ ├── Enums.cs
│ ├── Guids.cs
│ ├── Key.snk
│ ├── LINQBridge.ico
│ ├── LINQBridgeLogo.png
│ ├── License.txt
│ ├── PkgCmdID.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Resources
│ │ ├── Command1.png
│ │ └── MyCommand.png
│ ├── Settings
│ │ └── PackageSettings.cs
│ ├── Targets
│ │ └── Directory.Build.targets
│ ├── VSPackage.resx
│ ├── VSPackage.vsct
│ ├── VsAsyncPackage.cs
│ ├── app.config
│ ├── packages.config
│ └── source.extension.vsixmanifest
├── BridgeVs.Build
│ ├── BridgeVs.Build.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── SInjection.cs
│ ├── Tasks
│ │ ├── CleanBuildTask.cs
│ │ ├── MapperBuildTask.cs
│ │ └── SInjectionBuildTask.cs
│ ├── TypeMapper
│ │ └── VisualizerAttributeInjector.cs
│ ├── Util
│ │ ├── EnumerableExtension.cs
│ │ ├── ReflectionUtils.cs
│ │ ├── TypeReferenceExtension.cs
│ │ └── VisualizerAssemblyNameFormat.cs
│ ├── app.config
│ └── packages.config
├── BridgeVs.DynamicVisualizers
│ ├── BridgeVs.DynamicVisualizers.csproj
│ ├── DynamicDebuggerVisualizer.cs
│ ├── DynamicObjectSource.cs
│ ├── Forms
│ │ ├── TemporaryForm.cs
│ │ └── TemporaryForm.resx
│ ├── GlobalSuppressions.cs
│ ├── Helper
│ │ ├── TypeNameHelper.cs
│ │ └── VisualStudioVersionHelper.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Template
│ │ ├── Inspection.Template.cs
│ │ ├── Inspection.cs
│ │ ├── Inspection.tt
│ │ └── Message.cs
│ ├── Win32Interop.WinHandles
│ │ ├── Internal
│ │ │ └── NativeMethods.cs
│ │ ├── TopLevelWindowUtils.cs
│ │ ├── WindowHandle.cs
│ │ └── WindowHandleExtensions.cs
│ ├── app.config
│ └── packages.config
├── BridgeVs.Shared
│ ├── BridgeVs.Shared.csproj
│ ├── Common
│ │ ├── BridgeProjectInfo.cs
│ │ ├── CommonFolderPaths.cs
│ │ └── CommonRegistryConfigurations.cs
│ ├── Dependency
│ │ └── Crawler.cs
│ ├── FileSystem
│ │ └── FileSystemFactory.cs
│ ├── Logging
│ │ ├── Log.cs
│ │ └── RavenWrapper.cs
│ ├── Options
│ │ ├── Defaults.cs
│ │ ├── SerializationOption.cs
│ │ └── VisualStudioOption.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── SharedAssemblyProperties.cs
│ ├── Serialization
│ │ ├── BinarySerializer.cs
│ │ ├── IServiceSerializer.cs
│ │ ├── JsonSerializer.cs
│ │ ├── Truck.cs
│ │ └── XmlSerializer.cs
│ ├── Util
│ │ └── TypeExtension.cs
│ ├── Version.cs
│ ├── app.config
│ └── packages.config
└── BridgeVs.sln
├── Test
├── BridgeVs.UnitTest.Model
│ ├── AnotherModel.cs
│ ├── BridgeVs.UnitTest.Model.csproj
│ ├── Models.cs
│ ├── NotSerializableObject.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── XmlClass.cs
└── BridgeVs.UnitTest
│ ├── BridgeVs.UnitTest.csproj
│ ├── Build
│ └── Tasks
│ │ ├── CleanBuildTest.cs
│ │ ├── MapperBuildTest.cs
│ │ └── SInjectionBuildTest.cs
│ ├── DynamicVisualizers
│ ├── DynamicDebuggerVisualizerTest.cs
│ ├── DynamicObjectSourceTest.cs
│ ├── Helper
│ │ ├── ReferencedAssemblyFinderHelperTests.cs
│ │ └── TypeNameHelperUnitTest.cs
│ └── Template
│ │ └── MessageTest.cs
│ ├── PluginLoader.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── Shared
│ ├── Dependency
│ │ ├── CrawlerUnitTest.cs
│ │ └── Model.UnitTest.xml
│ └── Serialization
│ │ └── TruckTest.cs
│ ├── VsPackage.Helper
│ └── MsBuildVersionHelperUnitTest.cs
│ ├── app.config
│ └── packages.config
└── appveyor.yml
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 | *.sln merge=union
7 | *.csproj merge=union
8 | *.vbproj merge=union
9 | *.fsproj merge=union
10 | *.dbproj merge=union
11 |
12 | # Standard to msysgit
13 | *.doc diff=astextplain
14 | *.DOC diff=astextplain
15 | *.docx diff=astextplain
16 | *.DOCX diff=astextplain
17 | *.dot diff=astextplain
18 | *.DOT diff=astextplain
19 | *.pdf diff=astextplain
20 | *.PDF diff=astextplain
21 | *.rtf diff=astextplain
22 | *.RTF diff=astextplain
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | #################
2 | ## Eclipse
3 | #################
4 |
5 | *.pydevproject
6 | .project
7 | .metadata
8 | bin/
9 | tmp/
10 | NDependOut/
11 | .vs/
12 | *.tmp
13 | *.bak
14 | *.swp
15 | *~.nib
16 | local.properties
17 | .classpath
18 | .settings/
19 | .loadpath
20 | *.Isolator.config
21 |
22 | # External tool builders
23 | .externalToolBuilders/
24 |
25 | # Locally stored "Eclipse launch configurations"
26 | *.launch
27 |
28 | # CDT-specific
29 | .cproject
30 |
31 | # PDT-specific
32 | .buildpath
33 |
34 |
35 | #################
36 | ## Visual Studio
37 | #################
38 |
39 | ## Ignore Visual Studio temporary files, build results, and
40 | ## files generated by popular Visual Studio add-ons.
41 |
42 | # User-specific files
43 | *.suo
44 | *.user
45 | *.sln.docstates
46 |
47 | # Build results
48 | [Dd]ebug/
49 | [Rr]elease/
50 | *_i.c
51 | *_p.c
52 | *.ilk
53 | *.meta
54 | *.obj
55 | *.pch
56 | *.pdb
57 | *.pgc
58 | *.pgd
59 | *.rsp
60 | *.sbr
61 | *.tlb
62 | *.tli
63 | *.tlh
64 | *.tmp
65 | *.vspscc
66 | .builds
67 | *.dotCover
68 |
69 | ## TODO: If you have NuGet Package Restore enabled, uncomment this
70 | packages/
71 |
72 | # Visual C++ cache files
73 | ipch/
74 | *.aps
75 | *.ncb
76 | *.opensdf
77 | *.sdf
78 |
79 | # Visual Studio profiler
80 | *.psess
81 | *.vsp
82 |
83 | # ReSharper is a .NET coding add-in
84 | _ReSharper*
85 |
86 | # Installshield output folder
87 | [Ee]xpress
88 |
89 | # DocProject is a documentation generator add-in
90 | DocProject/buildhelp/
91 | DocProject/Help/*.HxT
92 | DocProject/Help/*.HxC
93 | DocProject/Help/*.hhc
94 | DocProject/Help/*.hhk
95 | DocProject/Help/*.hhp
96 | DocProject/Help/Html2
97 | DocProject/Help/html
98 |
99 | # Click-Once directory
100 | publish
101 |
102 | # Others
103 | [Bb]in
104 | [Oo]bj
105 | sql
106 | TestResults
107 | *.Cache
108 | ClientBin
109 | stylecop.*
110 | ~$*
111 | *.dbmdl
112 | Generated_Code #added for RIA/Silverlight projects
113 |
114 | # Backup & report files from converting an old project file to a newer
115 | # Visual Studio version. Backup files are not needed, because we have git ;-)
116 | _UpgradeReport_Files/
117 | Backup*/
118 | UpgradeLog*.XML
119 |
120 |
121 |
122 | ############
123 | ## Windows
124 | ############
125 |
126 | # Windows image file caches
127 | Thumbs.db
128 |
129 | # Folder config file
130 | Desktop.ini
131 |
132 |
133 | #############
134 | ## Python
135 | #############
136 |
137 | *.py[co]
138 |
139 | # Packages
140 | *.egg
141 | *.egg-info
142 | dist
143 | eggs
144 | parts
145 | bin
146 | var
147 | sdist
148 | develop-eggs
149 | .installed.cfg
150 |
151 | # Installer logs
152 | pip-log.txt
153 |
154 | # Unit test / coverage reports
155 | .coverage
156 | .tox
157 |
158 | #Translations
159 | *.mo
160 |
161 | #Mr Developer
162 | .mr.developer.cfg
163 |
164 | # Mac crap
165 | .DS_Store
166 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "Lib/SharpRaven"]
2 | path = Lib/SharpRaven
3 | url = https://github.com/codingadventures/raven-csharp
4 |
--------------------------------------------------------------------------------
/Docs/AdvancedInstaller.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Docs/AdvancedInstaller.png
--------------------------------------------------------------------------------
/Docs/BridgeVsOption.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Docs/BridgeVsOption.PNG
--------------------------------------------------------------------------------
/Docs/ErrorReports.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Docs/ErrorReports.PNG
--------------------------------------------------------------------------------
/Docs/Example.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Docs/Example.gif
--------------------------------------------------------------------------------
/Docs/PoweredByNDepend.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Docs/PoweredByNDepend.png
--------------------------------------------------------------------------------
/Docs/Registry.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Docs/Registry.PNG
--------------------------------------------------------------------------------
/Docs/SInject.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Docs/SInject.png
--------------------------------------------------------------------------------
/Docs/VsRestart.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Docs/VsRestart.PNG
--------------------------------------------------------------------------------
/Docs/VsRestartQuit.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Docs/VsRestartQuit.PNG
--------------------------------------------------------------------------------
/Docs/jetbrains-variant-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Docs/jetbrains-variant-2.png
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2013 - 2018 Coding Adventures
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Lib/Typemock/AutoDeploy/Configuration.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Lib/Typemock/AutoDeploy/Configuration.dll
--------------------------------------------------------------------------------
/Lib/Typemock/AutoDeploy/TypeMock.CLI.Common.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Lib/Typemock/AutoDeploy/TypeMock.CLI.Common.dll
--------------------------------------------------------------------------------
/Lib/Typemock/AutoDeploy/TypeMock.Dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Lib/Typemock/AutoDeploy/TypeMock.Dll
--------------------------------------------------------------------------------
/Lib/Typemock/AutoDeploy/TypeMock.Integration.Dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Lib/Typemock/AutoDeploy/TypeMock.Integration.Dll
--------------------------------------------------------------------------------
/Lib/Typemock/AutoDeploy/TypeMock.MSBuild.Tasks:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Lib/Typemock/AutoDeploy/TypeMock.MSBuild.Tasks.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/Lib/Typemock/AutoDeploy/TypeMock.MSBuild.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Lib/Typemock/AutoDeploy/TypeMock.MSBuild.dll
--------------------------------------------------------------------------------
/Lib/Typemock/AutoDeploy/Typemock.ArrangeActAssert.Dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Lib/Typemock/AutoDeploy/Typemock.ArrangeActAssert.Dll
--------------------------------------------------------------------------------
/Lib/Typemock/AutoDeploy/Typemock.Interceptors.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Lib/Typemock/AutoDeploy/Typemock.Interceptors.dll
--------------------------------------------------------------------------------
/Lib/Typemock/AutoDeploy/typemockconfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | false
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
--------------------------------------------------------------------------------
/Lib/Typemock/AutoDeploy/x64/Armadillo.Sandbox.Interception.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Lib/Typemock/AutoDeploy/x64/Armadillo.Sandbox.Interception.dll
--------------------------------------------------------------------------------
/Lib/Typemock/AutoDeploy/x64/MockWeaver.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Lib/Typemock/AutoDeploy/x64/MockWeaver.dll
--------------------------------------------------------------------------------
/Lib/Typemock/AutoDeploy/x64/OpenCover.Profiler.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Lib/Typemock/AutoDeploy/x64/OpenCover.Profiler.dll
--------------------------------------------------------------------------------
/Lib/Typemock/AutoDeploy/x64/ProfileLinker.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Lib/Typemock/AutoDeploy/x64/ProfileLinker.dll
--------------------------------------------------------------------------------
/Lib/Typemock/AutoDeploy/x86/Armadillo.Sandbox.Interception.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Lib/Typemock/AutoDeploy/x86/Armadillo.Sandbox.Interception.dll
--------------------------------------------------------------------------------
/Lib/Typemock/AutoDeploy/x86/MockWeaver.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Lib/Typemock/AutoDeploy/x86/MockWeaver.dll
--------------------------------------------------------------------------------
/Lib/Typemock/AutoDeploy/x86/OpenCover.Profiler.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Lib/Typemock/AutoDeploy/x86/OpenCover.Profiler.dll
--------------------------------------------------------------------------------
/Lib/Typemock/AutoDeploy/x86/ProfileLinker.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Lib/Typemock/AutoDeploy/x86/ProfileLinker.dll
--------------------------------------------------------------------------------
/Lib/Typemock/TMockRunner.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Lib/Typemock/TMockRunner.exe
--------------------------------------------------------------------------------
/Lib/Typemock/TMockRunner.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Lib/VS2017/Microsoft.VisualStudio.DebuggerVisualizers.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Lib/VS2017/Microsoft.VisualStudio.DebuggerVisualizers.dll
--------------------------------------------------------------------------------
/Src/.nuget/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Src/.nuget/NuGet.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Src/.nuget/NuGet.exe
--------------------------------------------------------------------------------
/Src/BridgeVs.AsyncVsPackage/Bridge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Src/BridgeVs.AsyncVsPackage/Bridge.png
--------------------------------------------------------------------------------
/Src/BridgeVs.AsyncVsPackage/BridgeVsExtension.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit psticlersons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System;
27 | using System.Collections.Generic;
28 | using System.ComponentModel.Design;
29 | using System.IO;
30 | using System.Linq;
31 | using BridgeVs.VsPackage.Helper;
32 | using BridgeVs.VsPackage.Helper.Command;
33 | using BridgeVs.VsPackage.Helper.Configuration;
34 | using EnvDTE;
35 | using Project = EnvDTE.Project;
36 |
37 | namespace BridgeVs.VisualStudio.AsyncExtension
38 | {
39 | public class BridgeVsExtension
40 | {
41 | private readonly DTE _application;
42 |
43 | public BridgeVsExtension(DTE app)
44 | {
45 | _application = app;
46 | }
47 |
48 | private static bool IsSupported(string uniqueName)
49 | {
50 | return
51 | uniqueName.EndsWith(".csproj", StringComparison.InvariantCultureIgnoreCase) || uniqueName.EndsWith(".vbproj", StringComparison.InvariantCultureIgnoreCase);
52 | }
53 |
54 | private IEnumerable AllProjects
55 | {
56 | get
57 | {
58 | Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
59 | Projects projects = _application.Solution.Projects;
60 | if (projects == null)
61 | return Enumerable.Empty();
62 |
63 | return from project in projects.Cast()
64 | where IsSupported(project.UniqueName)
65 | select project;
66 | }
67 | }
68 |
69 | private string SolutionName => Path.GetFileNameWithoutExtension(_application.Solution.FileName);
70 |
71 | public void Execute(CommandAction action)
72 | {
73 | Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
74 | List projects = AllProjects.ToList();
75 |
76 | if (projects.Count == 0)
77 | return;
78 |
79 | if (BridgeCommand.IsEveryProjectSupported(projects, _application.Version, _application.Edition))
80 | {
81 | BridgeCommand.ActivateBridgeVsOnSolution(action, projects, SolutionName, _application.Version,
82 | _application.Edition, Path.GetDirectoryName(_application.Solution.FileName));
83 | }
84 | else
85 | {
86 | string message = $@"Solution {SolutionName} contains one or more un-supported projects. ASP.NET Core, .NET Core, .NET standard and UAP are not supported by LINQBridgeVs.";
87 | System.Windows.MessageBox.Show(message);
88 | }
89 | }
90 |
91 | public void UpdateCommand(MenuCommand cmd, CommandAction action)
92 | {
93 | CommandStates states = GetStatus(action);
94 | cmd.Visible = (CommandStates.Visible & states) == CommandStates.Visible;
95 | cmd.Enabled = (CommandStates.Enabled & states) == CommandStates.Enabled;
96 | }
97 |
98 | private CommandStates GetStatus(CommandAction action)
99 | {
100 | Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
101 |
102 | CommandStates result = CommandStates.Visible;
103 |
104 | bool isBridgeVsConfigured = PackageConfigurator.IsBridgeVsConfigured(_application.Version);
105 |
106 | if (!isBridgeVsConfigured)
107 | return result; //just show it as visible
108 |
109 | string solutionDir = Path.GetDirectoryName(_application.Solution.FileName);
110 | string directoryTarget = Path.Combine(solutionDir, "Directory.Build.targets");
111 | bool isSolutionEnabled = File.Exists(directoryTarget);
112 |
113 | if (isSolutionEnabled && action == CommandAction.Disable || !isSolutionEnabled && action == CommandAction.Enable)
114 | result |= CommandStates.Enabled;
115 |
116 | return result;
117 | }
118 | }
119 | }
--------------------------------------------------------------------------------
/Src/BridgeVs.AsyncVsPackage/Command/BridgeCommand.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using BridgeVs.Shared.Common;
27 | using BridgeVs.Shared.FileSystem;
28 | using BridgeVs.VsPackage.Helper.Configuration;
29 | using EnvDTE;
30 | using System;
31 | using System.Collections.Generic;
32 | using System.IO;
33 | using System.Linq;
34 | using System.Windows;
35 | using VSLangProj;
36 |
37 | namespace BridgeVs.VsPackage.Helper.Command
38 | {
39 | public static class BridgeCommand
40 | {
41 | private const string DirectoryBuildTargets = "Directory.Build.targets";
42 | private static readonly List UnsupportedFrameworks = new List(20)
43 | {
44 | "netstandard",
45 | "netcoreapp",
46 | "netcore",
47 | "netmf",
48 | "sl4",
49 | "sl5",
50 | "wp",
51 | "uap",
52 | "uap"
53 | };
54 |
55 | public static void ActivateBridgeVsOnSolution(CommandAction action, List projects, string solutionName,
56 | string vsVersion,
57 | string vsEdition,
58 | string solutionFolder)
59 | {
60 | Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
61 |
62 | List executeParams = new List();
63 |
64 | //enable each individual project by mapping the assembly name and location to a registry entry
65 | foreach (Project project in projects)
66 | {
67 | string path = project.Properties.Item("FullPath").Value.ToString();
68 | string outputPath = project.ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value
69 | .ToString();
70 | string fileName = project.Properties.Item("OutputFileName").Value.ToString();
71 | string projectOutputPath = Path.Combine(path, outputPath, fileName);
72 |
73 | string assemblyName = project.Properties.Item("AssemblyName").Value.ToString();
74 | IEnumerable references = Enumerable.Empty();
75 |
76 | if (project.Object is VSProject vsProject && vsProject.References != null)
77 | {
78 | references = from Reference reference in vsProject.References
79 | where reference.Path != null
80 | where reference.SourceProject == null //it means it's an assembly reference
81 | where !reference.Path.Contains(".NETFramework") && !reference.Path.Contains("Microsoft") //no .net framework assembly
82 | select reference.Path;
83 | }
84 |
85 | executeParams.Add(new BridgeProjectInfo(project.FullName, solutionName, assemblyName,
86 | projectOutputPath, vsVersion, vsEdition, references.ToList()));
87 |
88 | }
89 | switch (action)
90 | {
91 | case CommandAction.Enable:
92 | CommonRegistryConfigurations.BridgeSolution(solutionName, vsVersion, executeParams);
93 | //copy directory build target to the solution folder
94 | string target = PackageConfigurator.GetInstallationFolder(vsVersion);
95 | File.Copy(Path.Combine(target, "Targets", DirectoryBuildTargets), Path.Combine(solutionFolder, DirectoryBuildTargets), true);
96 | break;
97 | case CommandAction.Disable:
98 | CommonRegistryConfigurations.UnBridgeSolution(solutionName, vsVersion);
99 | //delete directory build target
100 | File.Delete(Path.Combine(solutionFolder, DirectoryBuildTargets));
101 | break;
102 | }
103 |
104 | string result = action == CommandAction.Enable ? "Bridged" : "Un-Bridged";
105 | string userAction = action == CommandAction.Enable ? "Please rebuild your solution." : string.Empty;
106 | string message = $@"Solution {solutionName} has been {result}. {userAction}";
107 | MessageBox.Show(message);
108 | }
109 |
110 |
111 | public static bool IsEveryProjectSupported(List projects, string applicationVersion,
112 | string applicationEdition)
113 | {
114 | Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
115 |
116 | foreach (Project project in projects)
117 | {
118 | string targetFramework = project.Properties.Item("TargetFrameworkMoniker").Value.ToString();
119 | if (string.IsNullOrEmpty(targetFramework))
120 | continue;
121 |
122 | string tfm = targetFramework.Split(',').FirstOrDefault();
123 |
124 | if (!string.IsNullOrEmpty(tfm) && UnsupportedFrameworks.Any(s => Contains(tfm, s, StringComparison.OrdinalIgnoreCase)))
125 | {
126 | return false;
127 | }
128 | }
129 |
130 | return true;
131 | }
132 |
133 | private static bool Contains(string source, string toCheck, StringComparison comp)
134 | {
135 | return source?.IndexOf(toCheck, comp) >= 0;
136 | }
137 |
138 | }
139 | }
--------------------------------------------------------------------------------
/Src/BridgeVs.AsyncVsPackage/Configuration/MsBuildVersionHelper.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System;
27 |
28 | namespace BridgeVs.VsPackage.Helper.Configuration
29 | {
30 | internal static class MsBuildVersionHelper
31 | {
32 | public static string GetMsBuildVersion(string vsVersion)
33 | {
34 | switch (vsVersion)
35 | {
36 | case "11.0":
37 | return "v4.0";
38 | case "12.0":
39 | return "v12.0";
40 | case "14.0":
41 | return "v14.0";
42 | case "15.0":
43 | return "v15.0";
44 | case "16.0":
45 | return "v16.0";
46 | default :
47 | throw new ArgumentException("Visual Studio Version not Supported", nameof(vsVersion));
48 | }
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Src/BridgeVs.AsyncVsPackage/Configuration/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | Software\LINQBridgeVs\{0}\Solutions\{1}
122 |
123 |
124 | Software\LINQBridgeVs\{0}
125 |
126 |
127 | Software\LINQBridgeVs\{0}
128 |
129 |
130 | If you skip the configuration you won't be able to use LINQBridgeVs. Are you sure?
131 |
132 |
--------------------------------------------------------------------------------
/Src/BridgeVs.AsyncVsPackage/Configuration/Resources1.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace BridgeVs.VisualStudio.AsyncExtension.Configuration {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BridgeVs.VisualStudio.AsyncExtension.Configuration.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Looks up a localized string similar to Software\LINQBridgeVs\{0}\Solutions\{1}.
65 | ///
66 | internal static string EnabledProjectsRegistryKey {
67 | get {
68 | return ResourceManager.GetString("EnabledProjectsRegistryKey", resourceCulture);
69 | }
70 | }
71 |
72 | ///
73 | /// Looks up a localized string similar to Software\LINQBridgeVs\{0}.
74 | ///
75 | internal static string ProductRegistryKey {
76 | get {
77 | return ResourceManager.GetString("ProductRegistryKey", resourceCulture);
78 | }
79 | }
80 |
81 | ///
82 | /// Looks up a localized string similar to Software\LINQBridgeVs\{0}.
83 | ///
84 | internal static string ProductVersion {
85 | get {
86 | return ResourceManager.GetString("ProductVersion", resourceCulture);
87 | }
88 | }
89 |
90 | ///
91 | /// Looks up a localized string similar to If you skip the configuration you won't be able to use LINQBridgeVs. Are you sure?.
92 | ///
93 | internal static string SkipMessage {
94 | get {
95 | return ResourceManager.GetString("SkipMessage", resourceCulture);
96 | }
97 | }
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/Src/BridgeVs.AsyncVsPackage/Enums.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace BridgeVs.VsPackage.Helper
4 | {
5 | [Flags]
6 | public enum CommandStates : int
7 | {
8 | None = 0,
9 | Visible = 0x01,
10 | Enabled = 0x02
11 | }
12 |
13 | public enum CommandAction
14 | {
15 | Enable,
16 | Disable
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/Src/BridgeVs.AsyncVsPackage/Guids.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System;
27 |
28 | namespace BridgeVs.VisualStudio.AsyncExtension
29 | {
30 | public static class GuidList
31 | {
32 | public const string GuidBridgeVsExtensionPkgString = "fa136bfd-0b1d-4721-9159-1dbefcb5c4fc";
33 | private const string GuidBridgeVsExtensionCmdSetString = "d30046ec-11cc-48e5-bcfa-ca67686f0a45";
34 |
35 | public static readonly Guid GuidBridgeVsExtensionCmdSet = new Guid(GuidBridgeVsExtensionCmdSetString);
36 | };
37 | }
--------------------------------------------------------------------------------
/Src/BridgeVs.AsyncVsPackage/Key.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Src/BridgeVs.AsyncVsPackage/Key.snk
--------------------------------------------------------------------------------
/Src/BridgeVs.AsyncVsPackage/LINQBridge.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Src/BridgeVs.AsyncVsPackage/LINQBridge.ico
--------------------------------------------------------------------------------
/Src/BridgeVs.AsyncVsPackage/LINQBridgeLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Src/BridgeVs.AsyncVsPackage/LINQBridgeLogo.png
--------------------------------------------------------------------------------
/Src/BridgeVs.AsyncVsPackage/License.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2013 - 2018 Coding Adventures
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/Src/BridgeVs.AsyncVsPackage/PkgCmdID.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | namespace BridgeVs.VisualStudio.AsyncExtension
27 | {
28 | internal static class PkgCmdIdList
29 | {
30 | public const uint CmdIdEnableBridge = 0x100;
31 | public const uint CmdIdDisableBridge = 0x101;
32 | public const uint CmdIdFeedback = 0x105;
33 | public const uint CmdIdGettingStarted = 0x0106;
34 | };
35 | }
--------------------------------------------------------------------------------
/Src/BridgeVs.AsyncVsPackage/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 |
27 | using System.Reflection;
28 | using System.Runtime.CompilerServices;
29 | using System.Runtime.InteropServices;
30 |
31 | [assembly: AssemblyTitle("BridgeVs.AsyncVsPackage")]
32 | [assembly: AssemblyProduct("BridgeVs.VisualStudio.AsyncExtension")]
33 | [assembly: Guid("2016fd5d-79e9-4823-b927-cb796f7b411a")]
34 | #if TEST
35 | [assembly: InternalsVisibleTo("BridgeVs.UnitTest, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f575ceee4c0b7992660f21a6c2a09c93eac56d9dad2f20caa2d48bf5d904c9b2af5800ba01cae7b37299bff9486a8b97047959c3fbe16de730cf3397f4bafaefc745dba1ce34cedf27698f2dc96159eaa27eef4093f6c35236f30239a4841b864ea734ed3582478cc4214d76497ceb974ac920f35043de0913a149d1107bd3a1")]
36 | #endif
37 |
--------------------------------------------------------------------------------
/Src/BridgeVs.AsyncVsPackage/Resources/Command1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Src/BridgeVs.AsyncVsPackage/Resources/Command1.png
--------------------------------------------------------------------------------
/Src/BridgeVs.AsyncVsPackage/Resources/MyCommand.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Src/BridgeVs.AsyncVsPackage/Resources/MyCommand.png
--------------------------------------------------------------------------------
/Src/BridgeVs.AsyncVsPackage/Targets/Directory.Build.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | $(BuildDependsOn);
7 | LINQBridgeAfterBuild;
8 |
9 |
10 |
11 |
12 |
13 | $(CleanDependsOn);
14 | LINQBridgeAfterClean;
15 |
16 |
17 |
18 |
19 | $([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\Software\LINQBridgeVs\$(VisualStudioVersion)', 'InstallFolderPath', 'False', RegistryView.Registry64, RegistryView.Registry32))
20 | $([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\Software\LINQBridgeVs\$(VisualStudioVersion)\Solutions\$(SolutionName)', 'SolutionEnabled', 'False', RegistryView.Registry64, RegistryView.Registry32))
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/Src/BridgeVs.AsyncVsPackage/VSPackage.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | BridgeVs
122 |
123 |
124 | Enable/Disable the creation of custom debugger visualizers and the transformation of the target projects in a fully serializable libraries
125 |
126 |
--------------------------------------------------------------------------------
/Src/BridgeVs.AsyncVsPackage/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Src/BridgeVs.AsyncVsPackage/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/Src/BridgeVs.AsyncVsPackage/source.extension.vsixmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BridgeVs Debugger Visualizer
6 | Bridge between a Visual Studio debugging session and LINQPad. It creates, at compile time, a Custom Debugger Visualizer making the magnifier glass available for all of the public classes and structs. By clicking on the magnifier glass on an object instance, this will be transmitted over a bus and 'Dumped' out by LINQPad.
7 | https://github.com/codingadventures/LINQBridgeVs#getting-started
8 | License.txt
9 | https://github.com/codingadventures/LINQBridgeVs#getting-started
10 | https://github.com/codingadventures/LINQBridgeVs#release-notes-147
11 | LINQBridge.ico
12 | Bridge.png
13 | vsix,debugger-visualizer,aop,linqpad,debugging,serialization
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Src/BridgeVs.Build/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System.Reflection;
27 | using System.Runtime.CompilerServices;
28 | // General Information about an assembly is controlled through the following
29 | // set of attributes. Change these attribute values to modify the information
30 | // associated with an assembly.
31 |
32 | [assembly: AssemblyTitle("BridgeVs.Build")]
33 |
34 | #if TEST
35 | [assembly: InternalsVisibleTo("BridgeVs.UnitTest, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f575ceee4c0b7992660f21a6c2a09c93eac56d9dad2f20caa2d48bf5d904c9b2af5800ba01cae7b37299bff9486a8b97047959c3fbe16de730cf3397f4bafaefc745dba1ce34cedf27698f2dc96159eaa27eef4093f6c35236f30239a4841b864ea734ed3582478cc4214d76497ceb974ac920f35043de0913a149d1107bd3a1")]
36 | #endif
--------------------------------------------------------------------------------
/Src/BridgeVs.Build/Tasks/CleanBuildTask.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System.IO;
27 | using BridgeVs.Build.Util;
28 | using BridgeVs.Shared.Common;
29 | using BridgeVs.Shared.Logging;
30 | using BridgeVs.Shared.Options;
31 | using Microsoft.Build.Framework;
32 | using FS = BridgeVs.Shared.FileSystem.FileSystemFactory;
33 |
34 |
35 | namespace BridgeVs.Build.Tasks
36 | {
37 | public class CleanBuildTask : ITask
38 | {
39 | [Required]
40 | public string VisualStudioVer { private get; set; }
41 |
42 | [Required]
43 | public string Assembly { private get; set; }
44 |
45 | [Required]
46 | public string SolutionName { get; set; }
47 |
48 | public IBuildEngine BuildEngine { get; set; }
49 | public ITaskHost HostObject { get; set; }
50 |
51 | public bool Execute()
52 | {
53 | Log.VisualStudioVersion = VisualStudioVer;
54 |
55 | try
56 | {
57 | string visualizerAssemblyName = VisualizerAssemblyNameFormat.GetTargetVisualizerAssemblyName(VisualStudioVer, Assembly);
58 | string targetInstallationPath = VisualStudioOption.GetVisualizerDestinationFolder(VisualStudioVer);
59 |
60 | string visualizerFullPath = Path.Combine(targetInstallationPath, visualizerAssemblyName);
61 |
62 | if (FS.FileSystem.File.Exists(visualizerFullPath))
63 | FS.FileSystem.File.Delete(visualizerFullPath);
64 |
65 | //check if pdb also exists and delete it
66 | string visualizerPdbFullPath = Path.ChangeExtension(visualizerFullPath, "pdb");
67 |
68 | if (FS.FileSystem.File.Exists(visualizerPdbFullPath))
69 | FS.FileSystem.File.Delete(visualizerPdbFullPath);
70 | }
71 | catch (System.Exception exception)
72 | {
73 | Log.Write(exception, "Error During cleanup");
74 | BuildWarningEventArgs errorEvent = new BuildWarningEventArgs("Debugger Visualizer Cleanup", "", "CleanBuildTask", 0, 0, 0, 0, $"There was an error cleaning custom debugger visualizers", "", "LINQBridgeVs");
75 | BuildEngine.LogWarningEvent(errorEvent);
76 | exception.Capture(VisualStudioVer, message: "Error during project cleaning");
77 | }
78 |
79 | return true;
80 | }
81 | }
82 | }
--------------------------------------------------------------------------------
/Src/BridgeVs.Build/Tasks/SInjectionBuildTask.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using BridgeVs.Shared.Common;
27 | using BridgeVs.Shared.Logging;
28 | using Microsoft.Build.Framework;
29 | using System;
30 | using System.IO;
31 |
32 | namespace BridgeVs.Build.Tasks
33 | {
34 | public class SInjectionBuildTask : ITask
35 | {
36 | [Required]
37 | public string VisualStudioVer { private get; set; }
38 |
39 | [Required]
40 | public string Assembly { get; set; }
41 |
42 | [Required]
43 | public string Snk { get; set; }
44 |
45 | [Required]
46 | public string SolutionName { get; set; }
47 |
48 | public bool Execute()
49 | {
50 | Log.VisualStudioVersion = VisualStudioVer;
51 |
52 | try
53 | {
54 | string snkCertificate = File.Exists(Snk) ? Snk : null;
55 | using (SInjection sInjection = new SInjection(Assembly, snkCertificate))
56 | {
57 | return sInjection.Patch();
58 | }
59 | }
60 | catch (Exception e)
61 | {
62 | const string errorMessage = "Error Executing MSBuild Task SInjectionBuildTask";
63 | Log.Write(e, errorMessage);
64 | e.Capture(VisualStudioVer, message: errorMessage);
65 | BuildWarningEventArgs errorEvent = new BuildWarningEventArgs("Debugger Visualizer Creator", "", "SInjectionBuildTask", 0, 0, 0, 0, $"There was an error adding the serializable attributes to type of the project {Assembly}. Please change serialization method from Binary to Json or Xml in Tools->Options->BridgeVs->SerializationOption. ", "", "LINQBridgeVs");
66 | BuildEngine.LogWarningEvent(errorEvent);
67 | }
68 | return true;
69 | }
70 |
71 | public IBuildEngine BuildEngine { get; set; }
72 | public ITaskHost HostObject { get; set; }
73 | }
74 | }
--------------------------------------------------------------------------------
/Src/BridgeVs.Build/Util/EnumerableExtension.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System;
27 | using System.Collections.Generic;
28 | using System.Diagnostics;
29 |
30 | namespace BridgeVs.Build.Util
31 | {
32 | public static class EnumerableExtension
33 | {
34 | [DebuggerStepThrough]
35 | public static void ForEach(this IEnumerable @t, Action action) where T : class
36 | {
37 | foreach (T element in @t)
38 | {
39 | T el = element; //Avoiding enclosures
40 | action(el);
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Src/BridgeVs.Build/Util/TypeReferenceExtension.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System;
27 | using System.Linq;
28 | using Mono.Cecil;
29 |
30 | namespace BridgeVs.Build.Util
31 | {
32 | internal static class TypeReferenceExtension
33 | {
34 | private static MethodReference _CloneMethodWithDeclaringType(MethodDefinition methodDef, TypeReference declaringTypeRef)
35 | {
36 | if (!declaringTypeRef.IsGenericInstance || methodDef == null)
37 | {
38 | return methodDef;
39 | }
40 |
41 | MethodReference methodRef = new MethodReference(methodDef.Name, methodDef.ReturnType, declaringTypeRef)
42 | {
43 | CallingConvention = methodDef.CallingConvention,
44 | HasThis = methodDef.HasThis,
45 | ExplicitThis = methodDef.ExplicitThis
46 | };
47 |
48 | foreach (ParameterDefinition paramDef in methodDef.Parameters)
49 | {
50 | methodRef.Parameters.Add(new ParameterDefinition(paramDef.Name, paramDef.Attributes, declaringTypeRef.Module.Import(paramDef.ParameterType)));
51 | }
52 |
53 | foreach (GenericParameter genParamDef in methodDef.GenericParameters)
54 | {
55 | methodRef.GenericParameters.Add(new GenericParameter(genParamDef.Name, methodRef));
56 | }
57 |
58 | return methodRef;
59 | }
60 |
61 | public static MethodReference ReferenceMethod(this TypeReference typeRef, Func methodSelector)
62 | {
63 | return _CloneMethodWithDeclaringType(typeRef.Resolve().Methods.FirstOrDefault(methodSelector), typeRef);
64 | }
65 |
66 | public static FieldReference ReferenceField(this TypeReference typeRef, Func fieldSelector)
67 | {
68 | FieldDefinition fieldDef = typeRef.Resolve().Fields.FirstOrDefault(fieldSelector);
69 | if (!typeRef.IsGenericInstance || fieldDef == null)
70 | {
71 | return fieldDef;
72 | }
73 |
74 | return new FieldReference(fieldDef.Name, fieldDef.FieldType, typeRef);
75 | }
76 |
77 | private static MethodReference ReferencePropertyGetter(this TypeReference typeRef, Func propertySelector)
78 | {
79 | PropertyDefinition propDef = typeRef.Resolve().Properties.FirstOrDefault(propertySelector);
80 | if (propDef == null || propDef.GetMethod == null)
81 | {
82 | return null;
83 | }
84 |
85 | return _CloneMethodWithDeclaringType(propDef.GetMethod, typeRef);
86 | }
87 |
88 | private static MethodReference ReferencePropertySetter(this TypeReference typeRef, Func propertySelector)
89 | {
90 | PropertyDefinition propDef = typeRef.Resolve().Properties.FirstOrDefault(propertySelector);
91 | if (propDef == null || propDef.SetMethod == null)
92 | {
93 | return null;
94 | }
95 |
96 | return _CloneMethodWithDeclaringType(propDef.SetMethod, typeRef);
97 | }
98 | }
99 | }
--------------------------------------------------------------------------------
/Src/BridgeVs.Build/Util/VisualizerAssemblyNameFormat.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System;
27 | using System.IO;
28 |
29 | namespace BridgeVs.Build.Util
30 | {
31 | internal static class VisualizerAssemblyNameFormat
32 | {
33 | private const string DotNetFrameworkVisualizerName = "";
34 |
35 | ///
36 | /// This method returns the file name for the visualizer assembly being generated for the source assembly being mapped
37 | /// based on the visual studio version
38 | ///
39 | /// The visual studio version. 11(VS2012),12 (VS2013),14 (VS2015), 15 (VS2017)
40 | /// The source assembly being mapped by the visualizer
41 | /// The visualizer file name.
42 | /// Source Assembly: ConsoleApp.exe - VS Version: 15 - ConsoleApp.Visualizer.V15.dll
43 | internal static string GetTargetVisualizerAssemblyName(string vsVersion, string assembly)
44 | {
45 | if (!vsVersion.Contains("."))
46 | {
47 | throw new ArgumentException(@"The passed visual studio version is not correct", nameof(vsVersion));
48 | }
49 |
50 | string versionNumber = vsVersion.Split('.')[0];
51 | return $"{Path.GetFileNameWithoutExtension(assembly)}.Visualizer.V{versionNumber}.dll";
52 | }
53 |
54 | ///
55 | /// This methods returns the file name for the visualizer assembly being generated for the dot net framework.
56 | ///
57 | /// The visual studio version. 11(VS2012),12 (VS2013),14 (VS2015), 15 (VS2017).
58 | /// he visualizer file name.
59 | /// VS Version: 15 - DotNetDynamicVisualizerType.V15.dll
60 | public static string GetDotNetVisualizerName(string vsVersion)
61 | {
62 | string versionNumber = vsVersion.Split('.')[0];
63 | return $"DotNetDynamicVisualizerType.V{versionNumber}.dll";
64 | }
65 | }
66 | }
--------------------------------------------------------------------------------
/Src/BridgeVs.Build/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Src/BridgeVs.Build/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Src/BridgeVs.DynamicVisualizers/DynamicObjectSource.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using BridgeVs.DynamicVisualizers.Helper;
27 | using BridgeVs.Shared.Logging;
28 | using BridgeVs.Shared.Options;
29 | using BridgeVs.Shared.Serialization;
30 | using BridgeVs.Shared.Util;
31 | using Microsoft.VisualStudio.DebuggerVisualizers;
32 | using System;
33 | using System.Collections.Generic;
34 | using System.IO;
35 | using System.Threading;
36 | using CRC = BridgeVs.Shared.Common.CommonRegistryConfigurations;
37 | using Message = BridgeVs.DynamicVisualizers.Template.Message;
38 |
39 | namespace BridgeVs.DynamicVisualizers
40 | {
41 | public class DynamicObjectSource : VisualizerObjectSource
42 | {
43 | public override void GetData(object target, Stream outgoingData)
44 | {
45 | //configure once the vs version for logging and raven
46 | string vsVersion = VisualStudioVersionHelper.FindCurrentVisualStudioVersion();
47 | Log.VisualStudioVersion = vsVersion;
48 | try
49 | {
50 | string truckId = Guid.NewGuid().ToString();
51 |
52 | SerializationOption? serializationOption = Truck.SendCargo(target, truckId, CRC.GetSerializationOption(vsVersion));
53 |
54 | if (serializationOption.HasValue)
55 | {
56 | Message message = new Message(truckId, serializationOption.Value, target.GetType());
57 |
58 | Type type = Type.GetType(message.AssemblyQualifiedName);
59 |
60 | List assemblyNames = type.FindAssemblyNames();
61 | List projects = CRC.GetAssemblySolutionAndProject(assemblyNames, vsVersion);
62 |
63 | message.ReferencedAssemblies.AddRange(projects);
64 |
65 | Serialize(outgoingData, message);
66 | }
67 | else
68 | {
69 | Log.Write("Serialization option returned null");
70 | }
71 | }
72 | catch (ThreadAbortException)
73 | {
74 | // Catch exception and do nothing
75 | Thread.ResetAbort();
76 | }
77 | catch (Exception exception)
78 | {
79 | Log.Write(exception, "Error in BroadCastData");
80 | exception.Capture(vsVersion, message: "Error broadcasting the data to LINQPad");
81 | }
82 | }
83 | }
84 | }
--------------------------------------------------------------------------------
/Src/BridgeVs.DynamicVisualizers/Forms/TemporaryForm.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System;
27 | using System.Drawing;
28 | using System.Windows.Forms;
29 |
30 | namespace BridgeVs.DynamicVisualizers.Forms
31 | {
32 | internal class TemporaryForm : Form
33 | {
34 | private readonly Exception _exception;
35 |
36 | public TemporaryForm(Exception exception = null)
37 | {
38 |
39 | SuspendLayout();
40 | FormBorderStyle = FormBorderStyle.None;
41 | MaximizeBox = false;
42 | Name = "TemporaryForm";
43 | ShowIcon = false;
44 | ShowInTaskbar = false;
45 | Location = Cursor.Position;
46 | StartPosition = FormStartPosition.CenterParent;
47 | BackColor = Color.FromArgb(1, 0, 0);
48 | WindowState = FormWindowState.Maximized;
49 | Opacity = 0.01;
50 | Width = Screen.PrimaryScreen.WorkingArea.Width;
51 | Height = Screen.PrimaryScreen.WorkingArea.Height;
52 | ResumeLayout(false);
53 | Shown += Form1_Shown;
54 | _exception = exception;
55 | }
56 |
57 | private void Form1_Shown(object sender, EventArgs e)
58 | {
59 | if (_exception != null)
60 | {
61 | MessageBox.Show(_exception.Message, "Error in LINQBridgeVs", MessageBoxButtons.OK,
62 | MessageBoxIcon.Error);
63 | }
64 | }
65 |
66 | protected override void OnClick(EventArgs e)
67 | {
68 | base.OnClick(e);
69 | Invalidate();
70 | Close();
71 | }
72 |
73 | protected override void OnMouseClick(MouseEventArgs e)
74 | {
75 | base.OnMouseClick(e);
76 | Invalidate();
77 | Close();
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/Src/BridgeVs.DynamicVisualizers/Forms/TemporaryForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Src/BridgeVs.DynamicVisualizers/GlobalSuppressions.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingadventures/LINQBridgeVs/2b744965b5be21cd4030d6c87cadbd2bc8c914c5/Src/BridgeVs.DynamicVisualizers/GlobalSuppressions.cs
--------------------------------------------------------------------------------
/Src/BridgeVs.DynamicVisualizers/Helper/VisualStudioVersionHelper.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System.Linq;
27 |
28 | namespace BridgeVs.DynamicVisualizers.Helper
29 | {
30 | internal static class VisualStudioVersionHelper
31 | {
32 | ///
33 | /// It returns the visual studio version of the current assembly. by reading the major version from the assembly
34 | /// of Microsoft.VisualStudio.DebuggerVisualizers it is possible to deduce the visual studio version.
35 | ///
36 | /// The visual studio version. 15.0 --> VS2017, 14.0 --> VS2015 and so on
37 | internal static string FindCurrentVisualStudioVersion()
38 | {
39 | int version = (from refAssembly in typeof(VisualStudioVersionHelper).Assembly.GetReferencedAssemblies()
40 | where refAssembly.FullName.Contains("Microsoft.VisualStudio.DebuggerVisualizers")
41 | select refAssembly.Version.Major).FirstOrDefault();
42 |
43 | return version + ".0";
44 | }
45 | }
46 | }
--------------------------------------------------------------------------------
/Src/BridgeVs.DynamicVisualizers/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System.Reflection;
27 | using System.Runtime.CompilerServices;
28 | using System.Runtime.InteropServices;
29 |
30 | // General Information about an assembly is controlled through the following
31 | // set of attributes. Change these attribute values to modify the information
32 | // associated with an assembly.
33 | [assembly: AssemblyTitle("BridgeVs.DynamicVisualizers")]
34 | [assembly: AssemblyDescription("LINQBridgeVs Dynamic Visualizer")]
35 | [assembly: AssemblyProduct("BridgeVs.DynamicVisualizers")]
36 |
37 | #if TEST
38 | [assembly: InternalsVisibleTo("BridgeVs.UnitTest, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f575ceee4c0b7992660f21a6c2a09c93eac56d9dad2f20caa2d48bf5d904c9b2af5800ba01cae7b37299bff9486a8b97047959c3fbe16de730cf3397f4bafaefc745dba1ce34cedf27698f2dc96159eaa27eef4093f6c35236f30239a4841b864ea734ed3582478cc4214d76497ceb974ac920f35043de0913a149d1107bd3a1")]
39 | #endif
--------------------------------------------------------------------------------
/Src/BridgeVs.DynamicVisualizers/Template/Inspection.Template.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System.Collections.Generic;
27 | using BridgeVs.DynamicVisualizers.Helper;
28 | using BridgeVs.Shared.Options;
29 |
30 | namespace BridgeVs.DynamicVisualizers.Template
31 | {
32 | public partial class Inspection
33 | {
34 | private readonly string _typeNamespace;
35 |
36 | private readonly List _assemblies;
37 | private readonly string _typeToRetrieveFullName;
38 | private readonly string _typeName;
39 | private readonly string _truckId;
40 | private readonly SerializationOption _serializationType;
41 |
42 | internal Inspection(Message message)
43 | {
44 | _truckId = message.TruckId;
45 | _typeNamespace = message.TypeNamespace;
46 | _typeName = message.TypeName;
47 | _assemblies = message.ReferencedAssemblies;
48 | _typeToRetrieveFullName = TypeNameHelper.RemoveSystemNamespaces(message.TypeFullName);
49 | //if the type is anonymous or it's a nested class then use the generic object
50 | _typeName = _typeToRetrieveFullName.Contains("AnonymousType") || _typeToRetrieveFullName.Contains("+") ? "object" : _typeToRetrieveFullName;
51 | _serializationType = message.SerializationOption;
52 | }
53 | }
54 | }
--------------------------------------------------------------------------------
/Src/BridgeVs.DynamicVisualizers/Template/Inspection.tt:
--------------------------------------------------------------------------------
1 | <#@ template debug="false" hostspecific="false" language="C#" #>
2 | <#@ assembly name="System.Core" #>
3 | <#@ import namespace="System.Linq" #>
4 | <#@ import namespace="System.Text" #>
5 | <#@ import namespace="System.Collections.Generic" #>
6 | <#@ output extension=".linq" #>
7 |
8 |
9 | System
10 | System.Dynamic
11 | System.Runtime.Serialization.Formatters
12 | System.Xml.Linq
13 | BridgeVs.Shared.Serialization
14 | BridgeVs.Shared
15 | BridgeVs.Shared.Options
16 | <#= _typeNamespace #>
17 | <# foreach(var elem in _assemblies) {
18 | if (!elem.Contains("mscorlib")){#>
19 | <#=elem#>
20 | <#}
21 | }#>
22 |
23 | void Main()
24 | {
25 | Truck.ReceiveCargo("<#=_truckId#>", SerializationOption.<#= _serializationType #>, typeof(<#=_typeName#>)).Dump("<#=_typeToRetrieveFullName#>", 2);
26 | }
--------------------------------------------------------------------------------
/Src/BridgeVs.DynamicVisualizers/Template/Message.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using BridgeVs.DynamicVisualizers.Helper;
27 | using BridgeVs.Shared.Options;
28 | using System;
29 | using System.Collections.Generic;
30 | using System.Text.RegularExpressions;
31 |
32 | namespace BridgeVs.DynamicVisualizers.Template
33 | {
34 | [Serializable]
35 | internal class Message
36 | {
37 | public readonly string FileName;
38 | public readonly string TypeName;
39 | public readonly string TypeFullName;
40 |
41 | public readonly string TypeNamespace;
42 | public readonly string AssemblyQualifiedName;
43 | public readonly string AssemblyName;
44 | public readonly string TruckId;
45 | public readonly SerializationOption SerializationOption;
46 | public readonly List ReferencedAssemblies = new List(30);
47 |
48 | private readonly Regex _pattern1 = new Regex("[<]");
49 | private readonly Regex _pattern2 = new Regex("[>]");
50 | private readonly Regex _pattern3 = new Regex("[,]");
51 | private readonly Regex _pattern4 = new Regex("[`]");
52 | private readonly Regex _pattern5 = new Regex("[ ]");
53 |
54 | public Message(string truckId, SerializationOption serializationOption, Type type)
55 | {
56 | Type targetType = GetInterfaceTypeIfIsIterator(type);
57 |
58 | SerializationOption = serializationOption;
59 | FileName = CalculateFileNameFromType(targetType);
60 | TypeName = CalculateTypeNameFromType(targetType).Trim();
61 | TypeFullName = targetType.GetDisplayName(fullName: true);
62 | TypeNamespace = targetType.Namespace;
63 | AssemblyQualifiedName = targetType.AssemblyQualifiedName;
64 | AssemblyName = targetType.Assembly.GetName().Name;
65 | TruckId = truckId;
66 | }
67 |
68 | private string CalculateTypeNameFromType(Type type)
69 | {
70 | string targetTypeName = type.GetDisplayName(fullName: false);
71 |
72 | string typeName = _pattern1.Replace(targetTypeName, string.Empty);
73 | typeName = _pattern2.Replace(typeName, string.Empty);
74 | typeName = _pattern3.Replace(typeName, string.Empty);
75 | typeName = _pattern4.Replace(typeName, string.Empty);
76 | typeName = _pattern5.Replace(typeName, string.Empty);
77 |
78 | return typeName;
79 | }
80 |
81 | private static Type GetInterfaceTypeIfIsIterator(Type type)
82 | {
83 | string typeFullName = type.FullName;
84 |
85 | bool isObjectEnumerable = !string.IsNullOrEmpty(typeFullName) && typeFullName.Contains("System.Linq.Enumerable");
86 |
87 | if (!type.IsNestedPrivate || !type.Name.Contains("Iterator") || !isObjectEnumerable)
88 | return type;
89 |
90 | bool isBaseTypeEnumerable = type.BaseType == null || (!string.IsNullOrEmpty(type.BaseType.FullName) &&
91 | type.BaseType.FullName.Contains("Object"));
92 | //try with the base type now
93 | return isBaseTypeEnumerable ? type.GetInterface("IEnumerable`1") : type.BaseType.GetInterface("IEnumerable`1");
94 | }
95 |
96 | private string CalculateFileNameFromType(Type type)
97 | {
98 | string targetTypeFullName = type.GetDisplayName(false);
99 |
100 | string fileName = _pattern1.Replace(targetTypeFullName, "(");
101 | fileName = _pattern2.Replace(fileName, ")");
102 |
103 | return fileName;
104 | }
105 |
106 | public override string ToString()
107 | {
108 | return $"FileName: {FileName}"
109 | + Environment.NewLine
110 | + $"TypeFullName: {TypeFullName}"
111 | + Environment.NewLine
112 | + $"TypeName: {TypeName}"
113 | + Environment.NewLine
114 | + $"TypeNamespace: {TypeNamespace}"
115 | + Environment.NewLine
116 | + $"TruckId: {TruckId}"
117 | + Environment.NewLine
118 | + $"SerializationType: {SerializationOption}";
119 | }
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/Src/BridgeVs.DynamicVisualizers/Win32Interop.WinHandles/Internal/NativeMethods.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using System.Text;
4 |
5 | namespace Win32Interop.WinHandles.Internal
6 | {
7 | internal delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
8 |
9 | /// Win32 methods.
10 | internal static class NativeMethods
11 | {
12 | public const bool EnumWindows_ContinueEnumerating = true;
13 | public const bool EnumWindows_StopEnumerating = false;
14 |
15 | [DllImport("user32.dll")]
16 | public static extern bool EnumWindows(EnumWindowsProc enumProc, IntPtr lParam);
17 |
18 | [DllImport("user32.dll")]
19 | internal static extern IntPtr FindWindow(string sClassName, string sAppName);
20 |
21 | [DllImport("user32.dll")]
22 | internal static extern bool IsWindowVisible(IntPtr hWnd);
23 |
24 | [DllImport("user32.dll")]
25 | internal static extern IntPtr GetForegroundWindow();
26 |
27 | [DllImport("user32.dll", SetLastError = true)]
28 | internal static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint processId);
29 |
30 | [DllImport("user32.dll", CharSet = CharSet.Unicode)]
31 | internal static extern int GetWindowText(IntPtr hWnd, StringBuilder strText, int maxCount);
32 |
33 | [DllImport("user32.dll", CharSet = CharSet.Unicode)]
34 | internal static extern int GetWindowTextLength(IntPtr hWnd);
35 |
36 | [DllImport("user32.dll")]
37 | internal static extern int GetClassName(IntPtr hWnd,
38 | StringBuilder lpClassName,
39 | int nMaxCount);
40 | }
41 | }
--------------------------------------------------------------------------------
/Src/BridgeVs.DynamicVisualizers/Win32Interop.WinHandles/TopLevelWindowUtils.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using Win32Interop.WinHandles.Internal;
5 |
6 | namespace Win32Interop.WinHandles
7 | {
8 | ///
9 | /// Utilities for operating on windows that are top-level on the screen.
10 | ///
11 | public static class TopLevelWindowUtils
12 | {
13 | /// Gets the WindowHandle to the current foreground window.
14 | /// The foreground window.
15 | public static WindowHandle GetForegroundWindow()
16 | {
17 | var ptr = NativeMethods.GetForegroundWindow();
18 | return new WindowHandle(ptr);
19 | }
20 |
21 | /// Finds all the windows that match the given predicate.
22 | /// Thrown when one or more required
23 | /// arguments are null.
24 | /// A predicate which determines if the given
25 | /// window should be included in the collection returned.
26 | /// A collection of windows that passed the predicate.
27 | public static IEnumerable FindWindows(Predicate windowPredicate)
28 | {
29 | if (windowPredicate == null)
30 | throw new ArgumentNullException(nameof(windowPredicate));
31 |
32 | List windows = null;
33 |
34 | NativeMethods.EnumWindows((ptr, param) =>
35 | {
36 | var window = new WindowHandle(ptr);
37 | if (windowPredicate.Invoke(window))
38 | {
39 | if (windows == null)
40 | {
41 | windows = new List();
42 | }
43 |
44 | windows.Add(window);
45 | }
46 |
47 | return NativeMethods.EnumWindows_ContinueEnumerating;
48 | },
49 | IntPtr.Zero);
50 |
51 | // ReSharper disable once AssignNullToNotNullAttribute
52 | return windows ?? Enumerable.Empty();
53 | }
54 |
55 | ///
56 | /// Searches for the first window that matches the predicate.
57 | ///
58 | /// Thrown when one or more required
59 | /// arguments are null.
60 | /// The search criteria for the window. Return true
61 | /// when the window has been found.
62 | ///
63 | /// The window handle for which callback() returned true, or
64 | /// if callback() never returned true.
65 | ///
66 | public static WindowHandle FindWindow(Predicate callback)
67 | {
68 | if (callback == null)
69 | throw new ArgumentNullException(nameof(callback));
70 |
71 | WindowHandle found = WindowHandle.Invalid;
72 | NativeMethods.EnumWindows(delegate(IntPtr wnd, IntPtr param)
73 | {
74 | var window = new WindowHandle(wnd);
75 | if (callback.Invoke(window))
76 | {
77 | found = window;
78 | return NativeMethods.EnumWindows_StopEnumerating;
79 | }
80 |
81 | return NativeMethods.EnumWindows_ContinueEnumerating;
82 | },
83 | IntPtr.Zero);
84 |
85 | return found;
86 | }
87 | }
88 | }
--------------------------------------------------------------------------------
/Src/BridgeVs.DynamicVisualizers/Win32Interop.WinHandles/WindowHandle.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32Interop.WinHandles
4 | {
5 | ///
6 | /// Small wrapper class to allow extension methods specific to Win32 windows.
7 | ///
8 | public struct WindowHandle
9 | {
10 | /// Constructor.
11 | /// A raw IntPtr to the Win32 handle.
12 | public WindowHandle(IntPtr rawPtr)
13 | {
14 | RawPtr = rawPtr;
15 | }
16 |
17 | /// Represents an invalid window handle.
18 | public static WindowHandle Invalid { get; }
19 | = new WindowHandle(IntPtr.Zero);
20 |
21 | /// A raw IntPtr to the Win32 handle.
22 | public IntPtr RawPtr { get; }
23 |
24 | /// True if the handle represents a valid Win32 handle.
25 | public bool IsValid
26 | => RawPtr != IntPtr.Zero;
27 | }
28 | }
--------------------------------------------------------------------------------
/Src/BridgeVs.DynamicVisualizers/Win32Interop.WinHandles/WindowHandleExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using Win32Interop.WinHandles.Internal;
3 |
4 | namespace Win32Interop.WinHandles
5 | {
6 | /// Extension methods for
7 | public static class WindowHandleExtensions
8 | {
9 | /// Check if the given window handle is currently visible.
10 | /// The window to act on.
11 | /// true if the window is visible, false if not.
12 | public static bool IsVisible(this WindowHandle windowHandle)
13 | {
14 | return NativeMethods.IsWindowVisible(windowHandle.RawPtr);
15 | }
16 |
17 | /// Gets the Win32 class name of the given window.
18 | /// The window handle to act on.
19 | /// The class name of the passed in window.
20 | public static string GetClassName(this WindowHandle windowHandle)
21 | {
22 | int size = 255;
23 | int actualSize = 0;
24 | StringBuilder builder;
25 | do
26 | {
27 | builder = new StringBuilder(size);
28 | actualSize = NativeMethods.GetClassName(windowHandle.RawPtr, builder, builder.Capacity);
29 | size *= 2;
30 | } while (actualSize == size - 1);
31 |
32 | return builder.ToString();
33 | }
34 |
35 | /// Gets the text associated with the given window handle.
36 | /// The window handle to act on.
37 | /// The window text.
38 | public static string GetWindowText(this WindowHandle windowHandle)
39 | {
40 | int size = NativeMethods.GetWindowTextLength(windowHandle.RawPtr);
41 | if (size > 0)
42 | {
43 | StringBuilder builder = new StringBuilder(size + 1);
44 | NativeMethods.GetWindowText(windowHandle.RawPtr, builder, builder.Capacity);
45 | return builder.ToString();
46 | }
47 |
48 | return string.Empty;
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/Src/BridgeVs.DynamicVisualizers/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Src/BridgeVs.DynamicVisualizers/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Src/BridgeVs.Shared/BridgeVs.Shared.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {BC10F93A-5DA2-44F8-AE5E-5603CB46B548}
8 | Library
9 | Properties
10 | BridgeVs.Shared
11 | BridgeVs.Shared
12 | v4.0
13 | 512
14 |
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 | false
25 |
26 |
27 | full
28 | false
29 | true
30 | bin\Test\
31 | TRACE;DEBUG;TEST
32 | prompt
33 | 4
34 | false
35 |
36 |
37 | pdbonly
38 | true
39 | bin\Deploy\
40 | TRACE;DEPLOY
41 | prompt
42 | 4
43 | true
44 | false
45 |
46 |
47 | true
48 |
49 |
50 | ..\BridgeVs.AsyncVsPackage\Key.snk
51 |
52 |
53 |
54 |
55 |
56 | ..\packages\Newtonsoft.Json.11.0.2\lib\net40\Newtonsoft.Json.dll
57 |
58 |
59 |
60 |
61 |
62 | ..\packages\System.IO.Abstractions.2.1.0.256\lib\net40\System.IO.Abstractions.dll
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 | {31fe81f8-6e49-432c-b0b2-658e76f96983}
95 | SharpRaven
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/Src/BridgeVs.Shared/Common/BridgeProjectInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace BridgeVs.Shared.Common
4 | {
5 | public class BridgeProjectInfo
6 | {
7 | public BridgeProjectInfo(string projectName, string solutionName, string assemblyName)
8 | :this(projectName, solutionName, assemblyName, string.Empty, string.Empty, string.Empty, new List())
9 | {
10 |
11 | }
12 | public BridgeProjectInfo(string projectName, string solutionName, string assemblyName, string projectOutput, string vsVersion, string vsEdition, List references)
13 | {
14 | ProjectName = projectName;
15 | SolutionName = solutionName;
16 | AssemblyName = assemblyName;
17 | ProjectOutput = projectOutput;
18 | VsVersion = vsVersion;
19 | VsEdition = vsEdition;
20 | References = references;
21 | }
22 |
23 |
24 | public string ProjectName { get; }
25 |
26 | public List References;
27 |
28 | public string SolutionName { get; }
29 |
30 | public string AssemblyName { get; }
31 |
32 | public string ProjectOutput { get; }
33 |
34 | public string VsVersion { get; }
35 |
36 | public string VsEdition { get; }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Src/BridgeVs.Shared/Dependency/Crawler.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using Microsoft.Build.Evaluation;
27 | using System;
28 | using System.Collections.Generic;
29 | using System.IO;
30 | using System.Linq;
31 | using System.Xml;
32 |
33 | namespace BridgeVs.Shared.Dependency
34 | {
35 | public class Crawler
36 | {
37 | private const string MsbuildNamespace = "http://schemas.microsoft.com/developer/msbuild/2003";
38 |
39 | ///
40 | /// Finds the project dependencies given a csproj or vbproj file
41 | ///
42 | /// Path to the CS or VB project.
43 | /// a list of dependencies - path to the assembly
44 | public static IEnumerable FindDependencies(string projectFilePath)
45 | {
46 | if (string.IsNullOrEmpty(projectFilePath))
47 | {
48 | return Enumerable.Empty();
49 | }
50 |
51 | XmlNamespaceManager namespaceManager = new XmlNamespaceManager(new NameTable());
52 | namespaceManager.AddNamespace("aw", MsbuildNamespace);
53 |
54 | Project loadedProject =
55 | ProjectCollection.GlobalProjectCollection.LoadedProjects
56 | .FirstOrDefault(p => CompareProjectFileName(p, projectFilePath))
57 | ?? new Project(projectFilePath);
58 |
59 | IEnumerable assemblyReference =
60 | from proj in loadedProject.Items
61 | where proj.ItemType.Equals("Reference") && !proj.EvaluatedInclude.Contains("Microsoft") && !proj.EvaluatedInclude.Contains("System")
62 | let infos = proj.DirectMetadata.Select(p => p.EvaluatedValue)
63 | from info in infos
64 | where !string.IsNullOrEmpty(info) && !(info.Equals("True") || info.Equals("False")) //it could be true or false for some reason
65 | select info;
66 |
67 | return assemblyReference;
68 | }
69 |
70 | private static readonly Func CompareProjectFileName =
71 | (project, projectToCompare) =>
72 | {
73 | if (project == null) return false;
74 |
75 | string proj1FileName = Path.GetFileName(project.FullPath);
76 | string proj2FileName = Path.GetFileName(projectToCompare);
77 |
78 | return
79 | !string.IsNullOrEmpty(proj1FileName)
80 | && !string.IsNullOrEmpty(proj2FileName)
81 | && proj1FileName.Equals(proj2FileName);
82 | };
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/Src/BridgeVs.Shared/FileSystem/FileSystemFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO.Abstractions;
3 |
4 | namespace BridgeVs.Shared.FileSystem
5 | {
6 | public static class FileSystemFactory
7 | {
8 | private static readonly Lazy RealFileSystem = new Lazy(() => new System.IO.Abstractions.FileSystem());
9 |
10 | public static IFileSystem FileSystem => RealFileSystem.Value;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Src/BridgeVs.Shared/Logging/Log.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using BridgeVs.Shared.Common;
27 | using System;
28 | using System.Diagnostics;
29 | using System.Globalization;
30 | using System.IO;
31 |
32 | namespace BridgeVs.Shared.Logging
33 | {
34 | public static class Log
35 | {
36 | private static readonly string LogTxtFilePath = Path.Combine(CommonFolderPaths.LogFolderPath, "logs.txt");
37 |
38 | public static string VisualStudioVersion { get; set; }
39 |
40 | [Conditional("DEPLOY")]
41 | [Conditional("DEBUG")]
42 | public static void Write(Exception ex, string context = null)
43 | {
44 | if (string.IsNullOrEmpty(VisualStudioVersion))
45 | return;
46 |
47 | if (!CommonRegistryConfigurations.IsLoggingEnabled(VisualStudioVersion))
48 | return;
49 |
50 | try
51 | {
52 | string text = string.Concat(ex.GetType().Name, ": ", ex.Message, "\r\n", ex.StackTrace ?? "");
53 | if (ex.InnerException != null)
54 | {
55 | string text2 = text;
56 | text = string.Concat(text2, "\r\nINNER: ", ex.InnerException.GetType().Name, ex.InnerException.Message, (ex.InnerException.StackTrace ?? "").Replace("\n", "\n "));
57 | }
58 | if (!string.IsNullOrEmpty(context))
59 | {
60 | text = context + " - \r\n" + text;
61 | }
62 |
63 | InternalWrite(text);
64 | }
65 | catch
66 | {
67 | // ignored
68 | }
69 | }
70 |
71 | private static void InternalWrite(string msg, params object[] args)
72 | {
73 | if (args != null && args.Length > 0)
74 | msg = string.Format(CultureInfo.InvariantCulture, msg, args);
75 |
76 | File.AppendAllText(LogTxtFilePath, string.Concat(new[]
77 | {
78 | DateTime.Now.ToString("o"), " ", msg.Trim(), Environment.NewLine
79 | }));
80 | }
81 |
82 | ///
83 | /// Writes a formatted message
84 | ///
85 | /// A composite format string (see Remarks) that contains text intermixed with zero or more format items, which correspond to objects in the array.An object array that contains zero or more objects to format.
86 | [Conditional("DEBUG")]
87 | [Conditional("DEPLOY")]
88 | public static void Write(string msg, params object[] args)
89 | {
90 | if (string.IsNullOrEmpty(VisualStudioVersion))
91 | return;
92 |
93 | if (!CommonRegistryConfigurations.IsLoggingEnabled(VisualStudioVersion))
94 | return;
95 |
96 | try
97 | {
98 | InternalWrite(msg, args);
99 | }
100 | catch
101 | {
102 | // ignored
103 | }
104 | }
105 | }
106 | }
--------------------------------------------------------------------------------
/Src/BridgeVs.Shared/Logging/RavenWrapper.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using BridgeVs.Shared.Common;
27 | using SharpRaven;
28 | using SharpRaven.Data;
29 | using System;
30 | using System.Diagnostics;
31 | using System.Reflection;
32 |
33 | namespace BridgeVs.Shared.Logging
34 | {
35 | public static class RavenWrapper
36 | {
37 | ///
38 | /// The client id associated with the Sentry.io account.
39 | ///
40 | private const string RavenClientId = "https://e187bfd9b1304311be6876ac9036956d:6580e15fc2fd40899e5d5b0f28685efc@sentry.io/1189532";
41 | private const string LinqBridgeVs = "linqbridgevs";
42 | private const int Timeout = 2000;
43 |
44 | private static readonly Action OnSendError = ex =>
45 | {
46 | Trace.WriteLine("Error sending report to Sentry.io");
47 | Trace.WriteLine(ex.Message);
48 | Trace.WriteLine(ex.StackTrace);
49 | };
50 |
51 | [Conditional("DEPLOY")]
52 | public static void Capture(this Exception exception, string vsVersion, ErrorLevel errorLevel = ErrorLevel.Error, string message = "")
53 | {
54 | if (string.IsNullOrEmpty(vsVersion))
55 | {
56 | return;
57 | }
58 |
59 | if (!CommonRegistryConfigurations.IsErrorTrackingEnabled(vsVersion))
60 | {
61 | return;
62 | }
63 |
64 | Func removeUserId = new Func(request =>
65 | {
66 | //GDPR compliant, no personal data sent: no server name, no username stored, no ip address
67 | request.Packet.ServerName = LinqBridgeVs;
68 | request.Packet.Contexts.Device.Name = LinqBridgeVs;
69 | request.Packet.User.Username = CommonRegistryConfigurations.GetUniqueGuid(vsVersion);
70 | request.Packet.Release = Assembly.GetExecutingAssembly().VersionNumber();
71 | request.Packet.User.IpAddress = "0.0.0.0";
72 | return request;
73 | });
74 |
75 | SentryEvent sentryEvent = new SentryEvent(exception)
76 | {
77 | Message = message,
78 | Level = errorLevel
79 | };
80 |
81 | sentryEvent.Tags.Add("Visual Studio Version", vsVersion);
82 |
83 | RavenClient ravenClient = new RavenClient(RavenClientId)
84 | {
85 | BeforeSend = removeUserId,
86 | ErrorOnCapture = OnSendError,
87 | Timeout = TimeSpan.FromMilliseconds(Timeout) //should fail early if it can't send a message
88 | };
89 |
90 | ravenClient.Capture(sentryEvent);
91 | }
92 | }
93 | }
--------------------------------------------------------------------------------
/Src/BridgeVs.Shared/Options/Defaults.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | namespace BridgeVs.Shared.Options
27 | {
28 | public static class Defaults
29 | {
30 | public const string LINQPadInstallationPath = @"C:\Program Files (x86)\LINQPad5";
31 | public const SerializationOption SerializationMethod = SerializationOption.BinarySerializer;
32 | public const bool ErrorTrackingEnabled = false;
33 | public const bool LoggingEnabled = false;
34 | public const bool Map3RdPartyAssembly = false;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Src/BridgeVs.Shared/Options/SerializationOption.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System;
27 |
28 | namespace BridgeVs.Shared.Options
29 | {
30 | [Serializable]
31 | public enum SerializationOption
32 | {
33 | JsonSerializer,
34 | BinarySerializer,
35 | XmlSerializer
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Src/BridgeVs.Shared/Options/VisualStudioOption.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System;
27 | using System.Collections.Generic;
28 | using System.IO;
29 | using BridgeVs.Shared.Common;
30 |
31 | namespace BridgeVs.Shared.Options
32 | {
33 | internal class Settings
34 | {
35 | public string DebuggerVisualizerDestinationFolder;
36 |
37 | public string MsBuildVersion;
38 |
39 | public List CommonReferenceAssembliesLocation;
40 | }
41 |
42 | public static class VisualStudioOption
43 | {
44 | private static readonly Dictionary VisualStudioPaths;
45 |
46 | static VisualStudioOption()
47 | {
48 | VisualStudioPaths = new Dictionary
49 | {
50 | {
51 | "11.0", new Settings
52 | {
53 | DebuggerVisualizerDestinationFolder = CommonFolderPaths.Vs2012DebuggerVisualizerDestinationFolder,
54 | MsBuildVersion = "v4.0",
55 | CommonReferenceAssembliesLocation =new List { Path.Combine(CommonFolderPaths.VisualStudio2012Path, CommonFolderPaths.CommonReferenceAssembliesPath)}
56 | }
57 | },
58 | {
59 | "12.0", new Settings
60 | {
61 | DebuggerVisualizerDestinationFolder = CommonFolderPaths.Vs2013DebuggerVisualizerDestinationFolder,
62 | MsBuildVersion = "v12.0",
63 | CommonReferenceAssembliesLocation =new List { Path.Combine(CommonFolderPaths.VisualStudio2013Path, CommonFolderPaths.CommonReferenceAssembliesPath)}
64 | }
65 | },
66 | {
67 | "14.0", new Settings
68 | {
69 | DebuggerVisualizerDestinationFolder = CommonFolderPaths.Vs2015DebuggerVisualizerDestinationFolder,
70 | MsBuildVersion = "v14.0",
71 | CommonReferenceAssembliesLocation = new List { Path.Combine(CommonFolderPaths.VisualStudio2015Path, CommonFolderPaths.CommonReferenceAssembliesPath)}
72 | }
73 | },
74 | {
75 | "15.0", new Settings
76 | {
77 | DebuggerVisualizerDestinationFolder = CommonFolderPaths.Vs2017DebuggerVisualizerDestinationFolder,
78 | MsBuildVersion = "v15.0",
79 | CommonReferenceAssembliesLocation =new List { Path.Combine(CommonFolderPaths.VisualStudio2017CommPath, CommonFolderPaths.CommonReferenceAssembliesPath), Path.Combine(CommonFolderPaths.VisualStudio2017EntPath, CommonFolderPaths.CommonReferenceAssembliesPath), Path.Combine(CommonFolderPaths.VisualStudio2017ProPath, CommonFolderPaths.CommonReferenceAssembliesPath)}
80 | }
81 | },
82 | {
83 | "16.0", new Settings
84 | {
85 | DebuggerVisualizerDestinationFolder = CommonFolderPaths.Vs2019DebuggerVisualizerDestinationFolder,
86 | MsBuildVersion = "v16.0"
87 | }
88 | }
89 | };
90 | }
91 |
92 | private static void CheckVersion(string vsInputVersion)
93 | {
94 | if (vsInputVersion == null) throw new ArgumentNullException(nameof(vsInputVersion));
95 |
96 | if (!VisualStudioPaths.ContainsKey(vsInputVersion))
97 | throw new ArgumentException("This Version of visual studio is not yet supported.", nameof(vsInputVersion));
98 | }
99 |
100 | public static string GetVisualizerDestinationFolder(string visualStudioVersion)
101 | {
102 | CheckVersion(visualStudioVersion);
103 |
104 | return VisualStudioPaths[visualStudioVersion].DebuggerVisualizerDestinationFolder;
105 | }
106 |
107 | public static List GetCommonReferenceAssembliesPath(string visualStudioVersion)
108 | {
109 | CheckVersion(visualStudioVersion);
110 |
111 | return VisualStudioPaths[visualStudioVersion].CommonReferenceAssembliesLocation;
112 | }
113 | }
114 | }
--------------------------------------------------------------------------------
/Src/BridgeVs.Shared/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 |
27 | using System.Reflection;
28 | using System.Runtime.InteropServices;
29 |
30 | // General Information about an assembly is controlled through the following
31 | // set of attributes. Change these attribute values to modify the information
32 | // associated with an assembly.
33 | [assembly: AssemblyTitle("BridgeVs.Shared")]
34 | [assembly: AssemblyDescription("Shared classes for BridgeVs")]
35 | [assembly: AssemblyProduct("BridgeVs.Shared")]
36 |
--------------------------------------------------------------------------------
/Src/BridgeVs.Shared/Properties/SharedAssemblyProperties.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 | using System.Reflection;
26 | using System.Runtime.InteropServices;
27 |
28 | [assembly: AssemblyCopyright("Copyright © Coding Adventures 2013 - 2018")]
29 | [assembly: AssemblyCompany("Coding Adventures")]
30 | [assembly: ComVisible(false)]
31 | [assembly: AssemblyVersion("2.0.*")]
32 |
--------------------------------------------------------------------------------
/Src/BridgeVs.Shared/Serialization/BinarySerializer.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System;
27 | using System.IO;
28 | using System.Runtime.Serialization;
29 | using System.Runtime.Serialization.Formatters.Binary;
30 | using BridgeVs.Shared.Logging;
31 | using BridgeVs.Shared.Options;
32 |
33 | namespace BridgeVs.Shared.Serialization
34 | {
35 | ///
36 | ///
37 | /// Default Binary Serializer. It uses the BinaryFormatter and it expects the types to be marked as Serializable
38 | ///
39 | public sealed class BinarySerializer : IServiceSerializer
40 | {
41 | private readonly BinaryFormatter _formatter = new BinaryFormatter();
42 |
43 | public IServiceSerializer Next { get; set; }
44 |
45 | ///
46 | ///
47 | /// Serializes the specified a stream.
48 | ///
49 | /// Type T to be serialized
50 | /// A stream.
51 | /// The object to serialize.
52 | public void Serialize(Stream aStream, T objToSerialize)
53 | {
54 | aStream.Seek(0, SeekOrigin.Begin);
55 | Log.Write("Serialization Used: " + ToString());
56 |
57 | try
58 | {
59 | _formatter.Serialize(aStream, objToSerialize);
60 | }
61 | catch (SerializationException)
62 | {
63 | Log.Write("Binary Serialization unsuccessful");
64 | throw;
65 | }
66 | }
67 |
68 | ///
69 | ///
70 | /// Serializes the specified object to serialize.
71 | ///
72 | /// Type T to be serialized
73 | /// The object to serialize.
74 | ///
75 | public byte[] Serialize(T objToSerialize)
76 | {
77 | byte[] retValue;
78 | try
79 | {
80 | using (MemoryStream stream = new MemoryStream())
81 | {
82 | _formatter.Serialize(stream, objToSerialize);
83 | retValue = new byte[stream.Length];
84 | stream.Seek(0, SeekOrigin.Begin);
85 | stream.Read(retValue, 0, (int)stream.Length);
86 | }
87 | }
88 | catch (SerializationException)
89 | {
90 | throw;
91 | }
92 | return retValue;
93 | }
94 |
95 | ///
96 | ///
97 | /// Deserializes the specified a stream.
98 | ///
99 | /// Type T to be serialized
100 | /// A stream.
101 | ///
102 | public T Deserialize(Stream aStream)
103 | {
104 | try
105 | {
106 | aStream.Seek(0, SeekOrigin.Begin);
107 | return (T)_formatter.Deserialize(aStream);
108 | }
109 | catch (SerializationException se)
110 | {
111 | Log.Write(se);
112 | //log something here
113 | throw;
114 | }
115 | }
116 |
117 | ///
118 | ///
119 | /// Deserializes the specified object to deserialize.
120 | ///
121 | /// Type T to be serialized
122 | /// The object to deserialize.
123 | ///
124 | public T Deserialize(byte[] objToDeserialize)
125 | {
126 | T retValue;
127 | try
128 | {
129 | using (MemoryStream stream = new MemoryStream(objToDeserialize))
130 | {
131 | retValue = (T)_formatter.Deserialize(stream);
132 | }
133 | }
134 | catch (SerializationException serializationException)
135 | {
136 | Log.Write(serializationException);
137 | throw;
138 | }
139 |
140 | return retValue;
141 | }
142 |
143 |
144 | ///
145 | ///
146 | /// Deserializes the specified object to deserialize.
147 | ///
148 | /// The object to deserialize.
149 | /// The type
150 | ///
151 | public object Deserialize(byte[] objToDeserialize, Type type = null)
152 | {
153 | object @object;
154 | try
155 | {
156 | using (MemoryStream stream = new MemoryStream(objToDeserialize))
157 | {
158 | @object = _formatter.Deserialize(stream);
159 | }
160 | }
161 | catch (SerializationException e)
162 | {
163 | Log.Write(e);
164 | throw;
165 | }
166 | return @object;
167 | }
168 |
169 | public override string ToString()
170 | {
171 | return SerializationOption.BinarySerializer.ToString();
172 | }
173 | }
174 | }
175 |
--------------------------------------------------------------------------------
/Src/BridgeVs.Shared/Serialization/IServiceSerializer.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System;
27 | using System.IO;
28 |
29 | namespace BridgeVs.Shared.Serialization
30 | {
31 | ///
32 | ///
33 | ///
34 | public interface IServiceSerializer
35 | {
36 | IServiceSerializer Next { get; set; }
37 | ///
38 | /// Serializes the specified a stream.
39 | ///
40 | ///
41 | /// A stream.
42 | /// The obj to serialize.
43 | void Serialize(Stream aStream, T objToSerialize);
44 | ///
45 | /// Serializes the specified obj to serialize.
46 | ///
47 | ///
48 | /// The obj to serialize.
49 | ///
50 | byte[] Serialize(T objToSerialize);
51 | ///
52 | /// Deserializes the specified a stream.
53 | ///
54 | ///
55 | /// A stream.
56 | ///
57 | T Deserialize(Stream aStream);
58 | ///
59 | /// Deserializes the specified obj to deserialize.
60 | ///
61 | ///
62 | /// The obj to deserialize.
63 | ///
64 | T Deserialize(byte[] objToDeserialize);
65 |
66 | ///
67 | /// Deserializes the specified obj to deserialize.
68 | ///
69 | /// The obj to deserialize.
70 | ///
71 | ///
72 | object Deserialize(byte[] objToDeserialize, Type @type = null);
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/Src/BridgeVs.Shared/Serialization/JsonSerializer.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System;
27 | using System.IO;
28 | using BridgeVs.Shared.Options;
29 | using Newtonsoft.Json;
30 | using Newtonsoft.Json.Bson;
31 | using Newtonsoft.Json.Serialization;
32 |
33 | namespace BridgeVs.Shared.Serialization
34 | {
35 | public sealed class JsonSerializer : IServiceSerializer
36 | {
37 | private const int MaxDepth = 8;
38 |
39 | public IServiceSerializer Next { get; set; }
40 |
41 | private readonly Newtonsoft.Json.JsonSerializer _jsonSerializer = new Newtonsoft.Json.JsonSerializer
42 | {
43 | MaxDepth = MaxDepth,
44 | Formatting = Formatting.None,
45 | ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
46 | TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Full,
47 | DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate,
48 | ObjectCreationHandling = ObjectCreationHandling.Auto,
49 | NullValueHandling = NullValueHandling.Include,
50 | ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor,
51 | ContractResolver = new DefaultContractResolver
52 | {
53 | IgnoreSerializableInterface = false,
54 | IgnoreSerializableAttribute = false,
55 | },
56 | TypeNameHandling = TypeNameHandling.All
57 | };
58 |
59 |
60 | public void Serialize(Stream aStream, T objToSerialize)
61 | {
62 | using (BsonWriter sw = new BsonWriter(aStream))
63 | {
64 | _jsonSerializer.Serialize(sw, objToSerialize);
65 | }
66 | }
67 |
68 | public byte[] Serialize(T objToSerialize)
69 | {
70 | using (MemoryStream stream = new MemoryStream())
71 | using (BsonWriter sw = new BsonWriter(stream))
72 | {
73 | _jsonSerializer.Serialize(sw, objToSerialize);
74 | return stream.ToArray();
75 | }
76 | }
77 |
78 | public T Deserialize(Stream aStream)
79 | {
80 | using (BsonReader reader = new BsonReader(aStream))
81 | {
82 | return _jsonSerializer.Deserialize(reader);
83 | }
84 | }
85 |
86 | public T Deserialize(byte[] objToDeserialize)
87 | {
88 | using (MemoryStream stream = new MemoryStream(objToDeserialize))
89 | using (BsonReader br = new BsonReader(stream))
90 | {
91 | return _jsonSerializer.Deserialize(br);
92 | }
93 | }
94 |
95 | public object Deserialize(byte[] objToDeserialize, Type type = null)
96 | {
97 |
98 | using (MemoryStream stream = new MemoryStream(objToDeserialize))
99 | using (BsonReader sw = new BsonReader(stream))
100 | {
101 | return @type != null ? _jsonSerializer.Deserialize(sw, type) : _jsonSerializer.Deserialize(sw);
102 | }
103 | }
104 |
105 | public override string ToString()
106 | {
107 | return SerializationOption.JsonSerializer.ToString();
108 | }
109 | }
110 | }
--------------------------------------------------------------------------------
/Src/BridgeVs.Shared/Serialization/XmlSerializer.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using BridgeVs.Shared.Options;
27 | using System;
28 | using System.IO;
29 | using MicrosoftXml = System.Xml.Serialization;
30 |
31 | namespace BridgeVs.Shared.Serialization
32 | {
33 | public sealed class XmlSerializer : IServiceSerializer
34 | {
35 | //hot start otherwise a thread abort exception is generated
36 | private static readonly MicrosoftXml.XmlSerializer CacheXmlSerializer = new MicrosoftXml.XmlSerializer(typeof(object));
37 |
38 | public IServiceSerializer Next { get; set; }
39 |
40 | public void Serialize(Stream aStream, T objToSerialize)
41 | {
42 | MicrosoftXml.XmlSerializer xmlSerializer = new MicrosoftXml.XmlSerializer(objToSerialize.GetType());
43 |
44 | xmlSerializer.Serialize(aStream, objToSerialize);
45 | }
46 |
47 | public byte[] Serialize(T objToSerialize)
48 | {
49 | using (MemoryStream stream = new MemoryStream())
50 | {
51 | Serialize(stream, objToSerialize);
52 | return stream.ToArray();
53 | }
54 | }
55 |
56 | public T Deserialize(Stream aStream)
57 | {
58 | MicrosoftXml.XmlSerializer xmlSerializer = new MicrosoftXml.XmlSerializer(typeof(T));
59 |
60 | return (T) xmlSerializer.Deserialize(aStream);
61 | }
62 |
63 | public T Deserialize(byte[] objToDeserialize)
64 | {
65 | using (MemoryStream stream = new MemoryStream(objToDeserialize))
66 | {
67 | return Deserialize(stream);
68 | }
69 | }
70 |
71 | public object Deserialize(byte[] objToDeserialize, Type type = null)
72 | {
73 |
74 | if (type == null)
75 | return null; //cannot deserialize with xml a not-known type
76 |
77 | MicrosoftXml.XmlSerializer xmlSerializer = new MicrosoftXml.XmlSerializer(type);
78 | using (MemoryStream stream = new MemoryStream(objToDeserialize))
79 | {
80 | return xmlSerializer.Deserialize(stream);
81 | }
82 | }
83 |
84 | public override string ToString()
85 | {
86 | return SerializationOption.XmlSerializer.ToString();
87 | }
88 | }
89 | }
--------------------------------------------------------------------------------
/Src/BridgeVs.Shared/Util/TypeExtension.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | namespace BridgeVs.Shared.Util
6 | {
7 | public static class TypeExtension
8 | {
9 | public static List FindAssemblyNames(this Type targetType)
10 | {
11 | string currentAssemblyName = targetType.Assembly.GetName().Name;
12 |
13 | if (!targetType.IsGenericType)
14 | {
15 | return new List { currentAssemblyName };
16 | }
17 |
18 | IEnumerable assNames = from genericType in targetType.GetGenericArguments()
19 | let name = genericType.Assembly.GetName().Name
20 | select name;
21 |
22 | return assNames.Distinct().ToList();
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Src/BridgeVs.Shared/Version.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Reflection;
6 | using System.Text;
7 |
8 | namespace BridgeVs.Shared
9 | {
10 | public static class AssemblyVersion
11 | {
12 | public static string VersionNumber(this Assembly assembly)
13 | {
14 | FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
15 | return fvi.FileVersion;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Src/BridgeVs.Shared/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Src/BridgeVs.Shared/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Test/BridgeVs.UnitTest.Model/AnotherModel.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System;
27 |
28 | namespace BridgeVs.UnitTest.Model
29 | {
30 | [Serializable]
31 | public class AnotherModelTest
32 | {
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Test/BridgeVs.UnitTest.Model/BridgeVs.UnitTest.Model.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {BF2D610C-BD8F-4C1C-A23D-6B213E6699F3}
8 | Library
9 | Properties
10 | BridgeVs.UnitTest.Model
11 | BridgeVs.UnitTest.Model
12 | v4.0
13 | 512
14 |
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 | false
25 |
26 |
27 | bin\Test\
28 | DEBUG;TRACE
29 | true
30 | full
31 | On
32 | x86
33 | false
34 |
35 |
36 | true
37 |
38 |
39 | ..\..\Src\BridgeVs.AsyncVsPackage\Key.snk
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
60 |
--------------------------------------------------------------------------------
/Test/BridgeVs.UnitTest.Model/Models.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System;
27 | using System.Collections.Generic;
28 |
29 | namespace BridgeVs.UnitTest.Model
30 | {
31 | [Serializable]
32 | public class CustomType1
33 | {
34 | public List AnotherModelList;
35 | public IEnumerable AnotherEnumerable;
36 |
37 | public CustomType1()
38 | {
39 | AnotherModelList = new List { new AnotherModelTest() };
40 | AnotherEnumerable = new List {"String1", "String2"};
41 | }
42 | }
43 |
44 | public class CustomType4 : Dictionary
45 | {
46 |
47 |
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Test/BridgeVs.UnitTest.Model/NotSerializableObject.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 |
27 | using System.Collections;
28 | using System.Collections.Generic;
29 |
30 | namespace BridgeVs.UnitTest.Model
31 | {
32 | public interface INotSerializable
33 | {
34 |
35 | }
36 | public class AClass : INotSerializable
37 | {
38 |
39 | }
40 |
41 | public enum Enum1
42 | {
43 | A, B, C
44 | }
45 |
46 | public struct RandomStruct
47 | {
48 | public bool Check;
49 | public Hashtable Map { get; set; }
50 | }
51 |
52 | public class NotSerializableObject
53 | {
54 | public Enum1 Prop1 { get; set; }
55 | public int Int { get; set; }
56 | public Dictionary Dictionary { get; set; }
57 | public INotSerializable NotSerializable { get; set; }
58 |
59 |
60 | public NotSerializableObject()
61 | {
62 | var r = new RandomStruct { Check = true, Map = new Hashtable { { 123312, new List { 1, 2, 2, 3 } } } };
63 |
64 | Prop1 = Enum1.B;
65 | Int = 123321;
66 | Dictionary = new Dictionary
67 | {
68 | {"1",r }
69 | };
70 | NotSerializable = new AClass();
71 |
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/Test/BridgeVs.UnitTest.Model/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System.Reflection;
27 | using System.Runtime.InteropServices;
28 |
29 | // General Information about an assembly is controlled through the following
30 | // set of attributes. Change these attribute values to modify the information
31 | // associated with an assembly.
32 | [assembly: AssemblyTitle("BridgeVs.Model.Test")]
33 | [assembly: AssemblyDescription("")]
34 | [assembly: AssemblyConfiguration("")]
35 | [assembly: AssemblyCompany("Coding Adventures")]
36 | [assembly: AssemblyProduct("BridgeVs.Model.Test")]
37 | [assembly: AssemblyCopyright("Copyright © Coding Adventures 2013 - 2018")]
38 | [assembly: AssemblyTrademark("")]
39 | [assembly: AssemblyCulture("")]
40 |
41 | // Setting ComVisible to false makes the types in this assembly not visible
42 | // to COM components. If you need to access a type in this assembly from
43 | // COM, set the ComVisible attribute to true on that type.
44 | [assembly: ComVisible(false)]
45 |
46 | // The following GUID is for the ID of the typelib if this project is exposed to COM
47 | [assembly: Guid("1453a1a8-c29e-4df7-bc65-8db38c224378")]
48 |
49 | // Version information for an assembly consists of the following four values:
50 | //
51 | // Major Version
52 | // Minor Version
53 | // Build Number
54 | // Revision
55 | //
56 | // You can specify all the values or you can default the Build and Revision Numbers
57 | // by using the '*' as shown below:
58 | // [assembly: AssemblyVersion("1.0.*")]
59 | [assembly: AssemblyVersion("1.0.0.0")]
60 | [assembly: AssemblyFileVersion("1.0.0.0")]
61 |
--------------------------------------------------------------------------------
/Test/BridgeVs.UnitTest.Model/XmlClass.cs:
--------------------------------------------------------------------------------
1 | using System.Xml.Linq;
2 |
3 | namespace BridgeVs.UnitTest.Model
4 | {
5 | public class XmlClass
6 | {
7 | public int MyProperty => 12;
8 |
9 | public XElement Contacts
10 | {
11 | get;
12 | }
13 |
14 | public XmlClass()
15 | {
16 | Contacts =
17 | new XElement("Contacts",
18 | new XElement("Contact",
19 | new XElement("Name", "Patrick Hines"),
20 | new XElement("Phone", "206-555-0144"),
21 | new XElement("Address",
22 | new XElement("Street1", "123 Main St"),
23 | new XElement("City", "Mercer Island"),
24 | new XElement("State", "WA"),
25 | new XElement("Postal", "68042")
26 | )
27 | )
28 | );
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Test/BridgeVs.UnitTest/Build/Tasks/SInjectionBuildTest.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.IO;
3 | using System.IO.Abstractions.TestingHelpers;
4 | using BridgeVs.Build.Tasks;
5 | using BridgeVs.Shared.Common;
6 | using BridgeVs.UnitTest.Model;
7 | using Microsoft.VisualStudio.TestTools.UnitTesting;
8 | using Mono.Cecil;
9 | using TypeMock.ArrangeActAssert;
10 | using FS = BridgeVs.Shared.FileSystem.FileSystemFactory;
11 |
12 | namespace BridgeVs.UnitTest.Build.Tasks
13 | {
14 | [TestClass]
15 | [Isolated]
16 | public class SInjectionBuildTest
17 | {
18 | private static string AssemblyToInjectLocation => typeof(CustomType1).Assembly.Location;
19 | private static byte[] AssemblyToInjectBytes => File.ReadAllBytes(AssemblyToInjectLocation);
20 |
21 |
22 | private static readonly MockFileSystem MockFileSystem = new MockFileSystem(new Dictionary
23 | {
24 | { AssemblyToInjectLocation, new MockFileData(AssemblyToInjectBytes) }
25 | });
26 |
27 |
28 | [TestInitialize]
29 | public void Init()
30 | {
31 | Isolate.WhenCalled(() => FS.FileSystem).WillReturn(MockFileSystem);
32 |
33 | object[] args =
34 | {
35 | AssemblyToInjectLocation, FileMode.Open, FileAccess.ReadWrite,
36 | FileShare.Read
37 | };
38 | Stream access = FS.FileSystem.File.Open(AssemblyToInjectLocation, FileMode.Open, FileAccess.Read,
39 | FileShare.ReadWrite);
40 |
41 | Isolate.NonPublic.WhenCalled(typeof(ModuleDefinition), "GetFileStream")
42 | .WithExactArguments(args)
43 | .WillReturn(access);
44 |
45 | Isolate.WhenCalled(() => CommonRegistryConfigurations.Map3RdPartyAssembly("", "")).WillReturn(false);
46 | Isolate.WhenCalled(() => CommonRegistryConfigurations.IsErrorTrackingEnabled("")).WillReturn(false);
47 | Isolate.WhenCalled(() => CommonRegistryConfigurations.IsLoggingEnabled("")).WillReturn(false);
48 | }
49 |
50 | [TestMethod]
51 | [TestCategory("UnitTest")]
52 | public void SInjection_BuildTask_Test_Should_Succeed()
53 | {
54 |
55 | SInjectionBuildTask sInjectionBuildTask = new SInjectionBuildTask
56 | {
57 | Assembly = AssemblyToInjectLocation
58 | };
59 |
60 | bool result = sInjectionBuildTask.Execute();
61 |
62 | Assert.IsTrue(result, "SInjection Build Task Execute return false.");
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------
/Test/BridgeVs.UnitTest/DynamicVisualizers/DynamicObjectSourceTest.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using BridgeVs.DynamicVisualizers;
27 | using BridgeVs.DynamicVisualizers.Template;
28 | using BridgeVs.UnitTest.Model;
29 | using Microsoft.VisualStudio.TestTools.UnitTesting;
30 | using System.Collections.Generic;
31 | using System.IO;
32 | using System.Linq;
33 | using System.Runtime.Serialization.Formatters.Binary;
34 |
35 | namespace BridgeVs.UnitTest.DynamicVisualizers
36 | {
37 | [TestClass]
38 | public class DynamicObjectSourceTest
39 | {
40 | private static readonly IEnumerable TestQuery
41 | = from i in Enumerable.Range(1, 100)
42 | where i > 23
43 | select i;
44 |
45 | [TestMethod]
46 | [TestCategory("UnitTest")]
47 | public void BroadCastData_SkipWhileIteratorShouldSucceed()
48 | {
49 | List r = TestQuery.SkipWhile(i => i < 45).ToList();
50 |
51 | Message message = DeserializeMessage(r);
52 | Assert.AreEqual("List(Int32)", message.FileName);
53 | Assert.AreEqual("System.Collections.Generic.List", message.TypeFullName);
54 | Assert.AreEqual("ListInt32", message.TypeName);
55 | Assert.AreEqual("System.Collections.Generic", message.TypeNamespace);
56 | }
57 |
58 | [TestMethod]
59 | [TestCategory("UnitTest")]
60 | public void BroadCastData_OfTypeIteratorShouldSucceed()
61 | {
62 | List r = TestQuery.OfType().ToList(); ;
63 |
64 | Message message = DeserializeMessage(r);
65 |
66 | Assert.AreEqual("List(Int16)", message.FileName);
67 | Assert.AreEqual("System.Collections.Generic.List", message.TypeFullName);
68 | Assert.AreEqual("ListInt16", message.TypeName);
69 | Assert.AreEqual("System.Collections.Generic", message.TypeNamespace);
70 | }
71 |
72 | [TestMethod]
73 | [TestCategory("UnitTest")]
74 | public void BroadCastData_DictionaryShouldSucceed()
75 | {
76 | Dictionary r = new Dictionary { { 1, "Test" } };
77 |
78 | Message message = DeserializeMessage(r);
79 |
80 | Assert.AreEqual("Dictionary(Int32, Object)", message.FileName);
81 | Assert.AreEqual("System.Collections.Generic.Dictionary", message.TypeFullName);
82 | Assert.AreEqual("DictionaryInt32Object", message.TypeName);
83 | Assert.AreEqual("System.Collections.Generic", message.TypeNamespace);
84 | }
85 | //for now
86 | [TestMethod]
87 | [TestCategory("UnitTest")]
88 | public void BroadCastData_AnonymousShouldSucceed()
89 | {
90 | var r = TestQuery.Select(i => new { Value = i });
91 |
92 | Message message = DeserializeMessage(r);
93 |
94 | Assert.AreEqual("IEnumerable(AnonymousType(Int32))", message.FileName);
95 | Assert.AreEqual("System.Collections.Generic.IEnumerable>", message.TypeFullName);
96 | Assert.AreEqual("IEnumerableAnonymousTypeInt32", message.TypeName);
97 | Assert.AreEqual("System.Collections.Generic", message.TypeNamespace);
98 | }
99 |
100 | [TestMethod]
101 | [TestCategory("UnitTest")]
102 | public void BroadCastData_CustomObjectShouldSucceed()
103 | {
104 | IEnumerable r = TestQuery.Select(i => new CustomType1());
105 |
106 | Message message = DeserializeMessage(r);
107 |
108 | Assert.AreEqual("IEnumerable(CustomType1)", message.FileName);
109 | Assert.AreEqual($"System.Collections.Generic.IEnumerable<{typeof(CustomType1).Assembly.GetName().Name}.CustomType1>", message.TypeFullName);
110 | Assert.AreEqual("IEnumerableCustomType1", message.TypeName);
111 | Assert.AreEqual("System.Collections.Generic", message.TypeNamespace);
112 | }
113 |
114 | private static Message DeserializeMessage(object @object)
115 | {
116 | using (MemoryStream memoryStream = new MemoryStream())
117 | {
118 | DynamicObjectSource dynamicObjectSource = new DynamicObjectSource();
119 | dynamicObjectSource.GetData(@object, memoryStream);
120 | BinaryFormatter binaryFormatter = new BinaryFormatter();
121 | memoryStream.Position = 0;
122 | return (Message)binaryFormatter.Deserialize(memoryStream);
123 | }
124 | }
125 | }
126 | }
--------------------------------------------------------------------------------
/Test/BridgeVs.UnitTest/DynamicVisualizers/Helper/ReferencedAssemblyFinderHelperTests.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using BridgeVs.Shared.Util;
4 | using BridgeVs.UnitTest.Model;
5 | using Microsoft.VisualStudio.TestTools.UnitTesting;
6 | using TypeMock.ArrangeActAssert;
7 |
8 | namespace BridgeVs.UnitTest.DynamicVisualizers.Helper
9 | {
10 | [TestClass]
11 | [Isolated]
12 | public class ReferencedAssemblyFinderHelperTests
13 | {
14 | private Dictionary _dictionary;
15 |
16 |
17 | [TestInitialize]
18 | [TestCategory("UnitTest")]
19 | public void Init()
20 | {
21 | CustomType4 customType4 = new CustomType4 { { "1", new AnotherModelTest() } };
22 | _dictionary = new Dictionary { { "2", customType4 } };
23 | }
24 |
25 | [TestMethod]
26 | [TestCategory("UnitTest")]
27 | public void FindReferencedAssembliesTest()
28 | {
29 | List refAss = _dictionary.GetType().FindAssemblyNames();
30 |
31 | Assert.IsTrue(refAss.Count > 0);
32 | Assert.IsTrue(refAss.Any(p => p.Equals(typeof(CustomType4).Assembly.GetName().Name)));
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Test/BridgeVs.UnitTest/DynamicVisualizers/Helper/TypeNameHelperUnitTest.cs:
--------------------------------------------------------------------------------
1 | using BridgeVs.DynamicVisualizers.Helper;
2 | using BridgeVs.UnitTest.Model;
3 | using Microsoft.VisualStudio.TestTools.UnitTesting;
4 |
5 | namespace BridgeVs.UnitTest.DynamicVisualizers.Helper
6 | {
7 | [TestClass]
8 | public class TypeNameHelperUnitTest
9 | {
10 |
11 | [TestMethod]
12 | [TestCategory("UnitTest")]
13 | public void GetDisplayName_ReturnsEmptyString()
14 | {
15 | // act
16 | string result = TypeNameHelper.GetDisplayName(null, false);
17 |
18 | // assert
19 | Assert.AreEqual("", result);
20 | }
21 |
22 | [TestMethod]
23 | [TestCategory("UnitTest")]
24 | public void GetDisplayName_ReturnsObject()
25 | {
26 | // act
27 | string result = typeof(object).GetDisplayName(false);
28 |
29 | // assert
30 | Assert.AreEqual("Object", result);
31 | }
32 |
33 | [TestMethod]
34 | [TestCategory("UnitTest")]
35 | public void GetDisplayName_ReturnsNotSerializableObject()
36 | {
37 | // act
38 | string result = typeof(NotSerializableObject).GetDisplayName(false);
39 |
40 | // assert
41 | Assert.AreEqual("NotSerializableObject", result);
42 | }
43 |
44 | [TestMethod]
45 | [TestCategory("UnitTest")]
46 | public void GetDisplayName_ReturnsFullNameNotSerializableObject()
47 | {
48 | // act
49 | string result = typeof(NotSerializableObject).GetDisplayName(true);
50 |
51 | // assert
52 | Assert.AreEqual("BridgeVs.UnitTest.Model.NotSerializableObject", result);
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Test/BridgeVs.UnitTest/DynamicVisualizers/Template/MessageTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using BridgeVs.DynamicVisualizers.Template;
5 | using BridgeVs.Shared.Options;
6 | using Microsoft.VisualStudio.TestTools.UnitTesting;
7 |
8 | namespace BridgeVs.UnitTest.DynamicVisualizers.Template
9 | {
10 | [TestClass]
11 | public class MessageTest
12 | {
13 |
14 | [TestMethod]
15 | [TestCategory("UnitTest")]
16 | public void Message_of_anonymous_list_should_return_AnonymousType()
17 | {
18 | var a = new { str1 = Guid.NewGuid().ToString(), str2 = Guid.NewGuid().ToString() };
19 |
20 | var res = (from i in Enumerable.Range(0, 2)
21 | select a).ToList();
22 |
23 | Message message = new Message(Guid.NewGuid().ToString(), SerializationOption.BinarySerializer, res.GetType());
24 |
25 | Assert.IsTrue(message.AssemblyName.Equals("mscorlib"));
26 | Assert.IsTrue(message.FileName.Equals("List(AnonymousType(String, String))"));
27 | }
28 |
29 | [TestMethod]
30 | [TestCategory("UnitTest")]
31 | public void Message_of_list_of_int_should_return_List_int()
32 | {
33 | List res = (from i in Enumerable.Range(0, 2)
34 | select i).ToList();
35 |
36 | Message message = new Message(Guid.NewGuid().ToString(), SerializationOption.BinarySerializer, res.GetType());
37 |
38 | Assert.IsTrue(message.AssemblyName.Equals("mscorlib"));
39 | Assert.AreEqual(message.FileName, "List(Int32)", "List of int should return List(Int32)");
40 | }
41 |
42 |
43 |
44 | [TestMethod]
45 | [TestCategory("UnitTest")]
46 | public void CalculateFileNameFromTypeByCallingBridgeVsDynamicVisualizersTemplateMessage_ctor_ReturnsToStringIsFileNameObject_truck()
47 | {
48 | // act
49 | Message result = new Message("truckId", SerializationOption.XmlSerializer, typeof(object));
50 |
51 | // assert
52 | Assert.AreEqual("FileName: Object\r\nTypeFullName: System.Object\r\nTypeName: Object\r\nTyp" +
53 | "eNamespace: System\r\nTruckId: truckId\r\nSerializationType: XmlSerializer", result.ToString());
54 | }
55 |
56 |
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/Test/BridgeVs.UnitTest/PluginLoader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using System.Reflection;
4 |
5 | namespace BridgeVs.UnitTest
6 | {
7 | // Mark as MarshalByRefObject allows method calls to be proxied across app-domain boundaries
8 | public class PluginRunner : MarshalByRefObject
9 | {
10 | public Assembly Assembly { get; private set; }
11 | // make sure that we're loading the assembly into the correct app domain.
12 | public void LoadAssembly(byte[] byteArr)
13 | {
14 | Assembly = Assembly.Load(byteArr);
15 | }
16 |
17 | // be careful here, only types from currently loaded assemblies can be passed as parameters / return value.
18 | // also, all parameters / return values from this object must be marked [Serializable]
19 | public string CreateAndExecutePluginResult(string assemblyQualifiedTypeName)
20 | {
21 | var domain = AppDomain.CurrentDomain;
22 |
23 | // we use this overload of GetType which allows us to pass in a custom AssemblyResolve function
24 | // this allows us to get a Type reference without searching the disk for an assembly.
25 | var pluginType = Type.GetType(
26 | assemblyQualifiedTypeName,
27 | (name) => domain.GetAssemblies().Where(a => a.FullName == name.FullName).FirstOrDefault(),
28 | null,
29 | true);
30 |
31 | dynamic plugin = Activator.CreateInstance(pluginType);
32 |
33 | // do whatever you want here with the instantiated plugin
34 | string result = plugin.RunTest();
35 |
36 | // remember, you can only return types which are already loaded in the primary app domain and can be serialized.
37 | return result;
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Test/BridgeVs.UnitTest/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System.Reflection;
27 | using System.Runtime.InteropServices;
28 |
29 | // General Information about an assembly is controlled through the following
30 | // set of attributes. Change these attribute values to modify the information
31 | // associated with an assembly.
32 | [assembly: AssemblyTitle("BridgeVs.Build.Test")]
33 | [assembly: AssemblyDescription("")]
34 | [assembly: AssemblyConfiguration("")]
35 | [assembly: AssemblyCompany("Coding Adventures")]
36 | [assembly: AssemblyProduct("BridgeVs.Build.Test")]
37 | [assembly: AssemblyCopyright("Coding Adventures Copyright © 2013 - 2018")]
38 | [assembly: AssemblyTrademark("")]
39 | [assembly: AssemblyCulture("")]
40 |
41 | // Setting ComVisible to false makes the types in this assembly not visible
42 | // to COM components. If you need to access a type in this assembly from
43 | // COM, set the ComVisible attribute to true on that type.
44 | [assembly: ComVisible(false)]
45 |
46 | // The following GUID is for the ID of the typelib if this project is exposed to COM
47 | [assembly: Guid("08a6ed44-07e4-4ae3-b37c-163cbc84e173")]
48 |
49 | // Version information for an assembly consists of the following four values:
50 | //
51 | // Major Version
52 | // Minor Version
53 | // Build Number
54 | // Revision
55 | //
56 | // You can specify all the values or you can default the Build and Revision Numbers
57 | // by using the '*' as shown below:
58 | // [assembly: AssemblyVersion("1.0.*")]
59 | [assembly: AssemblyVersion("1.0.0.0")]
60 | [assembly: AssemblyFileVersion("1.0.0.0")]
61 |
--------------------------------------------------------------------------------
/Test/BridgeVs.UnitTest/Shared/Dependency/CrawlerUnitTest.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using System;
27 | using System.IO;
28 | using System.Linq;
29 | using System.Reflection;
30 | using BridgeVs.Shared.Dependency;
31 | using BridgeVs.Shared.Logging;
32 | using Microsoft.VisualStudio.TestTools.UnitTesting;
33 |
34 | namespace BridgeVs.VsPackage.Helper.Test
35 | {
36 | [TestClass]
37 | public class CrawlerUnitTest
38 | {
39 | private const string CsProject = @"Shared\Dependency\Model.UnitTest.xml";
40 | [TestMethod]
41 | [TestCategory("UnitTest")]
42 | public void Files_Needed_For_Testing_Should_Be_Deployed()
43 | {
44 | Assert.IsTrue(File.Exists(CsProject), "deployment failed: " + CsProject +
45 | " did not get deployed");
46 | }
47 |
48 | [TestMethod]
49 | [TestCategory("UnitTest")]
50 | public void Crawler_Should_Return_One_Project_Dependency()
51 | {
52 | var projects = Crawler.FindDependencies(CsProject).ToList();
53 |
54 | //Assert
55 | var containsAnotherModel = projects.Any(p => p.Equals("AnotherModel.UnitTest.dll"));
56 |
57 | Assert.IsTrue(containsAnotherModel, "AnotherModel.UnitTest is not included in the references");
58 | }
59 |
60 | [TestMethod]
61 | [TestCategory("UnitTest")]
62 | public void Crawler_Should_Return_An_Empty_Collection_When_Input_Is_Empty()
63 | {
64 | var projects = Crawler.FindDependencies(string.Empty).ToList();
65 |
66 | Assert.IsTrue(projects.Count == 0, "Error! no projects should be loaded");
67 | }
68 |
69 | }
70 | }
--------------------------------------------------------------------------------
/Test/BridgeVs.UnitTest/Shared/Dependency/Model.UnitTest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Debug
7 | AnyCPU
8 | {8A5E73F6-2093-4669-9C09-BEAB033BE56C}
9 | Library
10 | Properties
11 | Model.UnitTest
12 | Model.UnitTest
13 | v4.0
14 | 512
15 |
16 |
17 |
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | bin\Test\
28 | DEBUG
29 |
30 |
31 | true
32 | bin\Deploy\
33 | DEBUG;TRACE
34 | full
35 | AnyCPU
36 | prompt
37 | MinimumRecommendedRules.ruleset
38 |
39 |
40 | true
41 | bin\Release\
42 | DEBUG;TRACE
43 | full
44 | AnyCPU
45 | prompt
46 | MinimumRecommendedRules.ruleset
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 | AnotherModel.UnitTest.dll
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/Test/BridgeVs.UnitTest/VsPackage.Helper/MsBuildVersionHelperUnitTest.cs:
--------------------------------------------------------------------------------
1 | #region License
2 | // Copyright (c) 2013 - 2018 Coding Adventures
3 | //
4 | // Permission is hereby granted, free of charge, to any person
5 | // obtaining a copy of this software and associated documentation
6 | // files (the "Software"), to deal in the Software without
7 | // restriction, including without limitation the rights to use,
8 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the
10 | // Software is furnished to do so, subject to the following
11 | // conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be
14 | // included in all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | // NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | // OTHER DEALINGS IN THE SOFTWARE.
24 | #endregion
25 |
26 | using BridgeVs.VsPackage.Helper.Configuration;
27 | using Microsoft.VisualStudio.TestTools.UnitTesting;
28 |
29 | namespace BridgeVs.UnitTest.VsPackage.Helper
30 | {
31 | [TestClass]
32 | public class MsBuildVersionHelperUnitTest
33 | {
34 | [TestMethod]
35 | [TestCategory("UnitTest")]
36 | public void VS_Version_11_Should_Return_MsBuild_Version_V11()
37 | {
38 | string msBuildVersion = MsBuildVersionHelper.GetMsBuildVersion("11.0");
39 | Assert.IsTrue(msBuildVersion == "v4.0");
40 | }
41 | [TestMethod]
42 | [TestCategory("UnitTest")]
43 | public void VS_Version_12_Should_Return_MsBuild_Version_V12()
44 | {
45 | string msBuildVersion = MsBuildVersionHelper.GetMsBuildVersion("12.0");
46 | Assert.IsTrue(msBuildVersion == "v12.0");
47 | }
48 | [TestMethod]
49 | [TestCategory("UnitTest")]
50 | public void VS_Version_14_Should_Return_MsBuild_Version_V14()
51 | {
52 | string msBuildVersion = MsBuildVersionHelper.GetMsBuildVersion("14.0");
53 | Assert.IsTrue(msBuildVersion == "v14.0");
54 | }
55 | [TestMethod]
56 | [TestCategory("UnitTest")]
57 | public void VS_Version_15_Should_Return_MsBuild_Version_V15()
58 | {
59 | string msBuildVersion = MsBuildVersionHelper.GetMsBuildVersion("15.0");
60 | Assert.IsTrue(msBuildVersion == "v15.0");
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Test/BridgeVs.UnitTest/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Test/BridgeVs.UnitTest/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: 2.0.{build}
2 | pull_requests:
3 | do_not_increment_build_number: true
4 | branches:
5 | only:
6 | - master
7 | image: Visual Studio 2019 Preview
8 | configuration:
9 | - Debug
10 | - Test
11 | - Deploy
12 | platform: Any CPU
13 | install:
14 | - cmd: git submodule update --init --recursive
15 | before_build:
16 | - ps: nuget restore c:\projects\linqbridgevs\src\BridgeVs.sln
17 | build:
18 | project: src\BridgeVs.sln
19 | parallel: true
20 | verbosity: normal
21 | environment:
22 | LICENSE:
23 | secure: Xt89zh3/sBkKjzrExB+Qhyc6zuRNB0lQhj7RuPHrJ4s=
24 | COMPANY_NAME:
25 | secure: TE/EpwbShGrtiWBvkYKzNakaXglte8G723mXWPDjtP0=
26 | test_script:
27 | - ps: |
28 | if ($env:CONFIGURATION -eq "Test")
29 | {
30 | $args = c:\projects\linqbridgevs\Lib\Typemock\TMockRunner.exe -deploy c:\projects\linqbridgevs\Lib\Typemock\AutoDeploy -register $env:COMPANY_NAME $env:LICENSE vstest.console.exe "Test\BridgeVs.UnitTest\bin\Test\BridgeVs.UnitTest.dll" /logger:Appveyor /TestCaseFilter:"TestCategory=UnitTest"
31 | Start-Process powershell -Verb runAs -ArgumentList '$args'
32 | }
33 |
--------------------------------------------------------------------------------