Guest User

Untitled

a guest
Feb 15th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. var clothingFiles = Directory.GetFiles(ClothesDirectory);
  2.  
  3. NAPI.Util.ConsoleOutput($"Found {clothingFiles.Length} Clothing Files");
  4.  
  5. foreach (var clothingItem in clothingFiles)
  6. {
  7. string content = File.ReadAllText($"{clothingItem}");
  8.  
  9. var result = JsonConvert.DeserializeObject<Dictionary<object, object>>(content);
  10.  
  11. foreach (var pair in result)
  12. {
  13. clothesData.Add((clothesData)pair.Key, (ClothesInfo)pair.Value);
  14. }
  15. }
  16.  
  17. return clothesData;
  18. }
  19.  
  20.  
  21. How my JSON file looks
  22. {new clothesData((int)ClothesType.Mask, 1, 0), new ClothesInfo("Pig Mask", "Pig Mask",50) },
  23. {new clothesData((int)ClothesType.Mask, 1, 1), new ClothesInfo("Brown Pig Mask", "Brown Pig Mask",50) },
  24. {new clothesData((int)ClothesType.Mask, 1, 2), new ClothesInfo("Bloody Pig Mask", "Bloody Pig Mask",50) },
  25. {new clothesData((int)ClothesType.Mask, 1, 3), new ClothesInfo("Black Pig Mask", "Black Pig Mask",50) },
  26. {new clothesData((int)ClothesType.Mask, 2, 0), new ClothesInfo("Skull Mask","Skull Mask", 50) },
  27. {new clothesData((int)ClothesType.Mask, 2, 1), new ClothesInfo(" Gray Skull Mask","Gray Skull Mask", 50) },
  28. {new clothesData((int)ClothesType.Mask, 2, 2), new ClothesInfo("Black Skull Mask","Black Skull Mask", 50) },
  29. {new clothesData((int)ClothesType.Mask, 2, 3), new ClothesInfo("Bone Skull Mask","Bone Skull Mask", 50) },
  30. {new clothesData((int)ClothesType.Mask, 3, 0), new ClothesInfo("Pogo Mask", "Pogo Mask", 50) },
  31. {new clothesData((int)ClothesType.Mask, 4, 0), new ClothesInfo("White Hockey Mask","White Hockey Mask", 50) },
  32. {new clothesData((int)ClothesType.Mask, 4, 1), new ClothesInfo("Red Hockey Mask","Red Hockey Mask", 50) },
Add Comment
Please, Sign In to add comment