【问题标题】:Creating and using resources within Windows Core IOT在 Windows Core IOT 中创建和使用资源
【发布时间】:2016-03-30 20:12:38
【问题描述】:

我正在 Raspberry Pi 上构建 Windows Core IOT 后台任务应用程序,我需要存储一些文本资源文件(html、css、js)以通过 tcp 套接字连接提供服务。

问题是我正在努力寻找将这些文件的文件夹作为嵌入式资源的最简单方法,我可以从我构建的网络服务器访问这些资源。

任何建议都会很好。

我似乎无权访问 Properties 命名空间。

【问题讨论】:

    标签: c# iot windows-10-iot-core


    【解决方案1】:

    将文件包含到您的项目中并使用 InstalledLocation 文件夹访问它们。

    例如,如果您的项目结构中有一个名为“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");
    }
    

    【讨论】:

      猜你喜欢
      • 2019-07-12
      • 2022-07-24
      • 1970-01-01
      • 2018-01-11
      • 2010-09-10
      • 1970-01-01
      • 1970-01-01
      • 2019-12-20
      相关资源
      最近更新 更多