Monodevelop:将嵌入式资源行末CRLF转换为LF? [英] Monodevelop: embedded resource line-ending CRLF converted to LF?

查看:57
本文介绍了Monodevelop:将嵌入式资源行末CRLF转换为LF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个不完全是文本的资源.这是一个包含一些文本和一些ansi控制代码的文件.在我的程序中,我将其作为二进制文件进行处理.但是,我发现以System.Resources.ResourceManager.GetObject()作为byte []加载时,所有CRLF都转换为LF.这不是我想要的.我想知道是在编译时还是在运行时.

I have a resource which isn't exactly textual. It's a file with some texts in it and some ansi control code. In my program I'm processing it as a binary file. However, I found that when I load it with System.Resources.ResourceManager.GetObject() as a byte[], all CRLFs are converted to LFs. This is not exactly what I want. I wonder if it's happening at compile time or runtime.

同一项目在Windows和OS X上的Xamarin上均可正常运行.未进行任何转换.这仅在Linux上发生.而且我确定磁盘上的文件确实包含CRLF.我对照ResourceManager加载的byte []的大小检查了文件大小.

The same project works fine on Xamarin on Windows and OS X. No conversion is happening. It's only happening on Linux. And I'm sure the file on the disk does contain CRLFs. I checked the file size against the size of the byte[] loaded by ResourceManager.

有什么主意如何防止这种情况的发生?谢谢.

Any ideas how to prevent this from happening? Thanks.

推荐答案

此行为取决于设置选项->文本编辑器->常规->行结束对流:

This behavior depends on setting Options->Text Editor->General->Line ending convetion:

您可能已将此设置设置为始终转换行尾",并且可能想要保持行尾原样"或始终要求转换".

You probably have this settings set to "Always convert line endings" and you probably want either "Leave line endings as is" or "Always ask for conversion".

这也可以连接到您的GIT设置,该设置在结帐时将所有行尾转换为LF.有关更多信息,请参见"git config core.eol"和"git config core.autocrlf".

This could also be connected to your GIT settings which converts all line endings to LFs during checkout. See "git config core.eol" and "git config core.autocrlf" for more informations.

这篇关于Monodevelop:将嵌入式资源行末CRLF转换为LF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆