Exemple #1
0
        private bool InjectImages()
        {
            string   currentDir = Environment.CurrentDirectory;
            Bitmap   bootTvImg;
            Bitmap   bootDrcImg;
            Bitmap   iconImg;
            Bitmap   tmp;
            Graphics g;

            try
            {
                Cll.Log.WriteLine("Creating bitmaps.");

                if (BootTvPath != null)
                {
                    tmp = new Bitmap(BootTvPath);
                }
                else
                {
                    tmp = BootTvImg.Create();
                }
                bootTvImg = new Bitmap(1280, 720, PixelFormat.Format24bppRgb);
                g         = Graphics.FromImage(bootTvImg);
                g.DrawImage(tmp, new Rectangle(0, 0, 1280, 720));
                g.Dispose();
                tmp.Dispose();

                if (BootDrcPath != null)
                {
                    tmp = new Bitmap(BootDrcPath);
                }
                else
                {
                    tmp = BootDrcImg.Create();
                }
                bootDrcImg = new Bitmap(854, 480, PixelFormat.Format24bppRgb);
                g          = Graphics.FromImage(bootDrcImg);
                g.DrawImage(tmp, new Rectangle(0, 0, 854, 480));
                g.Dispose();
                tmp.Dispose();

                if (IconPath != null)
                {
                    tmp = new Bitmap(IconPath);
                }
                else
                {
                    tmp = IconImg.Create();
                }
                iconImg = new Bitmap(128, 128, PixelFormat.Format32bppArgb);
                g       = Graphics.FromImage(iconImg);
                g.DrawImage(tmp, new Rectangle(0, 0, 128, 128));
                g.Dispose();
                tmp.Dispose();

                Cll.Log.WriteLine("Bitmaps created.");
            }
            catch
            {
                Cll.Log.WriteLine("Error creating bitmaps.");
                return(false);
            }

            if (!NusContent.ConvertToTGA(bootTvImg, currentDir + "\\base\\meta\\bootTvTex.tga"))
            {
                Cll.Log.WriteLine("Error creating \"bootTvTex.tga\" file.");
                return(false);
            }
            if (!NusContent.ConvertToTGA(bootDrcImg, currentDir + "\\base\\meta\\bootDrcTex.tga"))
            {
                Cll.Log.WriteLine("Error creating \"bootDrcTex.tga\" file.");
                return(false);
            }
            if (!NusContent.ConvertToTGA(iconImg, currentDir + "\\base\\meta\\iconTex.tga"))
            {
                Cll.Log.WriteLine("Error creating \"iconTex.tga\" file.");
                return(false);
            }

            Cll.Log.WriteLine("Injected TGA files.");

            return(true);
        }