如何在 IronPython/Silverlight 中导入挂钩?

发布于 2024-09-05 05:12:06 字数 313 浏览 2 评论 0原文

我正在扩展 TryPython 来(以及其他各种内容)允许用户保存文件,然后导入该文件。 TryPython 会重载内置的文件操作,因此我需要知道需要挂钩导入的哪些部分才能使导入使用重载的文件操作。

事实上,对 IronPython 在 Silverlight 中使用时的导入进行基本概述将非常有帮助。我不需要一个完整的工作解决方案(尽管我不会阻止你写一个!:)。我是一个Python新手,我真的不知道从哪里开始。

谢谢!

I'm extending TryPython to (along with various other things) allow users to save a file and subsequently import that file. TryPython overloads the built in file operations, so I need to know what parts of import need to hooked into in order for import to use the overloaded file operations.

Really, a basic overview of IronPython's import when used in Silverlight would be extremely helpful. I don't need a complete working solution (although I won't stop you from writing one! :). I'm a Python newbie, and I really have no idea where to even begin.

Thanks!

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

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

发布评论

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

评论(1

一场春暖 2024-09-12 05:12:06

IronPython 的导入基本上像往常一样工作,但文件系统在 Silverlight 中被抽象出来。这是由 DLR 托管 API 的 PlatformAdaptionLayer 完成的。最终结果是所有对要导入的文件的请求都会转到 XAP 文件,而不是转到文件系统。

我建议使用可以替换导入功能的多种方法之一。您可以重新定义 import 或更好地使用 导入器挂钩

IronPython's import basically works as usual but the file system is abstracted away in Silverlight. This is done by the DLR hosting API's PlatformAdaptionLayer. The end result is that all requests for files to be imported go to the XAP file rather than going to the file system.

I would suggest using one of the various ways you can replace importing functionality. You could either redefine import or better yet use the importer hooks

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