Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. private string GetCountryResourcePath(string countryName)
  2. {
  3. Assembly assembly = this.GetType().GetTypeInfo().Assembly;
  4. string[] assemblyResources = assembly.GetManifestResourceNames();
  5.  
  6. string searchTerm = string.Format(".{0}, countryName);
  7.  
  8. foreach(string resourcePath in assemblyResources)
  9. {
  10. if (resourcePath.LastIndexOf(searchTerm, StringComparison.OrdinalIgnoreCase)>0)
  11. return resourcePath;
  12. }
  13. return string.Empty;
  14. }
  15.  
  16. string countryResourcePath = GetCountryResourcePath( countryName );
  17. if (countryResourcePath == String.Empty)
  18. return;
  19.  
  20. using (Stream countryStream = assembly.GetManifestResourceStream(countryStream))
  21. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement