Exemplo n.º 1
0
        void Initialize()
        {
            string[] mods = Array.FindAll(Directory.GetFiles(ModLoader.ModDir), path => path.ToLower().EndsWith(".zip"));

            Console.WriteLine("Found {0} Mod{1}.", mods.Length, (mods.Length == 1 ? "" : "s"));

            foreach (string modPath in mods)
            {
                try{
                    ModData loadedMod = FileLoader.LoadModData(modPath);
                    if (loadedMod == null)
                    {
                        Console.WriteLine("Mod Couldnt Load for unknown Reasons");
                    }
                }catch (Exception e) {
                    Console.WriteLine("Failed to Load Mod {0}, {1}", e.Message, e.StackTrace);
                }
            }

            Console.WriteLine("Managed to load {0} Mod{1}.", ModLoader.Mods.Count, (ModLoader.Mods.Count == 1 ? "" : "s"));
        }
Exemplo n.º 2
0
        public File LoadFile(string path)
        {
            string finalPath = rootDir + path;

            //Search Through Loaded files and Check if File has been Already Loaded
            int index = LoadedFiles.FindIndex(v => v.Path == finalPath);

            if (index != -1)
            {
                return(LoadedFiles[index]);
            }

            //Load file, Cache Loaded Instance, Return Result
            File f = FileLoader.UnzipFile(File, finalPath);

            if (f == null)
            {
                return(null);
            }
            LoadedFiles.Add(f);
            return(f);
        }