private string BuildMobImageSmall(ViewableMonster mob)
        {
            var iconColumnValue = mob.Icon;
            var iconName        = iconColumnValue.Substring(0, 4);

            if (listMonsters.SmallImageList.Images.ContainsKey(iconName) == false)
            {
                // [M014]010
                var iconFilename = string.Format("{0}.dds", iconName);
                var iconFilepath = Path.Combine(MobIconDir, iconFilename);
                if (File.Exists(iconFilepath))
                {
                    var dds = new DdsFile();
                    using (var stream = File.OpenRead(iconFilepath)) {
                        dds.Deserialize(stream);
                    }

                    var png = dds.AsPng();
                    listMonsters.SmallImageList.Images.Add(iconName, png);
                    listMonsters.LargeImageList.Images.Add(iconName, png);
                }
            }

            return(iconName);
        }
Exemple #2
0
        public void CanReadDdsFile()
        {
            const string path = @"Assets\Scenes\Texture.DDS";

            using (var stream = File.Open(path, FileMode.Open))
                using (var reader = new BinaryReader(stream))
                {
                    var file = DdsFile.Deserialize(reader);
                    Assert.NotNull(file);
                }
        }