hello stackoverflow u been trying to read a text file formatted all in one like separated with // example of line
ammoName\Arx\maxAmmo\14\startAmmo\14\clipName\galil_upgraded_zm\clipSize\35\shotCount\1\dropAmmoMin\1\dropAmmoMax\30\dropClipAmmoMin\0\
and i want to load it into a dictionary as key/value so like
key maxAmmo value 14
but only issue i have here is these weapon files have some key values that are the same so i cant use dictionary i will post what i have tryied so far
Dictionary<string, string> WeaponStuff = new Dictionary<string, string>();
using (StreamReader sr = new StreamReader(filename))
{
string _line;
while ((_line = sr.ReadLine()) != null)
{
string[] keyvalue = _line.Split('\\');
for (int i = 0; i < keyvalue.Length; i++)
{
WeaponStuff.Add(keyvalue[i], keyvalue[i + 1]);
}
}
}
foreach (var key in WeaponStuff.Keys)
{
Console.WriteLine(key);//here are all the keys
}
textEdit1.Text = WeaponStuff["maxAmmo"];
basically all i want to do is read the file into a list<> or dictionary search up a key and display value in text box
then have a save button and when i hit save it will add all the new values and that form text boxes to the file but not sure how to get it to work as i cant seem to fix this issue