示例#1
0
        static Form viewImage(int fileid, int w, int h)
        {
            LureConfig.LureFile f = LureConfig.get().findFile(fileid);
            string pal            = "";
            string nm             = "";

            if (f != null)
            {
                pal = f.node.Attributes["palette"].Value;
                if (f.node.Attributes["name"] != null)
                {
                    nm = f.node.Attributes["name"].Value;
                }
                if (w == 0)
                {
                    w = LureCommon.strToInt(f.node.Attributes["width"].Value);
                }
                if (h == 0)
                {
                    h = LureCommon.strToInt(f.node.Attributes["height"].Value);
                }
            }
            if (w == 0)
            {
                w = 320;
            }
            if (h == 0)
            {
                h = 200;
            }
            return(new ImgForm(fileid, w, h, pal, nm));
        }
示例#2
0
        static void list(string[] argv)
        {
            bool known = false;
            int  dsk   = -1;
            int  aid   = 1;

            while (aid < argv.Length)
            {
                string s = argv[aid];
                aid++;
                switch (s)
                {
                case "known":
                    known = true;
                    break;

                case "disk":
                    dsk = LureCommon.strToInt(argv[aid]);
                    aid++;
                    break;

                default:
                    throw new Exception("unknown param " + s);
                }
            }
            Console.WriteLine("  id     offset      size       type");
            for (int i = 0; i < 5; i++)
            {
                if (dsk == -1 || dsk == i)
                {
                    Console.WriteLine("-=DISK " + i.ToString() + "=-");
                    foreach (LureDisk.FileEntry f in LureDisks.get(i).entries)
                    {
                        if (f.id == 0xFFFF)
                        {
                            break;
                        }
                        LureConfig.LureFile lf = LureConfig.get().findFile(f.id);
                        if (!known || lf != null)
                        {
                            Console.WriteLine(string.Format("{0,5:D}{1,12:X8}{2,12:X8}{3,20:s}", f.id, f.realOfs, f.realSize, (lf == null?"":lf.type)));
                        }
                    }
                }
            }
        }
示例#3
0
        public static void importResource(int id)
        {
            LureConfig.LureFile f = LureConfig.get().findFile(id);
            if (f == null)
            {
                throw new Exception("File not found in config " + id.ToString());
            }
            string infile = "";

            switch (f.type)
            {
            case "text":
            case "string_list":
            case "text_decode_table":
                infile = LureConfig.get().inputFile(id.ToString() + ".xml");
                LureCommon.checkFile(infile);
                System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
                doc.Load(infile);
                if (f.type == "text")
                {
                    new LureText(f.id).import(doc);
                }
                else if (f.type == "text_decode_table")
                {
                    TextDecoder.get().import(doc);
                }
                else
                {
                    new LureStringList(f.id).import(doc);
                }
                break;

            case "font":
                infile = LureConfig.get().inputFile(id.ToString() + ".bmp");
                LureCommon.checkFile(infile);
                System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(infile);
                new LureFont(f.id).import(bmp);
                break;

            case "image":
                int    w   = LureCommon.strToInt(f.node.Attributes["width"].Value);
                int    h   = LureCommon.strToInt(f.node.Attributes["height"].Value);
                string pal = f.node.Attributes["palette"].Value;
                string nm  = "image" + f.id.ToString();
                if (f.node.Attributes["name"] != null)
                {
                    nm = f.node.Attributes["name"].Value;
                }
                infile = LureConfig.get().outputFile(nm + ".bmp");
                new LureImage(f.id, w, h, pal).import(new System.Drawing.Bitmap(infile));
                break;

            case "anim":
                string apal = f.node.Attributes["palette"].Value;
                string anm  = "image" + f.id.ToString();
                if (f.node.Attributes["name"] != null)
                {
                    anm = f.node.Attributes["name"].Value;
                }
                infile = LureConfig.get().outputFile(anm + ".bmp");
                new LureAnim(f.id, apal).import(new System.Drawing.Bitmap(infile));
                break;

            default:
                throw new Exception("dont know how to import " + f.type);
            }
        }
示例#4
0
        public static void exportResource(int id)
        {
            LureConfig.LureFile f = LureConfig.get().findFile(id);
            if (f == null)
            {
                throw new Exception("File not found in config " + id.ToString());
            }
            string outfile = "";

            switch (f.type)
            {
            case "text":
            case "string_list":
            case "text_decode_table":
                outfile = LureConfig.get().outputFile(id.ToString() + ".xml");
                if (f.type == "text")
                {
                    new LureText(f.id).export().Save(outfile);
                }
                else if (f.type == "text_decode_table")
                {
                    TextDecoder.get().export().Save(outfile);
                }
                else
                {
                    new LureStringList(f.id).export().Save(outfile);
                }
                break;

            case "font":
                outfile = LureConfig.get().outputFile(id.ToString() + ".bmp");
                new LureFont(f.id).export().Save(outfile, ImageFormat.Bmp);
                break;

            case "image":
                int    w   = LureCommon.strToInt(f.node.Attributes["width"].Value);
                int    h   = LureCommon.strToInt(f.node.Attributes["height"].Value);
                string pal = f.node.Attributes["palette"].Value;
                string nm  = "image" + f.id.ToString();
                if (f.node.Attributes["name"] != null)
                {
                    nm = f.node.Attributes["name"].Value;
                }
                outfile = LureConfig.get().outputFile(nm + ".bmp");
                new LureImage(f.id, w, h, pal).export().Save(outfile, ImageFormat.Bmp);
                break;

            case "anim":
                string apal = f.node.Attributes["palette"].Value;
                string anm  = "image" + f.id.ToString();
                if (f.node.Attributes["name"] != null)
                {
                    anm = f.node.Attributes["name"].Value;
                }
                outfile = LureConfig.get().outputFile(anm + ".bmp");
                new LureAnim(f.id, apal).export().Save(outfile, ImageFormat.Bmp);
                break;

            default:
                throw new Exception("dont know how to export " + f.type);
            }
        }