コード例 #1
0
 public UnrealPackage LoadPackage(string name)
 {
     foreach (KeyValuePair <string, List <string> > kvp in Files)
     {
         foreach (string f in kvp.Value)
         {
             if (Path.GetFileName(f).StartsWith(name))
             {
                 var package = _CachedPackages.Find(pkg => pkg.PackageName == Path.GetFileNameWithoutExtension(f));
                 if (package != null)
                 {
                     return(package);
                 }
                 if (IsLineage(f))
                 {
                     package = UnrealLoader.LoadPackage(f, new LineageDecoder(), FileAccess.Read);
                 }
                 else
                 {
                     package = UnrealLoader.LoadPackage(f, FileAccess.Read);
                 }
                 PreInit(package);
                 _CachedPackages.Add(package);
                 return(package);
             }
         }
     }
     return(null);
 }
コード例 #2
0
        public void LoadPackageTest()
        {
            string testPackagePath = Path.Join(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "upk", "TestUC2", "TestUC2.u");
            var    package         = UnrealLoader.LoadPackage(testPackagePath);

            Assert.IsNotNull(package);

            // FIXME: UELib is dependent on WinForms
            //package.InitializePackage();

            //var testClass = package.FindObject("Test", typeof(UClass));
            //Assert.IsNotNull(testClass);

            //string testClassContent = testClass.Decompile();
            //Assert.AreNotSame("", testClassContent);
        }