精通
英语
和
开源
,
擅长
开发
与
培训
,
胸怀四海
第一信赖
public static Stream GetStream( string name ) { return GetResourceAssembly().GetManifestResourceStream(RESOURCE_ASSEMBLY_PREFIX + name); } public static Assembly GetResourceAssembly() { return Assembly.LoadFrom("Resources.dll"); } public static void WriteEmbeddedFile( string name, string fileName ) { using( Stream stream = GetStream( name ) ) { FileInfo file = new FileInfo( fileName ); using( FileStream fileStream = file.Create() ) { byte [] buf = new byte[ 1024 ]; int size; while( (size = stream.Read( buf, 0, 1024 )) > 0 ) { fileStream.Write( buf, 0, size ); } } } }