Resolved line endings issue
This commit is contained in:
@@ -35,12 +35,7 @@ namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
|
|||||||
var codeGenerator = factory.Create(className, wszDefaultNamespace, bstrInputFileContents, codeDomProvider);
|
var codeGenerator = factory.Create(className, wszDefaultNamespace, bstrInputFileContents, codeDomProvider);
|
||||||
var code = codeGenerator.GenerateCode();
|
var code = codeGenerator.GenerateCode();
|
||||||
|
|
||||||
var data = Encoding.UTF8.GetBytes(code);
|
rgbOutputFileContents[0] = code.ConvertToIntPtr(out pcbOutput);
|
||||||
|
|
||||||
rgbOutputFileContents[0] = Marshal.AllocCoTaskMem(data.Length);
|
|
||||||
Marshal.Copy(data, 0, rgbOutputFileContents[0], data.Length);
|
|
||||||
|
|
||||||
pcbOutput = (uint)data.Length;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
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\ReswFileCodeGenerator.cs" />
|
||||||
<Compile Include="CustomTool\ReswFileCSharpCodeGenerator.cs" />
|
<Compile Include="CustomTool\ReswFileCSharpCodeGenerator.cs" />
|
||||||
<Compile Include="CustomTool\ReswFileVisualBasicCodeGenerator.cs" />
|
<Compile Include="CustomTool\ReswFileVisualBasicCodeGenerator.cs" />
|
||||||
|
<Compile Include="CustomTool\StringExtension.cs" />
|
||||||
<Compile Include="Guids.cs" />
|
<Compile Include="Guids.cs" />
|
||||||
<Compile Include="Resources.Designer.cs">
|
<Compile Include="Resources.Designer.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
|
|||||||
Reference in New Issue
Block a user