tags:

views:

126

answers:

4

Is there a way to list all strings (that are not embeddet in a ressource) in a .net project? I'm particulary interested in messagebox strings etc. so I can check if everything has been translated and written correctly. All tools I have tried so far can only list ressoure strings.

Any help very appreciated.

Ah forgot to say: I'm a Windows guy running Windows and only Windows, so please tell me something that runs on windows. I don't mind a simple way without using command line tool hacking etc., but will certainly do it if really neccessary.

Update: It's possible to use regex expressions directly in VS search which is very handy.

("[^"]*")

Matches all strings. However I want to list strings with at least one space character only.

Update2 "([^"])+:b+([^"])+" Does what I need. Hope it helps someone else.

Thanks!

+6  A: 

This should help to some extent:

Use ildasm to dump the IL to a file. Then run this in PowerShell:

cat filename.il | where { $_.Contains("ldstr") }
Mehrdad Afshari
Requirement is Windows only...
Yuval A
Thats grep is a Linux thing, right? Forgot to say it has to run on windows...
@Yuval A: 1: Requirement wasn't there when I answered. 2: grep runs on Windows. 3: This is just an idea. Not a complete solution.
Mehrdad Afshari
So maybe there is a slightly more convenient way? ;)
Elegant solution.
Patrik
+1 - PowerShell is for Windows.
Daniel A. White
A: 

Mehrdad's idea of getting ILDASM to dump IL output to a file and searching for ldstr is exceptionally brilliant. I confess, it never occurred to me to use such a method.

If you need GREP solutions for Windows, my best experience has been using RegexBuddy or it's big brother - PowerGREP.

Cerebrus
A: 

I found out that I can use regex directly in Visual Studio search function which is very handy. Now I need a valid regex expression.

("[^"]*")

This matches all strings like "ThisIsAString". What I want is to match only strings with at least one space character so "This Is" should match while "ThisIs" should not match.

Please help me out with the expression as I'm totaly new to this stuff.

+1  A: 

"([^"])+:b+([^"])+" This matches all strings with at least one space character. For me this is sufficient. Feel free to modify it if you need to. Hope that helps someone.