如何在 IronPython/Silverlight 中导入挂钩?
我正在扩展 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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