Nez.EffectResource.getFileResourceBytes C# (CSharp) Méthode

getFileResourceBytes() public static méthode

fetches the raw byte data of a file from the Content folder. Used to keep the Effect subclass code simple and clean due to the Effect constructor requiring the byte[].
public static getFileResourceBytes ( string path ) : byte[]
path string Path.
Résultat byte[]
		public static byte[] getFileResourceBytes( string path )
		{
			#if FNA
			path = path.Replace( ".mgfxo", ".fxb" );
			#endif

			byte[] bytes;
			try
			{
				using( var stream = TitleContainer.OpenStream( path ) )
				{
					bytes = new byte[stream.Length];
					stream.Read( bytes, 0, bytes.Length );
				}
			}
			catch( Exception e )
			{
				var txt = string.Format( "OpenStream failed to find file at path: {0}. Did you add it to the Content folder?", path );
				throw new Exception( txt, e );
			}

			return bytes;
		}
	}