// Path: src/main/java/com/technofovea/hllib/enums/DirectoryItemType.java
// public enum DirectoryItemType implements JnaEnum<DirectoryItemType> {
// 
//     
//     NONE,
//     FOLDER,
//     FILE;
// 
// 
//     private static int start = 0;
// 
//     public int getIntValue() {
//         return this.ordinal()+start;
//     }
// 
// 
//     public DirectoryItemType getForValue(int i) {
//         for(DirectoryItemType o : this.values()){
//             if(o.getIntValue() == i){
//                 return o;
//             }
//         }
//         return null;
//     }
// 
// 
// 
// 
// }
// 
// Path: src/main/java/com/technofovea/hllib/enums/PackageType.java
// public enum PackageType implements JnaEnum<PackageType> {
// 
//     NONE,
//     BSP,
//     GCF,
//     PAK,
//     VBSP,
//     WAD,
//     XZP,
//     ZIP,
//     NCF,
//     VPK;
//     
//     private static int start = 0;
// 
//     public int getIntValue() {
//         return this.ordinal() + start;
//     }
// 
//     public PackageType getForValue(
//             int i) {
//         for (PackageType o : this.values()) {
//             if (o.getIntValue() == i) {
//                 return o;
//             }
// 
//         }
//         return null;
//     }
// }
// 
// Path: src/main/java/com/technofovea/hllib/masks/FileMode.java
// public class FileMode extends MappedMask{
//     
// 	public static final int INDEX_MODE_READ= 0;
// 	public static final int INDEX_MODE_WRITE= 1;
// 	public static final int INDEX_MODE_CREATE= 2;
// 	public static final int INDEX_MODE_VOLATILE= 3;
// 	public static final int INDEX_MODE_NO_FILEMAPPING= 4;
// 	public static final int INDEX_MODE_QUICK_FILEMAPPING= 5;
// 
// }
// 
// Path: src/main/java/com/technofovea/hllib/methods/FullLibrary.java
// public interface FullLibrary extends BasicLibrary {
// 
//     /**
//      * Called to initialize the DLL library.
//      */
//     public void initialize();
// 
//     /**
//      * Called to shut down the DLL library.
//      */
//     public void shutdown();
// 
//     public boolean itemGetSize(DirectoryItem item, IntByReference size);
// 
//     public boolean itemGetSizeEx(DirectoryItem item, LongByReference size);
// 
//     public boolean itemGetSizeOnDisk(DirectoryItem item, IntByReference size);
// 
//     public boolean itemGetSizeOnDiskEx(DirectoryItem item, LongByReference size);
// 
//     public void itemGetPath(DirectoryItem item, byte[] buffer, int bufsize);
// 
//     public boolean createPackage(PackageType ePackageType, IntByReference packageId);
// 
//     public void packageClose();
// 
//     public void deletePackage(HlPackage pkg);
// 
//     public boolean packageGetExtractable(DirectoryItem file, ByteByReference extractable);
// 
//     public boolean packageGetFileSize(DirectoryItem file, IntByReference size);
// 
//     public boolean packageGetFileSizeOnDisk(DirectoryItem file, IntByReference size);
// 
//     public boolean packageCreateStream(DirectoryItem file, PointerByReference stream);
// 
//     public boolean fileCreateStream(DirectoryItem item, PointerByReference stream);
// }
// 
// Path: src/main/java/com/technofovea/hllib/methods/ManagedLibrary.java
// public interface ManagedLibrary extends BasicLibrary, ManagedCalls{       
// 
// }


import com.sun.jna.Memory;
import com.technofovea.hllib.enums.DirectoryItemType;
import com.technofovea.hllib.enums.PackageType;
import com.technofovea.hllib.masks.FileMode;
import com.technofovea.hllib.methods.FullLibrary;
import com.technofovea.hllib.methods.ManagedLibrary;
import java.io.File;
import java.io.FileInputStream;
import java.net.URL;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import junit.framework.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

package com.technofovea.hllib;


/**
 *
 * @author Darien Hager
 */
public class FileListingTest {

    private static final String TEST_BSP = "utest.bsp";

        static ManagedLibrary fixture;


    @BeforeClass
    public static void BeforeClass() throws Exception {
        DllPathFinder.setJnaPathPath();
        fixture = HlLib.getLibrary();
        
        
    }

    private void buildList(ManagedLibrary lib, DirectoryItem folder, Set<String> store){
        List<DirectoryItem> children = folder.getChildren();
        for(DirectoryItem child:children){
            if(lib.itemGetType(child) == DirectoryItemType.FOLDER){
                buildList(lib, child, store);
            }else{
                store.add(lib.itemGetPath(child));
            }
        }
    }

    private HlPackage openFile(ManagedLibrary lib, File target) throws Exception{
        FileMode fm = new FileMode();
        fm.set(FileMode.INDEX_MODE_READ);

        PackageType pt = lib.getPackageTypeFromName(target.getAbsolutePath());
// Path: src/main/java/com/technofovea/hllib/enums/DirectoryItemType.java
// public enum DirectoryItemType implements JnaEnum<DirectoryItemType> {
// 
//     
//     NONE,
//     FOLDER,
//     FILE;
// 
// 
//     private static int start = 0;
// 
//     public int getIntValue() {
//         return this.ordinal()+start;
//     }
// 
// 
//     public DirectoryItemType getForValue(int i) {
//         for(DirectoryItemType o : this.values()){
//             if(o.getIntValue() == i){
//                 return o;
//             }
//         }
//         return null;
//     }
// 
// 
// 
// 
// }
// 
// Path: src/main/java/com/technofovea/hllib/enums/PackageType.java
// public enum PackageType implements JnaEnum<PackageType> {
// 
//     NONE,
//     BSP,
//     GCF,
//     PAK,
//     VBSP,
//     WAD,
//     XZP,
//     ZIP,
//     NCF,
//     VPK;
//     
//     private static int start = 0;
// 
//     public int getIntValue() {
//         return this.ordinal() + start;
//     }
// 
//     public PackageType getForValue(
//             int i) {
//         for (PackageType o : this.values()) {
//             if (o.getIntValue() == i) {
//                 return o;
//             }
// 
//         }
//         return null;
//     }
// }
// 
// Path: src/main/java/com/technofovea/hllib/masks/FileMode.java
// public class FileMode extends MappedMask{
//     
// 	public static final int INDEX_MODE_READ= 0;
// 	public static final int INDEX_MODE_WRITE= 1;
// 	public static final int INDEX_MODE_CREATE= 2;
// 	public static final int INDEX_MODE_VOLATILE= 3;
// 	public static final int INDEX_MODE_NO_FILEMAPPING= 4;
// 	public static final int INDEX_MODE_QUICK_FILEMAPPING= 5;
// 
// }
// 
// Path: src/main/java/com/technofovea/hllib/methods/FullLibrary.java
// public interface FullLibrary extends BasicLibrary {
// 
//     /**
//      * Called to initialize the DLL library.
//      */
//     public void initialize();
// 
//     /**
//      * Called to shut down the DLL library.
//      */
//     public void shutdown();
// 
//     public boolean itemGetSize(DirectoryItem item, IntByReference size);
// 
//     public boolean itemGetSizeEx(DirectoryItem item, LongByReference size);
// 
//     public boolean itemGetSizeOnDisk(DirectoryItem item, IntByReference size);
// 
//     public boolean itemGetSizeOnDiskEx(DirectoryItem item, LongByReference size);
// 
//     public void itemGetPath(DirectoryItem item, byte[] buffer, int bufsize);
// 
//     public boolean createPackage(PackageType ePackageType, IntByReference packageId);
// 
//     public void packageClose();
// 
//     public void deletePackage(HlPackage pkg);
// 
//     public boolean packageGetExtractable(DirectoryItem file, ByteByReference extractable);
// 
//     public boolean packageGetFileSize(DirectoryItem file, IntByReference size);
// 
//     public boolean packageGetFileSizeOnDisk(DirectoryItem file, IntByReference size);
// 
//     public boolean packageCreateStream(DirectoryItem file, PointerByReference stream);
// 
//     public boolean fileCreateStream(DirectoryItem item, PointerByReference stream);
// }
// 
// Path: src/main/java/com/technofovea/hllib/methods/ManagedLibrary.java
// public interface ManagedLibrary extends BasicLibrary, ManagedCalls{       
// 
// }


// Path: src/test/java/com/technofovea/hllib/FileListingTest.java
import com.sun.jna.Memory;
import com.technofovea.hllib.enums.DirectoryItemType;
import com.technofovea.hllib.enums.PackageType;
import com.technofovea.hllib.masks.FileMode;
import com.technofovea.hllib.methods.FullLibrary;
import com.technofovea.hllib.methods.ManagedLibrary;
import java.io.File;
import java.io.FileInputStream;
import java.net.URL;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import junit.framework.Assert;
import org.junit.BeforeClass;
import org.junit.Test;


package com.technofovea.hllib;


/**
 *
 * @author Darien Hager
 */
public class FileListingTest {

    private static final String TEST_BSP = "utest.bsp";

        static ManagedLibrary fixture;


    @BeforeClass
    public static void BeforeClass() throws Exception {
        DllPathFinder.setJnaPathPath();
        fixture = HlLib.getLibrary();
        
        
    }

    private void buildList(ManagedLibrary lib, DirectoryItem folder, Set<String> store){
        List<DirectoryItem> children = folder.getChildren();
        for(DirectoryItem child:children){
            if(lib.itemGetType(child) == DirectoryItemType.FOLDER){
                buildList(lib, child, store);
            }else{
                store.add(lib.itemGetPath(child));
            }
        }
    }

    private HlPackage openFile(ManagedLibrary lib, File target) throws Exception{
        FileMode fm = new FileMode();
        fm.set(FileMode.INDEX_MODE_READ);

        PackageType pt = lib.getPackageTypeFromName(target.getAbsolutePath());
        if (pt == PackageType.NONE) {