예제 #1
0
        private void selectIndex(int index)
        {
            ArcsCollisionRecord col = collisionEntry.entries[index];

            ArcsDatabase db = TDCGExplorer.TDCGExplorer.ArcsDB;
            // 衝突した先のtahを取得する.
            ArcsTahEntry from = db.GetTah(col.fromTahID);
            ArcsTahEntry to   = db.GetTah(col.toTahID);
            // 既に同じ名前で追加していないか調べる.
            ArcsTahFilesEntry fromfile = db.GetTahFilesEntry(col.fromFilesID);
            ArcsTahFilesEntry tofile   = db.GetTahFilesEntry(col.toFilesID);

            string text =
                @"<p>" +
                @"<h2> " + TextResource.CollisionHTML_CollisionFrom + " : " + from.shortname + "</h2>" +
                @"<adress>" + TextResource.Directory + " : " + Path.GetDirectoryName(from.path) + "</adress>" +
                @"<h3> " + TextResource.CollisionHTML_CollisionTo + " : " + to.shortname + "</h3>" +
                @"<adress>" + TextResource.Directory + " : " + Path.GetDirectoryName(to.path) + "</adress>" +
                @"<pre>" + fromfile.GetDisplayPath().ToLower() + " --> " + tofile.GetDisplayPath().ToLower() + "</pre>" +
                @"<pre>" + TextResource.HashCode + " : " + tofile.hash.ToString("x8") + "</pre>";

            webBrowser.DocumentText = text;

            try
            {
                string filename = fromfile.GetDisplayPath().ToLower();
                if (Path.GetExtension(filename) == ".tso")
                {
                    // TSOを表示する.
                    using (GenericTAHStream tahstream = new GenericTAHStream(new GenericArcsTahInfo(from), fromfile))
                    {
                        Cursor.Current = Cursors.WaitCursor;
                        TDCGExplorer.TDCGExplorer.MainFormWindow.makeTSOViwer();
                        TDCGExplorer.TDCGExplorer.MainFormWindow.clearTSOViewer();
                        TDCGExplorer.TDCGExplorer.MainFormWindow.Viewer.LoadTSOFile(tahstream.stream);
                        if (TDCGExplorer.TDCGExplorer.SystemDB.loadinitialpose)
                        {
                            TDCGExplorer.TDCGExplorer.MainFormWindow.doInitialTmoLoad();                                                    // 初期tmoを読み込む.
                        }
                        // カメラをセンター位置に.
                        TSOCameraAutoCenter camera = new TSOCameraAutoCenter(TDCGExplorer.TDCGExplorer.MainFormWindow.Viewer);
                        camera.UpdateCenterPosition(fromfile.path.ToUpper());
                        // 次回カメラが必ずリセットされる様にする.
                        TDCGExplorer.TDCGExplorer.MainFormWindow.setNeedCameraReset();
                        Cursor.Current = Cursors.Default;
                        //TDCGExplorer.TDCGExplorer.FigureLoad = false;
                    }
                }
            }
            catch (Exception)
            {
            }
        }
예제 #2
0
        private void LoadPsdFile(int index)
        {
            try
            {
                string ext         = Path.GetExtension(filesEntries[index].path).ToLower();
                string psdfilename = filesEntries[index].path;
                string psdpath     = "data/icon/items/";
                if (Path.GetDirectoryName(filesEntries[index].path).ToLower() == "script\\backgrounds")
                {
                    psdpath = "data/icon/backgrounds/";
                }
                if (ext != ".psd")
                {
                    string fname = Path.GetFileNameWithoutExtension(psdfilename);
                    psdfilename = psdpath + fname + ".psd";
                }
                psdfilename = psdfilename.ToLower();
                foreach (ArcsTahFilesEntry fentry in filesEntries)
                {
                    if (fentry.path.ToLower() == psdfilename)
                    {
                        using (GenericTAHStream tahstream = new GenericTAHStream(info, fentry))
                        {
                            PSDFile psd = new PSDFile();
                            psd.Load(tahstream.stream);
#if false
                            TDCGExplorer.TDCGExplorer.MainFormWindow.PictureBox.Image  = psd.Bitmap;
                            TDCGExplorer.TDCGExplorer.MainFormWindow.PictureBox.Width  = psd.Bitmap.Width;
                            TDCGExplorer.TDCGExplorer.MainFormWindow.PictureBox.Height = psd.Bitmap.Height;
#else
                            TDCGExplorer.TDCGExplorer.MainFormWindow.SetBitmap(psd.Bitmap);
#endif
                        }
                        return;
                    }
                }
            }
            catch (Exception)
            {
            }
            NoImageIcon();
        }
예제 #3
0
        private void assembleTsoData()
        {
            foreach (LoadTsoInfo tsoload in loadtsoinfo)
            {
                GenericTahInfo    info = tsoload.info;
                ArcsTahFilesEntry file = tsoload.file;
                int id = tsoload.id;
                try
                {
                    // tso名を取得する.
                    string tsoname;
                    using (GenericTAHStream tahstream = new GenericTAHStream(info, file))
                    {
                        using (MemoryStream memorystream = new MemoryStream())
                        {
                            ZipFileUtil.CopyStream(tahstream.stream, memorystream);
                            tsoname = TDCGTbnUtil.GetTsoName(memorystream.ToArray());
                        }
                    }

                    GenericTahInfo    tsoinfo = null;
                    ArcsTahFilesEntry tso     = null;
                    if (info.zipid < 0)
                    {// Arcsの場合
                        int                      pastVersion = -1;
                        ArcsTahEntry             tahinfo     = null;
                        List <ArcsTahFilesEntry> tsos        = TDCGExplorer.TDCGExplorer.ArcsDB.GetTahFilesEntry(TAHUtil.CalcHash(tsoname));
                        foreach (ArcsTahFilesEntry subfile in tsos)
                        {
                            ArcsTahEntry subtah = TDCGExplorer.TDCGExplorer.ArcsDB.GetTah(subfile.tahid);
                            if (subtah.version > pastVersion)
                            {
                                tso         = subfile;
                                tahinfo     = subtah;
                                pastVersion = subtah.version;
                            }
                        }
                        tsoinfo = new GenericArcsTahInfo(tahinfo);
                    }
                    else
                    {// zipの場合
                        int                      pastVersion = -1;
                        ArcsZipTahEntry          tahinfo     = null;
                        List <ArcsTahFilesEntry> tsos        = TDCGExplorer.TDCGExplorer.ArcsDB.GetZipTahFilesEntries(TAHUtil.CalcHash(tsoname));
                        foreach (ArcsTahFilesEntry subfile in tsos)
                        {
                            ArcsZipTahEntry subtah = TDCGExplorer.TDCGExplorer.ArcsDB.GetZipTah(subfile.tahid);
                            if (subtah.version > pastVersion)
                            {
                                tso         = subfile;
                                tahinfo     = subtah;
                                pastVersion = subtah.version;
                            }
                        }
                        tsoinfo = new GenericZipsTahInfo(tahinfo);
                    }
                    if (tsoinfo != null && tso != null)
                    {
                        // TSOを読み込む
                        using (GenericTAHStream tahstream = new GenericTAHStream(tsoinfo, tso))
                        {
                            using (MemoryStream memorystream = new MemoryStream())
                            {
                                ZipFileUtil.CopyStream(tahstream.stream, memorystream);
                                PNGTsoData tsodata = new PNGTsoData();
                                tsodata.tsoID   = (uint)id;
                                tsodata.tsodata = memorystream.ToArray();
                                tsoDataList.Add(tsodata);
                            }
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
        }
예제 #4
0
        private void dataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex < 0)
                {
                    return;
                }

                System.Windows.Forms.DataGridViewRow dgr = this.dataGridView.CurrentRow;
                System.Data.DataRowView drv = (System.Data.DataRowView)dgr.DataBoundItem;
                System.Data.DataRow     dr  = (System.Data.DataRow)drv.Row;
                int index = int.Parse(dr.ItemArray[0].ToString());

                if (index >= 0)
                {
                    string ext = Path.GetExtension(filesEntries[index].path).ToLower();
                    if (ext == ".tso" || ext == ".tmo")
                    {
                        using (GenericTAHStream tahstream = new GenericTAHStream(info, filesEntries[index]))
                        {
                            Cursor.Current = Cursors.WaitCursor;
                            TDCGExplorer.TDCGExplorer.MainFormWindow.makeTSOViwer();
                            if (ext == ".tso")
                            {
                                if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
                                {
                                    TDCGExplorer.TDCGExplorer.MainFormWindow.Viewer.LoadTSOFile(tahstream.stream);
                                    if (TDCGExplorer.TDCGExplorer.SystemDB.loadinitialpose)
                                    {
                                        TDCGExplorer.TDCGExplorer.MainFormWindow.doInitialTmoLoad();                                                     // 初期tmoを読み込む.
                                    }
                                }
                                else
                                {
                                    TDCGExplorer.TDCGExplorer.MainFormWindow.clearTSOViewer();
                                    TDCGExplorer.TDCGExplorer.MainFormWindow.Viewer.LoadTSOFile(tahstream.stream);
                                    if (TDCGExplorer.TDCGExplorer.SystemDB.loadinitialpose)
                                    {
                                        TDCGExplorer.TDCGExplorer.MainFormWindow.doInitialTmoLoad();                                                     // 初期tmoを読み込む.
                                    }
                                    // カメラをセンター位置に.
                                    TSOCameraAutoCenter camera = new TSOCameraAutoCenter(TDCGExplorer.TDCGExplorer.MainFormWindow.Viewer);
                                    camera.UpdateCenterPosition(Path.GetFileName(filesEntries[index].path).ToUpper());
                                    // 次回カメラが必ずリセットされる様にする.
                                    TDCGExplorer.TDCGExplorer.MainFormWindow.setNeedCameraReset();
                                }
                            }
                            else if (ext == ".tmo")
                            {
                                TDCGExplorer.TDCGExplorer.MainFormWindow.Viewer.LoadTMOFile(tahstream.stream);
                                TDCGExplorer.TDCGExplorer.defaultpose = tahstream.stream;
                            }
                            Cursor.Current = Cursors.Default;
                            //TDCGExplorer.TDCGExplorer.FigureLoad = false;
                        }
                    }
                    LoadPsdFile(index);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(TextResource.Error + ":" + ex.Message, TextResource.Error, MessageBoxButtons.OK);
            }
        }