Exemple #1
0
        private static UnitSettings readUnitSettings(ReadBuffer rb)
        {
            UnitSettings us;

            us.used          = rb.readByteArray(228);
            us.hp            = rb.readIntArray(228);
            us.shield        = rb.readShortArray(228);
            us.armor         = rb.readByteArray(228);
            us.build_time    = rb.readShortArray(228);
            us.mineral_cost  = rb.readShortArray(228);
            us.gas_cost      = rb.readShortArray(228);
            us.str_unit_name = rb.readShortArray(228);
            us.weapon_damage = rb.readShortArray(130);
            us.upgrade_bonus = rb.readShortArray(130);
            return(us);
        }
Exemple #2
0
        private static Settings loadVersioned(byte[] bytes, String fileName)
        {
            Settings s = new Settings();

            s.settingsPath = fileName;
            try {
                ReadBuffer rb = new ReadBuffer(bytes);

                String ver = rb.readString(defaultEncoding);
                if (ver == "version")
                {
                    int verNumber = rb.readInt();
                    if (verNumber == 1)
                    {
                        s.inpuPath   = rb.readString(defaultEncoding);
                        s.outputPath = rb.readString(defaultEncoding);

                        s.langauges = rb.readStringArray(defaultEncoding);
                        s.encodings = rb.readStringArray(defaultEncoding);

                        s.strings = rb.readStringArrayArray(s.encodings);

                        s.useCondition     = rb.readInt();
                        s.lastKnownMapping = rb.readIntArray(rb.readInt());

                        s.originalEncoding = rb.readString(defaultEncoding);
                        s.originalStrings  = rb.readStringArray(s.originalEncoding);

                        s.repack = rb.readBool();
                    }
                }
                else     // Load vanilla settings and generate rest
                {
                    rb = new ReadBuffer(bytes);
                    String encoding = "EUC-KR";

                    s.inpuPath   = rb.readString(encoding);
                    s.outputPath = rb.readString(encoding);

                    s.langauges = rb.readStringArray(encoding);
                    s.encodings = new string[s.langauges.Length];
                    for (int i = 0; i < s.encodings.Length; i++)
                    {
                        s.encodings[i] = encoding;
                    }

                    s.strings = rb.readStringArrayArray(s.encodings);

                    s.useCondition     = rb.readInt();
                    s.lastKnownMapping = rb.readIntArray(rb.readInt());

                    s.originalEncoding = encoding;

                    s.originalStrings = rb.readStringArray(s.originalEncoding);
                }



                // New ver
                try {
                    s.repack = rb.readBool();
                } catch (Exception) {
                }
                return(s);
            } catch (Exception) {
                return(null);
            }
        }