Пример #1
0
        object LoadNewUnit()
        {
            string name = String();

            if (refed_units == unit_map.Length)
            {
                Array.Resize(ref unit_map, refed_units * 2);
            }

            SerUnit su = reg.LoadUnit(name);

            unit_map[refed_units++] = su;

            byte[] hash = Bytes(su.hash.Length);

            for (int i = 0; i < hash.Length; i++)
            {
                if (hash[i] != su.hash[i])
                {
                    goto badhash;
                }
            }

            int ix = Int();

            return(su.bynum[ix]);

badhash:
            throw new ThawException(string.Format("Hash mismatch for " +
                                                  "unit {0} referenced from {1}, wanted {2}, got {3}",
                                                  su.name, unit.name, Utils.HashToStr(unit.hash),
                                                  Utils.HashToStr(su.hash)));
        }