Loading our flat files
For the final feature in our flat file system, we add the loading functionality.
Time to load our file
Now that we have created a way to save information to a flat file, we need to create a way to load that information. To do this, we will use a similar process as the one that we used to save the information. Let's add our final function to the script:
void ReadFile(string file = "") { if(file != "") sFileName = file; using(StreamReader sr = new StreamReader(sDirectory + sFileName)) { int kills = Convert.ToInt32(sr.ReadLine()); int deaths = Convert.ToInt32(sr.ReadLine()); int totgold = Convert.ToInt32(sr.ReadLine()); int curgold = Convert.ToInt32(sr.ReadLine()); int level = Convert.ToInt32(sr.ReadLine()); int rwon = Convert.ToInt32(sr.ReadLine()); int rlost = Convert.ToInt32(sr.ReadLine()); float pkdr = Convert.ToSingle(sr.ReadLine()); float pwlr = Convert.ToSingle(sr.ReadLine()); float ptime = Convert.ToSingle(sr.ReadLine...