Example #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);
        }
Example #2
0
        public unsafe static Slot[] getSlots(String filePath)
        {
            EUDSettings es = new EUDSettings();

            es.action         = (byte)5;
            es.outputFilePath = (byte *)0;
            es.inputFilePath  = toByteArray(filePath);
            try {
                run(&es); // Run extraction
                UnsafeReadBuffer rb  = new UnsafeReadBuffer(es.outputFilePath);
                Slot[]           ret = new Slot[12];
                for (int i = 0; i < 12; i++)
                {
                    byte b = (byte)rb.readByte();
                    if (b >= 0 && b < 9)
                    {
                        ret[i] = (Slot)b;
                    }
                    else
                    {
                        ret[i] = Slot.Invalid;
                    }
                }

                es.action = (byte)3;
                run(&es); // Free the array data string
                return(ret);
            } catch (Exception) {
            }
            return(null);
        }
Example #3
0
        public static unsafe String[] getMapNameAndDescription(String filePath)
        {
            String      mapName        = "";
            String      mapDescription = "";
            EUDSettings es             = new EUDSettings();

            es.action         = (byte)7;
            es.outputFilePath = (byte *)0;
            es.inputFilePath  = toByteArray(filePath);
            try {
                run(&es); // Run extraction
                UnsafeReadBuffer rb = new UnsafeReadBuffer(es.outputFilePath);
                mapName        = rb.readString();
                mapDescription = rb.readString();
                es.action      = (byte)3;
                run(&es); // Free the array data string
            } catch (Exception) {
            }
            return(new String[] { mapName, mapDescription });
        }
Example #4
0
        public unsafe static int getFileDurationInMs(String filePath)
        {
            EUDSettings es = new EUDSettings();

            es.action         = (byte)4;
            es.outputFilePath = (byte *)0;
            es.inputFilePath  = toByteArray(filePath);
            try {
                run(&es); // Free the array data string
            } catch (Exception) {
            }
            int duration = (int)es.outputFilePath;

            killByteArray(es.inputFilePath);
            if (es.result != 0)
            {
                throw new InvalidSoundException();
            }
            return(duration);
        }
Example #5
0
        private static ProcessFunc _Process = null; // DLL Method


        public unsafe static SoundFiles getWavs(Settings settings)
        {
            if (settings.inpuPath == null)
            {
                throw new Exception("Invalid file");
            }
            else if (!File.Exists(settings.inpuPath))
            {
                throw new Exception("File doesn't exist");
            }

            EUDSettings es = new EUDSettings();

            es.action        = (byte)2;
            es.inputFilePath = toByteArray(settings.inpuPath);
            List <SoundFile> insides = new List <SoundFile>();
            List <SoundFile> maps    = new List <SoundFile>();
            Exception        e       = null;

            try {
                run(&es); // Get the array data string
                UnsafeReadBuffer rb = new UnsafeReadBuffer(es.outputFilePath);
                insides = fromListOfStringsFromBuffer("Native", rb, true, false);
                maps    = fromListOfStringsFromBuffer(new FileInfo(settings.inpuPath).Name, rb, false, true);

                es.action = (byte)3;
                run(&es); // Free the array data string
            } catch (Exception ex) {
                e = ex;
            }
            killByteArray(es.inputFilePath);
            if (e != null)
            {
                throw e;
            }
            return(new SoundFiles(insides, maps));
        }
Example #6
0
        public unsafe static bool process(Settings settings)
        {
            EUDSettings es = new EUDSettings();

            es.action = (byte)1;

            es.addTouchRevive            = settings.addTouchRevive;
            es.useDefaultGunShot         = settings.useDefaultGunfireSound;
            es.useDefaultBackgroundMusic = settings.useDefaultBackgroundSound;
            es.enableVisor            = settings.enableVisor;
            es.enableBarrier          = settings.enableBarrier;
            es.addLeaderboard         = settings.addLeaderboard;
            es.addTimeLock            = settings.addTimelock;
            es.recalculateHPAndDamage = settings.adjustHPAndWeapons;
            es.muteUnits = settings.muteUnits;

            es.useSanctuaryColors = settings.addSancColors;

            es.GunShotWavFilePath    = toByteArray(settings.gunforeSoundPath == null ? "" : settings.gunforeSoundPath.toStorageString());
            es.VisorUsageFilePath    = toByteArray(settings.visorSound == null ? "" : settings.visorSound.toStorageString());
            es.BackgroundWavFilePath = toByteArray(settings.backgroundSound == null ? "" : settings.backgroundSound.toStorageString());

            es.TimeLockMessage = toByteArray(settings.timeLockMessage);
            es.TimeLockFrom    = toByteArray(settings.timeLockRangeFrom);
            es.TimeLockTo      = toByteArray(settings.timeLockRangeTo);
            es.inputFilePath   = toByteArray(settings.inpuPath);
            es.outputFilePath  = toByteArray(settings.outputPath);

            es.result = 0;
            es.preferredUnitSettings = toByteArray(settings.preferredSettings);
            es.EMPDamage             = (short)settings.EMPDamage;
            es.ignoreArmors          = toByteArray(settings.ignoreArmors);

            es.mapName       = toByteArray(settings.mapName);
            es.description   = toByteArray(settings.mapDescription);
            es.objectives    = toByteArray(settings.mapObjectives);
            es.useObjectives = settings.useObjectives;

            run(&es);

            killByteArray(es.GunShotWavFilePath);
            killByteArray(es.VisorUsageFilePath);
            killByteArray(es.BackgroundWavFilePath);

            killByteArray(es.TimeLockMessage);
            killByteArray(es.TimeLockFrom);
            killByteArray(es.TimeLockTo);
            killByteArray(es.inputFilePath);
            killByteArray(es.outputFilePath);

            settings.result = es.result;

            killByteArray(es.preferredUnitSettings);
            killByteArray(es.ignoreArmors);

            killByteArray(es.mapName);
            killByteArray(es.description);
            killByteArray(es.objectives);

            return(es.result == 0);
        }