//Switch to determine if the demostats counter part exists public static bool attachedDemoExist(demostat stat) { if (File.Exists(stat.filepath)) { return(true); } else { return(false); } }
//Gets a list of demostats to display demos public static List <demostat> getSavedDemos() { List <demostat> all = new List <demostat>(); string[] demofiles = Directory.GetFiles("demos", "*.replayts"); foreach (string filename in demofiles) { demostat instance = serialwrite.Binary.ReadFromBinaryFile <demostat>(filename); //Read file into mem instance.filepath = Path.ChangeExtension(filename, ".replay"); //Add the filepath to it all.Add(instance); //Add it to the list } return(all); }