コード例 #1
0
        public CollisionTahPageControl(CollisionItem argCollisionEntry)
        {
            InitializeComponent();
            collisionEntry = argCollisionEntry;
            Text           = Path.GetFileName(collisionEntry.tah.path);

            TDCGExplorer.TDCGExplorer.SetToolTips(Text);

            DataTable data = new DataTable();

            data.Columns.Add(TextResource.CollisionFrom, Type.GetType("System.String"));
            data.Columns.Add(TextResource.CollisionTo, Type.GetType("System.String"));
            data.Columns.Add(TextResource.CollisionedTAH, Type.GetType("System.String"));
            foreach (ArcsCollisionRecord col in collisionEntry.entries)
            {
                ArcsDatabase db = TDCGExplorer.TDCGExplorer.ArcsDB;
                // 衝突した先のtahを取得する.
                ArcsTahEntry to = db.GetTah(col.toTahID);
                // 既に同じ名前で追加していないか調べる.
                ArcsTahFilesEntry fromfile = db.GetTahFilesEntry(col.fromFilesID);
                ArcsTahFilesEntry tofile   = db.GetTahFilesEntry(col.toFilesID);
                DataRow           row      = data.NewRow();
                string[]          content  = { fromfile.GetDisplayPath(), tofile.GetDisplayPath().ToLower(), to.shortname };
                row.ItemArray = content;
                data.Rows.Add(row);
            }
            dataGridView.DataSource            = data;
            dataGridView.AutoSizeColumnsMode   = DataGridViewAutoSizeColumnsMode.AllCells;
            dataGridView.ReadOnly              = true;
            dataGridView.AllowUserToAddRows    = false;
            dataGridView.AllowUserToDeleteRows = false;

            selectIndex(0);
        }
コード例 #2
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)
            {
            }
        }
コード例 #3
0
        public void Run()
        {
            TDCGExplorer.TDCGExplorer.IncBusy();
            ArcsDatabase arcDB = TDCGExplorer.TDCGExplorer.ArcsDB;
            // TAHを列挙する.
            List <ArcsTahEntry> tahs = arcDB.GetTahs();

            foreach (ArcsTahEntry tah in tahs)
            {
                Dictionary <string, ArcsTahEntry> tbnmap = new Dictionary <string, ArcsTahEntry>();
                List <ArcsTahFilesEntry>          files  = arcDB.GetTahFilesPath(tah.id);
                foreach (ArcsTahFilesEntry file in files)
                {
                    try
                    {
                        TDCGExplorer.TDCGExplorer.SetToolTips(TextResource.Searching + ":" + tah.shortname);
                        if (file.path.ToLower().StartsWith("script/items/") /*|| file.path.ToLower().StartsWith("script/backgrounds/" )*/)
                        {
                            // TBNファイルか?
                            if (file.path.ToLower().EndsWith(".tbn") == true)
                            {
                                // N765BODY_A00.TBN
                                // 1234567890123456
                                string directory = Path.GetDirectoryName(file.path).ToLower().Replace('\\', '/');
                                string fullname  = Path.GetFileNameWithoutExtension(file.path).ToLower();
                                string basename  = fullname.Substring(0, 10);
                                string colbase   = directory + "/" + basename + "00.tbn";

                                // <<1.08.1
                                // コード毎のtbnファイル名を全て集める.
                                if (tbnfiles.ContainsKey(colbase) == false)
                                {
                                    tbnfiles.Add(colbase, new List <string>());
                                }
                                tbnfiles[colbase].Add(file.path);
                                // 1.08.1>>

                                if (tbnmap.ContainsKey(colbase) == true)
                                {
                                    continue;                                      // 既に該当tbnの情報を見つけている.
                                }
                                // baseとなるtbnそのものだった場合.
                                if (file.path.ToLower() == colbase)
                                {
                                    tbnmap.Add(colbase, tah);
                                    continue;
                                }
                                // カテゴリ先頭のtbnファイルを検索する.
                                List <ArcsTahFilesEntry> tbns = arcDB.GetTahFilesEntry(TDCGExplorer.TAHUtil.CalcHash(colbase));
                                if (tbns.Count == 0)
                                {
                                    // 該当するtbnの00番が見つからない.
                                    MissingEntryInformation entry = new MissingEntryInformation();
                                    entry.id       = tah.id;
                                    entry.path     = String.Copy(tah.path);
                                    entry.basetbn  = String.Copy(colbase);
                                    entry.zipfiles = null;
                                    // 該当tbnを含むzipを検索する.
                                    HashSet <string>         zipname  = new HashSet <string>();
                                    List <ArcsTahFilesEntry> zipfiles = arcDB.GetZipTahFilesEntries(TDCGExplorer.TAHUtil.CalcHash(colbase));
                                    foreach (ArcsTahFilesEntry zipfile in zipfiles)
                                    {
                                        if (zipfile.path.ToLower() != colbase)
                                        {
                                            continue;                                    // ハッシュ衝突なら無視する.
                                        }
                                        ArcsZipTahEntry ziptah = arcDB.GetZipTah(zipfile.tahid);
                                        ArcsZipArcEntry zip    = arcDB.GetZip(ziptah.zipid);
                                        zipname.Add(zip.GetDisplayPath());
                                    }
                                    // 発見したZIPの数だけ報告する.0
                                    if (zipname.Count == 0)
                                    {
                                        control.asyncDisplayFromArcs(entry);
                                    }
                                    else
                                    {
                                        entry.zipfiles = new List <string>();
                                        foreach (string zip in zipname)
                                        {
                                            entry.zipfiles.Add(String.Copy(zip));
                                        }
                                        control.asyncDisplayFromArcs(entry);
                                    }
                                }
                                tbnmap.Add(colbase, tah);
                            }
                        }
                    }
                    // おかしなファイル名でindex違反が起きるかもしれない.
                    catch (Exception)
                    {
                    }
                }
            }
            // TBN辞書をセットして終了
            control.tbnfiles = tbnfiles;
            TDCGExplorer.TDCGExplorer.SetToolTips(TextResource.SearchComplete);
            TDCGExplorer.TDCGExplorer.DecBusy();
        }