如何在 Delphi Prism for .net 中创建适用于 Windows 和 Linux(Mono) 的 ini 文件?
我的 Delphi Prism 程序需要创建、读取和写入 inifile,但我想我注意到 Delphi Prism 并不真正支持任何类型的 Inifile 结构。 (如果我错了,请纠正我。)
这让我开始讨论 ShineOn 库文件,它支持 inifile。但是,当您在 Linux 上的 Mono 下运行程序时,它会使程序崩溃。我是否使用 ShineOn 的任何方法并不重要。只要在uses关键字下列出ShineOn库文件,程序就不会在Linux上运行,而是完全崩溃。您可以在 Delphi Prism for .net 中创建适用于 Windows 和 Linux(Mono) 的 ini 文件吗?如果是这样,你会怎么做?
我确实在互联网和 Stackoverflow 上搜索了答案,这导致我找到了 C# 类 INI 文件。我以为它很有前途,直到我注意到它需要加载 Kernel32.dll 文件才能工作。 (如果我错了,请再次纠正我)。显然,互联网上有关 Delphi Prism Inifile 的信息很少。
My Delphi Prism program needs to create and read and write into an inifile, but I think I noticed Delphi Prism doesn't really support any sort of Inifile structure. (Correct me if I am wrong.)
This leads me into talking about ShineOn library file, which supports inifile. However, it crashes the program when you run your program on Linux under Mono. It doesn't matter if I use any methods from ShineOn or not. As long as the ShineOn library file is listed under uses keyword, the program does not run but crash completely on Linux. Can you create inifile in Delphi Prism for .net that will work on window and Linux(Mono)? If so, how would you do it?
I did search for answer on the internet and Stackoverflow, which led to me C# Class INI file. I thought, it was promising until I noticed that it needs to load Kernel32.dll file to work. (Again correct me if I am wrong). Apparently, there is very little information on the Internet about Delphi Prism Inifile.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
实际上,您根本不应该在 .NET(或 Mono)环境中使用 .ini - 文件。 .NET 和 Mono 提供完整的 App.config XML 配置基础架构,您应该在您的应用程序中利用它。有很多优点,因为所有内容都是类型安全的,并且所有内容都包含在 System.Configuration 命名空间中。
Actually you really shouldn't use .ini - Files in .NET (or Mono) environments at all. .NET and Mono offer complete App.config XML-Configuration infrastructure and you should leverage this for your applications. There are a lot of advantages because everything is available type safe and all is covered in the System.Configuration Namespace.
请参阅 http://nini.sourceforge.net/
它记录可在 MS .NET 和 Mono 上工作
See http://nini.sourceforge.net/
It documented to work on both MS .NET and Mono