Silverlight 5 Trusted Mode. Accessing FileSystem and Local drives

时间秒杀一切 提交于 2019-11-28 01:52:26

问题


Is there any way, any chance at all to access entire filesystem in SL app with elevated trust? That will work both in Windows and Mac? Through AutomationFactory,PInvoke or unmanaged code? I need an app that could read local drives, folders and files.

UDP: Ok, seems it's possible to read folders and files using classes of System.IO from mscorlib. Although you still can't get information about local mounted drives. There is no DriveInfo in Silverlight's mscorlib :(


回答1:


Ok I have an idea about this.

It is straightforward enough with Windows, to get the list of the local drives you can use AutomationFactory. There is plenty amount of examples if you google it. Search for something called SilverlightFileExplorer.

Now on a Mac you can use Directory.EnumerateDirectories("/") and then it gets all the folders in the root. Including Volumes folder which contains shortcuts to the local drives. I'm not an expert of Berkeley System Distribution (BSD) Unix filesystems, so I can't really promise that it would work on any Mac, but this approach works on mine.

I'm still playing around with that. When I get working prototype I'll probably share it through github or something.



来源:https://stackoverflow.com/questions/8522590/silverlight-5-trusted-mode-accessing-filesystem-and-local-drives

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!