public void Validate(H3Map map)
 {
     foreach (var mapObject in map.Objects)
     {
         CheckForUnexpectedTemplateSubId(mapObject);
     }
 }
        private byte[] BuildHash(H3Map map)
        {
            using var m      = new MemoryStream();
            using var writer = new BinaryWriter(m);
            WriteHeader(writer, map.Info);
            WriteHeroes(writer, map.Heroes);
            WriteVictorConditions(writer, map.VictoryCondition);
            WriteLossCondition(writer, map.LossCondition);
            WritePlayers(writer, map.Players);
            if (map.AllowedArtifacts != null)
            {
                WriteArtifacts(writer, map.AllowedArtifacts);
            }

            if (map.AllowedSpells != null)
            {
                WriteSpells(writer, map.AllowedSpells);
            }

            if (map.AllowedSecondarySkills != null)
            {
                WriteSkills(writer, map.AllowedSecondarySkills);
            }

            WriteRumors(writer, map.Rumors);
            WriteTerrain(writer, map.Terrain);
            WriteObjects(writer, map.Objects);
            WriteEvents(writer, map.Events);

            return(m.ToArray());
        }
        public void Process(H3Map map, string mapFilePath)
        {
            var hash = BitConverter.ToString(sha1Managed.ComputeHash(BuildHash(map)));

            hashes.Add(hash, mapFilePath);
            totalCount++;
        }
 public void Validate(H3Map map)
 {
     foreach (var validator in validators)
     {
         validator.Validate(map);
     }
 }
Exemple #5
0
 public void Validate(H3Map map)
 {
     foreach (var template in map.Objects.Select(x => x.Template).Distinct())
     {
         ValidateTemplate(template);
     }
 }
Exemple #6
0
 public static void TestH3MReader()
 {
     // H3MapLoader mapLoader = new H3MapLoader(@"D:\Toney\Personal\Git\toneyisnow\HeroesIII\MapLoader\maps\Coop_Campaing_Shadow_of_Death\Sandro B\Sandro B");
     // string file = @"D:\Toney\Personal\Git\toneyisnow\HeroesIII\MapLoader\maps\HoMM3 Map Pack by HoMMdb\Shadow of Death & HoMM3 Complete\Astral Venice\Astral Venice.h3m";
     string      file      = @"D:\GitRoot\toneyisnow\HeroesIII\MapLoader\maps\HoMM3 Map Pack by HoMMdb\Shadow of Death & HoMM3 Complete\Podarok 2001 eng\Podarok 2001 eng.h3m";
     H3MapLoader mapLoader = new H3MapLoader(file);
     H3Map       map       = mapLoader.LoadMap();
 }