logic: fix more Visual Studio plugin issues
* using .Net framework version 4.6.1 in all projects * implemented exception handling in VCFileWrapperFactory * moved logging in separate assembly * enabled logging in wrapper code
This commit is contained in:
Binary file not shown.
@@ -27,6 +27,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VCProjectEngineWrapperVs201
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VCProjectEngineWrapperVs2012", "VCProjectEngineWrapper\VCProjectEngineWrapperVs2012.csproj", "{C5439B90-42E7-414D-8C3F-BDCABB0592E2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SourcetrailPluginUtility", "SourcetrailPluginUtility\SourcetrailPluginUtility.csproj", "{604B5751-AF34-4FF9-92C3-C85A6BCDF98E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -65,6 +67,10 @@ Global
|
||||
{C5439B90-42E7-414D-8C3F-BDCABB0592E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C5439B90-42E7-414D-8C3F-BDCABB0592E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C5439B90-42E7-414D-8C3F-BDCABB0592E2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{604B5751-AF34-4FF9-92C3-C85A6BCDF98E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{604B5751-AF34-4FF9-92C3-C85A6BCDF98E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{604B5751-AF34-4FF9-92C3-C85A6BCDF98E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{604B5751-AF34-4FF9-92C3-C85A6BCDF98E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.Logging
|
||||
{
|
||||
public interface ILogger
|
||||
{
|
||||
void LogMessage(LogMessage message);
|
||||
}
|
||||
}
|
||||
+10
-13
@@ -138,13 +138,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ComUtils.cs" />
|
||||
<Compile Include="Logging\FileLogger.cs" />
|
||||
<Compile Include="Logging\ILogger.cs" />
|
||||
<Compile Include="Logging\Logging.cs" />
|
||||
<Compile Include="Logging\LogManager.cs" />
|
||||
<Compile Include="Logging\LogMessage.cs" />
|
||||
<Compile Include="Logging\Obfuscation\NameObfuscator.cs" />
|
||||
<Compile Include="Logging\VSOutputLogger.cs" />
|
||||
<Compile Include="Multitasking\LimitedThreadsTaskScheduler.cs" />
|
||||
<Compile Include="Utility\IPathResolver.cs" />
|
||||
<Compile Include="SolutionParser\VsPathResolver.cs" />
|
||||
@@ -224,12 +217,12 @@
|
||||
<DependentUpon>WindowMessage.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="source.extension.vsixmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="source.extension.vsixmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Key.snk" />
|
||||
</ItemGroup>
|
||||
@@ -252,6 +245,10 @@
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SourcetrailPluginUtility\SourcetrailPluginUtility.csproj">
|
||||
<Project>{604b5751-af34-4ff9-92c3-c85a6bcdf98e}</Project>
|
||||
<Name>SourcetrailPluginUtility</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\VCProjectEngineWrapperFactories\VCProjectEngineWrapperFactories.csproj">
|
||||
<Project>{8188d64d-e880-490c-b267-b493a2171be3}</Project>
|
||||
<Name>VCProjectEngineWrapperFactories</Name>
|
||||
|
||||
Binary file not shown.
+1
-1
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.Logging
|
||||
{
|
||||
class FileLogger : ILogger
|
||||
public class FileLogger : ILogger
|
||||
{
|
||||
private static string _directory = "";
|
||||
private static string _fileNamePrefix = "Log_SourcetrailPlugin_";
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace CoatiSoftware.SourcetrailPlugin.Logging
|
||||
{
|
||||
public interface ILogger
|
||||
{
|
||||
void LogMessage(LogMessage message);
|
||||
}
|
||||
}
|
||||
-3
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.Logging
|
||||
{
|
||||
-4
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.Logging
|
||||
{
|
||||
+1
-6
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.Logging
|
||||
{
|
||||
+1
-1
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.Logging.Obfuscation
|
||||
{
|
||||
class NameObfuscator
|
||||
public class NameObfuscator
|
||||
{
|
||||
private static NameObfuscator _instance = null;
|
||||
|
||||
+1
-4
@@ -1,13 +1,10 @@
|
||||
using EnvDTE;
|
||||
using Microsoft.VisualStudio;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.Logging
|
||||
{
|
||||
class VSOutputLogger : ILogger
|
||||
public class VSOutputLogger : ILogger
|
||||
{
|
||||
private EnvDTE.DTE _dte = null;
|
||||
private OutputWindowPane _pane = null;
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("SourcetrailPluginUtility")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Coati Software")]
|
||||
[assembly: AssemblyProduct("SourcetrailPluginUtility")]
|
||||
[assembly: AssemblyCopyright("Copyright © Coati Software 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("604b5751-af34-4ff9-92c3-c85a6bcdf98e")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.*")]
|
||||
//[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{604B5751-AF34-4FF9-92C3-C85A6BCDF98E}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CoatiSoftware.SourcetrailPlugin</RootNamespace>
|
||||
<AssemblyName>SourcetrailPluginUtility</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.11.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Logging\FileLogger.cs" />
|
||||
<Compile Include="Logging\ILogger.cs" />
|
||||
<Compile Include="Logging\Logging.cs" />
|
||||
<Compile Include="Logging\LogManager.cs" />
|
||||
<Compile Include="Logging\LogMessage.cs" />
|
||||
<Compile Include="Logging\Obfuscation\NameObfuscator.cs" />
|
||||
<Compile Include="Logging\VSOutputLogger.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Key.snk" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
+3
-2
@@ -1,4 +1,5 @@
|
||||
using Microsoft.VisualStudio.VCProjectEngine;
|
||||
using CoatiSoftware.SourcetrailPlugin.Logging;
|
||||
using Microsoft.VisualStudio.VCProjectEngine;
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
@@ -74,7 +75,7 @@ namespace VCProjectEngineWrapper
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Logging.Logging.LogError("Failed to retreive compiler tool: " + e.Message);
|
||||
Logging.LogError("Failed to retreive compiler tool: " + e.Message);
|
||||
}
|
||||
return new
|
||||
#if (VS2012)
|
||||
|
||||
+6
-1
@@ -9,8 +9,9 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>VCProjectEngineWrapper</RootNamespace>
|
||||
<AssemblyName>VCProjectEngineWrapperVs2012</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -62,6 +63,10 @@
|
||||
<Compile Include="VCProjectWrapper.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SourcetrailPluginUtility\SourcetrailPluginUtility.csproj">
|
||||
<Project>{604b5751-af34-4ff9-92c3-c85a6bcdf98e}</Project>
|
||||
<Name>SourcetrailPluginUtility</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\VCProjectEngineWrapperInterfaces\VCProjectEngineWrapperInterfaces.csproj">
|
||||
<Project>{F592DB46-0C77-470B-AAF8-80C51F44380E}</Project>
|
||||
<Name>VCProjectEngineWrapperInterfaces</Name>
|
||||
|
||||
+6
-1
@@ -9,8 +9,9 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>VCProjectEngineWrapper</RootNamespace>
|
||||
<AssemblyName>VCProjectEngineWrapperVs2013</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -65,6 +66,10 @@
|
||||
<None Include="KeyVs2013.snk" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SourcetrailPluginUtility\SourcetrailPluginUtility.csproj">
|
||||
<Project>{604b5751-af34-4ff9-92c3-c85a6bcdf98e}</Project>
|
||||
<Name>SourcetrailPluginUtility</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\VCProjectEngineWrapperInterfaces\VCProjectEngineWrapperInterfaces.csproj">
|
||||
<Project>{F592DB46-0C77-470B-AAF8-80C51F44380E}</Project>
|
||||
<Name>VCProjectEngineWrapperInterfaces</Name>
|
||||
|
||||
+6
-1
@@ -9,8 +9,9 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>VCProjectEngineWrapper</RootNamespace>
|
||||
<AssemblyName>VCProjectEngineWrapperVs2015</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -65,6 +66,10 @@
|
||||
<None Include="KeyVs2015.snk" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SourcetrailPluginUtility\SourcetrailPluginUtility.csproj">
|
||||
<Project>{604b5751-af34-4ff9-92c3-c85a6bcdf98e}</Project>
|
||||
<Name>SourcetrailPluginUtility</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\VCProjectEngineWrapperInterfaces\VCProjectEngineWrapperInterfaces.csproj">
|
||||
<Project>{F592DB46-0C77-470B-AAF8-80C51F44380E}</Project>
|
||||
<Name>VCProjectEngineWrapperInterfaces</Name>
|
||||
|
||||
+6
-1
@@ -9,8 +9,9 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>VCProjectEngineWrapper</RootNamespace>
|
||||
<AssemblyName>VCProjectEngineWrapperVs2017</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -65,6 +66,10 @@
|
||||
<None Include="KeyVs2017.snk" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SourcetrailPluginUtility\SourcetrailPluginUtility.csproj">
|
||||
<Project>{604b5751-af34-4ff9-92c3-c85a6bcdf98e}</Project>
|
||||
<Name>SourcetrailPluginUtility</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\VCProjectEngineWrapperInterfaces\VCProjectEngineWrapperInterfaces.csproj">
|
||||
<Project>{f592db46-0c77-470b-aaf8-80c51f44380e}</Project>
|
||||
<Name>VCProjectEngineWrapperInterfaces</Name>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.VisualStudio.VCProjectEngine;
|
||||
using CoatiSoftware.SourcetrailPlugin.Logging;
|
||||
using Microsoft.VisualStudio.VCProjectEngine;
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
@@ -72,9 +73,9 @@ namespace VCProjectEngineWrapper
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Logging.Logging.LogError("Failed to retreive project configuration: " + e.Message);
|
||||
Logging.LogError("Failed to retreive project configuration: " + e.Message);
|
||||
}
|
||||
// Logging.Logging.LogError("Failed to find project config matching with \"" + configurationName + "\"");
|
||||
Logging.LogError("Failed to find project config matching with \"" + configurationName + "\"");
|
||||
|
||||
return new
|
||||
#if (VS2012)
|
||||
|
||||
+77
-13
@@ -1,24 +1,88 @@
|
||||
namespace VCProjectEngineWrapper
|
||||
using CoatiSoftware.SourcetrailPlugin.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace VCProjectEngineWrapper
|
||||
{
|
||||
public static class VCFileWrapperFactory
|
||||
{
|
||||
private interface IFactoryModule
|
||||
{
|
||||
IVCFileWrapper Create(object wrapped);
|
||||
}
|
||||
|
||||
private class FactoryModule2017 : IFactoryModule
|
||||
{
|
||||
public IVCFileWrapper Create(object wrapped)
|
||||
{
|
||||
return new VCFileWrapperVs2017(wrapped);
|
||||
}
|
||||
}
|
||||
|
||||
private class FactoryModule2015 : IFactoryModule
|
||||
{
|
||||
public IVCFileWrapper Create(object wrapped)
|
||||
{
|
||||
return new VCFileWrapperVs2015(wrapped);
|
||||
}
|
||||
}
|
||||
|
||||
private class FactoryModule2013 : IFactoryModule
|
||||
{
|
||||
public IVCFileWrapper Create(object wrapped)
|
||||
{
|
||||
return new VCFileWrapperVs2013(wrapped);
|
||||
}
|
||||
}
|
||||
|
||||
private class FactoryModule2012 : IFactoryModule
|
||||
{
|
||||
public IVCFileWrapper Create(object wrapped)
|
||||
{
|
||||
return new VCFileWrapperVs2012(wrapped);
|
||||
}
|
||||
}
|
||||
|
||||
private static Queue<IFactoryModule> modules = null;
|
||||
|
||||
public static IVCFileWrapper create(object wrapped)
|
||||
{
|
||||
if (modules == null)
|
||||
{
|
||||
modules = new Queue<IFactoryModule>();
|
||||
|
||||
// One of these modules will be working for each version of Visual Studio.
|
||||
modules.Enqueue(new FactoryModule2017());
|
||||
modules.Enqueue(new FactoryModule2015());
|
||||
modules.Enqueue(new FactoryModule2013());
|
||||
modules.Enqueue(new FactoryModule2012());
|
||||
}
|
||||
|
||||
IVCFileWrapper wrapper = null;
|
||||
int testedModuleCount = 0;
|
||||
|
||||
wrapper = new VCFileWrapperVs2017(wrapped);
|
||||
while (wrapper == null && testedModuleCount < modules.Count)
|
||||
{
|
||||
try
|
||||
{
|
||||
wrapper = modules.Peek().Create(wrapped);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
wrapper = null;
|
||||
}
|
||||
|
||||
if (wrapper == null || !wrapper.isValid())
|
||||
{
|
||||
wrapper = new VCFileWrapperVs2015(wrapped);
|
||||
}
|
||||
if (wrapper == null || !wrapper.isValid())
|
||||
{
|
||||
wrapper = new VCFileWrapperVs2013(wrapped);
|
||||
}
|
||||
if (wrapper == null || !wrapper.isValid())
|
||||
{
|
||||
wrapper = new VCFileWrapperVs2012(wrapped);
|
||||
testedModuleCount++;
|
||||
|
||||
if (wrapper == null || !wrapper.isValid())
|
||||
{
|
||||
// Moving the failing module to the end of the queue.
|
||||
// This causes the working module to finall end up in front.
|
||||
IFactoryModule failedModule = modules.Dequeue();
|
||||
Logging.LogInfo("Discarcing " + failedModule.GetType().Name + " while creating file wrapper.");
|
||||
modules.Enqueue(failedModule);
|
||||
wrapper = null;
|
||||
}
|
||||
}
|
||||
|
||||
return wrapper;
|
||||
|
||||
+6
-1
@@ -9,8 +9,9 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>VCProjectEngineWrapper</RootNamespace>
|
||||
<AssemblyName>VCProjectEngineWrapperFactory</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -54,6 +55,10 @@
|
||||
<Compile Include="VCProjectWrapperFactory.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SourcetrailPluginUtility\SourcetrailPluginUtility.csproj">
|
||||
<Project>{604b5751-af34-4ff9-92c3-c85a6bcdf98e}</Project>
|
||||
<Name>SourcetrailPluginUtility</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\VCProjectEngineWrapperInterfaces\VCProjectEngineWrapperInterfaces.csproj">
|
||||
<Project>{f592db46-0c77-470b-aaf8-80c51f44380e}</Project>
|
||||
<Name>VCProjectEngineWrapperInterfaces</Name>
|
||||
|
||||
+72
-43
@@ -1,60 +1,89 @@
|
||||
using System;
|
||||
using CoatiSoftware.SourcetrailPlugin.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace VCProjectEngineWrapper
|
||||
{
|
||||
public static class VCProjectWrapperFactory
|
||||
{
|
||||
private interface IFactoryModule
|
||||
{
|
||||
IVCProjectWrapper Create(object wrapped);
|
||||
}
|
||||
|
||||
private class FactoryModule2017 : IFactoryModule
|
||||
{
|
||||
public IVCProjectWrapper Create(object wrapped)
|
||||
{
|
||||
return new VCProjectWrapperVs2017(wrapped);
|
||||
}
|
||||
}
|
||||
|
||||
private class FactoryModule2015 : IFactoryModule
|
||||
{
|
||||
public IVCProjectWrapper Create(object wrapped)
|
||||
{
|
||||
return new VCProjectWrapperVs2015(wrapped);
|
||||
}
|
||||
}
|
||||
|
||||
private class FactoryModule2013 : IFactoryModule
|
||||
{
|
||||
public IVCProjectWrapper Create(object wrapped)
|
||||
{
|
||||
return new VCProjectWrapperVs2013(wrapped);
|
||||
}
|
||||
}
|
||||
|
||||
private class FactoryModule2012 : IFactoryModule
|
||||
{
|
||||
public IVCProjectWrapper Create(object wrapped)
|
||||
{
|
||||
return new VCProjectWrapperVs2012(wrapped);
|
||||
}
|
||||
}
|
||||
|
||||
private static Queue<IFactoryModule> modules = null;
|
||||
|
||||
public static IVCProjectWrapper create(object wrapped)
|
||||
{
|
||||
if (modules == null)
|
||||
{
|
||||
modules = new Queue<IFactoryModule>();
|
||||
|
||||
// One of these modules will be working for each version of Visual Studio.
|
||||
modules.Enqueue(new FactoryModule2017());
|
||||
modules.Enqueue(new FactoryModule2015());
|
||||
modules.Enqueue(new FactoryModule2013());
|
||||
modules.Enqueue(new FactoryModule2012());
|
||||
}
|
||||
|
||||
IVCProjectWrapper wrapper = null;
|
||||
int testedModuleCount = 0;
|
||||
|
||||
try
|
||||
while (wrapper == null && testedModuleCount < modules.Count)
|
||||
{
|
||||
try
|
||||
{
|
||||
wrapper = modules.Peek().Create(wrapped);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
wrapper = null;
|
||||
}
|
||||
|
||||
testedModuleCount++;
|
||||
|
||||
if (wrapper == null || !wrapper.isValid())
|
||||
{
|
||||
wrapper = new VCProjectWrapperVs2017(wrapped);
|
||||
// Moving the failing module to the end of the queue.
|
||||
// This causes the working module to finall end up in front.
|
||||
IFactoryModule failedModule = modules.Dequeue();
|
||||
Logging.LogInfo("Discarcing " + failedModule.GetType().Name + " while creating project wrapper.");
|
||||
modules.Enqueue(failedModule);
|
||||
wrapper = null;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
wrapper = null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (wrapper == null || !wrapper.isValid())
|
||||
{
|
||||
wrapper = new VCProjectWrapperVs2015(wrapped);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
wrapper = null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (wrapper == null || !wrapper.isValid())
|
||||
{
|
||||
wrapper = new VCProjectWrapperVs2013(wrapped);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
wrapper = null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (wrapper == null || !wrapper.isValid())
|
||||
{
|
||||
wrapper = new VCProjectWrapperVs2012(wrapped);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
wrapper = null;
|
||||
}
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
+2
-1
@@ -9,8 +9,9 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>VCProjectEngineWrapper</RootNamespace>
|
||||
<AssemblyName>VCProjectWrapper</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
|
||||
Reference in New Issue
Block a user