Exemplo n.º 1
0
        public static void WriteUnitFbiFile(Fbi unit)
        {
            TdfNode sourceRoot;

            using (var f = new StreamReader(unit.File, Encoding.GetEncoding(1252)))
            {
                sourceRoot = TdfNode.LoadTdf(f);
            }

            var targetUnitInfo = ToTdfNode(unit);

            var instructions = TdfCompare.ComputePropertyMapping(sourceRoot.Keys["UNITINFO"], targetUnitInfo, 1);

            TdfCompare.PerformInstructions(unit.File, instructions);
        }
Exemplo n.º 2
0
        public static void WriteWeaponTdfFile(Tdf weapon)
        {
            TdfNode sourceRoot;

            using (var f = new StreamReader(weapon.File, Encoding.GetEncoding(1252)))
            {
                sourceRoot = TdfNode.LoadTdf(f);
            }

            var targetWeaponInfo = ToTdfNode(weapon);

            var instructions = TdfCompare.ComputePropertyMapping(sourceRoot.Keys[weapon.ID], targetWeaponInfo, 1);

            if (sourceRoot.Keys[weapon.ID].Keys.ContainsKey("DAMAGE"))
            {
                instructions.AddRange(TdfCompare.ComputePropertyMapping(sourceRoot.Keys[weapon.ID].Keys["DAMAGE"], targetWeaponInfo.Keys["DAMAGE"], 2));
            }

            TdfCompare.PerformInstructions(weapon.File, instructions);
        }