Exemplo n.º 1
0
 /// <summary>
 /// Reads specified package.
 /// </summary>
 /// <param name="FilePath">Absolute path to a package.</param>
 /// <param name="szr">Serializer class for a desired version of package.</param>
 public L2Package(string FilePath, IUnrealSerializer szr = null)
 {
     Path   = FilePath;
     Reader = new PackageReader();
     Reader.Read(Path);
     Header      = new Header(Reader.Bytes);
     NameTable   = new NameTable(Header, Reader.Bytes);
     ImportTable = new ImportTable(Header, Reader.Bytes);
     ExportTable = new ExportTable(Header, Reader.Bytes);
     Serializer  = szr;
 }
 public void ImportTableTest()
 {
     try
     {
         //alloc
         //act (Alloc is Act for ctor)
         ImportTable et = new ImportTable(header, pf.Bytes);
     }
     catch (Exception)
     {
         //assert
         Assert.Fail();
     }
 }
        public void GetImportTableEnumeratorTest()
        {
            //Alloc
            ImportTable et = new ImportTable(header, pf.Bytes);

            try
            {
                //Act
                ImportTableEnumerator <Import> ete = (ImportTableEnumerator <Import>)et.GetEnumerator();
                Assert.IsNotNull(ete);
            }
            catch (Exception)
            {
                //Assert
                Assert.Fail();
            }
        }
        public void ImportTableCopyToTest()
        {
            //Alloc
            ImportTable IT = new ImportTable(header, pf.Bytes);

            Import[] IA = new Import[IT.Count];
            try
            {
                //Act
                IT.CopyTo(IA, 0);
                //Assert
            }
            catch (Exception ex)
            {
                //Assert
                Assert.Fail(ex.ToString());
            }
        }
        public void ImportTableIndexOperatorTest()
        {
            //Alloc
            Import      imp;
            ImportTable nt = new ImportTable(header, pf.Bytes);

            //Act
            try
            {
                for (int i = 0; i < nt.Count; i++)
                {
                    imp = nt[i];
                }
            }
            //Assert
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
        public void MoveImportTableEnumeratorTest()
        {
            //Alloc
            Import      exp;
            ImportTable et = new ImportTable(header, pf.Bytes);

            try
            {
                //Act

                ImportTableEnumerator <Import> ete = (ImportTableEnumerator <Import>)et.GetEnumerator();
                while (ete.MoveNext())
                {
                    exp = ((IEnumerator <Import>)ete).Current;
                }
            }
            catch (Exception)
            {
                //Assert
                Assert.Fail();
            }
        }
        public void ResetImportTableEnumeratorTest()
        {
            //Alloc

            ImportTable et = new ImportTable(header, pf.Bytes);

            try
            {
                //Act

                ImportTableEnumerator <Import> ete = (ImportTableEnumerator <Import>)et.GetEnumerator();
                ete.MoveNext();;
                Import First = (Import)ete.Current;
                ete.MoveNext();
                Import Second = (Import)ete.Current;
                Assert.IsTrue(First.ObjectName.Value != Second.ObjectName.Value);
            }
            catch (Exception)
            {
                //Assert
                Assert.Fail();
            }
        }