示例#1
0
 public override bool import(string filename)
 {
     byte[] img = BImage.import8bitBitmap(filename, hdr.width,
                                          hdr.height * hdr.n_sprites, Config.get().findPalette(pal), 0);
     byte[] data = new byte[img.Length + SkyDisk.FileHeader.size];
     Array.Copy(hdr.buf, data, SkyDisk.FileHeader.size);
     Array.Copy(img, 0, data, SkyDisk.FileHeader.size, img.Length);
     return(SkyDisk.get().importFile((int)filenum, data));
 }
示例#2
0
        private void paletteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count != 1)
            {
                return;
            }
            uint      fid  = uint.Parse(listView1.SelectedItems[0].SubItems[0].Text);
            String    men  = (sender as ToolStripMenuItem).Text;
            BResource bres = null;

            try
            {
                switch (men)
                {
                case "Palette": bres = new BPalette(fid, ""); break;

                case "Image": bres = new BImage(fid, 320, 200, "", 0); break;

                case "Sequence": bres = new BSequence(fid, "", "aqua"); break;

                case "Sprites": bres = new BSprites(fid, ""); break;

                case "Charset": bres = new BCharset(fid, 8, 0); break;

                case "Text": bres = new BText(fid); break;

                case "Script": bres = new BScripts(fid); break;

                case "Speech": bres = new BSpeech(fid); break;

                case "Sound": bres = new BSound(fid); break;
                }
            }
            catch (Exception ex)
            {
                bres = null;
                MessageBox.Show("Error creating resource.\n" + ex.GetType().Name + ":\n" + ex.Message);
            }
            if (bres != null)
            {
                clearRes();
                cntrl = bres.control;
                if (cntrl != null)
                {
                    panel1.Controls.Add(cntrl);
                    bres.initControl();
                }
            }
        }
示例#3
0
 public override bool export(string filename)
 {
     BImage.get8bitBitmap(hdr.width, hdr.height * hdr.n_sprites,
                          Config.get().findPalette(pal), sprdata, 0).Save(filename, ImageFormat.Bmp);
     return(true);
 }
示例#4
0
 private void paletteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count!=1) return;
     uint fid = uint.Parse(listView1.SelectedItems[0].SubItems[0].Text);
     String men = (sender as ToolStripMenuItem).Text;
     BResource bres = null;
     try
     {
         switch (men)
         {
             case "Palette": bres = new BPalette(fid, ""); break;
             case "Image": bres = new BImage(fid, 320, 200, "",0); break;
             case "Sequence": bres = new BSequence(fid, "", "aqua"); break;
             case "Sprites": bres = new BSprites(fid, ""); break;
             case "Charset": bres = new BCharset(fid, 8, 0); break;
             case "Text": bres = new BText(fid); break;
             case "Script": bres = new BScripts(fid); break;
             case "Speech": bres = new BSpeech(fid); break;
             case "Sound": bres = new BSound(fid); break;
         }
     }
     catch(Exception ex)
     {
         bres = null;
         MessageBox.Show("Error creating resource.\n"+ex.GetType().Name+":\n"+ex.Message);
     }
     if (bres != null)
     {
         clearRes();
         cntrl = bres.control;
         if (cntrl!=null)
         {
             panel1.Controls.Add(cntrl);
             bres.initControl();
         }
     }
 }