示例#1
0
        public unsafe static UnitSettings[] getUnitSettings(String filePath)
        {
            EUDSettings es = new EUDSettings();

            es.action         = (byte)6;
            es.outputFilePath = (byte *)0;
            es.inputFilePath  = toByteArray(filePath);
            try {
                run(&es); // Run extraction
                UnsafeReadBuffer rb  = new UnsafeReadBuffer(es.outputFilePath);
                UnitSettings[]   ret = new UnitSettings[2];
                for (int i = 0; i < 2; i++)
                {
                    ret[i].used          = rb.readByteArray(228);
                    ret[i].hp            = rb.readIntArray(228);
                    ret[i].shield        = rb.readShortArray(228);
                    ret[i].armor         = rb.readByteArray(228);
                    ret[i].build_time    = rb.readShortArray(228);
                    ret[i].mineral_cost  = rb.readShortArray(228);
                    ret[i].gas_cost      = rb.readShortArray(228);
                    ret[i].str_unit_name = rb.readShortArray(228);
                    ret[i].weapon_damage = rb.readShortArray(130);
                    ret[i].upgrade_bonus = rb.readShortArray(130);
                }
                es.action = (byte)3;
                run(&es); // Free the array data string
                return(ret);
            } catch (Exception) {
            }
            return(null);
        }
        private static MapString readMapString(UnsafeReadBuffer rb, String encoding)
        {
            MapString ms = new MapString();

            ms.mapIndex = rb.readInt();

            ms.str = rb.readString(encoding);
            ms.isMapDescription = rb.readByte() == 1 ? true : false;
            ms.isMapName        = rb.readByte() == 1 ? true : false;

            ms.unitIndexs              = rb.readIntArray(rb.readInt());
            ms.switchIndexes           = rb.readIntArray(rb.readInt());
            ms.locationIndexes         = rb.readIntArray(rb.readInt());
            ms.triggerActionIndexes    = rb.readIntArray(rb.readInt());
            ms.triggerCommentIndexes   = rb.readIntArray(rb.readInt());
            ms.briefingActionIndexes   = rb.readIntArray(rb.readInt());
            ms.briefingCommentsIndexes = rb.readIntArray(rb.readInt());
            ms.forceNamesIndexes       = rb.readIntArray(rb.readInt());

            return(ms);
        }