Exemplo n.º 1
0
        private static void Main(string[] args)
        {
            UnityContext context = new LocalUnityContext("data");
            var          file    = context.LoadFile("level0");

            Console.WriteLine("Loading dependencies");
            foreach (var dependency in file.Dependencies.Items)
            {
                Console.WriteLine($"Dependency: {dependency.AssetPath}");
                var loadedDependency = dependency.Load(context);
            }
            Console.WriteLine();


            Console.WriteLine("PreloadTable:");
            foreach (var obj in file.PreloadList.Items)
            {
                Console.WriteLine($"File:{obj.FileID} Path:{obj.PathID}");
                var fileDep   = file.Dependencies.Items[obj.FileID];
                var loadedDep = fileDep.Load(context);
            }
            Console.WriteLine();


            Console.ReadLine();
        }
Exemplo n.º 2
0
        private static void Main(string[] args)
        {
            DerPopoClassDatabase db = new DerPopoClassDatabase();

            using (FileStream fs = File.OpenRead("TestData\\DerPopo\\unity-5.5.0f3.dat"))
            {
                db.Read(fs);
                db.Write();
            }

            UnityContext context = new LocalUnityContext("TestData\\Assets");

            using (FileStream fs = File.OpenRead("TestData\\typedefs.xml"))
            {
                XmlSerializer ser        = new XmlSerializer(typeof(TypeDatabase));
                var           myDatabase = (TypeDatabase)ser.Deserialize(fs);
                foreach (var type in myDatabase.Tables[0].Types)
                {
                    context.TypeTable.AddTypeNode(type);
                }
            }
            var file = context.LoadFile("level0");

            FindScriptsInFile(file);
            Console.WriteLine("Loading dependencies");
            foreach (var dependency in file.Dependencies)
            {
                Console.WriteLine($"Dependency: {dependency.AssetPath}");
                var loadedDependency = dependency.Load(context);
                FindScriptsInFile(loadedDependency);
            }
            Console.WriteLine();

            FindScriptsInFile(file);

            Console.ReadLine();
        }