private static Hashtable _asmfiles;
public static byte[] LoadAssemblyFiles(string filename)
{
if (filename == null)
{
throw new ArgumentNullException("filename");
}
if (!filename.StartsWith("/"))
{
throw new ArgumentException("must starts with '/'", "filename");
}
filename = "/" + filename.Remove(0, 1).Replace('/', '.');
if (Resx._asmfiles == null)
{
Hashtable afs = new Hashtable();
foreach (string resname in typeof(Resx).Assembly.GetManifestResourceNames())
{
if (resname.StartsWith("UploadFileHelper.Uploader.File."))
{
byte[] buf;
string fn = "/" + resname.Remove(0, "UploadFileHelper.Uploader.File.".Length);
fn = fn.ToLower();
using (Stream s = typeof(Resx).Assembly.GetManifestResourceStream(resname))
{
buf = new byte[s.Length];
s.Read(buf, 0, buf.Length);
}
afs.Add(fn, buf);
}
}
Resx._asmfiles = afs;
}
return (byte[]) Resx._asmfiles[filename.ToLower()];
}