public void LoadResource <T>(String filenameToEnum, PhysFS physFSInstance, Dictionary <string, T> MapDictionary) where T : MainGameObject, new() { var FileList = physFSInstance.EnumerateFiles(filenameToEnum); foreach (var file in FileList) { var filepath = filenameToEnum + "/" + file; var locationData = DeserializeJsonFile <T>(physFSInstance, filepath); MapDictionary.Add(locationData.Name.Replace(" ", "-"), locationData); } }
static bool Enumerate(string[] args) { if (args.Length < 1) { Console.WriteLine("Usage: enumerate/ls <dir>"); return(false); } foreach (var f in physFS.EnumerateFiles(args[0])) { Console.WriteLine(" - {0}", f); } return(true); }
public void FileEnumeration() { using var pfs = new PhysFS(""); pfs.Mount("./", "/", false); var effectiveFiles = Directory.GetFiles("./").Select(Path.GetFileName).ToArray(); Array.Sort(effectiveFiles); var enumeratedFiles = pfs.EnumerateFiles("/").ToArray(); Array.Sort(enumeratedFiles); enumeratedFiles.Should().BeEquivalentTo(effectiveFiles); }
void FileEnumeration() { using (var pfs = new PhysFS("")) { pfs.Mount("./", "/", false); var effectiveFiles = Directory.GetFiles("./").Select(x => Path.GetFileName(x)).ToArray(); Array.Sort(effectiveFiles); var enumeratedFiles = pfs.EnumerateFiles("/"); Array.Sort(enumeratedFiles); Assert.Equal(effectiveFiles, enumeratedFiles); } }
public List <T> LoadSingleResource <T>(String filenameToEnum, PhysFS physFSInstance) where T : MainGameObject, new() { var dataset = new List <T>(); var FileList = physFSInstance.EnumerateFiles(filenameToEnum); foreach (var file in FileList) { var filepath = filenameToEnum + "/" + file; var locationData = DeserializeJsonFile <T>(physFSInstance, filepath); dataset.Add(locationData); } return(dataset); }
private void RefreshEnumList_Click(object sender, System.EventArgs e) { EnumList.Items.Clear(); EnumList.Items.AddRange(PhysFS.EnumerateFiles(EnumFilesPath.Text)); }