Move legacy VS2013 solution folder
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<TestSettings name="Integration Tests" id="85f80678-5acf-4267-a4f8-e5bf47bd5e87" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
|
||||
<Description>This test run configuration uses the VS IDE host type in the test run.</Description>
|
||||
<Execution>
|
||||
<Hosts>
|
||||
<VSSDKTestHostRunConfig name="VS IDE" HiveKind="DevEnv" HiveName="11.0Exp" xmlns="http://microsoft.com/schemas/VisualStudio/SDK/Tools/IdeHostAdapter/2006/06" />
|
||||
</Hosts>
|
||||
<TestTypeSpecific>
|
||||
<UnitTestRunConfig testTypeId="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b">
|
||||
<AssemblyResolution>
|
||||
<TestDirectory useLoadContext="true" />
|
||||
</AssemblyResolution>
|
||||
</UnitTestRunConfig>
|
||||
</TestTypeSpecific>
|
||||
<AgentRule name="LocalMachineDefaultRole">
|
||||
</AgentRule>
|
||||
</Execution>
|
||||
</TestSettings>
|
||||
@@ -0,0 +1,73 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{91EF78EF-DAB6-4031-AA01-3D127F1E0BCD}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
IntegrationTests.testsettings = IntegrationTests.testsettings
|
||||
UnitTests.testsettings = UnitTests.testsettings
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReswCodeGen.Tests", "ReswCodeGen.Tests\ReswCodeGen.Tests.csproj", "{B56DDC92-E86D-46AA-BE28-7ACA670EE9CE}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSPackage", "VSPackage\VSPackage.csproj", "{2451352F-1CB8-494A-920B-024B8B486185}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSPackage_IntegrationTests", "VSPackage\VSPackage_IntegrationTests\VSPackage_IntegrationTests.csproj", "{D03690D8-EE17-4284-9403-F3F277CF4580}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSPackage_UnitTests", "VSPackage\VSPackage_UnitTests\VSPackage_UnitTests.csproj", "{64F7EAFB-9AF1-4DA4-A4DA-013B4DF10306}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
CD_ROM|Any CPU = CD_ROM|Any CPU
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
DVD-5|Any CPU = DVD-5|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
SingleImage|Any CPU = SingleImage|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B56DDC92-E86D-46AA-BE28-7ACA670EE9CE}.CD_ROM|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B56DDC92-E86D-46AA-BE28-7ACA670EE9CE}.CD_ROM|Any CPU.Build.0 = Release|Any CPU
|
||||
{B56DDC92-E86D-46AA-BE28-7ACA670EE9CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B56DDC92-E86D-46AA-BE28-7ACA670EE9CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B56DDC92-E86D-46AA-BE28-7ACA670EE9CE}.DVD-5|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B56DDC92-E86D-46AA-BE28-7ACA670EE9CE}.DVD-5|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B56DDC92-E86D-46AA-BE28-7ACA670EE9CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B56DDC92-E86D-46AA-BE28-7ACA670EE9CE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B56DDC92-E86D-46AA-BE28-7ACA670EE9CE}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B56DDC92-E86D-46AA-BE28-7ACA670EE9CE}.SingleImage|Any CPU.Build.0 = Release|Any CPU
|
||||
{2451352F-1CB8-494A-920B-024B8B486185}.CD_ROM|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2451352F-1CB8-494A-920B-024B8B486185}.CD_ROM|Any CPU.Build.0 = Release|Any CPU
|
||||
{2451352F-1CB8-494A-920B-024B8B486185}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2451352F-1CB8-494A-920B-024B8B486185}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2451352F-1CB8-494A-920B-024B8B486185}.DVD-5|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2451352F-1CB8-494A-920B-024B8B486185}.DVD-5|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2451352F-1CB8-494A-920B-024B8B486185}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2451352F-1CB8-494A-920B-024B8B486185}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2451352F-1CB8-494A-920B-024B8B486185}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2451352F-1CB8-494A-920B-024B8B486185}.SingleImage|Any CPU.Build.0 = Release|Any CPU
|
||||
{D03690D8-EE17-4284-9403-F3F277CF4580}.CD_ROM|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D03690D8-EE17-4284-9403-F3F277CF4580}.CD_ROM|Any CPU.Build.0 = Release|Any CPU
|
||||
{D03690D8-EE17-4284-9403-F3F277CF4580}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D03690D8-EE17-4284-9403-F3F277CF4580}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D03690D8-EE17-4284-9403-F3F277CF4580}.DVD-5|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D03690D8-EE17-4284-9403-F3F277CF4580}.DVD-5|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D03690D8-EE17-4284-9403-F3F277CF4580}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D03690D8-EE17-4284-9403-F3F277CF4580}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D03690D8-EE17-4284-9403-F3F277CF4580}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D03690D8-EE17-4284-9403-F3F277CF4580}.SingleImage|Any CPU.Build.0 = Release|Any CPU
|
||||
{64F7EAFB-9AF1-4DA4-A4DA-013B4DF10306}.CD_ROM|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{64F7EAFB-9AF1-4DA4-A4DA-013B4DF10306}.CD_ROM|Any CPU.Build.0 = Release|Any CPU
|
||||
{64F7EAFB-9AF1-4DA4-A4DA-013B4DF10306}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{64F7EAFB-9AF1-4DA4-A4DA-013B4DF10306}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{64F7EAFB-9AF1-4DA4-A4DA-013B4DF10306}.DVD-5|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{64F7EAFB-9AF1-4DA4-A4DA-013B4DF10306}.DVD-5|Any CPU.Build.0 = Debug|Any CPU
|
||||
{64F7EAFB-9AF1-4DA4-A4DA-013B4DF10306}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{64F7EAFB-9AF1-4DA4-A4DA-013B4DF10306}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{64F7EAFB-9AF1-4DA4-A4DA-013B4DF10306}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{64F7EAFB-9AF1-4DA4-A4DA-013B4DF10306}.SingleImage|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,68 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
|
||||
{
|
||||
[TestClass]
|
||||
[DeploymentItem("Resources/Resources.resw")]
|
||||
public class CSharpCodeGeneratorTests
|
||||
{
|
||||
private string reswFileContents;
|
||||
private const string FILE_PATH = "Resources.resw";
|
||||
private string actual;
|
||||
private ICodeGenerator target;
|
||||
|
||||
[TestInitialize]
|
||||
public void Initialize()
|
||||
{
|
||||
reswFileContents = File.ReadAllText(FILE_PATH);
|
||||
|
||||
target = new CodeGeneratorFactory().Create(FILE_PATH.Replace(".resw", string.Empty), "TestApp", reswFileContents);
|
||||
actual = target.GenerateCode();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GenerateCodeDoesNotReturnNull()
|
||||
{
|
||||
Assert.IsNotNull(actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GeneratedCodeIsAPublicClass()
|
||||
{
|
||||
Assert.IsTrue(actual.Contains("public partial class"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GeneratedCodeContainsPropertiesDefinedInResources()
|
||||
{
|
||||
var resourceItems = target.ResourceParser.Parse();
|
||||
|
||||
foreach (var item in resourceItems.Where(item => !item.Name.Contains(".")))
|
||||
Assert.IsTrue(actual.Contains("public static string " + item.Name));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GeneratedCodePropertiesContainsCommentsSimilarToValuesDefinedInResources()
|
||||
{
|
||||
var resourceItems = target.ResourceParser.Parse();
|
||||
|
||||
foreach (var item in resourceItems.Where(item => !item.Name.Contains(".")))
|
||||
Assert.IsTrue(actual.Contains("Localized resource similar to \"" + item.Value + "\""));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ClassNameEqualsFileNameWithoutExtension()
|
||||
{
|
||||
Assert.IsTrue(actual.Contains("class Resources"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ResourceLoaderInitializedWithClassName()
|
||||
{
|
||||
Assert.IsTrue(actual.Contains("ResourceLoader.GetForCurrentView(currentAssemblyName + \"/Resources\");"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
|
||||
{
|
||||
[TestClass]
|
||||
[DeploymentItem("Resources/Resources.resw")]
|
||||
public class CSharpCodeGeneratorTestsInternal
|
||||
{
|
||||
private string reswFileContents;
|
||||
private const string FILE_PATH = "Resources.resw";
|
||||
private string actual;
|
||||
private ICodeGenerator target;
|
||||
|
||||
[TestInitialize]
|
||||
public void Initialize()
|
||||
{
|
||||
reswFileContents = File.ReadAllText(FILE_PATH);
|
||||
|
||||
target = new CodeGeneratorFactory().Create(FILE_PATH.Replace(".resw", string.Empty), "TestApp", reswFileContents, classAccessibility: TypeAttributes.NestedAssembly);
|
||||
actual = target.GenerateCode();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GenerateCodeDoesNotReturnNull()
|
||||
{
|
||||
Assert.IsNotNull(actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GeneratedCodeIsAnInternalClass()
|
||||
{
|
||||
Assert.IsTrue(actual.Contains("internal partial class"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GeneratedCodeContainsPropertiesDefinedInResources()
|
||||
{
|
||||
var resourceItems = target.ResourceParser.Parse();
|
||||
|
||||
foreach (var item in resourceItems.Where(item => !item.Name.Contains(".")))
|
||||
Assert.IsTrue(actual.Contains("public static string " + item.Name));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GeneratedCodePropertiesContainsCommentsSimilarToValuesDefinedInResources()
|
||||
{
|
||||
var resourceItems = target.ResourceParser.Parse();
|
||||
|
||||
foreach (var item in resourceItems.Where(item => !item.Name.Contains(".")))
|
||||
Assert.IsTrue(actual.Contains("Localized resource similar to \"" + item.Value + "\""));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ClassNameEqualsFileNameWithoutExtension()
|
||||
{
|
||||
Assert.IsTrue(actual.Contains("class Resources"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ResourceLoaderInitializedWithClassName()
|
||||
{
|
||||
Assert.IsTrue(actual.Contains("ResourceLoader.GetForCurrentView(currentAssemblyName + \"/Resources\");"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System.IO;
|
||||
using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
|
||||
{
|
||||
[TestClass]
|
||||
[DeploymentItem("Resources/Resources.resw")]
|
||||
public class ClassNameExtractorTests
|
||||
{
|
||||
private const string ClassName = "Resources.resw";
|
||||
|
||||
[TestMethod]
|
||||
public void DoesNotReturnNull()
|
||||
{
|
||||
var actual = ClassNameExtractor.GetClassName(ClassName);
|
||||
Assert.IsNotNull(actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ReturnsFileNameWithoutExtension()
|
||||
{
|
||||
var actual = ClassNameExtractor.GetClassName(ClassName);
|
||||
Assert.AreEqual("Resources", actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(FileNotFoundException))]
|
||||
public void ThrowsFileNotFoundException()
|
||||
{
|
||||
ClassNameExtractor.GetClassName("C:\\Test\\Resources\\Strings.resw");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.IO;
|
||||
using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
|
||||
{
|
||||
[TestClass]
|
||||
[DeploymentItem("Resources/Valid/Resources.resw")]
|
||||
public class CodeGeneratorFactoryTests
|
||||
{
|
||||
private string reswFileContents;
|
||||
private const string CLASS_NAME = "C:\\Test\\Resources\\Strings.resw";
|
||||
|
||||
[TestInitialize]
|
||||
public void Initialize()
|
||||
{
|
||||
reswFileContents = File.ReadAllText("Resources.resw");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CodeGeneratorFactoryReturnsValidInstance()
|
||||
{
|
||||
var target = new CodeGeneratorFactory();
|
||||
var actual = target.Create(CLASS_NAME, "TestApp", reswFileContents);
|
||||
Assert.IsNotNull(actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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("ReswCodeGen.Tests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ReswCodeGen.Tests")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2012")]
|
||||
[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("948cb0e4-5fec-4bb0-84c3-afdd75406336")]
|
||||
|
||||
// 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.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,62 @@
|
||||
using System.IO;
|
||||
using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
|
||||
{
|
||||
[TestClass]
|
||||
[DeploymentItem("Resources/ResourcesWithoutValues.resw")]
|
||||
[DeploymentItem("Resources/ResourcesWithoutComments.resw")]
|
||||
public class ResourceParserErrorHandlingTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void ParseHandlesMissingResourceItemValues()
|
||||
{
|
||||
var reswFileContents = File.ReadAllText("ResourcesWithoutValues.resw");
|
||||
var target = new ResourceParser(reswFileContents);
|
||||
var actual = target.Parse();
|
||||
|
||||
Assert.IsNotNull(actual);
|
||||
CollectionAssert.AllItemsAreNotNull(actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ParseWithMissingResourceItemValuesSetsValueNull()
|
||||
{
|
||||
var reswFileContents = File.ReadAllText("ResourcesWithoutValues.resw");
|
||||
var target = new ResourceParser(reswFileContents);
|
||||
var actual = target.Parse();
|
||||
|
||||
Assert.IsNotNull(actual);
|
||||
CollectionAssert.AllItemsAreNotNull(actual);
|
||||
|
||||
foreach (var item in actual)
|
||||
Assert.IsTrue(string.IsNullOrEmpty(item.Value));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ParseHandlesMissingResourceItemComments()
|
||||
{
|
||||
var reswFileContents = File.ReadAllText("ResourcesWithoutComments.resw");
|
||||
var target = new ResourceParser(reswFileContents);
|
||||
var actual = target.Parse();
|
||||
|
||||
Assert.IsNotNull(actual);
|
||||
CollectionAssert.AllItemsAreNotNull(actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ParseWithMissingResourceItemCommentsSetsCommentsNull()
|
||||
{
|
||||
var reswFileContents = File.ReadAllText("ResourcesWithoutComments.resw");
|
||||
var target = new ResourceParser(reswFileContents);
|
||||
var actual = target.Parse();
|
||||
|
||||
Assert.IsNotNull(actual);
|
||||
CollectionAssert.AllItemsAreNotNull(actual);
|
||||
|
||||
foreach (var item in actual)
|
||||
Assert.IsTrue(string.IsNullOrEmpty(item.Comment));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
|
||||
{
|
||||
[TestClass]
|
||||
[DeploymentItem("Resources/Resources.resw")]
|
||||
public class ResourceParserTests
|
||||
{
|
||||
private string reswFileContents;
|
||||
|
||||
[TestInitialize]
|
||||
public void Initialize()
|
||||
{
|
||||
reswFileContents = File.ReadAllText("Resources.resw");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CanLoadTestReswFileContents()
|
||||
{
|
||||
Assert.IsNotNull(reswFileContents);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CanTestReswFileContentsLoadToXDocument()
|
||||
{
|
||||
var doc = XDocument.Parse(reswFileContents);
|
||||
Assert.IsNotNull(doc);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CanParseTestReswFileContents()
|
||||
{
|
||||
var doc = XDocument.Parse(reswFileContents);
|
||||
var resourcs = doc.Descendants("data");
|
||||
Assert.IsNotNull(resourcs);
|
||||
Assert.AreNotEqual(0, resourcs.Count());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ConstructorSetsReswFileContents()
|
||||
{
|
||||
var target = new ResourceParser(reswFileContents);
|
||||
Assert.IsNotNull(target.ReswFileContents);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ParseReturnsResourceItems()
|
||||
{
|
||||
var target = new ResourceParser(reswFileContents);
|
||||
var actual = target.Parse();
|
||||
Assert.IsNotNull(actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ParseReturnedResourceItemsContainsName()
|
||||
{
|
||||
var target = new ResourceParser(reswFileContents);
|
||||
var actual = target.Parse();
|
||||
|
||||
foreach (var item in actual)
|
||||
Assert.IsNotNull(item.Name);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ParseReturnedResourceItemsContainsValue()
|
||||
{
|
||||
var target = new ResourceParser(reswFileContents);
|
||||
var actual = target.Parse();
|
||||
|
||||
foreach (var item in actual)
|
||||
Assert.IsNotNull(item.Value);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ParseReturnedResourceItemsContainsComment()
|
||||
{
|
||||
var target = new ResourceParser(reswFileContents);
|
||||
var actual = target.Parse();
|
||||
|
||||
foreach (var item in actual)
|
||||
Assert.IsNotNull(item.Comment);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Test1" xml:space="preserve">
|
||||
<value>Test 1 value</value>
|
||||
<comment>Test 1 comment</comment>
|
||||
</data>
|
||||
<data name="Test2" xml:space="preserve">
|
||||
<value>Test 2 value</value>
|
||||
<comment>Test 2 comment</comment>
|
||||
</data>
|
||||
<data name="Test3" xml:space="preserve">
|
||||
<value>Test 3 value</value>
|
||||
<comment>Test 3 comment</comment>
|
||||
</data>
|
||||
<data name="TestControl.Text" xml:space="preserve">
|
||||
<value>TestControl.Text value</value>
|
||||
<comment>TestControl.Test comment</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,132 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Test1" xml:space="preserve">
|
||||
<value>Test 1 value</value>
|
||||
</data>
|
||||
<data name="Test2" xml:space="preserve">
|
||||
<value>Test 2 value</value>
|
||||
</data>
|
||||
<data name="Test3" xml:space="preserve">
|
||||
<value>Test 3 value</value>
|
||||
</data>
|
||||
<data name="TestControl.Text" xml:space="preserve">
|
||||
<value>TestControl.Text value</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,136 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Test1" xml:space="preserve">
|
||||
<value />
|
||||
<comment>Test 1 comment</comment>
|
||||
</data>
|
||||
<data name="Test2" xml:space="preserve">
|
||||
<value />
|
||||
<comment>Test 2 comment</comment>
|
||||
</data>
|
||||
<data name="Test3" xml:space="preserve">
|
||||
<value />
|
||||
<comment>Test 3 comment</comment>
|
||||
</data>
|
||||
<data name="TestControl.Text" xml:space="preserve">
|
||||
<value />
|
||||
<comment>TestControl.Test comment</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,119 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{B56DDC92-E86D-46AA-BE28-7ACA670EE9CE}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests</RootNamespace>
|
||||
<AssemblyName>ReswCodeGen.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
</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>
|
||||
<ItemGroup>
|
||||
<Reference Include="Moq">
|
||||
<HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
|
||||
</ItemGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
<ItemGroup>
|
||||
<Compile Include="ClassNameExtractorTests.cs" />
|
||||
<Compile Include="CodeGeneratorFactoryTests.cs" />
|
||||
<Compile Include="VisualBasicCodeGeneratorInternalTests.cs" />
|
||||
<Compile Include="CSharpCodeGeneratorTests.cs" />
|
||||
<Compile Include="CSharpCodeGeneratorTestsInternal.cs" />
|
||||
<Compile Include="ResourceParserErrorHandlingTests.cs" />
|
||||
<Compile Include="ResourceParserTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="StringExtensionTests.cs" />
|
||||
<Compile Include="VisualBasicCodeGeneratorTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\Resources.resw">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<Content Include="Resources\ResourcesWithoutValues.resw">
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\ResourcesWithoutComments.resw">
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\VSPackage\VSPackage.csproj">
|
||||
<Project>{2451352F-1CB8-494A-920B-024B8B486185}</Project>
|
||||
<Name>VSPackage</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
|
||||
{
|
||||
[TestClass]
|
||||
[DeploymentItem("Resources/Resources.resw")]
|
||||
public class StringExtensionTests
|
||||
{
|
||||
const string TEXT = "test";
|
||||
|
||||
[TestMethod]
|
||||
public void ConvertToIntPtrDoesNotReturnZero()
|
||||
{
|
||||
uint len;
|
||||
var ptr = TEXT.ConvertToIntPtr(out len);
|
||||
Assert.AreNotEqual(IntPtr.Zero, ptr);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ConvertToIntPtrReturnsStringLengthAsParameter()
|
||||
{
|
||||
uint len;
|
||||
TEXT.ConvertToIntPtr(out len);
|
||||
Assert.AreNotEqual(TEXT.Length, len);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ConvertToIntPtrConvertsCorrectString()
|
||||
{
|
||||
uint len;
|
||||
var ptr = TEXT.ConvertToIntPtr(out len);
|
||||
var str = Marshal.PtrToStringAnsi(ptr, (int) len);
|
||||
Assert.AreEqual(TEXT, str);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
|
||||
using Microsoft.VisualBasic;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
|
||||
{
|
||||
[TestClass]
|
||||
[DeploymentItem("Resources/Resources.resw")]
|
||||
public class VisualBasicCodeGeneratorInternalTests
|
||||
{
|
||||
private const string FILE_PATH = "Resources.resw";
|
||||
private string actual;
|
||||
private string reswFileContents;
|
||||
private ICodeGenerator target;
|
||||
|
||||
[TestInitialize]
|
||||
public void Initialize()
|
||||
{
|
||||
reswFileContents = File.ReadAllText(FILE_PATH);
|
||||
|
||||
target = new CodeGeneratorFactory().Create(FILE_PATH.Replace(".resw", string.Empty), "TestApp", reswFileContents, new VBCodeProvider(), TypeAttributes.NestedAssembly);
|
||||
actual = target.GenerateCode();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GenerateCodeDoesNotReturnNull()
|
||||
{
|
||||
Assert.IsNotNull(actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GeneratedCodeIsFriendClass()
|
||||
{
|
||||
Assert.IsTrue(actual.Contains("Partial Friend Class"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GeneratedCodeContainsPropertiesDefinedInResources()
|
||||
{
|
||||
var resourceItems = target.ResourceParser.Parse();
|
||||
|
||||
foreach (var item in resourceItems.Where(item => !item.Name.Contains(".")))
|
||||
Assert.IsTrue(actual.Contains("Public Shared ReadOnly Property " + item.Name + "() As String"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GeneratedCodePropertiesContainsCommentsSimilarToValuesDefinedInResources()
|
||||
{
|
||||
var resourceItems = target.ResourceParser.Parse();
|
||||
|
||||
foreach (var item in resourceItems.Where(item => !item.Name.Contains(".")))
|
||||
Assert.IsTrue(actual.Contains("Localized resource similar to \"" + item.Value + "\""));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ClassNameEqualsFileNameWithoutExtension()
|
||||
{
|
||||
Assert.IsTrue(actual.Contains("Class Resources"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ResourceLoaderInitializedWithClassName()
|
||||
{
|
||||
Assert.IsTrue(actual.Contains("ResourceLoader.GetForCurrentView(currentAssemblyName + \"/Resources\")"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
|
||||
using Microsoft.VisualBasic;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
|
||||
{
|
||||
[TestClass]
|
||||
[DeploymentItem("Resources/Resources.resw")]
|
||||
public class VisualBasicCodeGeneratorTests
|
||||
{
|
||||
private const string FILE_PATH = "Resources.resw";
|
||||
private string actual;
|
||||
private string reswFileContents;
|
||||
private ICodeGenerator target;
|
||||
|
||||
[TestInitialize]
|
||||
public void Initialize()
|
||||
{
|
||||
reswFileContents = File.ReadAllText(FILE_PATH);
|
||||
|
||||
target = new CodeGeneratorFactory().Create(FILE_PATH.Replace(".resw", string.Empty), "TestApp", reswFileContents, new VBCodeProvider());
|
||||
actual = target.GenerateCode();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GenerateCodeDoesNotReturnNull()
|
||||
{
|
||||
Assert.IsNotNull(actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GeneratedCodeContainsPropertiesDefinedInResources()
|
||||
{
|
||||
var resourceItems = target.ResourceParser.Parse();
|
||||
|
||||
foreach (var item in resourceItems.Where(item => !item.Name.Contains(".")))
|
||||
Assert.IsTrue(actual.Contains("Public Shared ReadOnly Property " + item.Name + "() As String"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GeneratedCodePropertiesContainsCommentsSimilarToValuesDefinedInResources()
|
||||
{
|
||||
var resourceItems = target.ResourceParser.Parse();
|
||||
|
||||
foreach (var item in resourceItems.Where(item => !item.Name.Contains(".")))
|
||||
Assert.IsTrue(actual.Contains("Localized resource similar to \"" + item.Value + "\""));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ClassNameEqualsFileNameWithoutExtension()
|
||||
{
|
||||
Assert.IsTrue(actual.Contains("Class Resources"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ResourceLoaderInitializedWithClassName()
|
||||
{
|
||||
Assert.IsTrue(actual.Contains("ResourceLoader.GetForCurrentView(currentAssemblyName + \"/Resources\")"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Moq" version="4.0.10827" targetFramework="net45" />
|
||||
</packages>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<TestSettings name="Unit Tests" id="906380a7-c058-43a6-8f36-966013e5a9eb" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
|
||||
<Description>This test run configuration is used for running the unit tests</Description>
|
||||
<Execution>
|
||||
<TestTypeSpecific>
|
||||
<UnitTestRunConfig testTypeId="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b">
|
||||
<AssemblyResolution>
|
||||
<TestDirectory useLoadContext="true" />
|
||||
</AssemblyResolution>
|
||||
</UnitTestRunConfig>
|
||||
</TestTypeSpecific>
|
||||
<AgentRule name="LocalMachineDefaultRole">
|
||||
</AgentRule>
|
||||
</Execution>
|
||||
</TestSettings>
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.IO;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
{
|
||||
public static class ClassNameExtractor
|
||||
{
|
||||
public static string GetClassName(string wszInputFilePath)
|
||||
{
|
||||
if (!File.Exists(wszInputFilePath))
|
||||
throw new FileNotFoundException();
|
||||
|
||||
var fileInfo = new FileInfo(wszInputFilePath);
|
||||
return fileInfo.Name.Replace(fileInfo.Extension, string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
using System;
|
||||
using System.CodeDom;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using Microsoft.CSharp;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
{
|
||||
public class CodeDomCodeGenerator : CodeGenerator, IDisposable
|
||||
{
|
||||
private readonly TypeAttributes? classAccessibility;
|
||||
private readonly VisualStudioVersion visualStudioVersion;
|
||||
private readonly string className;
|
||||
private readonly CodeNamespace codeNamespace;
|
||||
private readonly CodeCompileUnit compileUnit;
|
||||
private readonly CodeDomProvider provider;
|
||||
|
||||
public CodeDomCodeGenerator(IResourceParser resourceParser,
|
||||
string className,
|
||||
string defaultNamespace,
|
||||
CodeDomProvider codeDomProvider = null,
|
||||
TypeAttributes? classAccessibility = null,
|
||||
VisualStudioVersion visualStudioVersion = VisualStudioVersion.VS2012)
|
||||
: base(resourceParser, defaultNamespace)
|
||||
{
|
||||
this.className = className;
|
||||
this.classAccessibility = classAccessibility;
|
||||
this.visualStudioVersion = visualStudioVersion;
|
||||
compileUnit = new CodeCompileUnit();
|
||||
provider = codeDomProvider ?? new CSharpCodeProvider();
|
||||
codeNamespace = new CodeNamespace(defaultNamespace);
|
||||
}
|
||||
|
||||
public override string GenerateCode()
|
||||
{
|
||||
codeNamespace.Comments.Add(
|
||||
new CodeCommentStatement("--------------------------------------------------------------------------------------------------"));
|
||||
codeNamespace.Comments.Add(new CodeCommentStatement("<auto-generatedInfo>"));
|
||||
codeNamespace.Comments.Add(new CodeCommentStatement("\tThis code was generated by ResW File Code Generator (http://reswcodegen.codeplex.com)"));
|
||||
codeNamespace.Comments.Add(new CodeCommentStatement("\tResW File Code Generator was written by Christian Resma Helle"));
|
||||
codeNamespace.Comments.Add(new CodeCommentStatement("\tand is under GNU General Public License version 2 (GPLv2)"));
|
||||
codeNamespace.Comments.Add(new CodeCommentStatement(string.Empty));
|
||||
codeNamespace.Comments.Add(new CodeCommentStatement("\tThis code contains a helper class exposing property representations"));
|
||||
codeNamespace.Comments.Add(new CodeCommentStatement("\tof the string resources defined in the specified .ResW file"));
|
||||
codeNamespace.Comments.Add(new CodeCommentStatement(string.Empty));
|
||||
codeNamespace.Comments.Add(new CodeCommentStatement("\tGenerated: " + DateTime.Now.ToString(CultureInfo.InvariantCulture)));
|
||||
codeNamespace.Comments.Add(new CodeCommentStatement("</auto-generatedInfo>"));
|
||||
codeNamespace.Comments.Add(
|
||||
new CodeCommentStatement("--------------------------------------------------------------------------------------------------"));
|
||||
|
||||
codeNamespace.Imports.Add(new CodeNamespaceImport("Windows.ApplicationModel.Resources"));
|
||||
|
||||
var targetClass = new CodeTypeDeclaration(className)
|
||||
{
|
||||
IsClass = true,
|
||||
IsPartial = true,
|
||||
TypeAttributes = classAccessibility.HasValue ? classAccessibility.Value : TypeAttributes.Public
|
||||
};
|
||||
|
||||
const string resourceLoaderType = "ResourceLoader";
|
||||
var resourceLoaderField = new CodeMemberField(resourceLoaderType, "resourceLoader")
|
||||
{
|
||||
Attributes = MemberAttributes.Private | MemberAttributes.Static | MemberAttributes.Final
|
||||
};
|
||||
targetClass.Members.Add(resourceLoaderField);
|
||||
|
||||
var constructor = new CodeTypeConstructor();
|
||||
|
||||
var executingAssemblyVar = new CodeVariableDeclarationStatement(typeof (string), "executingAssemblyName");
|
||||
var executingAssemblyInit = new CodeAssignStatement(new CodeVariableReferenceExpression("executingAssemblyName"),
|
||||
new CodeSnippetExpression("Windows.UI.Xaml.Application.Current.GetType().AssemblyQualifiedName"));
|
||||
var executingAssemblySplit = new CodeVariableDeclarationStatement(typeof (string[]), "executingAssemblySplit");
|
||||
var executingAssemblyInit2 = new CodeAssignStatement(new CodeVariableReferenceExpression("executingAssemblySplit"),
|
||||
new CodeMethodInvokeExpression(new CodeVariableReferenceExpression("executingAssemblyName"),
|
||||
"Split",
|
||||
new CodePrimitiveExpression(',')));
|
||||
var executingAssemblyInit3 = new CodeAssignStatement(new CodeVariableReferenceExpression("executingAssemblyName"),
|
||||
new CodeArrayIndexerExpression(new CodeVariableReferenceExpression("executingAssemblySplit"),
|
||||
new CodePrimitiveExpression(1)));
|
||||
|
||||
var currentAssemblyVar = new CodeVariableDeclarationStatement(typeof (string), "currentAssemblyName");
|
||||
var currentAssemblyInit = new CodeAssignStatement(new CodeVariableReferenceExpression("currentAssemblyName"),
|
||||
new CodePropertyReferenceExpression(new CodeTypeOfExpression(className), "AssemblyQualifiedName"));
|
||||
var currentAssemblySplit = new CodeVariableDeclarationStatement(typeof (string[]), "currentAssemblySplit");
|
||||
var currentAssemblyInit2 = new CodeAssignStatement(new CodeVariableReferenceExpression("currentAssemblySplit"),
|
||||
new CodeMethodInvokeExpression(new CodeVariableReferenceExpression("currentAssemblyName"),
|
||||
"Split",
|
||||
new CodePrimitiveExpression(',')));
|
||||
var currentAssemblyInit3 = new CodeAssignStatement(new CodeVariableReferenceExpression("currentAssemblyName"),
|
||||
new CodeArrayIndexerExpression(new CodeVariableReferenceExpression("currentAssemblySplit"),
|
||||
new CodePrimitiveExpression(1)));
|
||||
|
||||
var createResourceLoader = new CodeConditionStatement(
|
||||
new CodeSnippetExpression("executingAssemblyName.Equals(currentAssemblyName)"),
|
||||
new CodeStatement[] // true
|
||||
{
|
||||
visualStudioVersion == VisualStudioVersion.VS2013
|
||||
? new CodeAssignStatement(new CodeFieldReferenceExpression(null, "resourceLoader"),
|
||||
new CodeMethodInvokeExpression(new CodeTypeReferenceExpression("ResourceLoader"),
|
||||
"GetForCurrentView",
|
||||
new CodeSnippetExpression("\"" + className + "\"")))
|
||||
: new CodeAssignStatement(new CodeFieldReferenceExpression(null, "resourceLoader"),
|
||||
new CodeObjectCreateExpression(new CodeTypeReference("ResourceLoader"),
|
||||
new CodeSnippetExpression("\"" + className + "\"")))
|
||||
},
|
||||
new CodeStatement[] // false
|
||||
{
|
||||
visualStudioVersion == VisualStudioVersion.VS2013
|
||||
? new CodeAssignStatement(new CodeFieldReferenceExpression(null, "resourceLoader"),
|
||||
new CodeMethodInvokeExpression(new CodeTypeReferenceExpression("ResourceLoader"),
|
||||
"GetForCurrentView",
|
||||
new CodeSnippetExpression("currentAssemblyName + \"/" + className + "\"")))
|
||||
: new CodeAssignStatement(new CodeFieldReferenceExpression(null, "resourceLoader"),
|
||||
new CodeObjectCreateExpression(new CodeTypeReference("ResourceLoader"),
|
||||
new CodeSnippetExpression("currentAssemblyName + \"/" + className + "\"")))
|
||||
});
|
||||
|
||||
constructor.Statements.Add(executingAssemblyVar);
|
||||
constructor.Statements.Add(executingAssemblyInit);
|
||||
constructor.Statements.Add(executingAssemblySplit);
|
||||
constructor.Statements.Add(executingAssemblyInit2);
|
||||
constructor.Statements.Add(executingAssemblyInit3);
|
||||
constructor.Statements.Add(currentAssemblyVar);
|
||||
constructor.Statements.Add(currentAssemblyInit);
|
||||
constructor.Statements.Add(currentAssemblySplit);
|
||||
constructor.Statements.Add(currentAssemblyInit2);
|
||||
constructor.Statements.Add(currentAssemblyInit3);
|
||||
constructor.Statements.Add(createResourceLoader);
|
||||
|
||||
targetClass.Members.Add(constructor);
|
||||
|
||||
var resources = ResourceParser.Parse();
|
||||
foreach (var item in resources)
|
||||
{
|
||||
if (string.IsNullOrEmpty(item.Name) || item.Name.Contains("."))
|
||||
continue;
|
||||
|
||||
var property = new CodeMemberProperty
|
||||
{
|
||||
Name = item.Name.Trim(),
|
||||
Attributes = MemberAttributes.Public | MemberAttributes.Static,
|
||||
HasGet = true,
|
||||
Type = new CodeTypeReference(typeof (string))
|
||||
};
|
||||
|
||||
property.Comments.Add(new CodeCommentStatement("<summary>", true));
|
||||
property.Comments.Add(new CodeCommentStatement("Localized resource similar to \"" + (item.Value ?? item.Name) + "\"", true));
|
||||
property.Comments.Add(new CodeCommentStatement("</summary>", true));
|
||||
property.GetStatements.Add(
|
||||
new CodeMethodReturnStatement(
|
||||
new CodeMethodInvokeExpression(
|
||||
new CodeFieldReferenceExpression(null, "resourceLoader"),
|
||||
"GetString",
|
||||
new CodePrimitiveExpression(item.Name))));
|
||||
|
||||
targetClass.Members.Add(property);
|
||||
}
|
||||
|
||||
codeNamespace.Types.Add(targetClass);
|
||||
compileUnit.Namespaces.Add(codeNamespace);
|
||||
|
||||
return GenerateCodeFromCompileUnit();
|
||||
}
|
||||
|
||||
private string GenerateCodeFromCompileUnit()
|
||||
{
|
||||
var options = new CodeGeneratorOptions {BracingStyle = "C"};
|
||||
|
||||
var code = new StringBuilder();
|
||||
|
||||
using (var writer = new StringWriter(code))
|
||||
provider.GenerateCodeFromCompileUnit(compileUnit, writer, options);
|
||||
|
||||
return code.ToString();
|
||||
}
|
||||
|
||||
#region IDisposable
|
||||
|
||||
private bool disposed;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
~CodeDomCodeGenerator()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool dispose)
|
||||
{
|
||||
if (disposed)
|
||||
return;
|
||||
disposed = true;
|
||||
|
||||
if (dispose)
|
||||
provider.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
{
|
||||
public abstract class CodeGenerator : ICodeGenerator
|
||||
{
|
||||
protected CodeGenerator(IResourceParser resourceParser, string defaultNamespace)
|
||||
{
|
||||
ResourceParser = resourceParser;
|
||||
Namespace = defaultNamespace;
|
||||
}
|
||||
|
||||
public IResourceParser ResourceParser { get; set; }
|
||||
public string Namespace { get; set; }
|
||||
|
||||
public abstract string GenerateCode();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Reflection;
|
||||
using EnvDTE;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
{
|
||||
public class CodeGeneratorFactory
|
||||
{
|
||||
public ICodeGenerator Create(string className, string defaultNamespace, string inputFileContents, CodeDomProvider codeDomProvider = null, TypeAttributes? classAccessibility = null)
|
||||
{
|
||||
return new CodeDomCodeGenerator(new ResourceParser(inputFileContents), className, defaultNamespace, codeDomProvider, classAccessibility, VisualStudioHelper.GetVersion());
|
||||
}
|
||||
}
|
||||
|
||||
public static class VisualStudioHelper
|
||||
{
|
||||
public static VisualStudioVersion GetVersion()
|
||||
{
|
||||
var dte = Package.GetGlobalService(typeof(SDTE)) as DTE;
|
||||
var vsVersion = VisualStudioVersion.VS2012;
|
||||
if (dte != null)
|
||||
{
|
||||
Version dteVersion;
|
||||
if (Version.TryParse(dte.Version, out dteVersion) && dteVersion >= new Version(12, 0))
|
||||
vsVersion = VisualStudioVersion.VS2013;
|
||||
}
|
||||
return vsVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
{
|
||||
public interface ICodeGenerator
|
||||
{
|
||||
IResourceParser ResourceParser { get; set; }
|
||||
string Namespace { get; set; }
|
||||
string GenerateCode();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
{
|
||||
public interface IResourceParser
|
||||
{
|
||||
string ReswFileContents { get; set; }
|
||||
List<ResourceItem> Parse();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
{
|
||||
public class ResourceItem
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
public string Comment { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
{
|
||||
public class ResourceParser : IResourceParser
|
||||
{
|
||||
public ResourceParser(string reswFileContents)
|
||||
{
|
||||
ReswFileContents = reswFileContents;
|
||||
}
|
||||
|
||||
public string ReswFileContents { get; set; }
|
||||
|
||||
public List<ResourceItem> Parse()
|
||||
{
|
||||
var doc = XDocument.Parse(ReswFileContents);
|
||||
|
||||
var list = new List<ResourceItem>();
|
||||
|
||||
foreach (var element in doc.Descendants("data"))
|
||||
{
|
||||
if (element.Attributes().All(c => c.Name != "name"))
|
||||
continue;
|
||||
|
||||
var item = new ResourceItem();
|
||||
|
||||
var nameAttribute = element.Attribute("name");
|
||||
if (nameAttribute != null)
|
||||
item.Name = nameAttribute.Value;
|
||||
|
||||
if (element.Descendants().Any(c => c.Name == "value"))
|
||||
{
|
||||
var valueElement = element.Descendants("value").FirstOrDefault();
|
||||
if (valueElement != null)
|
||||
item.Value = valueElement.Value;
|
||||
}
|
||||
|
||||
if (element.Descendants().Any(c => c.Name == "comment"))
|
||||
{
|
||||
var commentElement = element.Descendants("comment").FirstOrDefault();
|
||||
if (commentElement != null)
|
||||
item.Comment = commentElement.Value;
|
||||
}
|
||||
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.CSharp;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
{
|
||||
[Guid("98983F6D-BC77-46AC-BA5A-8D9E8763F0D2")]
|
||||
[ComVisible(true)]
|
||||
public class ReswFileCSharpCodeGenerator : ReswFileCodeGenerator
|
||||
{
|
||||
public ReswFileCSharpCodeGenerator()
|
||||
: base(new CSharpCodeProvider())
|
||||
{
|
||||
}
|
||||
|
||||
public override int DefaultExtension(out string pbstrDefaultExtension)
|
||||
{
|
||||
pbstrDefaultExtension = ".cs";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.CodeDom;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.CSharp;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
{
|
||||
[Guid("151F74CA-404D-4188-B994-D7683C32ACF4")]
|
||||
[ComVisible(true)]
|
||||
public class ReswFileCSharpCodeGeneratorInternal : ReswFileCodeGenerator
|
||||
{
|
||||
public ReswFileCSharpCodeGeneratorInternal()
|
||||
: base(new CSharpCodeProvider(), TypeAttributes.NestedAssembly)
|
||||
{
|
||||
}
|
||||
|
||||
public override int DefaultExtension(out string pbstrDefaultExtension)
|
||||
{
|
||||
pbstrDefaultExtension = ".cs";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.CodeDom;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
{
|
||||
[ComVisible(true)]
|
||||
public abstract class ReswFileCodeGenerator : IVsSingleFileGenerator
|
||||
{
|
||||
private readonly CodeDomProvider codeDomProvider;
|
||||
private readonly TypeAttributes? classAccessibility;
|
||||
|
||||
protected ReswFileCodeGenerator(CodeDomProvider codeDomProvider, TypeAttributes? classAccessibility = null)
|
||||
{
|
||||
this.codeDomProvider = codeDomProvider;
|
||||
this.classAccessibility = classAccessibility;
|
||||
}
|
||||
|
||||
#region IVsSingleFileGenerator Members
|
||||
|
||||
public abstract int DefaultExtension(out string pbstrDefaultExtension);
|
||||
|
||||
public virtual int Generate(string wszInputFilePath,
|
||||
string bstrInputFileContents,
|
||||
string wszDefaultNamespace,
|
||||
IntPtr[] rgbOutputFileContents,
|
||||
out uint pcbOutput,
|
||||
IVsGeneratorProgress pGenerateProgress)
|
||||
{
|
||||
try
|
||||
{
|
||||
var className = ClassNameExtractor.GetClassName(wszInputFilePath);
|
||||
var factory = new CodeGeneratorFactory();
|
||||
var codeGenerator = factory.Create(className, wszDefaultNamespace, bstrInputFileContents, codeDomProvider, classAccessibility);
|
||||
var code = codeGenerator.GenerateCode();
|
||||
|
||||
rgbOutputFileContents[0] = code.ConvertToIntPtr(out pcbOutput);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show(e.Message, "Unable to generate code");
|
||||
throw;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.VisualBasic;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
{
|
||||
[Guid("92DFB543-7138-419B-99D9-90CC77607671")]
|
||||
[ComVisible(true)]
|
||||
public class ReswFileVisualBasicCodeGenerator : ReswFileCodeGenerator
|
||||
{
|
||||
public ReswFileVisualBasicCodeGenerator()
|
||||
: base(new VBCodeProvider())
|
||||
{
|
||||
}
|
||||
|
||||
public override int DefaultExtension(out string pbstrDefaultExtension)
|
||||
{
|
||||
pbstrDefaultExtension = ".vb";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.VisualBasic;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
{
|
||||
[Guid("6C6AC14F-9B11-47C1-BC90-DFBFB89B1CB8")]
|
||||
[ComVisible(true)]
|
||||
public class ReswFileVisualBasicCodeGeneratorInternal : ReswFileCodeGenerator
|
||||
{
|
||||
public ReswFileVisualBasicCodeGeneratorInternal()
|
||||
: base(new VBCodeProvider(), TypeAttributes.NestedAssembly)
|
||||
{
|
||||
}
|
||||
|
||||
public override int DefaultExtension(out string pbstrDefaultExtension)
|
||||
{
|
||||
pbstrDefaultExtension = ".vb";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
{
|
||||
public static class StringExtension
|
||||
{
|
||||
public static IntPtr ConvertToIntPtr(this string code, out uint pcbOutput)
|
||||
{
|
||||
var data = Encoding.Default.GetBytes(code);
|
||||
|
||||
var ptr = Marshal.AllocCoTaskMem(data.Length);
|
||||
Marshal.Copy(data, 0, ptr, data.Length);
|
||||
|
||||
pcbOutput = (uint)data.Length;
|
||||
return ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
||||
{
|
||||
public enum VisualStudioVersion
|
||||
{
|
||||
VS2012,
|
||||
VS2013,
|
||||
Unknown
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// This file is used by Code Analysis to maintain SuppressMessage
|
||||
// attributes that are applied to this project. Project-level
|
||||
// suppressions either have no target or are given a specific target
|
||||
// and scoped to a namespace, type, member, etc.
|
||||
//
|
||||
// To add a suppression to this file, right-click the message in the
|
||||
// Error List, point to "Suppress Message(s)", and click "In Project
|
||||
// Suppression File". You do not need to add suppressions to this
|
||||
// file manually.
|
||||
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1017:MarkAssembliesWithComVisible")]
|
||||
@@ -0,0 +1,15 @@
|
||||
// Guids.cs
|
||||
// MUST match guids.h
|
||||
|
||||
using System;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage
|
||||
{
|
||||
static class GuidList
|
||||
{
|
||||
public const string guidVSPackagePkgString = "6a4c1726-440f-4b2d-a2e5-711277da6099";
|
||||
public const string guidVSPackageCmdSetString = "fb40dc0b-2f75-404c-ba4e-dc1b90c41941";
|
||||
|
||||
public static readonly Guid guidVSPackageCmdSet = new Guid(guidVSPackageCmdSetString);
|
||||
};
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,88 @@
|
||||
GNU General Public License version 2 (GPLv2)
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
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("ResW File Code Generator Custom Tool")]
|
||||
[assembly: AssemblyDescription("A Visual Studio 2012 Custom Tool for generating a strongly typed helper class for accessing localized resources from a .ResW file.")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ResW File Code Generator Custom Tool")]
|
||||
[assembly: AssemblyCopyright("Copyright © Christian Resma Helle 2012")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: CLSCompliant(false)]
|
||||
[assembly: NeutralResourcesLanguage("en-US")]
|
||||
|
||||
// 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 Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.3.0.*")]
|
||||
|
||||
[assembly: InternalsVisibleTo("VSPackage_IntegrationTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010045bd05a5b24c74b83f069df52e138682c2fb8b1ee65cb9d351fd7e8d622308aeb588b2a2975d75da4fe8a392510528baa26a3317809ec064d3cc852f0df94752ad2228d9f2a048ee2858c1e9d505b05f7fb4ede02f34154f75ea50445741c84f5ab1c814358f5fd6a6f08bb3d94284cff0524d5ca9d888c8648bcbc7a1e0a3c8")]
|
||||
[assembly: InternalsVisibleTo("VSPackage_UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010045bd05a5b24c74b83f069df52e138682c2fb8b1ee65cb9d351fd7e8d622308aeb588b2a2975d75da4fe8a392510528baa26a3317809ec064d3cc852f0df94752ad2228d9f2a048ee2858c1e9d505b05f7fb4ede02f34154f75ea50445741c84f5ab1c814358f5fd6a6f08bb3d94284cff0524d5ca9d888c8648bcbc7a1e0a3c8")]
|
||||
Generated
+63
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34014
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
VS SDK Notes: This resx file contains the resources that will be consumed directly by your package.
|
||||
For example, if you chose to create a tool window, there is a resource with ID 'CanNotCreateWindow'. This
|
||||
is used in VsPkg.cs to determine the string to show the user if there is an error when attempting to create
|
||||
the tool window.
|
||||
|
||||
Resources that are accessed directly from your package *by Visual Studio* are stored in the VSPackage.resx
|
||||
file.
|
||||
-->
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
@@ -0,0 +1,227 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>4.0</OldToolsVersion>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<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>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{2451352F-1CB8-494A-920B-024B8B486185}</ProjectGuid>
|
||||
<ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage</RootNamespace>
|
||||
<AssemblyName>ReswCodeGen.VSPackage</AssemblyName>
|
||||
<SignAssembly>True</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
</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>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.VisualStudio.OLE.Interop" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Design, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Interop" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Interop.10.0" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Interop.11.0">
|
||||
<EmbedInteropTypes>true</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TextManager.Interop" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.11.0" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.10.0" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.11.0" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Design" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Include="EnvDTE">
|
||||
<Guid>{80CC9F66-E7D8-4DDD-85B6-D9E6CD0E93E2}</Guid>
|
||||
<VersionMajor>8</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>primary</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
<COMReference Include="EnvDTE100">
|
||||
<Guid>{26AD1324-4B7C-44BC-84F8-B86AED45729F}</Guid>
|
||||
<VersionMajor>10</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>primary</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
<COMReference Include="EnvDTE80">
|
||||
<Guid>{1A31287A-4D7D-413E-8E32-3B374931BD89}</Guid>
|
||||
<VersionMajor>8</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>primary</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
<COMReference Include="EnvDTE90">
|
||||
<Guid>{2CE2370E-D744-4936-A090-3FFFE667B0E1}</Guid>
|
||||
<VersionMajor>9</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>primary</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
<COMReference Include="Microsoft.VisualStudio.CommandBars">
|
||||
<Guid>{1CBA492E-7263-47BB-87FE-639000619B15}</Guid>
|
||||
<VersionMajor>8</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>primary</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
<COMReference Include="stdole">
|
||||
<Guid>{00020430-0000-0000-C000-000000000046}</Guid>
|
||||
<VersionMajor>2</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>primary</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CustomTool\VisualStudioVersion.cs" />
|
||||
<Compile Include="VisualStudio2015Package.cs" />
|
||||
<Compile Include="VisualStudio2013Package.cs" />
|
||||
<Compile Include="CustomTool\ClassNameExtractor.cs" />
|
||||
<Compile Include="CustomTool\CodeDomCodeGenerator.cs" />
|
||||
<Compile Include="CustomTool\CodeGenerator.cs" />
|
||||
<Compile Include="CustomTool\CodeGeneratorFactory.cs" />
|
||||
<Compile Include="CustomTool\ICodeGenerator.cs" />
|
||||
<Compile Include="CustomTool\IResourceParser.cs" />
|
||||
<Compile Include="CustomTool\ResourceItem.cs" />
|
||||
<Compile Include="CustomTool\ResourceParser.cs" />
|
||||
<Compile Include="CustomTool\ReswFileCodeGenerator.cs" />
|
||||
<Compile Include="CustomTool\ReswFileCSharpCodeGenerator.cs" />
|
||||
<Compile Include="CustomTool\ReswFileCSharpCodeGeneratorInternal.cs" />
|
||||
<Compile Include="CustomTool\ReswFileVisualBasicCodeGenerator.cs" />
|
||||
<Compile Include="CustomTool\ReswFileVisualBasicCodeGeneratorInternal.cs" />
|
||||
<Compile Include="CustomTool\StringExtension.cs" />
|
||||
<Compile Include="Guids.cs" />
|
||||
<Compile Include="Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="VisualStudio2012Package.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="VSPackage.resx">
|
||||
<MergeWithCTO>true</MergeWithCTO>
|
||||
<ManifestResourceName>VSPackage</ManifestResourceName>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="source.extension.vsixmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Key.snk" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="License.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<IncludeInVSIX>true</IncludeInVSIX>
|
||||
</Content>
|
||||
<Content Include="Resources\Package.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<IncludeInVSIX>true</IncludeInVSIX>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<UseCodebase>true</UseCodebase>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,130 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="110" xml:space="preserve">
|
||||
<value>ResW File Code Generator</value>
|
||||
</data>
|
||||
<data name="112" xml:space="preserve">
|
||||
<value>A Visual Studio Custom Tool for generating a strongly typed helper class for accessing localized resources from a .ResW file.</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="400" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\Package.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
+359
@@ -0,0 +1,359 @@
|
||||
|
||||
namespace Microsoft.VsSDK.IntegrationTestLibrary
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// This class is responsible to close dialog boxes that pop up during different VS Calls
|
||||
/// </summary>
|
||||
internal class DialogBoxPurger : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// The default number of milliseconds to wait for the threads to signal to terminate.
|
||||
/// </summary>
|
||||
private const int DefaultMillisecondsToWait = 3500;
|
||||
|
||||
/// <summary>
|
||||
/// Object used for synchronization between thread calls.
|
||||
/// </summary>
|
||||
internal static volatile object Mutex = new object();
|
||||
|
||||
/// <summary>
|
||||
/// The IVsUIShell. This cannot be queried on the working thread from the service provider. Must be done in the main thread.!!
|
||||
/// </summary>
|
||||
private IVsUIShell uiShell;
|
||||
|
||||
/// <summary>
|
||||
/// The button to "press" on the dialog.
|
||||
/// </summary>
|
||||
private int buttonAction;
|
||||
|
||||
/// <summary>
|
||||
/// Thread signales to the calling thread that it is done.
|
||||
/// </summary>
|
||||
private bool exitThread = false;
|
||||
|
||||
/// <summary>
|
||||
/// Calling thread signales to this thread to die.
|
||||
/// </summary>
|
||||
private AutoResetEvent threadDone = new AutoResetEvent(false);
|
||||
|
||||
/// <summary>
|
||||
/// The queued thread started.
|
||||
/// </summary>
|
||||
private AutoResetEvent threadStarted = new AutoResetEvent(false);
|
||||
|
||||
/// <summary>
|
||||
/// The result of the dialogbox closing for all the dialog boxes. That is if there are two of them and one fails this will be false.
|
||||
/// </summary>
|
||||
private bool dialogBoxCloseResult = false;
|
||||
|
||||
/// <summary>
|
||||
/// The expected text to see on the dialog box. If set the thread will continue finding the dialog box with this text.
|
||||
/// </summary>
|
||||
private string expectedDialogBoxText = String.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The number of the same dialog boxes to wait for.
|
||||
/// This is for scenarios when two dialog boxes with the same text are popping up.
|
||||
/// </summary>
|
||||
private int numberOfDialogsToWaitFor = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Has the object been disposed.
|
||||
/// </summary>
|
||||
private bool isDisposed;
|
||||
|
||||
/// <summary>
|
||||
/// Overloaded ctor.
|
||||
/// </summary>
|
||||
/// <param name="buttonAction">The botton to "press" on the dialog box.</param>
|
||||
/// <param name="numberOfDialogsToWaitFor">The number of dialog boxes with the same message to wait for. This is the situation when the same action pops up two of the same dialog boxes</param>
|
||||
/// <param name="expectedDialogMesssage">The expected dialog box message to check for.</param>
|
||||
internal DialogBoxPurger(int buttonAction, int numberOfDialogsToWaitFor, string expectedDialogMesssage)
|
||||
{
|
||||
this.buttonAction = buttonAction;
|
||||
this.numberOfDialogsToWaitFor = numberOfDialogsToWaitFor;
|
||||
this.expectedDialogBoxText = expectedDialogMesssage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overloaded ctor.
|
||||
/// </summary>
|
||||
/// <param name="buttonAction">The botton to "press" on the dialog box.</param>
|
||||
/// <param name="numberOfDialogsToWaitFor">The number of dialog boxes with the same message to wait for. This is the situation when the same action pops up two of the same dialog boxes</param>
|
||||
internal DialogBoxPurger(int buttonAction, int numberOfDialogsToWaitFor)
|
||||
{
|
||||
this.buttonAction = buttonAction;
|
||||
this.numberOfDialogsToWaitFor = numberOfDialogsToWaitFor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overloaded ctor.
|
||||
/// </summary>
|
||||
/// <param name="buttonAction">The botton to "press" on the dialog box.</param>
|
||||
/// <param name="expectedDialogMesssage">The expected dialog box message to check for.</param>
|
||||
internal DialogBoxPurger(int buttonAction, string expectedDialogMesssage)
|
||||
{
|
||||
this.buttonAction = buttonAction;
|
||||
this.expectedDialogBoxText = expectedDialogMesssage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overloaded ctor.
|
||||
/// </summary>
|
||||
/// <param name="buttonAction">The botton to "press" on the dialog box.</param>
|
||||
internal DialogBoxPurger(int buttonAction)
|
||||
{
|
||||
this.buttonAction = buttonAction;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
#region IDisposable Members
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
if (this.isDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.WaitForDialogThreadToTerminate();
|
||||
|
||||
this.isDisposed = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Spawns a thread that will start listening to dialog boxes.
|
||||
/// </summary>
|
||||
internal void Start()
|
||||
{
|
||||
// We ask for the uishell here since we cannot do that on the therad that we will spawn.
|
||||
IVsUIShell uiShell = Package.GetGlobalService(typeof(SVsUIShell)) as IVsUIShell;
|
||||
|
||||
if (uiShell == null)
|
||||
{
|
||||
throw new InvalidOperationException("Could not get the uiShell from the serviceProvider");
|
||||
}
|
||||
|
||||
this.uiShell = uiShell;
|
||||
|
||||
System.Threading.Thread thread = new System.Threading.Thread(new ThreadStart(this.HandleDialogBoxes));
|
||||
thread.Start();
|
||||
|
||||
// We should never deadlock here, hence do not use the lock. Wait to be sure that the thread started.
|
||||
this.threadStarted.WaitOne(3500, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Waits for the dialog box close thread to terminate. If the thread does not signal back within millisecondsToWait that it is shutting down,
|
||||
/// then it will tell to the thread to do it.
|
||||
/// </summary>
|
||||
internal bool WaitForDialogThreadToTerminate()
|
||||
{
|
||||
return this.WaitForDialogThreadToTerminate(DefaultMillisecondsToWait);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Waits for the dialog box close thread to terminate. If the thread does not signal back within millisecondsToWait that it is shutting down,
|
||||
/// then it will tell to the thread to do it.
|
||||
/// </summary>
|
||||
/// <param name="millisecondsToWait">The number milliseconds to wait for until the dialog purger thread is signaled to terminate. This is just for safe precaution that we do not hang. </param>
|
||||
/// <returns>The result of the dialog boxes closing</returns>
|
||||
internal bool WaitForDialogThreadToTerminate(int numberOfMillisecondsToWait)
|
||||
{
|
||||
bool signaled = false;
|
||||
|
||||
// We give millisecondsToWait sec to bring up and close the dialog box.
|
||||
signaled = this.threadDone.WaitOne(numberOfMillisecondsToWait, false);
|
||||
|
||||
// Kill the thread since a timeout occured.
|
||||
if (!signaled)
|
||||
{
|
||||
lock (Mutex)
|
||||
{
|
||||
// Set the exit thread to true. Next time the thread will kill itselfes if it sees
|
||||
this.exitThread = true;
|
||||
}
|
||||
|
||||
// Wait for the thread to finish. We should never deadlock here.
|
||||
this.threadDone.WaitOne();
|
||||
}
|
||||
|
||||
return this.dialogBoxCloseResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is the thread method.
|
||||
/// </summary>
|
||||
private void HandleDialogBoxes()
|
||||
{
|
||||
// No synchronization numberOfDialogsToWaitFor since it is readonly
|
||||
IntPtr[] hwnds = new IntPtr[this.numberOfDialogsToWaitFor];
|
||||
bool[] dialogBoxCloseResults = new bool[this.numberOfDialogsToWaitFor];
|
||||
|
||||
try
|
||||
{
|
||||
// Signal that we started
|
||||
lock (Mutex)
|
||||
{
|
||||
this.threadStarted.Set();
|
||||
}
|
||||
|
||||
// The loop will be exited either if a message is send by the caller thread or if we found the dialog. If a message box text is specified the loop will not exit until the dialog is found.
|
||||
bool stayInLoop = true;
|
||||
int dialogBoxesToWaitFor = 1;
|
||||
|
||||
while (stayInLoop)
|
||||
{
|
||||
int hwndIndex = dialogBoxesToWaitFor - 1;
|
||||
|
||||
// We need to lock since the caller might set context to null.
|
||||
lock (Mutex)
|
||||
{
|
||||
if (this.exitThread)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// We protect the shell too from reentrency.
|
||||
this.uiShell.GetDialogOwnerHwnd(out hwnds[hwndIndex]);
|
||||
|
||||
}
|
||||
|
||||
if (hwnds[hwndIndex] != IntPtr.Zero)
|
||||
{
|
||||
StringBuilder windowClassName = new StringBuilder(256);
|
||||
NativeMethods.GetClassName(hwnds[hwndIndex], windowClassName, windowClassName.Capacity);
|
||||
|
||||
// The #32770 is the class name of a messagebox dialog.
|
||||
if (windowClassName.ToString().Contains("#32770"))
|
||||
{
|
||||
IntPtr unmanagedMemoryLocation = IntPtr.Zero;
|
||||
string dialogBoxText = String.Empty;
|
||||
try
|
||||
{
|
||||
unmanagedMemoryLocation = Marshal.AllocHGlobal(10 * 1024);
|
||||
NativeMethods.EnumChildWindows(hwnds[hwndIndex], new NativeMethods.CallBack(FindMessageBoxString), unmanagedMemoryLocation);
|
||||
dialogBoxText = Marshal.PtrToStringUni(unmanagedMemoryLocation);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (unmanagedMemoryLocation != IntPtr.Zero)
|
||||
{
|
||||
Marshal.FreeHGlobal(unmanagedMemoryLocation);
|
||||
}
|
||||
}
|
||||
|
||||
lock (Mutex)
|
||||
{
|
||||
|
||||
// Since this is running on the main thread be sure that we close the dialog.
|
||||
bool dialogCloseResult = false;
|
||||
if (this.buttonAction != 0)
|
||||
{
|
||||
dialogCloseResult = NativeMethods.EndDialog(hwnds[hwndIndex], this.buttonAction);
|
||||
}
|
||||
|
||||
// Check if we have found the right dialog box.
|
||||
if (String.IsNullOrEmpty(this.expectedDialogBoxText) || (!String.IsNullOrEmpty(dialogBoxText) && String.Compare(this.expectedDialogBoxText, dialogBoxText.Trim(), StringComparison.OrdinalIgnoreCase) == 0))
|
||||
{
|
||||
dialogBoxCloseResults[hwndIndex] = dialogCloseResult;
|
||||
if (dialogBoxesToWaitFor++ >= this.numberOfDialogsToWaitFor)
|
||||
{
|
||||
stayInLoop = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
//Let the main thread run a possible close command.
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
|
||||
foreach (IntPtr hwnd in hwnds)
|
||||
{
|
||||
// At this point the dialog should be closed, if not attempt to close it.
|
||||
if (hwnd != IntPtr.Zero)
|
||||
{
|
||||
NativeMethods.SendMessage(hwnd, NativeMethods.WM_CLOSE, 0, new IntPtr(0));
|
||||
}
|
||||
}
|
||||
|
||||
lock (Mutex)
|
||||
{
|
||||
// Be optimistic.
|
||||
this.dialogBoxCloseResult = true;
|
||||
|
||||
for (int i = 0; i < dialogBoxCloseResults.Length; i++)
|
||||
{
|
||||
if (!dialogBoxCloseResults[i])
|
||||
{
|
||||
this.dialogBoxCloseResult = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.threadDone.Set();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds a messagebox string on a messagebox.
|
||||
/// </summary>
|
||||
/// <param name="hwnd">The windows handle of the dialog</param>
|
||||
/// <param name="unmanagedMemoryLocation">A pointer to the memorylocation the string will be written to</param>
|
||||
/// <returns>True if found.</returns>
|
||||
private static bool FindMessageBoxString(IntPtr hwnd, IntPtr unmanagedMemoryLocation)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(512);
|
||||
NativeMethods.GetClassName(hwnd, sb, sb.Capacity);
|
||||
|
||||
if (sb.ToString().ToLower().Contains("static"))
|
||||
{
|
||||
StringBuilder windowText = new StringBuilder(2048);
|
||||
NativeMethods.GetWindowText(hwnd, windowText, windowText.Capacity);
|
||||
|
||||
if (windowText.Length > 0)
|
||||
{
|
||||
IntPtr stringAsPtr = IntPtr.Zero;
|
||||
try
|
||||
{
|
||||
stringAsPtr = Marshal.StringToHGlobalAnsi(windowText.ToString());
|
||||
char[] stringAsArray = windowText.ToString().ToCharArray();
|
||||
|
||||
// Since unicode characters are copied check if we are out of the allocated length.
|
||||
// If not add the end terminating zero.
|
||||
if ((2 * stringAsArray.Length) + 1 < 2048)
|
||||
{
|
||||
Marshal.Copy(stringAsArray, 0, unmanagedMemoryLocation, stringAsArray.Length);
|
||||
Marshal.WriteInt32(unmanagedMemoryLocation, 2 * stringAsArray.Length, 0);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (stringAsPtr != IntPtr.Zero)
|
||||
{
|
||||
Marshal.FreeHGlobal(stringAsPtr);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
/***************************************************************************
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
This code is licensed under the Visual Studio SDK license terms.
|
||||
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
|
||||
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
|
||||
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
|
||||
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
namespace Microsoft.VsSDK.IntegrationTestLibrary
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
|
||||
/// <summary>
|
||||
/// Defines pinvoked utility methods and internal VS Constants
|
||||
/// </summary>
|
||||
internal static class NativeMethods
|
||||
{
|
||||
internal delegate bool CallBack(IntPtr hwnd, IntPtr lParam);
|
||||
|
||||
// Declare two overloaded SendMessage functions
|
||||
[DllImport("user32.dll")]
|
||||
internal static extern UInt32 SendMessage(IntPtr hWnd, UInt32 Msg,
|
||||
UInt32 wParam, IntPtr lParam);
|
||||
|
||||
[DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
|
||||
internal static extern bool PeekMessage([In, Out] ref Microsoft.VisualStudio.OLE.Interop.MSG msg, HandleRef hwnd, int msgMin, int msgMax, int remove);
|
||||
|
||||
[DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
|
||||
internal static extern bool TranslateMessage([In, Out] ref Microsoft.VisualStudio.OLE.Interop.MSG msg);
|
||||
|
||||
[DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
|
||||
internal static extern int DispatchMessage([In] ref Microsoft.VisualStudio.OLE.Interop.MSG msg);
|
||||
|
||||
[DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
|
||||
internal static extern bool AttachThreadInput(uint idAttach, uint idAttachTo, bool attach);
|
||||
|
||||
[DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
|
||||
internal static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
|
||||
|
||||
[DllImport("kernel32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
|
||||
internal static extern uint GetCurrentThreadId();
|
||||
|
||||
[DllImport("user32")]
|
||||
internal static extern int EnumChildWindows(IntPtr hwnd, CallBack x, IntPtr y);
|
||||
|
||||
[DllImport("user32")]
|
||||
internal static extern bool IsWindowVisible(IntPtr hDlg);
|
||||
|
||||
[DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
|
||||
internal static extern IntPtr SetFocus(IntPtr hWnd);
|
||||
|
||||
[DllImport("user32")]
|
||||
internal static extern int GetClassName(IntPtr hWnd,
|
||||
StringBuilder className,
|
||||
int stringLength);
|
||||
[DllImport("user32")]
|
||||
internal static extern int GetWindowText(IntPtr hWnd, StringBuilder className, int stringLength);
|
||||
|
||||
|
||||
[DllImport("user32")]
|
||||
internal static extern bool EndDialog(IntPtr hDlg, int result);
|
||||
|
||||
[DllImport("Kernel32")]
|
||||
internal static extern long GetLastError();
|
||||
|
||||
internal const int QS_KEY = 0x0001,
|
||||
QS_MOUSEMOVE = 0x0002,
|
||||
QS_MOUSEBUTTON = 0x0004,
|
||||
QS_POSTMESSAGE = 0x0008,
|
||||
QS_TIMER = 0x0010,
|
||||
QS_PAINT = 0x0020,
|
||||
QS_SENDMESSAGE = 0x0040,
|
||||
QS_HOTKEY = 0x0080,
|
||||
QS_ALLPOSTMESSAGE = 0x0100,
|
||||
QS_MOUSE = QS_MOUSEMOVE | QS_MOUSEBUTTON,
|
||||
QS_INPUT = QS_MOUSE | QS_KEY,
|
||||
QS_ALLEVENTS = QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY,
|
||||
QS_ALLINPUT = QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY | QS_SENDMESSAGE;
|
||||
|
||||
internal const int Facility_Win32 = 7;
|
||||
|
||||
internal const int WM_CLOSE = 0x0010;
|
||||
|
||||
internal const int
|
||||
S_FALSE = 0x00000001,
|
||||
S_OK = 0x00000000,
|
||||
|
||||
IDOK = 1,
|
||||
IDCANCEL = 2,
|
||||
IDABORT = 3,
|
||||
IDRETRY = 4,
|
||||
IDIGNORE = 5,
|
||||
IDYES = 6,
|
||||
IDNO = 7,
|
||||
IDCLOSE = 8,
|
||||
IDHELP = 9,
|
||||
IDTRYAGAIN = 10,
|
||||
IDCONTINUE = 11;
|
||||
|
||||
internal static long HResultFromWin32(long error)
|
||||
{
|
||||
if (error <= 0)
|
||||
{
|
||||
return error;
|
||||
}
|
||||
|
||||
return ((error & 0x0000FFFF) | (Facility_Win32 << 16) | 0x80000000);
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// Please use this "approved" method to compare file names.
|
||||
/// </devdoc>
|
||||
public static bool IsSamePath(string file1, string file2)
|
||||
{
|
||||
if (file1 == null || file1.Length == 0)
|
||||
{
|
||||
return (file2 == null || file2.Length == 0);
|
||||
}
|
||||
|
||||
Uri uri1 = null;
|
||||
Uri uri2 = null;
|
||||
|
||||
try
|
||||
{
|
||||
if (!Uri.TryCreate(file1, UriKind.Absolute, out uri1) || !Uri.TryCreate(file2, UriKind.Absolute, out uri2))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (uri1 != null && uri1.IsFile && uri2 != null && uri2.IsFile)
|
||||
{
|
||||
return 0 == String.Compare(uri1.LocalPath, uri2.LocalPath, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
return file1 == file2;
|
||||
}
|
||||
catch (UriFormatException e)
|
||||
{
|
||||
System.Diagnostics.Trace.WriteLine("Exception " + e.Message);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,401 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Diagnostics;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using EnvDTE;
|
||||
using EnvDTE80;
|
||||
using Microsoft.Win32;
|
||||
using IOleServiceProvider = Microsoft.VisualStudio.OLE.Interop.IServiceProvider;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Microsoft.VSSDK.Tools.VsIdeTesting;
|
||||
using Microsoft.VisualStudio;
|
||||
|
||||
namespace Microsoft.VsSDK.IntegrationTestLibrary
|
||||
{
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public class TestUtils
|
||||
{
|
||||
|
||||
#region Methods: Handling embedded resources
|
||||
/// <summary>
|
||||
/// Gets the embedded file identified by the resource name, and converts the
|
||||
/// file into a string.
|
||||
/// </summary>
|
||||
/// <param name="resourceName">In VS, is DefaultNamespace.FileName?</param>
|
||||
/// <returns></returns>
|
||||
public static string GetEmbeddedStringResource(Assembly assembly, string resourceName)
|
||||
{
|
||||
string result = null;
|
||||
|
||||
// Use the .NET procedure for loading a file embedded in the assembly
|
||||
Stream stream = assembly.GetManifestResourceStream(resourceName);
|
||||
if (stream != null)
|
||||
{
|
||||
// Convert bytes to string
|
||||
byte[] fileContentsAsBytes = new byte[stream.Length];
|
||||
stream.Read(fileContentsAsBytes, 0, (int)stream.Length);
|
||||
result = Encoding.Default.GetString(fileContentsAsBytes);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Embedded resource not found - list available resources
|
||||
Debug.WriteLine("Unable to find the embedded resource file '" + resourceName + "'.");
|
||||
Debug.WriteLine(" Available resources:");
|
||||
foreach (string aResourceName in assembly.GetManifestResourceNames())
|
||||
{
|
||||
Debug.WriteLine(" " + aResourceName);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="embeddedResourceName"></param>
|
||||
/// <param name="baseFileName"></param>
|
||||
/// <param name="fileExtension"></param>
|
||||
/// <returns></returns>
|
||||
public static void WriteEmbeddedResourceToFile(Assembly assembly, string embeddedResourceName, string fileName)
|
||||
{
|
||||
// Get file contents
|
||||
string fileContents = GetEmbeddedStringResource(assembly, embeddedResourceName);
|
||||
if (fileContents == null)
|
||||
throw new ApplicationException("Failed to get embedded resource '" + embeddedResourceName + "' from assembly '" + assembly.FullName);
|
||||
|
||||
// Write to file
|
||||
StreamWriter sw = new StreamWriter(fileName);
|
||||
sw.Write(fileContents);
|
||||
sw.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes an embedded resource to a file.
|
||||
/// </summary>
|
||||
/// <param name="assembly">The name of the assembly that the embedded resource is defined.</param>
|
||||
/// <param name="embeddedResourceName">The name of the embedded resource.</param>
|
||||
/// <param name="fileName">The file to write the embedded resource's content.</param>
|
||||
public static void WriteEmbeddedResourceToBinaryFile(Assembly assembly, string embeddedResourceName, string fileName)
|
||||
{
|
||||
// Get file contents
|
||||
Stream stream = assembly.GetManifestResourceStream(embeddedResourceName);
|
||||
if (stream == null)
|
||||
throw new InvalidOperationException("Failed to get embedded resource '" + embeddedResourceName + "' from assembly '" + assembly.FullName);
|
||||
|
||||
// Write to file
|
||||
BinaryWriter sw = null;
|
||||
FileStream fs = null;
|
||||
try
|
||||
{
|
||||
byte[] fileContentsAsBytes = new byte[stream.Length];
|
||||
stream.Read(fileContentsAsBytes, 0, (int)stream.Length);
|
||||
|
||||
FileMode mode = FileMode.CreateNew;
|
||||
if (File.Exists(fileName))
|
||||
{
|
||||
mode = FileMode.Truncate;
|
||||
}
|
||||
|
||||
fs = new FileStream(fileName, mode);
|
||||
|
||||
sw = new BinaryWriter(fs);
|
||||
sw.Write(fileContentsAsBytes);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (fs != null)
|
||||
{
|
||||
fs.Close();
|
||||
}
|
||||
if (sw != null)
|
||||
{
|
||||
sw.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods: Handling temporary files and directories
|
||||
/// <summary>
|
||||
/// Returns the first available file name on the form
|
||||
/// [baseFileName]i.[extension]
|
||||
/// where [i] starts at 1 and increases until there is an available file name
|
||||
/// in the given directory. Also creates an empty file with that name to mark
|
||||
/// that file as occupied.
|
||||
/// </summary>
|
||||
/// <param name="directory">Directory that the file should live in.</param>
|
||||
/// <param name="baseFileName"></param>
|
||||
/// <param name="extension">may be null, in which case the .[extension] part
|
||||
/// is not added.</param>
|
||||
/// <returns>Full file name.</returns>
|
||||
public static string GetNewFileName(string directory, string baseFileName, string extension)
|
||||
{
|
||||
// Get the new file name
|
||||
string fileName = GetNewFileOrDirectoryNameWithoutCreatingAnything(directory, baseFileName, extension);
|
||||
|
||||
// Create an empty file to mark it as taken
|
||||
StreamWriter sw = new StreamWriter(fileName);
|
||||
|
||||
sw.Write("");
|
||||
sw.Close();
|
||||
return fileName;
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns the first available directory name on the form
|
||||
/// [baseDirectoryName]i
|
||||
/// where [i] starts at 1 and increases until there is an available directory name
|
||||
/// in the given directory. Also creates the directory to mark it as occupied.
|
||||
/// </summary>
|
||||
/// <param name="directory">Directory that the file should live in.</param>
|
||||
/// <param name="baseDirectoryName"></param>
|
||||
/// <returns>Full directory name.</returns>
|
||||
public static string GetNewDirectoryName(string directory, string baseDirectoryName)
|
||||
{
|
||||
// Get the new file name
|
||||
string directoryName = GetNewFileOrDirectoryNameWithoutCreatingAnything(directory, baseDirectoryName, null);
|
||||
|
||||
// Create an empty directory to make it as occupied
|
||||
Directory.CreateDirectory(directoryName);
|
||||
|
||||
return directoryName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="directory"></param>
|
||||
/// <param name="baseFileName"></param>
|
||||
/// <param name="extension"></param>
|
||||
/// <returns></returns>
|
||||
private static string GetNewFileOrDirectoryNameWithoutCreatingAnything(string directory, string baseFileName, string extension)
|
||||
{
|
||||
// - get a file name that we can use
|
||||
string fileName;
|
||||
int i = 1;
|
||||
|
||||
string fullFileName = null;
|
||||
while (true)
|
||||
{
|
||||
// construct next file name
|
||||
fileName = baseFileName + i;
|
||||
if (extension != null)
|
||||
fileName += '.' + extension;
|
||||
|
||||
// check if that file exists in the directory
|
||||
fullFileName = Path.Combine(directory, fileName);
|
||||
|
||||
if (!File.Exists(fullFileName) && !Directory.Exists(fullFileName))
|
||||
break;
|
||||
else
|
||||
i++;
|
||||
}
|
||||
|
||||
return fullFileName;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods: Handling solutions
|
||||
/// <summary>
|
||||
/// Closes the currently open solution (if any), and creates a new solution with the given name.
|
||||
/// </summary>
|
||||
/// <param name="solutionName">Name of new solution.</param>
|
||||
public void CreateEmptySolution(string directory, string solutionName)
|
||||
{
|
||||
CloseCurrentSolution(__VSSLNSAVEOPTIONS.SLNSAVEOPT_NoSave);
|
||||
|
||||
string solutionDirectory = GetNewDirectoryName(directory, solutionName);
|
||||
|
||||
// Create and force save solution
|
||||
IVsSolution solutionService = (IVsSolution)VsIdeTestHostContext.ServiceProvider.GetService(typeof(IVsSolution));
|
||||
solutionService.CreateSolution(solutionDirectory, solutionName, (uint)__VSCREATESOLUTIONFLAGS.CSF_SILENT);
|
||||
solutionService.SaveSolutionElement((uint)__VSSLNSAVEOPTIONS.SLNSAVEOPT_ForceSave, null, 0);
|
||||
DTE dte = VsIdeTestHostContext.Dte;
|
||||
Assert.AreEqual(solutionName + ".sln", Path.GetFileName(dte.Solution.FileName), "Newly created solution has wrong Filename");
|
||||
}
|
||||
|
||||
public void CloseCurrentSolution(__VSSLNSAVEOPTIONS saveoptions)
|
||||
{
|
||||
// Get solution service
|
||||
IVsSolution solutionService = (IVsSolution)VsIdeTestHostContext.ServiceProvider.GetService(typeof(IVsSolution));
|
||||
|
||||
// Close already open solution
|
||||
solutionService.CloseSolutionElement((uint)saveoptions, null, 0);
|
||||
}
|
||||
|
||||
public void ForceSaveSolution()
|
||||
{
|
||||
// Get solution service
|
||||
IVsSolution solutionService = (IVsSolution)VsIdeTestHostContext.ServiceProvider.GetService(typeof(IVsSolution));
|
||||
|
||||
// Force-save the solution
|
||||
solutionService.SaveSolutionElement((uint)__VSSLNSAVEOPTIONS.SLNSAVEOPT_ForceSave, null, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get current number of open project in solution
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int ProjectCount()
|
||||
{
|
||||
// Get solution service
|
||||
IVsSolution solutionService = (IVsSolution)VsIdeTestHostContext.ServiceProvider.GetService(typeof(IVsSolution));
|
||||
object projectCount;
|
||||
solutionService.GetProperty((int)__VSPROPID.VSPROPID_ProjectCount, out projectCount);
|
||||
return (int)projectCount;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods: Handling projects
|
||||
/// <summary>
|
||||
/// Creates a project.
|
||||
/// </summary>
|
||||
/// <param name="projectName">Name of new project.</param>
|
||||
/// <param name="templateName">Name of project template to use</param>
|
||||
/// <param name="language">language</param>
|
||||
/// <returns>New project.</returns>
|
||||
public void CreateProjectFromTemplate(string projectName, string templateName, string language, bool exclusive)
|
||||
{
|
||||
DTE dte = (DTE)VsIdeTestHostContext.ServiceProvider.GetService(typeof(DTE));
|
||||
|
||||
Solution2 sol = dte.Solution as Solution2;
|
||||
string projectTemplate = sol.GetProjectTemplate(templateName, language);
|
||||
|
||||
// - project name and directory
|
||||
string solutionDirectory = Directory.GetParent(dte.Solution.FullName).FullName;
|
||||
string projectDirectory = GetNewDirectoryName(solutionDirectory, projectName);
|
||||
|
||||
dte.Solution.AddFromTemplate(projectTemplate, projectDirectory, projectName, false);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods: Handling project items
|
||||
/// <summary>
|
||||
/// Create a new item in the project
|
||||
/// </summary>
|
||||
/// <param name="parent">the parent collection for the new item</param>
|
||||
/// <param name="templateName"></param>
|
||||
/// <param name="language"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public ProjectItem AddNewItemFromVsTemplate(ProjectItems parent, string templateName, string language, string name)
|
||||
{
|
||||
if (parent == null)
|
||||
throw new ArgumentException("project");
|
||||
if (name == null)
|
||||
throw new ArgumentException("name");
|
||||
|
||||
DTE dte = (DTE)VsIdeTestHostContext.ServiceProvider.GetService(typeof(DTE));
|
||||
|
||||
Solution2 sol = dte.Solution as Solution2;
|
||||
|
||||
string filename = sol.GetProjectItemTemplate(templateName, language);
|
||||
|
||||
parent.AddFromTemplate(filename, name);
|
||||
|
||||
return parent.Item(name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save an open document.
|
||||
/// </summary>
|
||||
/// <param name="documentMoniker">for filebased documents this is the full path to the document</param>
|
||||
public void SaveDocument(string documentMoniker)
|
||||
{
|
||||
// Get document cookie and hierarchy for the file
|
||||
IVsRunningDocumentTable runningDocumentTableService = (IVsRunningDocumentTable)VsIdeTestHostContext.ServiceProvider.GetService(typeof(IVsRunningDocumentTable));
|
||||
uint docCookie;
|
||||
IntPtr docData;
|
||||
IVsHierarchy hierarchy;
|
||||
uint itemId;
|
||||
runningDocumentTableService.FindAndLockDocument(
|
||||
(uint)Microsoft.VisualStudio.Shell.Interop._VSRDTFLAGS.RDT_NoLock,
|
||||
documentMoniker,
|
||||
out hierarchy,
|
||||
out itemId,
|
||||
out docData,
|
||||
out docCookie);
|
||||
|
||||
// Save the document
|
||||
IVsSolution solutionService = (IVsSolution)VsIdeTestHostContext.ServiceProvider.GetService(typeof(IVsSolution));
|
||||
solutionService.SaveSolutionElement((uint)__VSSLNSAVEOPTIONS.SLNSAVEOPT_ForceSave, hierarchy, docCookie);
|
||||
}
|
||||
|
||||
public void CloseInEditorWithoutSaving(string fullFileName)
|
||||
{
|
||||
// Get the RDT service
|
||||
IVsRunningDocumentTable runningDocumentTableService = (IVsRunningDocumentTable)VsIdeTestHostContext.ServiceProvider.GetService(typeof(IVsRunningDocumentTable));
|
||||
Assert.IsNotNull(runningDocumentTableService, "Failed to get the Running Document Table Service");
|
||||
|
||||
// Get our document cookie and hierarchy for the file
|
||||
uint docCookie;
|
||||
IntPtr docData;
|
||||
IVsHierarchy hierarchy;
|
||||
uint itemId;
|
||||
runningDocumentTableService.FindAndLockDocument(
|
||||
(uint)Microsoft.VisualStudio.Shell.Interop._VSRDTFLAGS.RDT_NoLock,
|
||||
fullFileName,
|
||||
out hierarchy,
|
||||
out itemId,
|
||||
out docData,
|
||||
out docCookie);
|
||||
|
||||
// Get the SolutionService
|
||||
IVsSolution solutionService = VsIdeTestHostContext.ServiceProvider.GetService(typeof(IVsSolution)) as IVsSolution;
|
||||
Assert.IsNotNull(solutionService, "Failed to get IVsSolution service");
|
||||
|
||||
// Close the document
|
||||
solutionService.CloseSolutionElement(
|
||||
(uint)__VSSLNSAVEOPTIONS.SLNSAVEOPT_NoSave,
|
||||
hierarchy,
|
||||
docCookie);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods: Handling Toolwindows
|
||||
public bool CanFindToolwindow(Guid persistenceGuid)
|
||||
{
|
||||
IVsUIShell uiShellService = VsIdeTestHostContext.ServiceProvider.GetService(typeof(SVsUIShell)) as IVsUIShell;
|
||||
Assert.IsNotNull(uiShellService);
|
||||
IVsWindowFrame windowFrame;
|
||||
int hr = uiShellService.FindToolWindow((uint)__VSFINDTOOLWIN.FTW_fFindFirst, ref persistenceGuid, out windowFrame);
|
||||
Assert.IsTrue(hr == VSConstants.S_OK);
|
||||
|
||||
return (windowFrame != null);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods: Loading packages
|
||||
public IVsPackage LoadPackage(Guid packageGuid)
|
||||
{
|
||||
IVsShell shellService = (IVsShell)VsIdeTestHostContext.ServiceProvider.GetService(typeof(SVsShell));
|
||||
IVsPackage package;
|
||||
shellService.LoadPackage(ref packageGuid, out package);
|
||||
Assert.IsNotNull(package, "Failed to load package");
|
||||
return package;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Executes a Command (menu item) in the given context
|
||||
/// </summary>
|
||||
public void ExecuteCommand(CommandID cmd)
|
||||
{
|
||||
object Customin = null;
|
||||
object Customout = null;
|
||||
string guidString = cmd.Guid.ToString("B").ToUpper();
|
||||
int cmdId = cmd.ID;
|
||||
DTE dte = VsIdeTestHostContext.Dte;
|
||||
dte.Commands.Raise(guidString, cmdId, ref Customin, ref Customout);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Microsoft.VSSDK.Tools.VsIdeTesting;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using EnvDTE;
|
||||
|
||||
namespace VSPackage_IntegrationTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Integration test for package validation
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public class PackageTest
|
||||
{
|
||||
private delegate void ThreadInvoker();
|
||||
|
||||
private TestContext testContextInstance;
|
||||
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get
|
||||
{
|
||||
return testContextInstance;
|
||||
}
|
||||
set
|
||||
{
|
||||
testContextInstance = value;
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[HostType("VS IDE")]
|
||||
public void PackageLoadTest()
|
||||
{
|
||||
UIThreadInvoker.Invoke((ThreadInvoker)delegate()
|
||||
{
|
||||
|
||||
//Get the Shell Service
|
||||
IVsShell shellService = VsIdeTestHostContext.ServiceProvider.GetService(typeof(SVsShell)) as IVsShell;
|
||||
Assert.IsNotNull(shellService);
|
||||
|
||||
//Validate package load
|
||||
IVsPackage package;
|
||||
Guid packageGuid = new Guid(GuidList.guidVSPackagePkgString);
|
||||
Assert.IsTrue(0 == shellService.LoadPackage(ref packageGuid, out package));
|
||||
Assert.IsNotNull(package, "Package failed to load");
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Microsoft.VsSDK.IntegrationTestLibrary;
|
||||
using Microsoft.VSSDK.Tools.VsIdeTesting;
|
||||
using EnvDTE;
|
||||
using System.IO;
|
||||
|
||||
namespace VSPackage_IntegrationTests.IntegrationTests
|
||||
{
|
||||
[TestClass]
|
||||
public class CPPProjectTests
|
||||
{
|
||||
#region fields
|
||||
private delegate void ThreadInvoker();
|
||||
private TestContext _testContext;
|
||||
#endregion
|
||||
|
||||
#region properties
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get { return _testContext; }
|
||||
set { _testContext = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ctors
|
||||
public CPPProjectTests()
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Additional test attributes
|
||||
//
|
||||
// You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
// Use ClassInitialize to run code before running the first test in the class
|
||||
// [ClassInitialize()]
|
||||
// public static void MyClassInitialize(TestContext testContext) { }
|
||||
//
|
||||
// Use ClassCleanup to run code after all tests in a class have run
|
||||
// [ClassCleanup()]
|
||||
// public static void MyClassCleanup() { }
|
||||
//
|
||||
// Use TestInitialize to run code before running each test
|
||||
// [TestInitialize()]
|
||||
// public void MyTestInitialize() { }
|
||||
//
|
||||
// Use TestCleanup to run code after each test has run
|
||||
// [TestCleanup()]
|
||||
// public void MyTestCleanup() { }
|
||||
//
|
||||
#endregion
|
||||
|
||||
[HostType("VS IDE")]
|
||||
[TestMethod]
|
||||
public void CPPWinformsApplication()
|
||||
{
|
||||
UIThreadInvoker.Invoke((ThreadInvoker)delegate()
|
||||
{
|
||||
//Solution and project creation parameters
|
||||
string solutionName = "CPPWinApp";
|
||||
string projectName = "CPPWinApp";
|
||||
|
||||
//Template parameters
|
||||
string projectType = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}";
|
||||
string projectTemplateName = Path.Combine("vcNet", "mc++appwiz.vsz");
|
||||
|
||||
string itemTemplateName = "newc++file.cpp";
|
||||
string newFileName = "Test.cpp";
|
||||
|
||||
DTE dte = (DTE)VsIdeTestHostContext.ServiceProvider.GetService(typeof(DTE));
|
||||
|
||||
TestUtils testUtils = new TestUtils();
|
||||
|
||||
testUtils.CreateEmptySolution(TestContext.TestDir, solutionName);
|
||||
Assert.AreEqual<int>(0, testUtils.ProjectCount());
|
||||
|
||||
//Add new CPP Windows application project to existing solution
|
||||
string solutionDirectory = Directory.GetParent(dte.Solution.FullName).FullName;
|
||||
string projectDirectory = TestUtils.GetNewDirectoryName(solutionDirectory, projectName);
|
||||
string projectTemplatePath = Path.Combine(dte.Solution.get_TemplatePath(projectType), projectTemplateName);
|
||||
Assert.IsTrue(File.Exists(projectTemplatePath), string.Format("Could not find template file: {0}", projectTemplatePath));
|
||||
dte.Solution.AddFromTemplate(projectTemplatePath, projectDirectory, projectName, false);
|
||||
|
||||
//Verify that the new project has been added to the solution
|
||||
Assert.AreEqual<int>(1, testUtils.ProjectCount());
|
||||
|
||||
//Get the project
|
||||
Project project = dte.Solution.Item(1);
|
||||
Assert.IsNotNull(project);
|
||||
Assert.IsTrue(string.Compare(project.Name, projectName, StringComparison.InvariantCultureIgnoreCase) == 0);
|
||||
|
||||
//Verify Adding new code file to project
|
||||
string newItemTemplatePath = Path.Combine(dte.Solution.ProjectItemsTemplatePath(projectType), itemTemplateName);
|
||||
Assert.IsTrue(File.Exists(newItemTemplatePath));
|
||||
ProjectItem item = project.ProjectItems.AddFromTemplate(newItemTemplatePath, newFileName);
|
||||
Assert.IsNotNull(item);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Microsoft.VsSDK.IntegrationTestLibrary;
|
||||
using Microsoft.VSSDK.Tools.VsIdeTesting;
|
||||
|
||||
namespace VSPackage_IntegrationTests.IntegrationTests
|
||||
{
|
||||
[TestClass]
|
||||
public class CSharpProjectTests
|
||||
{
|
||||
#region fields
|
||||
private delegate void ThreadInvoker();
|
||||
private TestContext _testContext;
|
||||
#endregion
|
||||
|
||||
#region properties
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get { return _testContext; }
|
||||
set { _testContext = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ctors
|
||||
public CSharpProjectTests()
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Additional test attributes
|
||||
//
|
||||
// You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
// Use ClassInitialize to run code before running the first test in the class
|
||||
// [ClassInitialize()]
|
||||
// public static void MyClassInitialize(TestContext testContext) { }
|
||||
//
|
||||
// Use ClassCleanup to run code after all tests in a class have run
|
||||
// [ClassCleanup()]
|
||||
// public static void MyClassCleanup() { }
|
||||
//
|
||||
// Use TestInitialize to run code before running each test
|
||||
// [TestInitialize()]
|
||||
// public void MyTestInitialize() { }
|
||||
//
|
||||
// Use TestCleanup to run code after each test has run
|
||||
// [TestCleanup()]
|
||||
// public void MyTestCleanup() { }
|
||||
//
|
||||
#endregion
|
||||
|
||||
[TestMethod]
|
||||
[HostType("VS IDE")]
|
||||
public void WinformsApplication()
|
||||
{
|
||||
UIThreadInvoker.Invoke((ThreadInvoker)delegate()
|
||||
{
|
||||
TestUtils testUtils = new TestUtils();
|
||||
|
||||
testUtils.CreateEmptySolution(TestContext.TestDir, "CSWinApp");
|
||||
Assert.AreEqual<int>(0, testUtils.ProjectCount());
|
||||
|
||||
//Create Winforms application project
|
||||
//TestUtils.CreateProjectFromTemplate("MyWindowsApp", "Windows Application", "CSharp", false);
|
||||
//Assert.AreEqual<int>(1, TestUtils.ProjectCount());
|
||||
|
||||
//TODO Verify that we can debug launch the application
|
||||
|
||||
//TODO Set Break point and verify that will hit
|
||||
|
||||
//TODO Verify Adding new project item to project
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Microsoft.VSSDK.Tools.VsIdeTesting;
|
||||
using EnvDTE;
|
||||
using System.IO;
|
||||
using Microsoft.VsSDK.IntegrationTestLibrary;
|
||||
|
||||
|
||||
namespace VSPackage_IntegrationTests.IntegrationTests
|
||||
{
|
||||
[TestClass]
|
||||
public class SolutionTests
|
||||
{
|
||||
#region fields
|
||||
private delegate void ThreadInvoker();
|
||||
private TestContext _testContext;
|
||||
#endregion
|
||||
|
||||
#region properties
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get { return _testContext; }
|
||||
set { _testContext = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region ctors
|
||||
public SolutionTests()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
[TestMethod]
|
||||
[HostType("VS IDE")]
|
||||
public void CreateEmptySolution()
|
||||
{
|
||||
UIThreadInvoker.Invoke((ThreadInvoker)delegate()
|
||||
{
|
||||
TestUtils testUtils = new TestUtils();
|
||||
testUtils.CloseCurrentSolution(__VSSLNSAVEOPTIONS.SLNSAVEOPT_NoSave);
|
||||
testUtils.CreateEmptySolution(TestContext.TestDir, "EmptySolution");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Microsoft.VsSDK.IntegrationTestLibrary;
|
||||
using Microsoft.VSSDK.Tools.VsIdeTesting;
|
||||
using EnvDTE;
|
||||
|
||||
namespace VSPackage_IntegrationTests.IntegrationTests
|
||||
{
|
||||
[TestClass]
|
||||
public class VisualBasicProjectTests
|
||||
{
|
||||
#region fields
|
||||
private delegate void ThreadInvoker();
|
||||
private TestContext _testContext;
|
||||
#endregion
|
||||
|
||||
#region properties
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get { return _testContext; }
|
||||
set { _testContext = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ctors
|
||||
public VisualBasicProjectTests()
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Additional test attributes
|
||||
//
|
||||
// You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
// Use ClassInitialize to run code before running the first test in the class
|
||||
// [ClassInitialize()]
|
||||
// public static void MyClassInitialize(TestContext testContext) { }
|
||||
//
|
||||
// Use ClassCleanup to run code after all tests in a class have run
|
||||
// [ClassCleanup()]
|
||||
// public static void MyClassCleanup() { }
|
||||
//
|
||||
// Use TestInitialize to run code before running each test
|
||||
// [TestInitialize()]
|
||||
// public void MyTestInitialize() { }
|
||||
//
|
||||
// Use TestCleanup to run code after each test has run
|
||||
// [TestCleanup()]
|
||||
// public void MyTestCleanup() { }
|
||||
//
|
||||
#endregion
|
||||
|
||||
[HostType("VS IDE")]
|
||||
[TestMethod]
|
||||
public void VBWinformsApplication()
|
||||
{
|
||||
UIThreadInvoker.Invoke((ThreadInvoker)delegate()
|
||||
{
|
||||
//Solution and project creation parameters
|
||||
string solutionName = "VBWinApp";
|
||||
string projectName = "VBWinApp";
|
||||
|
||||
//Template parameters
|
||||
string language = "VisualBasic";
|
||||
string projectTemplateName = "WindowsApplication.Zip";
|
||||
string itemTemplateName = "CodeFile.zip";
|
||||
string newFileName = "Test.vb";
|
||||
|
||||
DTE dte = (DTE)VsIdeTestHostContext.ServiceProvider.GetService(typeof(DTE));
|
||||
|
||||
TestUtils testUtils = new TestUtils();
|
||||
|
||||
testUtils.CreateEmptySolution(TestContext.TestDir, solutionName);
|
||||
Assert.AreEqual<int>(0, testUtils.ProjectCount());
|
||||
|
||||
//Add new Windows application project to existing solution
|
||||
testUtils.CreateProjectFromTemplate(projectName, projectTemplateName, language, false);
|
||||
|
||||
//Verify that the new project has been added to the solution
|
||||
Assert.AreEqual<int>(1, testUtils.ProjectCount());
|
||||
|
||||
//Get the project
|
||||
Project project = dte.Solution.Item(1);
|
||||
Assert.IsNotNull(project);
|
||||
Assert.IsTrue(string.Compare(project.Name, projectName, StringComparison.InvariantCultureIgnoreCase) == 0);
|
||||
|
||||
//Verify Adding new code file to project
|
||||
ProjectItem newCodeFileItem = testUtils.AddNewItemFromVsTemplate(project.ProjectItems, itemTemplateName, language, newFileName);
|
||||
Assert.IsNotNull(newCodeFileItem, "Could not create new project item");
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{D03690D8-EE17-4284-9403-F3F277CF4580}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>VSPackage_IntegrationTests</RootNamespace>
|
||||
<AssemblyName>VSPackage_IntegrationTests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
</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>
|
||||
<AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="envdte" />
|
||||
<Reference Include="envdte80" />
|
||||
<Reference Include="Microsoft.VisualStudio.OLE.Interop" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Interop" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Interop.10.0" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Interop.11.0">
|
||||
<EmbedInteropTypes>true</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.11.0" />
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Microsoft.VSSDK.TestHostFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<!--<Compile Include="Properties\AssemblyInfo.cs" />-->
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
<Compile Include="PackageTest.cs" />
|
||||
<Compile Include="IntegrationTest Library\DialogboxPurger.cs" />
|
||||
<Compile Include="IntegrationTest Library\NativeMethods.cs" />
|
||||
<Compile Include="IntegrationTest Library\Utils.cs" />
|
||||
<Compile Include="SignOff-Tests\CPPProjectTests.cs" />
|
||||
<Compile Include="SignOff-Tests\CSharpProjectTests.cs" />
|
||||
<Compile Include="SignOff-Tests\SolutionTests.cs" />
|
||||
<Compile Include="SignOff-Tests\VBProjectTests.cs" />
|
||||
<Compile Include="VisualStudioVersionHelperTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Key.snk" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\VSPackage.csproj">
|
||||
<Project>{2451352F-1CB8-494A-920B-024B8B486185}</Project>
|
||||
<Name>VSPackage</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,16 @@
|
||||
using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace VSPackage_IntegrationTests
|
||||
{
|
||||
[TestClass]
|
||||
public class VisualStudioHelperTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void GetVersionTests()
|
||||
{
|
||||
var actual = VisualStudioHelper.GetVersion();
|
||||
Assert.AreNotEqual(VisualStudioVersion.Unknown, actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,56 @@
|
||||
/***************************************************************************
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
This code is licensed under the Visual Studio SDK license terms.
|
||||
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
|
||||
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
|
||||
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
|
||||
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage;
|
||||
using Microsoft.VsSDK.UnitTestLibrary;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace VSPackage_UnitTests
|
||||
{
|
||||
[TestClass()]
|
||||
public class PackageTest
|
||||
{
|
||||
[TestMethod()]
|
||||
public void CreateInstance()
|
||||
{
|
||||
VisualStudio2012Package package = new VisualStudio2012Package();
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void IsIVsPackage()
|
||||
{
|
||||
VisualStudio2012Package package = new VisualStudio2012Package();
|
||||
Assert.IsNotNull(package as IVsPackage, "The object does not implement IVsPackage");
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void SetSite()
|
||||
{
|
||||
// Create the package
|
||||
IVsPackage package = new VisualStudio2012Package() as IVsPackage;
|
||||
Assert.IsNotNull(package, "The object does not implement IVsPackage");
|
||||
|
||||
// Create a basic service provider
|
||||
OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices();
|
||||
|
||||
// Site the package
|
||||
Assert.AreEqual(0, package.SetSite(serviceProvider), "SetSite did not return S_OK");
|
||||
|
||||
// Unsite the package
|
||||
Assert.AreEqual(0, package.SetSite(null), "SetSite(null) did not return S_OK");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{64F7EAFB-9AF1-4DA4-A4DA-013B4DF10306}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>VSPackage_UnitTests</RootNamespace>
|
||||
<AssemblyName>VSPackage_UnitTests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath Condition="'$(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 Condition="'$(OutputPath)'==''">bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.OLE.Interop" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Interop" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Interop.10.0" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Interop.11.0">
|
||||
<EmbedInteropTypes>true</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.11.0" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.10.0" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.11.0" />
|
||||
<!---->
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
|
||||
<Reference Include="Microsoft.VSSDK.UnitTestLibrary" />
|
||||
<Reference Include="Microsoft.VSSDK.TestHostFramework" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Design" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="PackageTest.cs" />
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Key.snk" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\VSPackage.csproj">
|
||||
<Project>{2451352F-1CB8-494A-920B-024B8B486185}</Project>
|
||||
<Name>VSPackage</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,70 @@
|
||||
using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using Microsoft.VisualStudio.Shell.Design.Serialization;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage
|
||||
{
|
||||
/// <summary>
|
||||
/// This is the class that implements the package exposed by this assembly.
|
||||
///
|
||||
/// The minimum requirement for a class to be considered a valid package for Visual Studio
|
||||
/// is to implement the IVsPackage interface and register itself with the shell.
|
||||
/// This package uses the helper classes defined inside the Managed Package Framework (MPF)
|
||||
/// to do it: it derives from the Package class that provides the implementation of the
|
||||
/// IVsPackage interface and uses the registration attributes defined in the framework to
|
||||
/// register itself and its components with the shell.
|
||||
/// </summary>
|
||||
// This attribute tells the PkgDef creation utility (CreatePkgDef.exe) that this class is
|
||||
// a package.
|
||||
[PackageRegistration(UseManagedResourcesOnly = true)]
|
||||
// This attribute is used to register the information needed to show this package
|
||||
// in the Help/About dialog of Visual Studio.
|
||||
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
|
||||
[Guid(GuidList.guidVSPackagePkgString)]
|
||||
[DefaultRegistryRoot("Software\\Microsoft\\VisualStudio\\11.0")]
|
||||
[ProvideObject(typeof(ReswFileCSharpCodeGenerator))]
|
||||
[ProvideObject(typeof(ReswFileVisualBasicCodeGenerator))]
|
||||
[ProvideObject(typeof(ReswFileCSharpCodeGeneratorInternal))]
|
||||
[ProvideObject(typeof(ReswFileVisualBasicCodeGeneratorInternal))]
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileCSharpCodeGenerator), "ReswFileCodeGenerator", "ResW File Code Generator for C#", "{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}", true)] // csharp
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileVisualBasicCodeGenerator), "ReswFileCodeGenerator", "ResW File Code Generator for VB", "{164B10B9-B200-11D0-8C61-00A0C91E29D5}", true)] // visual basic
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileCSharpCodeGenerator), "PublicReswFileCodeGenerator", "ResW File Code Generator for C#", "{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}", true)] // csharp
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileVisualBasicCodeGenerator), "PublicReswFileCodeGenerator", "ResW File Code Generator for VB", "{164B10B9-B200-11D0-8C61-00A0C91E29D5}", true)] // visual basic
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileCSharpCodeGeneratorInternal), "InternalReswFileCodeGenerator", "ResW File Code Generator for C#", "{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}", true)] // csharp
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileVisualBasicCodeGeneratorInternal), "InternalReswFileCodeGenerator", "ResW File Code Generator for VB", "{164B10B9-B200-11D0-8C61-00A0C91E29D5}", true)] // visual basic
|
||||
public sealed class VisualStudio2012Package : Package
|
||||
{
|
||||
/// <summary>
|
||||
/// Default constructor of the package.
|
||||
/// Inside this method you can place any initialization code that does not require
|
||||
/// any Visual Studio service because at this point the package object is created but
|
||||
/// not sited yet inside Visual Studio environment. The place to do all the other
|
||||
/// initialization is the Initialize method.
|
||||
/// </summary>
|
||||
public VisualStudio2012Package()
|
||||
{
|
||||
Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this.ToString()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Overridden Package Implementation
|
||||
#region Package Members
|
||||
|
||||
/// <summary>
|
||||
/// Initialization of the package; this method is called right after the package is sited, so this is the place
|
||||
/// where you can put all the initialization code that rely on services provided by VisualStudio.
|
||||
/// </summary>
|
||||
protected override void Initialize()
|
||||
{
|
||||
Debug.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
|
||||
base.Initialize();
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using Microsoft.VisualStudio.Shell.Design.Serialization;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage
|
||||
{
|
||||
/// <summary>
|
||||
/// This is the class that implements the package exposed by this assembly.
|
||||
///
|
||||
/// The minimum requirement for a class to be considered a valid package for Visual Studio
|
||||
/// is to implement the IVsPackage interface and register itself with the shell.
|
||||
/// This package uses the helper classes defined inside the Managed Package Framework (MPF)
|
||||
/// to do it: it derives from the Package class that provides the implementation of the
|
||||
/// IVsPackage interface and uses the registration attributes defined in the framework to
|
||||
/// register itself and its components with the shell.
|
||||
/// </summary>
|
||||
// This attribute tells the PkgDef creation utility (CreatePkgDef.exe) that this class is
|
||||
// a package.
|
||||
[PackageRegistration(UseManagedResourcesOnly = true)]
|
||||
// This attribute is used to register the information needed to show this package
|
||||
// in the Help/About dialog of Visual Studio.
|
||||
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
|
||||
[Guid(GuidList.guidVSPackagePkgString)]
|
||||
[DefaultRegistryRoot("Software\\Microsoft\\VisualStudio\\12.0")]
|
||||
[ProvideObject(typeof(ReswFileCSharpCodeGenerator))]
|
||||
[ProvideObject(typeof(ReswFileVisualBasicCodeGenerator))]
|
||||
[ProvideObject(typeof(ReswFileCSharpCodeGeneratorInternal))]
|
||||
[ProvideObject(typeof(ReswFileVisualBasicCodeGeneratorInternal))]
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileCSharpCodeGenerator), "ReswFileCodeGenerator", "ResW File Code Generator for C#", "{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}", true)] // csharp
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileVisualBasicCodeGenerator), "ReswFileCodeGenerator", "ResW File Code Generator for VB", "{164B10B9-B200-11D0-8C61-00A0C91E29D5}", true)] // visual basic
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileCSharpCodeGenerator), "PublicReswFileCodeGenerator", "ResW File Code Generator for C#", "{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}", true)] // csharp
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileVisualBasicCodeGenerator), "PublicReswFileCodeGenerator", "ResW File Code Generator for VB", "{164B10B9-B200-11D0-8C61-00A0C91E29D5}", true)] // visual basic
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileCSharpCodeGeneratorInternal), "InternalReswFileCodeGenerator", "ResW File Code Generator for C#", "{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}", true)] // csharp
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileVisualBasicCodeGeneratorInternal), "InternalReswFileCodeGenerator", "ResW File Code Generator for VB", "{164B10B9-B200-11D0-8C61-00A0C91E29D5}", true)] // visual basic
|
||||
public sealed class VisualStudio2013Package : Package
|
||||
{
|
||||
/// <summary>
|
||||
/// Default constructor of the package.
|
||||
/// Inside this method you can place any initialization code that does not require
|
||||
/// any Visual Studio service because at this point the package object is created but
|
||||
/// not sited yet inside Visual Studio environment. The place to do all the other
|
||||
/// initialization is the Initialize method.
|
||||
/// </summary>
|
||||
public VisualStudio2013Package()
|
||||
{
|
||||
Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this.ToString()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Overridden Package Implementation
|
||||
#region Package Members
|
||||
|
||||
/// <summary>
|
||||
/// Initialization of the package; this method is called right after the package is sited, so this is the place
|
||||
/// where you can put all the initialization code that rely on services provided by VisualStudio.
|
||||
/// </summary>
|
||||
protected override void Initialize()
|
||||
{
|
||||
Debug.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
|
||||
base.Initialize();
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using Microsoft.VisualStudio.Shell.Design.Serialization;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage
|
||||
{
|
||||
/// <summary>
|
||||
/// This is the class that implements the package exposed by this assembly.
|
||||
///
|
||||
/// The minimum requirement for a class to be considered a valid package for Visual Studio
|
||||
/// is to implement the IVsPackage interface and register itself with the shell.
|
||||
/// This package uses the helper classes defined inside the Managed Package Framework (MPF)
|
||||
/// to do it: it derives from the Package class that provides the implementation of the
|
||||
/// IVsPackage interface and uses the registration attributes defined in the framework to
|
||||
/// register itself and its components with the shell.
|
||||
/// </summary>
|
||||
// This attribute tells the PkgDef creation utility (CreatePkgDef.exe) that this class is
|
||||
// a package.
|
||||
[PackageRegistration(UseManagedResourcesOnly = true)]
|
||||
// This attribute is used to register the information needed to show this package
|
||||
// in the Help/About dialog of Visual Studio.
|
||||
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
|
||||
[Guid(GuidList.guidVSPackagePkgString)]
|
||||
[DefaultRegistryRoot("Software\\Microsoft\\VisualStudio\\14.0")]
|
||||
[ProvideObject(typeof(ReswFileCSharpCodeGenerator))]
|
||||
[ProvideObject(typeof(ReswFileVisualBasicCodeGenerator))]
|
||||
[ProvideObject(typeof(ReswFileCSharpCodeGeneratorInternal))]
|
||||
[ProvideObject(typeof(ReswFileVisualBasicCodeGeneratorInternal))]
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileCSharpCodeGenerator), "ReswFileCodeGenerator", "ResW File Code Generator for C#", "{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}", true)] // csharp
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileVisualBasicCodeGenerator), "ReswFileCodeGenerator", "ResW File Code Generator for VB", "{164B10B9-B200-11D0-8C61-00A0C91E29D5}", true)] // visual basic
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileCSharpCodeGenerator), "PublicReswFileCodeGenerator", "ResW File Code Generator for C#", "{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}", true)] // csharp
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileVisualBasicCodeGenerator), "PublicReswFileCodeGenerator", "ResW File Code Generator for VB", "{164B10B9-B200-11D0-8C61-00A0C91E29D5}", true)] // visual basic
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileCSharpCodeGeneratorInternal), "InternalReswFileCodeGenerator", "ResW File Code Generator for C#", "{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}", true)] // csharp
|
||||
[ProvideGeneratorAttribute(typeof(ReswFileVisualBasicCodeGeneratorInternal), "InternalReswFileCodeGenerator", "ResW File Code Generator for VB", "{164B10B9-B200-11D0-8C61-00A0C91E29D5}", true)] // visual basic
|
||||
public sealed class VisualStudio2015Package : Package
|
||||
{
|
||||
/// <summary>
|
||||
/// Default constructor of the package.
|
||||
/// Inside this method you can place any initialization code that does not require
|
||||
/// any Visual Studio service because at this point the package object is created but
|
||||
/// not sited yet inside Visual Studio environment. The place to do all the other
|
||||
/// initialization is the Initialize method.
|
||||
/// </summary>
|
||||
public VisualStudio2015Package()
|
||||
{
|
||||
Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this.ToString()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Overridden Package Implementation
|
||||
#region Package Members
|
||||
|
||||
/// <summary>
|
||||
/// Initialization of the package; this method is called right after the package is sited, so this is the place
|
||||
/// where you can put all the initialization code that rely on services provided by VisualStudio.
|
||||
/// </summary>
|
||||
protected override void Initialize()
|
||||
{
|
||||
Debug.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
|
||||
base.Initialize();
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PackageManifest Version="2.0.0"
|
||||
xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011"
|
||||
xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
|
||||
<Metadata>
|
||||
<Identity Id="6a4c1726-440f-4b2d-a2e5-711277da6099"
|
||||
Version="1.4"
|
||||
Language="en-US"
|
||||
Publisher="Christian Resma Helle" />
|
||||
<DisplayName>ResW File Code Generator</DisplayName>
|
||||
<Description xml:space="preserve">A Visual Studio Custom Tool for generating a strongly typed helper class for accessing localized resources from a .ResW file.</Description>
|
||||
<MoreInfo>http://visualstudiogallery.msdn.microsoft.com/3ab88efd-1afb-4ff5-9faf-8825a282596a</MoreInfo>
|
||||
<License>License.txt</License>
|
||||
</Metadata>
|
||||
<Installation InstalledByMsi="false">
|
||||
<InstallationTarget Version="[11.0,14.0]" Id="Microsoft.VisualStudio.IntegratedShell" />
|
||||
</Installation>
|
||||
<Dependencies>
|
||||
<Dependency Id="Microsoft.Framework.NDP"
|
||||
DisplayName="Microsoft .NET Framework"
|
||||
d:Source="Manual"
|
||||
Version="4.5" />
|
||||
<Dependency Id="Microsoft.VisualStudio.MPF.11.0"
|
||||
DisplayName="Visual Studio MPF 11.0"
|
||||
d:Source="Installed"
|
||||
Version="11.0" />
|
||||
</Dependencies>
|
||||
<Assets>
|
||||
<Asset Type="Microsoft.VisualStudio.VsPackage"
|
||||
d:Source="Project"
|
||||
d:ProjectName="%CurrentProject%"
|
||||
Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
|
||||
</Assets>
|
||||
</PackageManifest>
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
Copyright (c) 2007. Clarius Consulting, Manas Technology Solutions, InSTEDD
|
||||
http://code.google.com/p/moq/
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification, are permitted provided
|
||||
that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the
|
||||
above copyright notice, this list of conditions and
|
||||
the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce
|
||||
the above copyright notice, this list of conditions
|
||||
and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Clarius Consulting, Manas Technology Solutions or InSTEDD nor the
|
||||
names of its contributors may be used to endorse
|
||||
or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
[This is the BSD license, see
|
||||
http://www.opensource.org/licenses/bsd-license.php]
|
||||
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+5768
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
BIN
Binary file not shown.
+5120
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<repositories>
|
||||
<repository path="..\ReswCodeGen.Tests\packages.config" />
|
||||
</repositories>
|
||||
Reference in New Issue
Block a user