【问题标题】:Xamarin : Loading resources via GetManifestResourceStreamXamarin:通过 GetManifestResourceStream 加载资源
【发布时间】:2015-09-04 04:44:02
【问题描述】:

我正在开发一个使用 OpenGL/OpenTK 的 Xamarin 表单项目。我正在尝试使用 GetManifestResourceStream 加载着色器。无论我做什么,我都会得到 null

代码正在从 .Shared 项目运行,着色器位于 .ios / .Android 资源目录中

string prefix;

#if __IOS__ 
prefix = "OpenGLTesting.iOS.";
#endif
#if __ANDROID__
prefix = "OpenGLTesting.Droid.";
#endif

var assembly = typeof(App).GetTypeInfo ().Assembly;
Stream stream = assembly.GetManifestResourceStream (prefix + shaderName + ".glsl");

【问题讨论】:

    标签: opengl-es xamarin xamarin.ios xamarin.forms


    【解决方案1】:

    添加一些调试代码,例如调用assembly.GetManifestResourceNames ();,因此请确保您拥有正确的名称并且它已嵌入到您的程序集中。

    【讨论】:

      猜你喜欢
      • 2011-03-05
      • 2013-05-19
      • 2014-09-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-29
      • 2012-11-19
      相关资源
      最近更新 更多