Beispiel #1
0
        private static void AddResource(TmodFile modFile, string relPath, string filePath)
        {
            if (relPath.EndsWith(".png") && relPath != "icon.png")
            {
                using (var fs = File.OpenRead(filePath))
                {
                    var rawimg = ImageIO.ToRawBytes(fs);
                    if (rawimg != null)
                    {                    //some pngs can't be converted to rawimg
                        modFile.AddFile(Path.ChangeExtension(relPath, "rawimg"), rawimg);
                        return;
                    }
                }
            }

            modFile.AddFile(relPath, File.ReadAllBytes(filePath));
        }