public ADSPlayer(Resource.ADS ads)
        {
            screen   = new Bitmap(640, 480);
            g        = Graphics.FromImage(screen);
            this.ads = ads;
            bwads.WorkerReportsProgress      = true;
            bwads.WorkerSupportsCancellation = true;
            bwads.DoWork             += play;
            bwads.RunWorkerCompleted += bw_RunWorkerCompleted;
            //Debug.WriteLine("Properties:");
            //Debug.WriteLine("id\tname:");
            foreach (Resource.ADS.ResourceProperty rp in ads.resourceproperties)
            {
                //Debug.WriteLine(rp.id.ToString("X4") + "\t" + rp.name);
                Resource.TTM ttm       = (Resource.TTM)ResourceManager.get(rp.name);
                TTMPlayer    ttmplayer = new TTMPlayer(ttm, screen);
                //ttmplayer.bw.RunWorkerCompleted += bw_RunWorkerCompleted;
                ttmplayer.bw.ProgressChanged += bw_ProgressChanged;
                ttms.Add(rp.id, ttmplayer);

                /*foreach (UInt16 key in ttm.tags.Keys)
                 * {
                 * Debug.WriteLine("\t" + key.ToString("X4") + "\t" + ttm.tags[key]);
                 * }*/
            }
        }
        public static Resource.Resource get(string name)
        {
            if (resources.ContainsKey(name.ToLower()))
            {
                return(resources[name]);
            }
            else
            {
                if (map == null)
                {
                    map = new Map();

                    map.parse(resourcemap);
                }
                FileParser reader = new FileParser(SCRANTIC.ResourceManager.map.ResourceFile);
                int        index  = SCRANTIC.ResourceManager.map.getResourceIndex(name);
                if (index < 0)
                {
                    return(null);
                }
                UInt32 offset = SCRANTIC.ResourceManager.map.getOffset(index);
                reader.setOffset(offset);
                string filename = reader.getStringBlock(12);
                UInt32 size     = reader.getDWord();
                byte[] data     = reader.getBytes(size);
                string ext      = name.Substring(name.LastIndexOf(".") + 1).ToLower();
                switch (ext)
                {
                case "ads":
                    Resource.ADS adsres = new Resource.ADS(name);
                    adsres.parse(data);
                    resources.Add(name.ToLower(), adsres);
                    return(adsres);

                case "bmp":
                    Resource.BMP bmpres = new Resource.BMP(name);
                    bmpres.parse(data);
                    resources.Add(name.ToLower(), bmpres);
                    return(bmpres);

                case "pal":
                    Resource.PAL palres = new Resource.PAL(name);
                    palres.parse(data);
                    resources.Add(name.ToLower(), palres);
                    return(palres);

                case "scr":
                    Resource.SCR scrres = new Resource.SCR(name);
                    scrres.parse(data);
                    resources.Add(name.ToLower(), scrres);
                    return(scrres);

                case "ttm":
                    Resource.TTM ttmres = new Resource.TTM(name);
                    ttmres.parse(data);
                    resources.Add(name.ToLower(), ttmres);
                    return(ttmres);

                case "vin":
                    break;
                }
            }
            return(null);
        }