Resolved line endings issue

This commit is contained in:
Christian Resma Helle
2013-05-28 00:12:08 +02:00
parent e512662ed6
commit 13e20845a2
3 changed files with 20 additions and 6 deletions
@@ -35,12 +35,7 @@ namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
var codeGenerator = factory.Create(className, wszDefaultNamespace, bstrInputFileContents, codeDomProvider);
var code = codeGenerator.GenerateCode();
var data = Encoding.UTF8.GetBytes(code);
rgbOutputFileContents[0] = Marshal.AllocCoTaskMem(data.Length);
Marshal.Copy(data, 0, rgbOutputFileContents[0], data.Length);
pcbOutput = (uint)data.Length;
rgbOutputFileContents[0] = code.ConvertToIntPtr(out pcbOutput);
}
catch (Exception e)
{
@@ -0,0 +1,18 @@
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);
pcbOutput = (uint)data.Length;
var ptr = Marshal.StringToCoTaskMemAuto(code);
return ptr;
}
}
}
@@ -130,6 +130,7 @@
<Compile Include="CustomTool\ReswFileCodeGenerator.cs" />
<Compile Include="CustomTool\ReswFileCSharpCodeGenerator.cs" />
<Compile Include="CustomTool\ReswFileVisualBasicCodeGenerator.cs" />
<Compile Include="CustomTool\StringExtension.cs" />
<Compile Include="Guids.cs" />
<Compile Include="Resources.Designer.cs">
<AutoGen>True</AutoGen>