VFP 到 .Net 编译器

发布于 2024-08-04 09:35:41 字数 576 浏览 8 评论 0原文

有没有人有过关于 VFP 到 .Net 编译器的经验或了解?

我在一家拥有广泛 VFP9 应用程序的公司工作,他们正在寻找一种快速方法来让应用程序在 .Net 中运行。我被要求检查这个编译器,看看它是否是一个可行的选项,但到目前为止我还无法让它成功编译任何东西 - 即使我的“Hello World”世界应用程序也无法运行。

只是为了限定最后一句话:我可以“编译”非常简单的 Fox 应用程序,但生成的 .Net 可执行文件无法成功执行。我已经反汇编了源代码并将其转换为 C#,但通常它包含许多错误(100 多个)。

我很想立即放弃整个技术,但是福克斯用户社区似乎对此有很多支持和兴奋。有人对此有任何见解吗?

这是 VFP 到 .Net 编译器的链接

Has anyone had experience of or got any knowledge about the VFP to .Net Compiler?

I'm working for a company with an extensive range of VFP9 applications and they are looking for a quick way to get apps running in .Net. I've been asked to check out this compiler to see if it is a viable option but so far I haven't been able to get it to successfully compile anything - even my "Hello World" world application doesn't run.

Just to qualify that last remark: I can get really simple Fox apps to "compile" but the .Net executable that is produced does not execute successfully. I've dissassembled the source and turned it into C# but generally it contains many errors (100+).

I'm tempted to dismiss the whole technology out of hand however there seems to be lots of support for this and excitement about it the Fox user community. Does anyone have any insight into this?

Here is a link to the VFP to .Net Compiler

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

半边脸i 2024-08-11 09:35:41

我现在对 VFP 到 .Net 编译器有了一些经验,您可以在此处找到这些经验。

这实际上是.Net 的编译器,与 COM Interop 或 Web Services 无关。整个事情是围绕编译器附带的 SharpDevelop 构建的。实际上,您可以启动 SharpDevelop 并输入 FoxPro PRG。智能感知功能齐全,支持大多数(如果不是全部)Fox 命令和功能。当你点击编译时,另一边出现的是完整的 .Net 程序集。

如果运行该程序集,则看不到 VFP 实例,也看不到 COM 互操作。它是如何运作的?它背后的人创建了映射到 Fox 函数的 .Net 函数,因此,例如,如果您调用 StrToFile(),这就是实际运行的代码(由 Reflector 的奇迹带给您):

public static void StrToFile(string cExpression, string cFileName)
{
    if (File.Exists(cFileName))
    {
        File.Delete(cFileName);
    }
    FileStream stream = new FileStream(cFileName, FileMode.CreateNew, FileAccess.ReadWrite);
    StreamWriter writer = new StreamWriter(stream);
    writer.Write(cExpression);
    writer.Flush();
    writer.Close();
    stream.Close();
}

这意味着如果您在 Fox 中的工作效率非常高,但您需要 .Net 解决方案,您可以在 Fox 中编码并生成 .Net 程序集。

不过,我建议谨慎一些,因为并非所有内容都像上面的 StrToFile 示例一样好地实现。它对 Fox 表单之类的东西进行建模的方式非常糟糕,尽管它确实有效(您可以采用现有的 Fox 表单并将其添加到 SharpDevelop,它会将其转换为 .Net 表单)。如果有人想要更多细节,我很乐意对此进行扩展。

I now have some experience with the VFP to .Net Compiler which you can find here.

This is actually a compiler for .Net and has nothing to do with COM Interop or Web Services. The whole thing is built around SharpDevelop which ships with the compiler. Effectively you can fire up SharpDevelop and type in a FoxPro PRG. There is full in intellisense and most if not all Fox commands and functions are supported. When you hit compile, what comes out the other side is a full .Net assembly.

If you run the assembly there is no instance of VFP and no COM interop in sight. How does it work? The guys behind it have created .Net functions which map onto the Fox functions, so for example if you call the StrToFile() this is the code that actually runs (brought to you by the wonders of Reflector):

public static void StrToFile(string cExpression, string cFileName)
{
    if (File.Exists(cFileName))
    {
        File.Delete(cFileName);
    }
    FileStream stream = new FileStream(cFileName, FileMode.CreateNew, FileAccess.ReadWrite);
    StreamWriter writer = new StreamWriter(stream);
    writer.Write(cExpression);
    writer.Flush();
    writer.Close();
    stream.Close();
}

What this means is that if you are very productive in Fox but you a need .Net solution you can code in Fox and produce a .Net assembly.

I would however advise some caution as not everything is implemented as nicely as the StrToFile example above. The way it models things like Fox forms is pretty awful, although it does work (you can take an existing Fox form and add it to SharpDevelop and it will turn it in to a .Net form). If anyone wants any more detail I'll be happy to expand on this.

三生殊途 2024-08-11 09:35:41

VFP 并不直接“编译”为.Net 产品。但是,您可以通过 COM 访问它并创建一个项目作为单线程或多线程 DLL。

define class MyVFPForDotNet as custom OLEPUBLIC
  cSomeProperty = ""
  nOtherProperty = ""

  Function Init()
     cSomeProperty = curdir()

  endfunc

  Function SendBackAMessage()
     return "Hello World"
  endfunc

  function CallWithParms( cParm1 as String, nParm2 as Integer, dSomeDate as DateTime )
     .. do whatever

     return "whatever"
  endfunc

enddefine

然后您可以将其添加为 COM Interop,并且方法和属性将在 .Net 中可用。您的函数几乎可以在 VFP、查询、自动化等中执行任何操作。您可以简单地执行 XMLAdapter 来生成 XML 字符串,以将单个或多个游标集作为一大块返回,或者通过多次调用不同的方法单独返回。

祝你好运。

顺便说一句...即将为正在考虑通过 .net 进行转换/访问的 VFP 开发人员举办两场研讨会。一个位于 http://www.oakleafsd.com/,另一个位于 http://www.eps-software.com/

VFP doesn't directly "compile" to a .Net product. However, you can get to it via COM and creating a project as a single or multi-threaded DLL.

define class MyVFPForDotNet as custom OLEPUBLIC
  cSomeProperty = ""
  nOtherProperty = ""

  Function Init()
     cSomeProperty = curdir()

  endfunc

  Function SendBackAMessage()
     return "Hello World"
  endfunc

  function CallWithParms( cParm1 as String, nParm2 as Integer, dSomeDate as DateTime )
     .. do whatever

     return "whatever"
  endfunc

enddefine

Then you can add it as a COM Interop and the methods and properties would be available in .Net. Your functions can do almost anything in VFP, query, automation, etc. And you can simply do XMLAdapter to generate XML Strings to return back single or multiple cursor sets as one big chunk, or individually via multiple calls to different methods.

Good luck.

BTW... there are two upcoming seminars being offered for VFP developers who are looking into converting / accessing via .net. One at http://www.oakleafsd.com/, another at http://www.eps-software.com/

夜声 2024-08-11 09:35:41

有关 .Net 的 VFP Developer Studio 中表单的一些附加信息: eTecnologia 宣布,在 SharpDevelop 中设计为 VFP 表单的表单可以选择编译为 SVG,它可以在除 IE 之外的所有浏览器上运行,尽管有一个用于 IE 的 Google 插件将 SVG 转换为 SWF。他们之前还致力于为 SharpDevelop 中设计的 VFP 表单输出 XAML。此外,.Net 控件、COM 控件以及我们被告知的 Java 控件都将能够在随 Developer Studio 附带的定制 #D 中设计的 VFP 表单上使用。

Some additional information on forms in the VFP Developer Studio for .Net: eTecnologia has announced that forms designed as VFP forms in SharpDevelop will optionally compile to SVG, which can run on every browser except IE, although there is a Google plug-in for IE that converts the SVG to SWF. They have also previously committed to outputting XAML for VFP forms designed in SharpDevelop. In addition, .Net controls, COM controls, and we are told Java controls, will all be able to be used on VFP forms designed in the customized #D that ships with the Developer Studio.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文