Esempio n. 1
0
        public System.Windows.Forms.Control Show_Info(sFile file)
        {
            BinaryReader br  = new BinaryReader(File.OpenRead(file.path));
            string       ext = new String(br.ReadChars(4));

            br.Close();

            if (ext == "BTX0")
            {
                btx = BTX0.Read(file.path, file.id, pluginHost);
                return(new TextureControl(pluginHost, btx));
            }
            else if (ext == "BMD0")
            {
                sBMD0 bmd = BMD0.Read(file.path, file.id, pluginHost);

                if (bmd.header.numSect == 2)
                {
                    return(new ModelControl(pluginHost, bmd));
                }
                else if (btx.texture.texInfo.num_objs != 0)
                {
                    return(new ModelControl(pluginHost, bmd, btx));
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("There aren't textures.");
                }
            }

            return(new System.Windows.Forms.Control());
        }
Esempio n. 2
0
        public void Read(sFile file)
        {
            BinaryReader br  = new BinaryReader(File.OpenRead(file.path));
            string       ext = new String(br.ReadChars(4));

            br.Close();

            if (ext == "BTX0")
            {
                sBTX0 btx = BTX0.Read(file.path, file.id, pluginHost);

                Bitmap[] tex = new Bitmap[btx.texture.texInfo.num_objs];
                for (int i = 0; i < btx.texture.texInfo.num_objs; i++)
                {
                    string fileOut = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar +
                                     file.name + '_' + btx.texture.texInfo.names[i] + ".png";
                    if (File.Exists(fileOut))
                    {
                        fileOut = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + Path.GetRandomFileName() +
                                  '_' + btx.texture.texInfo.names[i] + ".png";
                    }

                    tex[i] = BTX0.GetTexture(pluginHost, btx, i);
                    tex[i].Save(fileOut);
                }
                pluginHost.Set_Object(tex);
            }
        }