Beispiel #1
0
        void eExportInfoDump(object sender, EventArgs args)
        {
            if (Client.tvRes.SelectedNode.Index != 0)
            {
                MessageBox.Show(res.err_pe_load, "first");
                return;
            }
            string name = ((Client.tvRes.SelectedNode).Tag as LibLoader2).LibraryPath;

            if (name == null)
            {
                throw new ArgumentException(string.Format(res.err_arg_filter, (Client.tvRes.SelectedNode).Tag));
            }
            MessageBox.Show(name);
            string pathname = Path.GetFileNameWithoutExtension(name);
            string basepath = Cor3.FileUtil.GetDir(string.Format(bp, pathname));

            if (basepath == string.Empty)
            {
                return;
            }
            string   newdir    = DirUtil.CreateIfNoExist(Path.Combine(basepath, pathname));
            string   stroutput = string.Empty;
            res_info wry       = Resources[name].ToResInfo();

            foreach (res_category ri in wry.table_data)
            {
                string tpath = DirUtil.CreateIfNoExist(Path.Combine(newdir, string.Format("{0}", ri.table_id)));
                foreach (res_table rt in ri.table_data)
                {
                    thought?t = new thought(Resources[name], ri.table_id, rt._n, rt.Lang);
                    Application.DoEvents();
                    byte[] bits = LoadBinary(t);
                    if (t.GetValueOrDefault().table.type == "BITMAP")
                    {
                        BITMAPINFOHEADER bih       = BITMAPINFOHEADER.CreateMemory(bits);
                        string           imagename = ckpath(tpath, ckname(t, bih)); // convert the dir/name
                        SaveImage(imagename, t, bih);
                        rt.ext_info = imagename;
                    }
                    else
                    {
                        SaveImage(Path.Combine(tpath, rt.name), bits);
                    }
                    t          = null;
                    stroutput += string.Format("{0}:{1}\n", rt._n, rt._t);
                }
            }
            if (Resources.ContainsKey(name))
            {
                Resources[name].SaveXml(wry, newdir, pathname);
            }
            Client.richTextBox1.Text = stroutput;
        }