how to compare a string in a resource.dll
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2010
10:38 PM
03-07-2010
10:38 PM
how to compare a string in a resource.dll
Hi,
what I'd like to be able to do is compare a string for a control with its associated string in the resource.dll file
I'm using VB script in TestComplete our Tested Application is written in C# and we have lots of resource files for the different languages our application runs under.
I'd like to check that a particular string is correctly being translated and that the translation is in the relevant resource file
If anybody has any clue on how to do this it would be very much appreciated!!
many thanks in advance
regards
K
what I'd like to be able to do is compare a string for a control with its associated string in the resource.dll file
I'm using VB script in TestComplete our Tested Application is written in C# and we have lots of resource files for the different languages our application runs under.
I'd like to check that a particular string is correctly being translated and that the translation is in the relevant resource file
If anybody has any clue on how to do this it would be very much appreciated!!
many thanks in advance
regards
K
Kay Chamberlain
Leica Microsystems Cambridge Ltd
Leica Microsystems Cambridge Ltd
1 REPLY 1
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2010
11:02 PM
03-15-2010
11:02 PM
Hello Kay,
You can use the script below to get all resources in the specified assembly. Before you run the script, you need to specify the full path to the needed assembly in the 'assemblyPath' variable.
To compare two strings, you can use the aqString.Compare method. Please read the "aqString.Compare" article fore more information.
You can use the script below to get all resources in the specified assembly. Before you run the script, you need to specify the full path to the needed assembly in the 'assemblyPath' variable.
Sub Test
Dim i, assemblyPath, assembly, names, stream, resourceReader, enumerator
assemblyPath = "C#_ASSEMBLY_PATH"
Set assembly = dotNET.System_Reflection.Assembly.LoadFile(assemblyPath)
Set names = assembly.GetManifestResourceNames()
For i = 0 To names.Length - 1
Log.AppendFolder("Resource: " + names.GetValue(i))
Set stream = assembly.GetManifestResourceStream(names.GetValue(i))
Set resourceReader = dotNET.System_Resources.ResourceReader.zctor_2(stream)
Set enumerator = resourceReader.GetEnumerator
While enumerator.MoveNext()
Log.Message("Key: " & enumerator.Key & vbCrLf & "Value: " & enumerator.Value)
Wend
Log.PopLogFolder
Next
End Sub
To compare two strings, you can use the aqString.Compare method. Please read the "aqString.Compare" article fore more information.
--
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
