-
-
Save pixeldesu/3d6d5dc9a62376d651d2b3bc25cd9134 to your computer and use it in GitHub Desktop.
IFFFileManager prototype
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.IO; | |
using PangLib.IFF; | |
using PangLib.IFF.DataModels; | |
namespace PangLib.IFF | |
{ | |
class IFFFileManager | |
{ | |
private string BasePath; | |
public Dictionary<string, IFFFile> Files = new Dictionary<string, IFFFile>(); | |
public IFFFileManager (string basePath) | |
{ | |
BasePath = basePath; | |
Build(); | |
} | |
private void Build() | |
{ | |
// get all file paths from BasePath | |
string[] files = System.IO.Directory.GetFiles(BasePath, "*.iff"); | |
files.forEach(file => { | |
// get all filenames from the files | |
string Model = Path.GetFileNameWithoutExtension(file); | |
// add specific IFFFile to IFFFileManager dictionary Files | |
switch (Model) | |
{ | |
case "Character": | |
Files.Add(Model, IFFFile<Character>.Load(file); | |
break; | |
case "Caddie": | |
Files.Add(Model, IFFFile<Caddie>.Load(file); | |
break; | |
// ... | |
} | |
// resulting structure: | |
// IFFFileManager.Files { | |
// "Character" => IFFFile<Character> | |
// "Caddie" => IFFFile<Caddie> | |
// ... | |
// } | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment