static void Main(string[] args) { Console.WriteLine("Extracts resources from .net .resources files or assemblies containing *.g.resources files, dumps them in the working directory."); if (args.Count() != 1) { Console.WriteLine("Usage: first argument should be a .resource file or an assembly."); return; } ResourceManager manager = null; //try{ try{ Assembly assembly = Assembly.LoadFile(args[0]); manager = new ResourceManager(assembly.GetName().Name + ".g", assembly); }catch(BadImageFormatException e){ // Ok, not an assembly. } if (manager == null){ manager = ResourceManager.CreateFileBasedResourceManager(Path.GetFileNameWithoutExtension(args[0]), Path.GetDirectoryName(args[0]), null); } //GetResourceSet() will return null unless I do a bogus fetch of a resource. I probably need to RTFM more. try{ Object hello = manager.GetObject("buttwars"); } catch (Exception) { } ResourceSet resourceset = manager.GetResourceSet(CultureInfo.InvariantCulture, false, false); foreach (DictionaryEntry resource in resourceset){ Console.WriteLine(resource.Key); if (resource.Value is UnmanagedMemoryStream) { UnmanagedMemoryStream stream = (UnmanagedMemoryStream)resource.Value; String path = (String)resource.Key; String directory = Path.GetDirectoryName(path); if(path == null) { Console.WriteLine("null?"); } if (directory != null && directory.Length != 0) { Directory.CreateDirectory(directory); } FileStream outputstream = File.Create(path); stream.CopyTo(outputstream); outputstream.Close(); } } Console.WriteLine(manager.ToString()); /*}catch(Exception e){ Console.Error.WriteLine(e.ToString()); }*/ }