简体   繁体   English

在Windows Core IOT中创建和使用资源

[英]Creating and using resources within Windows Core IOT

I am building a Windows Core IOT background task application on a Raspberry Pi, and I need to store some text resource files (html,css,js) to serve over a tcp socket connection. 我正在Raspberry Pi上构建Windows Core IOT后台任务应用程序,我需要存储一些文本资源文件(html,css,js)以通过tcp套接字连接提供服务。

Trouble is I am struggling to find the simplest way to have a folder of these files as embedded resources which I can access from the webserver I have built. 麻烦的是,我正在努力寻找最简单的方法来将这些文件的文件夹作为嵌入式资源,可以从已构建的Web服务器访问这些资源。

Any suggestions would be good. 任何建议都会很好。

I do not seem to have access to the Properties namespace. 我似乎无权访问Properties命名空间。

include the files into your project and access them with the InstalledLocation Folder. 将文件包含到您的项目中,并使用InstalledLocation文件夹访问它们。

If, for example, you have a folder named 'html' in your project structure, access the files like this: 例如,如果您的项目结构中有一个名为“ html”的文件夹,请按以下方式访问文件:

async void ExampleFunc()
{
    // get the StorageFolder
    var WebRoot = await Package.Current.InstalledLocation.GetFolderAsync("html");
    // load the file (StorageFile)
    var file = await WebRoot.GetFileAsync("index.html");
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM