First time here? Check out the site's "greatest hits" or read a post from the archives. Feel free to leave a comment or ask a question, and consider subscribing to the latest posts via RSS or e-mail. Thanks for visiting!
« Offline Blogging packages that are compa... | Main | Reflector Plus Plus - AddIns, IronPython... »

I needed to compare two resource-only satellite assemblies to see what strings had changed. Sometimes we need to update a string here and there and QA needs to know exactly what changed. Here's a quick "ResourceExporter." It will export stuff in a name=value format, which can, by the way, be turned back into RESX files using resgen.exe. No warrenty express or implied. I've run it successfully on the two assemblies I was comparing. Your Mileage May Vary.

    1 static void Main(string[] args)
    2 {
    3     Assembly a = Assembly.LoadFile(Path.Combine(System.Environment.CurrentDirectory,args[0]));
    4     string[] resources = a.GetManifestResourceNames();
    5     using (StreamWriter strWriter = File.CreateText(
Path.Combine(System.Environment.CurrentDirectory,args[0]+".txt")))
    6     {
    7         foreach(string resourceName in resources)
    8         {
    9             using(Stream str = a.GetManifestResourceStream(resourceName))
   10             {
   11                 using(ResourceReader reader = new ResourceReader(str))
   12                 {
   13                     foreach(DictionaryEntry entry in reader)
   14                     {
   15                         strWriter.WriteLine(String.Format("{0}={1}", entry.Key, entry.Value));
   16                     }
   17                 }
   18             }
   19         }
   20     }
   21 }

Tracked by:
"Interesting Finds" (Jason Haley) [Trackback]


Comments are closed.

Contact

Sponsors

Hosting By

On this page...

Tags

Calendar

<December 2008>
SunMonTueWedThuFriSat
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

Archives

Google Ads