Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. static List<Countries> openFile(string fileName)
  2. {
  3. string line = null;
  4. List<string> liste = new List<string>();
  5. List<Countries> countries = new List<Countries>();
  6. using (StreamReader reader = new StreamReader(fileName)) //fileName = "capitals.txt")
  7. {
  8. line = reader.ReadLine();
  9. while (line != null)
  10. {
  11. liste.Add(line);
  12. line = reader.ReadLine();
  13. }
  14. }
  15. foreach (string ttt in countries)
  16. {
  17. string[] test = ttt.Split('t');
  18. countries.Add(new Countries() { nomPays = test[0], Capitale = test[1] });
  19. }
  20. return countries;
  21. }
  22.  
  23. //get local folder
  24. StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
  25. var dataFolder = await local.GetFolderAsync("dataFolder");
  26. var file = await local.OpenStreamForReadAsync("Capitals.txt");
  27.  
  28. var uri = new System.Uri("ms-appx:///Assets/Capitals.txt");
  29. var file = Windows.Storage.StorageFile.GetFileFromApplicationUriAsync
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement