• R/O
  • SSH
  • HTTPS

customtool: 提交


Commit MetaInfo

修订版5 (tree)
时间2014-03-16 13:14:39
作者hogepiyo

Log Message

バグ修正・機能追加

更改概述

差异

--- TSOSorter/Source/TDCG/TAHDump.cs (revision 4)
+++ TSOSorter/Source/TDCG/TAHDump.cs (revision 5)
@@ -41,7 +41,7 @@
4141 foreach (string shortname in shortnames) if (shortname[0] == '!') skipflag = true;
4242 if (skipflag) return; // !で始まるディレクトリはスキップ
4343
44- string[] tah_files = Directory.GetFiles(dir, "*.TAH");
44+ string[] tah_files = Directory.GetFiles(dir, "*.*TAH"); //"@tah"も読み込む
4545 foreach (string file in tah_files)
4646 {
4747 // 既にdb上にエントリがあるか調べる.
--- TSOSorter/Source/TDCG/TDCGExplorer.cs (revision 4)
+++ TSOSorter/Source/TDCG/TDCGExplorer.cs (revision 5)
@@ -162,13 +162,15 @@
162162 {
163163 Options opt = new Options();
164164 opt.m_strTextArcPath = SystemDB.m_strArcPath;
165- opt.m_strTextTahWorkPath = SystemDB.m_strTahWorkPath;
165+// opt.m_strTextTahWorkPath = SystemDB.m_strTahWorkPath;
166+ opt.m_strTextDBFolder = SystemDB.m_strDBFolderPath;
166167 opt.Owner = Program.MainFormWindow;
167168 if (opt.ShowDialog() == DialogResult.OK)
168169 {
169170 // 反映
170171 SystemDB.m_strArcPath = opt.m_strTextArcPath;
171- SystemDB.m_strTahWorkPath = opt.m_strTextTahWorkPath;
172+ SystemDB.m_strDBFolderPath = opt.m_strTextDBFolder;
173+// SystemDB.m_strTahWorkPath = opt.m_strTextTahWorkPath;
172174 Program.MainFormWindow.DisplayDB();
173175
174176 }
@@ -209,10 +211,13 @@
209211 }
210212
211213 Program.MainFormWindow.FileViewer.AddFiles(filedb, strPartType);
214+
215+ TDCGExplorer.SetToolTips("Setup File Viewer Succeeded");
212216 }
213217 catch (Exception e)
214218 {
215219 Debug.WriteLine(e.Message);
220+ TDCGExplorer.SetToolTips("Setup File Viewer Failed");
216221 }
217222 }
218223 }
--- TSOSorter/Source/TDCG/TSOCameraAutoCenter.cs (nonexistent)
+++ TSOSorter/Source/TDCG/TSOCameraAutoCenter.cs (revision 5)
@@ -0,0 +1,258 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Linq;
4+using System.Text;
5+using System.IO;
6+using TDCG;
7+using Microsoft.DirectX;
8+using Microsoft.DirectX.Direct3D;
9+using Direct3D = Microsoft.DirectX.Direct3D;
10+
11+namespace TDCGExplorer
12+{
13+ public class TSOCameraAutoCenter
14+ {
15+ Viewer viewer;
16+
17+ public TSOCameraAutoCenter(Viewer TsoView)
18+ {
19+ viewer = TsoView;
20+ }
21+
22+ internal char current_row = 'A';
23+
24+ private void SetCurrentTSOFileName(string filename)
25+ {
26+ string basename = Path.GetFileNameWithoutExtension(filename);
27+ if (basename.Length == 12)
28+ current_row = basename.ToUpper()[9];
29+ else
30+ current_row = 'A';
31+ }
32+
33+ private int GetCenterBoneType()
34+ {
35+ switch (current_row)
36+ {
37+ case 'S'://手首
38+ case 'Z'://手持ちの小物
39+ return 1;
40+ case 'W'://タイツ・ガーター
41+ case 'I'://靴下
42+ return 2;
43+ case 'O'://靴
44+ return 3;
45+ case 'X'://腕装備(手甲など)
46+ return 4;
47+ default:
48+ return 0;
49+ }
50+ }
51+
52+ private string GetCenterBoneName()
53+ {
54+ switch (current_row)
55+ {
56+ case 'A'://身体
57+ return "W_Neck";
58+ case 'E'://瞳
59+ case 'D'://頭皮(生え際)
60+ case 'B'://前髪
61+ case 'C'://後髪
62+ case 'U'://アホ毛類
63+ return "Kami_Oya";
64+ case 'Q'://眼鏡
65+ case 'V'://眼帯
66+ case 'Y'://リボン
67+ case 'P'://頭部装備(帽子等)
68+ return "face_oya";
69+ case '3'://イヤリング類
70+ case '0'://眉毛
71+ case '2'://ほくろ
72+ case '1'://八重歯
73+ return "Head";
74+ case 'R'://首輪
75+ return "W_Neck";
76+ case 'F'://ブラ
77+ case 'J'://上衣(シャツ等)
78+ case 'T'://背中(羽など)
79+ case 'L'://上着オプション(エプロン等)
80+ return "W_Spine3";
81+ case 'G'://全身下着・水着
82+ case 'K'://全身衣装(ナース服等)
83+ return "W_Spine1";
84+ case 'S'://手首
85+ case 'X'://腕装備(手甲など)
86+ case 'Z'://手持ちの小物
87+ return "W_Hips";//not reached
88+ case 'H'://パンツ
89+ case 'M'://下衣(スカート等)
90+ case 'N'://尻尾
91+ return "W_Hips";
92+ case 'W'://タイツ・ガーター
93+ case 'I'://靴下
94+ return "W_Hips";//not reached
95+ case 'O'://靴
96+ return "W_Hips";//not reached
97+ default:
98+ return "W_Hips";
99+ }
100+ }
101+
102+ public void UpdateCenterPosition(string tsoname)
103+ {
104+ Vector3 position = new Vector3(0, 0, 0);
105+
106+ TMOFile tmo = viewer.FigureList[0].Tmo;
107+
108+ Dictionary<string, TMONode> nodemap = new Dictionary<string, TMONode>();
109+ foreach (TMONode node in tmo.nodes)
110+ {
111+ if (nodemap.ContainsKey(node.Name) == false)
112+ nodemap.Add(node.Name, node);
113+ }
114+
115+ SetCurrentTSOFileName(tsoname);
116+
117+ switch (GetCenterBoneType())
118+ {
119+ case 1://Hand
120+ {
121+#if false
122+ TMONode tmo_nodeR;
123+ TMONode tmo_nodeL;
124+ string boneR = "W_RightHand";
125+ string boneL = "W_LeftHand";
126+ if (nodemap.TryGetValue(boneR, out tmo_nodeR) && nodemap.TryGetValue(boneL, out tmo_nodeL))
127+ {
128+ Matrix mR = tmo_nodeR.combined_matrix;
129+ Matrix mL = tmo_nodeL.combined_matrix;
130+ position = new Vector3((mR.M41 + mL.M41) / 2.0f, (mR.M42 + mL.M42) / 2.0f, (mR.M43 + mL.M43) / 2.0f);
131+ }
132+#else
133+ // 両手はあまりにも離れているので右手にセンターを置く
134+ TMONode tmo_nodeR;
135+ string boneR = "W_RightHand";
136+ if (nodemap.TryGetValue(boneR, out tmo_nodeR))
137+ {
138+ Matrix mR = tmo_nodeR.combined_matrix;
139+ position = new Vector3(mR.M41, mR.M42, mR.M43);
140+ }
141+#endif
142+ }
143+ break;
144+ case 2://Leg
145+ {
146+ TMONode tmo_nodeR;
147+ TMONode tmo_nodeL;
148+ string boneR = "W_RightLeg";
149+ string boneL = "W_LeftLeg";
150+ if (nodemap.TryGetValue(boneR, out tmo_nodeR) && nodemap.TryGetValue(boneL, out tmo_nodeL))
151+ {
152+ Matrix mR = tmo_nodeR.combined_matrix;
153+ Matrix mL = tmo_nodeL.combined_matrix;
154+ position = new Vector3((mR.M41 + mL.M41) / 2.0f, (mR.M42 + mL.M42) / 2.0f, (mR.M43 + mL.M43) / 2.0f);
155+ }
156+ }
157+ break;
158+ case 3://Foot
159+ {
160+ TMONode tmo_nodeR;
161+ TMONode tmo_nodeL;
162+ string boneR = "W_RightFoot";
163+ string boneL = "W_LeftFoot";
164+ if (nodemap.TryGetValue(boneR, out tmo_nodeR) && nodemap.TryGetValue(boneL, out tmo_nodeL))
165+ {
166+ Matrix mR = tmo_nodeR.combined_matrix;
167+ Matrix mL = tmo_nodeL.combined_matrix;
168+ position = new Vector3((mR.M41 + mL.M41) / 2.0f, (mR.M42 + mL.M42) / 2.0f, (mR.M43 + mL.M43) / 2.0f);
169+ }
170+ }
171+ break;
172+ case 4://Shoulder
173+ {
174+ TMONode tmo_nodeR;
175+ TMONode tmo_nodeL;
176+ string boneR = "W_RightHand";
177+ string boneL = "W_LeftHand";
178+ if (nodemap.TryGetValue(boneR, out tmo_nodeR) && nodemap.TryGetValue(boneL, out tmo_nodeL))
179+ {
180+ Matrix mR = tmo_nodeR.combined_matrix;
181+ Matrix mL = tmo_nodeL.combined_matrix;
182+ position = new Vector3((mR.M41 + mL.M41) / 2.0f, (mR.M42 + mL.M42) / 2.0f, (mR.M43 + mL.M43) / 2.0f);
183+ }
184+ }
185+ break;
186+
187+ default:
188+ {
189+ TMONode tmo_node;
190+ string bone = GetCenterBoneName();
191+ if (nodemap.TryGetValue(bone, out tmo_node))
192+ {
193+ Matrix m = tmo_node.combined_matrix;
194+ position = new Vector3(m.M41, m.M42, m.M43);
195+ }
196+ }
197+ break;
198+ }
199+ viewer.Camera.Reset();
200+ viewer.Camera.SetCenter(position);
201+ }
202+
203+ public void TranslateToBone(string origin, string bone)
204+ {
205+ Vector3 position_origin = new Vector3(0, 0, 0);
206+ Vector3 position_bone = new Vector3(0, 0, 0);
207+
208+ TMONode tmo_node;
209+ Matrix m;
210+
211+ TMOFile tmo = viewer.FigureList[0].Tmo;
212+
213+ Dictionary<string, TMONode> nodemap = new Dictionary<string, TMONode>();
214+ foreach (TMONode node in tmo.nodes)
215+ {
216+ if (nodemap.ContainsKey(node.Name) == false)
217+ nodemap.Add(node.Name, node);
218+ }
219+
220+ if (nodemap.TryGetValue(origin, out tmo_node))
221+ {
222+ m = tmo_node.combined_matrix;
223+ position_origin = new Vector3(m.M41, m.M42, m.M43);
224+ if (nodemap.TryGetValue(bone, out tmo_node))
225+ {
226+ Vector3 pan_out = new Vector3(0, 0, 10);
227+
228+ m = tmo_node.combined_matrix;
229+ position_bone = new Vector3(m.M41, m.M42, m.M43);
230+
231+ viewer.Camera.SetTranslation(position_bone - position_origin + pan_out);
232+ }
233+ }
234+ }
235+
236+ public void SetCenter(string bone)
237+ {
238+ Vector3 position;
239+
240+ TMOFile tmo = viewer.FigureList[0].Tmo;
241+
242+ Dictionary<string, TMONode> nodemap = new Dictionary<string, TMONode>();
243+ foreach (TMONode node in tmo.nodes)
244+ {
245+ if (nodemap.ContainsKey(node.Name) == false)
246+ nodemap.Add(node.Name, node);
247+ }
248+
249+ TMONode tmo_node;
250+ if (nodemap.TryGetValue(bone, out tmo_node))
251+ {
252+ Matrix m = tmo_node.combined_matrix;
253+ position = new Vector3(m.M41, m.M42, m.M43);
254+ viewer.Camera.SetCenter(position);
255+ }
256+ }
257+ }
258+}
--- TSOSorter/Source/ArcsDataBase.cs (revision 4)
+++ TSOSorter/Source/ArcsDataBase.cs (revision 5)
@@ -94,12 +94,12 @@
9494
9595 public string GetArcsDatabasePath()
9696 {
97- return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), TSOSorter.TDCGExplorer.GetAppDataPath());
97+ return TSOSorter.TDCGExplorer.SystemDB.m_strDBFolderPath;// Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), TSOSorter.TDCGExplorer.GetAppDataPath());
9898 }
9999
100100 public string GetArcsDatabaseName()
101101 {
102- return Path.Combine(GetArcsDatabasePath(), "arcs.db");
102+ return Path.Combine(GetArcsDatabasePath(), "arcs2.db");
103103 }
104104
105105 public ArcsDatabase()
@@ -689,6 +689,21 @@
689689 }
690690 return int.Parse(id);
691691 }
692+ /** 指定したエントリ情報に更新する
693+ * */
694+ public void UpdateArcsTahEntry(ArcsTahEntry entry)
695+ {
696+ using (SQLiteCommand cmd = cnn.CreateCommand())
697+ {
698+ cmd.CommandText = "UPDATE TahEntry SET PATH=@path,SHORTNAME=@shortname,TAHVERSION=@version,DATETIME=@datetime WHERE ID=@id";
699+ cmd.Parameters.AddWithValue("path", entry.path);
700+ cmd.Parameters.AddWithValue("shortname", entry.shortname);
701+ cmd.Parameters.AddWithValue("id", entry.id);
702+ cmd.Parameters.AddWithValue("version", entry.version);
703+ cmd.Parameters.AddWithValue("datetime", entry.datetime);
704+ cmd.ExecuteNonQuery();
705+ }
706+ }
692707
693708 // 指定したtahに含まれるファイルを取得する.
694709 public List<ArcsTahFilesEntry> GetTahFilesPath(int tahid)
--- TSOSorter/Source/TSOViewer.Designer.cs (nonexistent)
+++ TSOSorter/Source/TSOViewer.Designer.cs (revision 5)
@@ -0,0 +1,46 @@
1+namespace TSOSorter
2+{
3+ partial class TSOViewer
4+ {
5+ /// <summary>
6+ /// 必要なデザイナ変数です。
7+ /// </summary>
8+ private System.ComponentModel.IContainer components = null;
9+
10+ /// <summary>
11+ /// 使用中のリソースをすべてクリーンアップします。
12+ /// </summary>
13+ /// <param name="disposing">マネージ リソースが破棄される場合 true、破棄されない場合は false です。</param>
14+ protected override void Dispose(bool disposing)
15+ {
16+ if (disposing && (components != null))
17+ {
18+ components.Dispose();
19+ }
20+ base.Dispose(disposing);
21+ }
22+
23+ #region Windows フォーム デザイナで生成されたコード
24+
25+ /// <summary>
26+ /// デザイナ サポートに必要なメソッドです。このメソッドの内容を
27+ /// コード エディタで変更しないでください。
28+ /// </summary>
29+ private void InitializeComponent()
30+ {
31+ this.SuspendLayout();
32+ //
33+ // TSOViewer
34+ //
35+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
36+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
37+ this.ClientSize = new System.Drawing.Size(482, 434);
38+ this.Name = "TSOViewer";
39+ this.Text = "TSOViewer";
40+ this.ResumeLayout(false);
41+
42+ }
43+
44+ #endregion
45+ }
46+}
\ No newline at end of file
--- TSOSorter/Source/Properties/AssemblyInfo.cs (revision 4)
+++ TSOSorter/Source/Properties/AssemblyInfo.cs (revision 5)
@@ -6,7 +6,7 @@
66 // アセンブリに関連付けられている情報を変更するには、
77 // これらの属性値を変更してください。
88 [assembly: AssemblyTitle("TSOSorter")]
9-[assembly: AssemblyDescription("TSO名順にTAHファイルをソート表示するツール")]
9+[assembly: AssemblyDescription("TBN名順にTAHファイルをソート表示するツール")]
1010 [assembly: AssemblyConfiguration("")]
1111 [assembly: AssemblyCompany("")]
1212 [assembly: AssemblyProduct("TSOSorter")]
--- TSOSorter/Source/Options.Designer.cs (revision 4)
+++ TSOSorter/Source/Options.Designer.cs (revision 5)
@@ -28,12 +28,14 @@
2828 /// </summary>
2929 private void InitializeComponent()
3030 {
31+ this.components = new System.ComponentModel.Container();
3132 this.label1 = new System.Windows.Forms.Label();
3233 this.textBoxArcsFolderPath = new System.Windows.Forms.TextBox();
3334 this.buttonArcsFolderRef = new System.Windows.Forms.Button();
3435 this.button1 = new System.Windows.Forms.Button();
35- this.buttonTahWorkFolderRef = new System.Windows.Forms.Button();
36- this.textBoxTahWorkFolder = new System.Windows.Forms.TextBox();
36+ this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
37+ this.buttonDBFolderRef = new System.Windows.Forms.Button();
38+ this.textBoxDBFolder = new System.Windows.Forms.TextBox();
3739 this.label2 = new System.Windows.Forms.Label();
3840 this.SuspendLayout();
3941 //
@@ -48,10 +50,11 @@
4850 //
4951 // textBoxArcsFolderPath
5052 //
51- this.textBoxArcsFolderPath.Location = new System.Drawing.Point(113, 10);
53+ this.textBoxArcsFolderPath.Location = new System.Drawing.Point(121, 10);
5254 this.textBoxArcsFolderPath.Name = "textBoxArcsFolderPath";
53- this.textBoxArcsFolderPath.Size = new System.Drawing.Size(460, 19);
55+ this.textBoxArcsFolderPath.Size = new System.Drawing.Size(452, 19);
5456 this.textBoxArcsFolderPath.TabIndex = 1;
57+ this.toolTip1.SetToolTip(this.textBoxArcsFolderPath, "カスタム少女3Dフォルダ配下の\"arcs\"フォルダを指定します。\r\nTAHファイルが存在すれば別のフォルダでもかまいません。");
5558 //
5659 // buttonArcsFolderRef
5760 //
@@ -74,22 +77,23 @@
7477 this.button1.UseVisualStyleBackColor = true;
7578 this.button1.Click += new System.EventHandler(this.button1_Click);
7679 //
77- // buttonTahWorkFolderRef
80+ // buttonDBFolderRef
7881 //
79- this.buttonTahWorkFolderRef.Location = new System.Drawing.Point(579, 33);
80- this.buttonTahWorkFolderRef.Name = "buttonTahWorkFolderRef";
81- this.buttonTahWorkFolderRef.Size = new System.Drawing.Size(75, 23);
82- this.buttonTahWorkFolderRef.TabIndex = 6;
83- this.buttonTahWorkFolderRef.Text = "参照...";
84- this.buttonTahWorkFolderRef.UseVisualStyleBackColor = true;
85- this.buttonTahWorkFolderRef.Click += new System.EventHandler(this.buttonTahWorkFolderRef_Click);
82+ this.buttonDBFolderRef.Location = new System.Drawing.Point(579, 33);
83+ this.buttonDBFolderRef.Name = "buttonDBFolderRef";
84+ this.buttonDBFolderRef.Size = new System.Drawing.Size(75, 23);
85+ this.buttonDBFolderRef.TabIndex = 6;
86+ this.buttonDBFolderRef.Text = "参照...";
87+ this.buttonDBFolderRef.UseVisualStyleBackColor = true;
88+ this.buttonDBFolderRef.Click += new System.EventHandler(this.button2_Click);
8689 //
87- // textBoxTahWorkFolder
90+ // textBoxDBFolder
8891 //
89- this.textBoxTahWorkFolder.Location = new System.Drawing.Point(113, 35);
90- this.textBoxTahWorkFolder.Name = "textBoxTahWorkFolder";
91- this.textBoxTahWorkFolder.Size = new System.Drawing.Size(460, 19);
92- this.textBoxTahWorkFolder.TabIndex = 5;
92+ this.textBoxDBFolder.Location = new System.Drawing.Point(121, 35);
93+ this.textBoxDBFolder.Name = "textBoxDBFolder";
94+ this.textBoxDBFolder.Size = new System.Drawing.Size(452, 19);
95+ this.textBoxDBFolder.TabIndex = 5;
96+ this.toolTip1.SetToolTip(this.textBoxDBFolder, "カスタム少女3Dフォルダ配下の\"arcs\"フォルダを指定します。\r\nTAHファイルが存在すれば別のフォルダでもかまいません。");
9397 //
9498 // label2
9599 //
@@ -96,9 +100,11 @@
96100 this.label2.AutoSize = true;
97101 this.label2.Location = new System.Drawing.Point(13, 38);
98102 this.label2.Name = "label2";
99- this.label2.Size = new System.Drawing.Size(99, 12);
103+ this.label2.Size = new System.Drawing.Size(103, 12);
100104 this.label2.TabIndex = 4;
101- this.label2.Text = "TAH作業用フォルダ";
105+ this.label2.Text = "ファイルDB設置場所";
106+ this.toolTip1.SetToolTip(this.label2, "ファイル情報をまとめたデータベースファイルを設置する場所を選択します。\r\nデフォルトはマイドキュメントのTDCGフォルダ配下です。\r\nこのオプションで変更できるの" +
107+ "はファイル情報データベースのみであり、システム設定情報の場所は変更出来ません。");
102108 //
103109 // Options
104110 //
@@ -105,8 +111,8 @@
105111 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
106112 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
107113 this.ClientSize = new System.Drawing.Size(678, 96);
108- this.Controls.Add(this.buttonTahWorkFolderRef);
109- this.Controls.Add(this.textBoxTahWorkFolder);
114+ this.Controls.Add(this.buttonDBFolderRef);
115+ this.Controls.Add(this.textBoxDBFolder);
110116 this.Controls.Add(this.label2);
111117 this.Controls.Add(this.button1);
112118 this.Controls.Add(this.buttonArcsFolderRef);
@@ -125,8 +131,9 @@
125131 private System.Windows.Forms.TextBox textBoxArcsFolderPath;
126132 private System.Windows.Forms.Button buttonArcsFolderRef;
127133 private System.Windows.Forms.Button button1;
128- private System.Windows.Forms.Button buttonTahWorkFolderRef;
129- private System.Windows.Forms.TextBox textBoxTahWorkFolder;
134+ private System.Windows.Forms.ToolTip toolTip1;
135+ private System.Windows.Forms.Button buttonDBFolderRef;
136+ private System.Windows.Forms.TextBox textBoxDBFolder;
130137 private System.Windows.Forms.Label label2;
131138 }
132139 }
\ No newline at end of file
--- TSOSorter/Source/TextResource.Designer.cs (revision 4)
+++ TSOSorter/Source/TextResource.Designer.cs (revision 5)
@@ -196,6 +196,15 @@
196196 }
197197
198198 /// <summary>
199+ /// {0}の拡張子整合性をチェック… に類似しているローカライズされた文字列を検索します。
200+ /// </summary>
201+ public static string CheckExtFile {
202+ get {
203+ return ResourceManager.GetString("CheckExtFile", resourceCulture);
204+ }
205+ }
206+
207+ /// <summary>
199208 /// 閉じる に類似しているローカライズされた文字列を検索します。
200209 /// </summary>
201210 public static string Close {
@@ -475,6 +484,51 @@
475484 }
476485
477486 /// <summary>
487+ /// {0}→{1}のリネームに失敗しました に類似しているローカライズされた文字列を検索します。
488+ /// </summary>
489+ public static string ErrorRenameFailed {
490+ get {
491+ return ResourceManager.GetString("ErrorRenameFailed", resourceCulture);
492+ }
493+ }
494+
495+ /// <summary>
496+ /// arcsdbの更新に失敗しました に類似しているローカライズされた文字列を検索します。
497+ /// </summary>
498+ public static string ErrorUpdateArcsDBFailed {
499+ get {
500+ return ResourceManager.GetString("ErrorUpdateArcsDBFailed", resourceCulture);
501+ }
502+ }
503+
504+ /// <summary>
505+ /// 存在しないファイルです。DB再構築を実施してください に類似しているローカライズされた文字列を検索します。
506+ /// </summary>
507+ public static string ErrorUpdateExt {
508+ get {
509+ return ResourceManager.GetString("ErrorUpdateExt", resourceCulture);
510+ }
511+ }
512+
513+ /// <summary>
514+ /// 拡張子チェック中エラー発生 に類似しているローカライズされた文字列を検索します。
515+ /// </summary>
516+ public static string ErrorUpdateExtToolTip {
517+ get {
518+ return ResourceManager.GetString("ErrorUpdateExtToolTip", resourceCulture);
519+ }
520+ }
521+
522+ /// <summary>
523+ /// filedbの更新に失敗しました に類似しているローカライズされた文字列を検索します。
524+ /// </summary>
525+ public static string ErrorUpdateFilesDBFailed {
526+ get {
527+ return ResourceManager.GetString("ErrorUpdateFilesDBFailed", resourceCulture);
528+ }
529+ }
530+
531+ /// <summary>
478532 /// 終了 に類似しているローカライズされた文字列を検索します。
479533 /// </summary>
480534 public static string Exit {
@@ -565,6 +619,15 @@
565619 }
566620
567621 /// <summary>
622+ /// 有効/無効 に類似しているローカライズされた文字列を検索します。
623+ /// </summary>
624+ public static string FileEnable {
625+ get {
626+ return ResourceManager.GetString("FileEnable", resourceCulture);
627+ }
628+ }
629+
630+ /// <summary>
568631 /// ファイル に類似しているローカライズされた文字列を検索します。
569632 /// </summary>
570633 public static string FileMenu {
@@ -1303,6 +1366,15 @@
13031366 }
13041367
13051368 /// <summary>
1369+ /// 拡張子の整合性チェック完了 に類似しているローカライズされた文字列を検索します。
1370+ /// </summary>
1371+ public static string SuccessCheckExt {
1372+ get {
1373+ return ResourceManager.GetString("SuccessCheckExt", resourceCulture);
1374+ }
1375+ }
1376+
1377+ /// <summary>
13061378 /// 3DCG MODS Referenceサーバから最新情報を取得しました に類似しているローカライズされた文字列を検索します。
13071379 /// </summary>
13081380 public static string SuccessModRefServer {
@@ -1312,6 +1384,15 @@
13121384 }
13131385
13141386 /// <summary>
1387+ /// {0} をリネームしました。 に類似しているローカライズされた文字列を検索します。
1388+ /// </summary>
1389+ public static string SuccessRename {
1390+ get {
1391+ return ResourceManager.GetString("SuccessRename", resourceCulture);
1392+ }
1393+ }
1394+
1395+ /// <summary>
13151396 /// アニメーション開始 に類似しているローカライズされた文字列を検索します。
13161397 /// </summary>
13171398 public static string SwitchToMortionEnabled {
--- TSOSorter/Source/FileViewer.cs (revision 4)
+++ TSOSorter/Source/FileViewer.cs (revision 5)
@@ -13,30 +13,43 @@
1313 {
1414 public class FileViewer : Control
1515 {
16+ public enum ColumnType
17+ {
18+ FILEROWID, // rowid(files.db
19+ ENABLE, // 有効無効
20+ HEAD, // NXXXXXXX_の部分
21+ CATEGORY, // カテゴリ
22+ DIR_PATH, // arcsからの相対パス
23+ FILENAME, // ファイル名
24+ }
1625 private ContextMenuStrip contextMenuStrip1;
1726 private DataGridView dataGridView1;
27+ public DataGridView DataGridView
28+ {
29+ get { return dataGridView1; }
30+ }
1831 private System.ComponentModel.IContainer components;
32+ private ToolStripMenuItem toolStripMenuItemEnable;
1933
20- private string m_strFileDBPath; // 作業用DB
34+// private string m_strFileDBPath; // 作業用DB
2135
2236 /** コンストラクタ
2337 * */
2438 public FileViewer()
2539 {
40+
2641 // DBPath設定
27- m_strFileDBPath = Path.Combine(
28- TSOSorter.TDCGExplorer.SystemDB.m_strTahWorkPath, "files.db");
42+// m_strFileDBPath = Path.Combine(
43+// TSOSorter.TDCGExplorer.SystemDB.m_strTahWorkPath, "files.db");
2944
3045 InitializeComponent();
3146 // dataGridViewを設定
32- DataTable data = setupDataTable();
33- dataGridView1.DataSource = data;
47+ clearTable();
3448 Controls.Add(dataGridView1);
3549 }
3650
3751 public void clearTable()
3852 {
39- //dataGridView1.Rows.Clear();
4053 dataGridView1.DataSource = setupDataTable();
4154 }
4255 /** dataGridViewのテーブル作成
@@ -46,12 +59,22 @@
4659 DataTable data = new DataTable();
4760 // ROWID
4861 data.Columns.Add("ID", Type.GetType("System.String"));
62+ data.Columns.Add(TSOSorter.TextResource.FileEnable, typeof(bool));
63+ data.Columns.Add(TSOSorter.TextResource.TBNHead, Type.GetType("System.String"));
64+ data.Columns.Add(TSOSorter.TextResource.Category, Type.GetType("System.String"));
4965 // TAH dir
5066 data.Columns.Add(TSOSorter.TextResource.Directory, Type.GetType("System.String"));
5167 // TAH File Name
5268 data.Columns.Add(TSOSorter.TextResource.Filename, Type.GetType("System.String"));
53- data.Columns.Add(TSOSorter.TextResource.TBNHead, Type.GetType("System.String"));
54- data.Columns.Add(TSOSorter.TextResource.Category , Type.GetType("System.String"));
69+ for (int i = 0; i < data.Columns.Count; i++)
70+ {
71+ bool bIsReadOnly = true;
72+ if( i == (int)ColumnType.ENABLE ) {
73+ bIsReadOnly = false;
74+ }
75+ data.Columns[i].ReadOnly = bIsReadOnly;
76+
77+ }
5578 return data;
5679 }
5780 private void InitializeComponent()
@@ -58,36 +81,64 @@
5881 {
5982 this.components = new System.ComponentModel.Container();
6083 this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
84+ this.toolStripMenuItemEnable = new System.Windows.Forms.ToolStripMenuItem();
6185 this.dataGridView1 = new System.Windows.Forms.DataGridView();
86+ this.contextMenuStrip1.SuspendLayout();
6287 ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
6388 this.SuspendLayout();
6489 //
6590 // contextMenuStrip1
6691 //
92+ this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
93+ this.toolStripMenuItemEnable});
6794 this.contextMenuStrip1.Name = "contextMenuStrip1";
68- this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4);
95+ this.contextMenuStrip1.Size = new System.Drawing.Size(202, 26);
96+ this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
6997 //
98+ // toolStripMenuItemEnable
99+ //
100+ this.toolStripMenuItemEnable.Name = "toolStripMenuItemEnable";
101+ this.toolStripMenuItemEnable.Size = new System.Drawing.Size(201, 22);
102+ this.toolStripMenuItemEnable.Text = "有効化/無効化切り替え";
103+ this.toolStripMenuItemEnable.Click += new System.EventHandler(this.toolStripMenuItemClose_Click);
104+ //
70105 // dataGridView1
71106 //
72107 this.dataGridView1.AllowUserToAddRows = false;
73108 this.dataGridView1.AllowUserToDeleteRows = false;
74109 this.dataGridView1.AllowUserToResizeRows = false;
110+ this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
75111 this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
112+ this.dataGridView1.ContextMenuStrip = this.contextMenuStrip1;
76113 this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
77114 this.dataGridView1.Location = new System.Drawing.Point(0, 0);
78115 this.dataGridView1.MultiSelect = false;
79116 this.dataGridView1.Name = "dataGridView1";
80- this.dataGridView1.ReadOnly = true;
81117 this.dataGridView1.RowTemplate.Height = 21;
82118 this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
83119 this.dataGridView1.Size = new System.Drawing.Size(240, 150);
84120 this.dataGridView1.TabIndex = 0;
121+ this.dataGridView1.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellValueChanged);
122+ this.dataGridView1.CellMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridView1_CellMouseClick);
123+ this.dataGridView1.CellContextMenuStripNeeded += new System.Windows.Forms.DataGridViewCellContextMenuStripNeededEventHandler(this.dataGridView1_CellContextMenuStripNeeded);
124+ this.dataGridView1.CellValidating += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.dataGridView1_CellValidating);
85125 this.dataGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellClick);
126+ this.dataGridView1.CurrentCellDirtyStateChanged += new System.EventHandler(this.dataGridView1_CurrentCellDirtyStateChanged);
127+ this.contextMenuStrip1.ResumeLayout(false);
86128 ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
87129 this.ResumeLayout(false);
88130
89131 }
132+ /** 有効無効の切り替え
133+ * */
134+ private void toolStripMenuItemClose_Click(object sender, EventArgs e)
135+ {
136+ int nRowIndex = dataGridView1.SelectedRows[0].Index;
137+ // チェックボックス切り替え
138+ dataGridView1[(int)ColumnType.ENABLE, nRowIndex].Value = !(bool)dataGridView1[(int)ColumnType.ENABLE, nRowIndex].Value;
90139
140+ //this.renameFile(dataGridView1.SelectedRows[0].Index);
141+ }
91142 /** ファイルをDBから取得して追加
92143 * */
93144 public void AddFiles(TSOSorter.FileDatabase filedb, string strPartType)
@@ -104,9 +155,18 @@
104155 {
105156 continue;
106157 }
158+ bool bIsEnable = (string)obj[(int)ColumnType.ENABLE] == "true";
159+
160+ // if disabled tah file(.@tah) to skip
161+ if (! Program.MainFormWindow.CheckBoxShowDisableTAH.Checked && ! bIsEnable)
162+ {
163+ continue;
164+ }
165+
107166 DataRow row = data.NewRow();
108167 //
109168 row.ItemArray = obj;
169+ row.ItemArray[(int)ColumnType.ENABLE] = bIsEnable;
110170 data.Rows.Add(row);
111171 }
112172 dataGridView1.DataSource = data;
@@ -122,7 +182,16 @@
122182 {
123183 return null;
124184 }
125- string[] content = { nFileRowID.ToString(),Path.GetDirectoryName( fileEntry.m_strPath ), fileEntry.m_strShortName, tsoNameEntry.m_strMODName, strPartType };
185+ bool bIsEnable = true; // 有効なファイルか?
186+ // ".tah"以外のファイル...(?tah)
187+ if (Path.GetExtension(fileEntry.m_strPath).ToLower() != ".tah")
188+ {
189+ // disable
190+ bIsEnable = false;
191+ }
192+ string[] content = { nFileRowID.ToString(), bIsEnable ? "true" : "false",
193+ tsoNameEntry.m_strMODName, strPartType,
194+ Path.GetDirectoryName( fileEntry.m_strPath ), fileEntry.m_strShortName};
126195 return content;
127196 }
128197
@@ -141,14 +210,17 @@
141210 System.Windows.Forms.DataGridViewRow dgr = dataGridView1.CurrentRow;
142211 System.Data.DataRowView drv = (System.Data.DataRowView)dgr.DataBoundItem;
143212 System.Data.DataRow dr = (System.Data.DataRow)drv.Row;
144- int nFileRowID = int.Parse(dr.ItemArray[0].ToString());
213+ int nFileRowID = int.Parse(dr.ItemArray[(int)ColumnType.FILEROWID].ToString());
145214
146215 // get current category
147216 string strPartType = Program.MainFormWindow.getCategoryStringFromComboBoxPartsType();
148217 if (nFileRowID >= 0)
149218 {
219+ // file entry取得
150220 FileEntry fileEntry = TSOSorter.TDCGExplorer.FileDB.getFileEntry(nFileRowID);
221+ // arc tah entry 取得
151222 ArcsTahEntry entry = TSOSorter.TDCGExplorer.ArcsDB.GetTah(fileEntry.m_strPath);
223+ // info作成
152224 GenericArcsTahInfo info = new GenericArcsTahInfo(entry);
153225 // TAHViewをセットアップ
154226 Program.MainFormWindow.TAHViewer.Setup(info,
@@ -175,6 +247,221 @@
175247 doAfterSelectRow(e.RowIndex);
176248 }
177249
250+ private void contextMenuStrip1_Opening(object sender, System.ComponentModel.CancelEventArgs e)
251+ {
178252
253+ }
254+
255+ private void dataGridView1_CurrentCellDirtyStateChanged(object sender, EventArgs e)
256+ {
257+
258+ if (dataGridView1.CurrentCellAddress.X == 1 &&
259+ dataGridView1.IsCurrentCellDirty)
260+ {
261+ // コミット
262+ dataGridView1.CommitEdit(DataGridViewDataErrorContexts.Commit );
263+ }
264+ }
265+
266+ private void renameFile(int nRowIndex)
267+ {
268+ // データの有効・無効を変更
269+ // ファイル名変更
270+ // グリッド情報取得
271+ System.Windows.Forms.DataGridViewRow dgr = dataGridView1.CurrentRow;
272+ System.Data.DataRowView drv = (System.Data.DataRowView)dgr.DataBoundItem;
273+ System.Data.DataRow dr = (System.Data.DataRow)drv.Row;
274+
275+ // dir and file path(for arcs.db)
276+ string strOldPath = Path.Combine(
277+ dr.ItemArray[(int)ColumnType.DIR_PATH].ToString(),
278+ dr.ItemArray[(int)ColumnType.FILENAME].ToString());
279+
280+ // 現在の状況(すなわちチェック変更後の状態
281+ bool bIsChecked = (bool)dataGridView1[(int)ColumnType.ENABLE, nRowIndex].Value;
282+
283+ // 変更後の拡張子
284+ string strNewExtension = ".tah";
285+ if (!bIsChecked)
286+ {
287+ strNewExtension = ".@tah";
288+ }
289+ // リネーム後のパス
290+ string strNewPath = Path.ChangeExtension(
291+ strOldPath, strNewExtension);
292+
293+ // ファイルをリネームする
294+ string strOldFullPath = Path.Combine(
295+ TSOSorter.TDCGExplorer.SystemDB.m_strArcPath, strOldPath);
296+
297+ // リネーム後のファイルパス
298+ string strNewFullPath = Path.ChangeExtension(
299+ strOldFullPath, strNewExtension);
300+
301+ // if リネーム後も同じファイルパスだった(ありえないが…
302+ if (strOldPath == strNewPath)
303+ {
304+ return;
305+ }
306+
307+ // filedbアップデート
308+ FileDatabase filedb = TSOSorter.TDCGExplorer.FileDB;
309+ // file rowid(for files.db)
310+ int nFileRowID = int.Parse(dr.ItemArray[0].ToString());
311+ // file entry get
312+ FileEntry fentry = filedb.getFileEntry(nFileRowID);
313+ if (nFileRowID < 0)
314+ {
315+ return;
316+ }
317+
318+ string strOldFileEntryPath = fentry.m_strPath;
319+ string strOldFileEntryShortPath = fentry.m_strShortName;
320+ // rename
321+ fentry.m_strPath = Path.ChangeExtension(fentry.m_strPath, strNewExtension);
322+ fentry.m_strShortName = Path.ChangeExtension(fentry.m_strShortName, strNewExtension);
323+
324+ try
325+ {
326+ using (SQLiteTransaction transaction = filedb.BeginTransaction())
327+ {
328+
329+ // update file entry
330+ filedb.UpdateFileEntry(nFileRowID, fentry);
331+ transaction.Commit();
332+ }
333+ }
334+ catch (Exception e)
335+ {
336+ Debug.Write(e.Message);
337+ TSOSorter.TDCGExplorer.SetToolTips(TextResource.ErrorUpdateFilesDBFailed);
338+ return;
339+ }
340+
341+ // update grid view
342+ DataTable dataTable = dataGridView1.DataSource as DataTable;
343+ dataTable.Columns[(int)ColumnType.FILENAME].ReadOnly = false;
344+ dataTable.Rows[nRowIndex][(int)ColumnType.FILENAME] = Path.GetFileName(strNewPath);
345+ dataTable.Columns[(int)ColumnType.FILENAME].ReadOnly = true;
346+ dataGridView1.UpdateCellValue( (int)ColumnType.FILENAME, nRowIndex );
347+ // dr.ItemArray[(int)ColumnType.FILENAME] = Path.GetFileName(strNewPath);
348+// dataGridView1[(int)ColumnType.FILENAME, nRowIndex].Value = Path.GetFileName(strNewPath);
349+
350+
351+ ArcsDatabase arcsdb = TSOSorter.TDCGExplorer.ArcsDB;
352+ // get tah entry
353+ ArcsTahEntry tahentry = arcsdb.GetTah(strOldPath);
354+ if (tahentry == null)
355+ {
356+ tahentry = arcsdb.GetTah( Path.ChangeExtension( strOldPath, strNewExtension ) );
357+ }
358+ if (tahentry == null)
359+ {
360+ return;
361+ }
362+ tahentry.path = Path.ChangeExtension(tahentry.path, strNewExtension);
363+ tahentry.shortname = Path.ChangeExtension(tahentry.path, strNewExtension);
364+ try
365+ {
366+ using (SQLiteTransaction transaction = arcsdb.BeginTransaction())
367+ {
368+ arcsdb.UpdateArcsTahEntry(tahentry);
369+ transaction.Commit();
370+ }
371+ }
372+ catch (Exception e)
373+ {
374+ Debug.WriteLine(e.Message);
375+ TSOSorter.TDCGExplorer.SetToolTips(TextResource.ErrorUpdateArcsDBFailed);
376+ // コミットを元に戻す
377+ try
378+ {
379+ using (SQLiteTransaction transaction = filedb.BeginTransaction())
380+ {
381+ fentry.m_strPath = strOldFileEntryPath;
382+ fentry.m_strShortName = strOldFileEntryShortPath;
383+ filedb.UpdateFileEntry(nFileRowID, fentry);
384+ transaction.Commit();
385+ }
386+ }
387+ catch (Exception ex)
388+ {
389+ Debug.Write(ex.Message);
390+ TSOSorter.TDCGExplorer.SetToolTips(TextResource.ErrorUpdateFilesDBFailed);
391+ return;
392+ }
393+ return;
394+ }
395+
396+ try
397+ {
398+ if (File.Exists(strOldFullPath))
399+ {
400+ File.Move(strOldFullPath, strNewFullPath);
401+ }
402+ }
403+ catch (Exception e)
404+ {
405+ Debug.Write(e.Message);
406+ TSOSorter.TDCGExplorer.SetToolTips(string.Format(TextResource.ErrorRenameFailed,
407+ strOldPath, strNewPath));
408+ return;
409+ }
410+
411+ // 選択
412+ doAfterSelectRow(dataGridView1.SelectedRows[0].Index);
413+
414+ TSOSorter.TDCGExplorer.SetToolTips(string.Format(TextResource.SuccessRename, strOldPath));
415+ }
416+
417+ /** チェックボックス変更時
418+ * */
419+ private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
420+ {
421+ if( TSOSorter.TDCGExplorer.BusyTest()) {
422+ return;
423+ }
424+ if (e.ColumnIndex == (int)ColumnType.ENABLE)
425+ {
426+ renameFile(e.RowIndex);
427+ }
428+
429+ }
430+
431+
432+ // 要らんかった
433+ private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
434+ {
435+ if (e.ColumnIndex < 0 || e.RowIndex < 0)
436+ {
437+ return;
438+ }
439+/* if (e.Button == MouseButtons.Right)
440+ {
441+ // 選択
442+ DataGridViewCell cell = dataGridView1[e.ColumnIndex, e.RowIndex];
443+ cell.Selected = true;
444+ }*/
445+ }
446+
447+ private void dataGridView1_CellContextMenuStripNeeded(object sender, DataGridViewCellContextMenuStripNeededEventArgs e)
448+ {
449+ if (e.ColumnIndex < 0 || e.RowIndex < 0)
450+ {
451+ return;
452+ }
453+
454+ // 選択
455+ DataGridViewCell cell = dataGridView1[e.ColumnIndex, e.RowIndex];
456+ cell.Selected = true;
457+ }
458+
459+ private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
460+ {
461+
462+ }
463+
464+
465+
179466 }
180467 }
--- TSOSorter/Source/FileDump.cs (revision 4)
+++ TSOSorter/Source/FileDump.cs (revision 5)
@@ -68,6 +68,7 @@
6868 int nFileRowID = db.AddFile(fileentry);
6969 if (nFileRowID < 0)
7070 {
71+ Debug.WriteLine("FileRowID=" + nFileRowID);
7172 return;
7273 }
7374
@@ -77,6 +78,7 @@
7778 }
7879 catch (Exception e)
7980 {
81+ Debug.WriteLine( string.Format("filepath={0}", filepath) );
8082 Debug.WriteLine(e.Message);
8183 }
8284 }
@@ -108,14 +110,44 @@
108110 if( ! ent.FileName.StartsWith("script/items" ) ) {
109111 continue;
110112 }
113+
114+ string strFileName = Path.GetFileName(ent.FileName); // file name
115+ string strWithoutExt = Path.GetFileNameWithoutExtension(ent.FileName );
116+
111117 TbnEntry tsoentry = new TbnEntry();
112118 // 「NXXXXXXX_A99」
113- tsoentry.m_strTBNName = Path.GetFileNameWithoutExtension(ent.FileName );
119+ tsoentry.m_strTBNName = strWithoutExt;
114120 // 「NXXXXXXX_」
115- tsoentry.m_strMODName = Path.GetFileName(ent.FileName).Substring(0,9 );
116- // 「A」
117- tsoentry.m_strTypeString = Path.GetFileName(ent.FileName).Substring(9, 1);
118- db.AddTBN(nFileRowID, tsoentry);
121+ tsoentry.m_strMODName = strWithoutExt;
122+ try
123+ {
124+ if (strFileName.Length >= 9)
125+ {
126+ tsoentry.m_strMODName = Path.GetFileName(ent.FileName).Substring(0, 9);
127+ }
128+ else
129+ {
130+ Debug.WriteLine(string.Format("{0} is too short", strFileName));
131+ }
132+ // 「A」
133+ tsoentry.m_strTypeString = "?";
134+ if (strFileName.Length >= 10)
135+ {
136+ tsoentry.m_strTypeString = strFileName.Substring(9, 1);
137+ }
138+ }
139+ catch (Exception e)
140+ {
141+ Debug.WriteLine(e);
142+ }
143+ try
144+ {
145+ db.AddTBN(nFileRowID, tsoentry);
146+ }
147+ catch (Exception e)
148+ {
149+ Debug.WriteLine(e);
150+ }
119151 }
120152 }
121153 }
--- TSOSorter/Source/MainForm.Designer.cs (revision 4)
+++ TSOSorter/Source/MainForm.Designer.cs (revision 5)
@@ -34,6 +34,7 @@
3434 this.終了ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
3535 this.表示ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
3636 this.arcsデータベースの構築更新ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
37+ this.toolStripMenuItemCheckExt = new System.Windows.Forms.ToolStripMenuItem();
3738 this.RefleshToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
3839 this.ツールToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
3940 this.オプションToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -43,6 +44,7 @@
4344 this.treeViewArcs = new System.Windows.Forms.TreeView();
4445 this.splitContainerRight = new System.Windows.Forms.SplitContainer();
4546 this.splitContainerTop = new System.Windows.Forms.SplitContainer();
47+ this.checkBoxBlockExtChange = new System.Windows.Forms.CheckBox();
4648 this.comboBoxPartsType = new System.Windows.Forms.ComboBox();
4749 this.checkBoxRecursive = new System.Windows.Forms.CheckBox();
4850 this.label2 = new System.Windows.Forms.Label();
@@ -50,12 +52,13 @@
5052 this.checkBoxAtTAH = new System.Windows.Forms.CheckBox();
5153 this.label1 = new System.Windows.Forms.Label();
5254 this.splitContainerInfo = new System.Windows.Forms.SplitContainer();
55+ this.pictureBox1 = new System.Windows.Forms.PictureBox();
5356 this.textBox1 = new System.Windows.Forms.TextBox();
5457 this.splitContainerTAH = new System.Windows.Forms.SplitContainer();
5558 this.statusStrip1 = new System.Windows.Forms.StatusStrip();
5659 this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
5760 this.timer1 = new System.Windows.Forms.Timer(this.components);
58- this.pictureBox1 = new System.Windows.Forms.PictureBox();
61+ this.toolTipBlockExt = new System.Windows.Forms.ToolTip(this.components);
5962 this.menuStrip1.SuspendLayout();
6063 this.splitContainerAll.Panel1.SuspendLayout();
6164 this.splitContainerAll.Panel2.SuspendLayout();
@@ -69,9 +72,9 @@
6972 this.splitContainerInfo.Panel1.SuspendLayout();
7073 this.splitContainerInfo.Panel2.SuspendLayout();
7174 this.splitContainerInfo.SuspendLayout();
75+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
7276 this.splitContainerTAH.SuspendLayout();
7377 this.statusStrip1.SuspendLayout();
74- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
7578 this.SuspendLayout();
7679 //
7780 // menuStrip1
@@ -106,6 +109,7 @@
106109 //
107110 this.表示ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
108111 this.arcsデータベースの構築更新ToolStripMenuItem,
112+ this.toolStripMenuItemCheckExt,
109113 this.RefleshToolStripMenuItem});
110114 this.表示ToolStripMenuItem.Name = "表示ToolStripMenuItem";
111115 this.表示ToolStripMenuItem.Size = new System.Drawing.Size(44, 22);
@@ -116,8 +120,18 @@
116120 this.arcsデータベースの構築更新ToolStripMenuItem.Name = "arcsデータベースの構築更新ToolStripMenuItem";
117121 this.arcsデータベースの構築更新ToolStripMenuItem.Size = new System.Drawing.Size(245, 22);
118122 this.arcsデータベースの構築更新ToolStripMenuItem.Text = "Arcsデータベースの構築・更新";
123+ this.arcsデータベースの構築更新ToolStripMenuItem.ToolTipText = "arcsフォルダ配下のTAHファイルを検索してファイル情報を登録します。\r\nTDCGManで除外された\".@tah\"ファイルもチェックします。\r\n「\".@tah\"" +
124+ "も検索」チェックボックスがOFFになっていても、データベースには登録されます。";
119125 this.arcsデータベースの構築更新ToolStripMenuItem.Click += new System.EventHandler(this.RebuildDBToolStripMenuItem_Click);
120126 //
127+ // toolStripMenuItemCheckExt
128+ //
129+ this.toolStripMenuItemCheckExt.Name = "toolStripMenuItemCheckExt";
130+ this.toolStripMenuItemCheckExt.Size = new System.Drawing.Size(245, 22);
131+ this.toolStripMenuItemCheckExt.Text = "拡張子チェック";
132+ this.toolStripMenuItemCheckExt.ToolTipText = "拡張子が外部で変更されたかチェックし、ファイルデータベースを更新します。\r\nチェック対象は\".tah\"⇔\".@tah\"のみです。";
133+ this.toolStripMenuItemCheckExt.Click += new System.EventHandler(this.toolStripMenuItemCheckExt_Click);
134+ //
121135 // RefleshToolStripMenuItem
122136 //
123137 this.RefleshToolStripMenuItem.Name = "RefleshToolStripMenuItem";
@@ -124,6 +138,7 @@
124138 this.RefleshToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F5;
125139 this.RefleshToolStripMenuItem.Size = new System.Drawing.Size(245, 22);
126140 this.RefleshToolStripMenuItem.Text = "最新の情報を表示";
141+ this.RefleshToolStripMenuItem.ToolTipText = "フォルダ一覧ツリーを更新します。";
127142 this.RefleshToolStripMenuItem.Click += new System.EventHandler(this.RefleshToolStripMenuItem_Click);
128143 //
129144 // ツールToolStripMenuItem
@@ -137,7 +152,7 @@
137152 // オプションToolStripMenuItem
138153 //
139154 this.オプションToolStripMenuItem.Name = "オプションToolStripMenuItem";
140- this.オプションToolStripMenuItem.Size = new System.Drawing.Size(148, 22);
155+ this.オプションToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
141156 this.オプションToolStripMenuItem.Text = "オプション...";
142157 this.オプションToolStripMenuItem.Click += new System.EventHandler(this.OptionsToolStripMenuItem_Click);
143158 //
@@ -210,6 +225,7 @@
210225 //
211226 // splitContainerTop.Panel1
212227 //
228+ this.splitContainerTop.Panel1.Controls.Add(this.checkBoxBlockExtChange);
213229 this.splitContainerTop.Panel1.Controls.Add(this.comboBoxPartsType);
214230 this.splitContainerTop.Panel1.Controls.Add(this.checkBoxRecursive);
215231 this.splitContainerTop.Panel1.Controls.Add(this.label2);
@@ -224,6 +240,18 @@
224240 this.splitContainerTop.SplitterDistance = 184;
225241 this.splitContainerTop.TabIndex = 0;
226242 //
243+ // checkBoxBlockExtChange
244+ //
245+ this.checkBoxBlockExtChange.AutoSize = true;
246+ this.checkBoxBlockExtChange.Location = new System.Drawing.Point(9, 68);
247+ this.checkBoxBlockExtChange.Name = "checkBoxBlockExtChange";
248+ this.checkBoxBlockExtChange.Size = new System.Drawing.Size(117, 16);
249+ this.checkBoxBlockExtChange.TabIndex = 8;
250+ this.checkBoxBlockExtChange.Text = "拡張子変更を抑止";
251+ this.toolTipBlockExt.SetToolTip(this.checkBoxBlockExtChange, "拡張子変更機能を抑止します。\r\n「有効/無効」カラムをクリックしても変更が反映されなくなります。");
252+ this.checkBoxBlockExtChange.UseVisualStyleBackColor = true;
253+ this.checkBoxBlockExtChange.CheckedChanged += new System.EventHandler(this.checkBoxBlockExtChange_CheckedChanged);
254+ //
227255 // comboBoxPartsType
228256 //
229257 this.comboBoxPartsType.FormattingEnabled = true;
@@ -262,12 +290,13 @@
262290 this.comboBoxPartsType.Name = "comboBoxPartsType";
263291 this.comboBoxPartsType.Size = new System.Drawing.Size(162, 20);
264292 this.comboBoxPartsType.TabIndex = 7;
293+ this.toolTipBlockExt.SetToolTip(this.comboBoxPartsType, "表示したいレーンのパーツタイプを選択します。");
265294 this.comboBoxPartsType.SelectedIndexChanged += new System.EventHandler(this.comboBoxPartsType_SelectedIndexChanged);
266295 //
267296 // checkBoxRecursive
268297 //
269298 this.checkBoxRecursive.AutoSize = true;
270- this.checkBoxRecursive.Location = new System.Drawing.Point(3, 3);
299+ this.checkBoxRecursive.Location = new System.Drawing.Point(9, 3);
271300 this.checkBoxRecursive.Name = "checkBoxRecursive";
272301 this.checkBoxRecursive.Size = new System.Drawing.Size(123, 16);
273302 this.checkBoxRecursive.TabIndex = 0;
@@ -290,7 +319,7 @@
290319 this.comboBoxAa.Items.AddRange(new object[] {
291320 "ABab(カスタム少女本体方式)",
292321 "AaBb(エクスプローラ方式)"});
293- this.comboBoxAa.Location = new System.Drawing.Point(9, 69);
322+ this.comboBoxAa.Location = new System.Drawing.Point(9, 41);
294323 this.comboBoxAa.Name = "comboBoxAa";
295324 this.comboBoxAa.Size = new System.Drawing.Size(162, 20);
296325 this.comboBoxAa.TabIndex = 3;
@@ -299,18 +328,19 @@
299328 // checkBoxAtTAH
300329 //
301330 this.checkBoxAtTAH.AutoSize = true;
302- this.checkBoxAtTAH.Location = new System.Drawing.Point(2, 25);
331+ this.checkBoxAtTAH.Location = new System.Drawing.Point(9, 25);
303332 this.checkBoxAtTAH.Name = "checkBoxAtTAH";
304333 this.checkBoxAtTAH.Size = new System.Drawing.Size(81, 16);
305334 this.checkBoxAtTAH.TabIndex = 5;
306335 this.checkBoxAtTAH.Text = "@tahを表示";
336+ this.toolTipBlockExt.SetToolTip(this.checkBoxAtTAH, "TDCG Manで無効化された「.@tah」ファイルも表示するようにします。");
307337 this.checkBoxAtTAH.UseVisualStyleBackColor = true;
308- this.checkBoxAtTAH.Visible = false;
338+ this.checkBoxAtTAH.CheckedChanged += new System.EventHandler(this.checkBoxAtTAH_CheckedChanged);
309339 //
310340 // label1
311341 //
312342 this.label1.AutoSize = true;
313- this.label1.Location = new System.Drawing.Point(2, 54);
343+ this.label1.Location = new System.Drawing.Point(2, 44);
314344 this.label1.Name = "label1";
315345 this.label1.Size = new System.Drawing.Size(111, 12);
316346 this.label1.TabIndex = 4;
@@ -335,6 +365,14 @@
335365 this.splitContainerInfo.SplitterDistance = 133;
336366 this.splitContainerInfo.TabIndex = 0;
337367 //
368+ // pictureBox1
369+ //
370+ this.pictureBox1.Location = new System.Drawing.Point(3, 3);
371+ this.pictureBox1.Name = "pictureBox1";
372+ this.pictureBox1.Size = new System.Drawing.Size(128, 128);
373+ this.pictureBox1.TabIndex = 0;
374+ this.pictureBox1.TabStop = false;
375+ //
338376 // textBox1
339377 //
340378 this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -380,14 +418,6 @@
380418 this.timer1.Enabled = true;
381419 this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
382420 //
383- // pictureBox1
384- //
385- this.pictureBox1.Location = new System.Drawing.Point(3, 3);
386- this.pictureBox1.Name = "pictureBox1";
387- this.pictureBox1.Size = new System.Drawing.Size(128, 128);
388- this.pictureBox1.TabIndex = 0;
389- this.pictureBox1.TabStop = false;
390- //
391421 // MainForm
392422 //
393423 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -398,7 +428,7 @@
398428 this.Controls.Add(this.menuStrip1);
399429 this.MainMenuStrip = this.menuStrip1;
400430 this.Name = "MainForm";
401- this.Text = "TSOSorter";
431+ this.Text = "TBNSorter ver1.01";
402432 this.Load += new System.EventHandler(this.MainForm_Load);
403433 this.menuStrip1.ResumeLayout(false);
404434 this.menuStrip1.PerformLayout();
@@ -416,10 +446,10 @@
416446 this.splitContainerInfo.Panel2.ResumeLayout(false);
417447 this.splitContainerInfo.Panel2.PerformLayout();
418448 this.splitContainerInfo.ResumeLayout(false);
449+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
419450 this.splitContainerTAH.ResumeLayout(false);
420451 this.statusStrip1.ResumeLayout(false);
421452 this.statusStrip1.PerformLayout();
422- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
423453 this.ResumeLayout(false);
424454 this.PerformLayout();
425455
@@ -454,6 +484,9 @@
454484 private System.Windows.Forms.Timer timer1;
455485 private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
456486 private System.Windows.Forms.PictureBox pictureBox1;
487+ private System.Windows.Forms.CheckBox checkBoxBlockExtChange;
488+ private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemCheckExt;
489+ private System.Windows.Forms.ToolTip toolTipBlockExt;
457490 }
458491 }
459492
--- TSOSorter/Source/MainForm.cs (revision 4)
+++ TSOSorter/Source/MainForm.cs (revision 5)
@@ -9,6 +9,7 @@
99 using System.Diagnostics;
1010 using TDCGExplorer;
1111 using System.IO;
12+using System.Data.SQLite;
1213
1314 namespace TSOSorter
1415 {
@@ -25,8 +26,18 @@
2526 {
2627 m_FileViewer = new FileViewer();
2728 m_TAHViewer = new TAHViewer();
29+ m_nComboBoxPartTypeSelected = 0;
2830
2931 InitializeComponent();
32+ }
33+
34+ private void MainForm_Load(object sender, EventArgs e)
35+ {
36+ // SystemDB情報を反映
37+ SystemDatabase sysdb = TDCGExplorer.SystemDB;
38+ checkBoxAtTAH.Checked = sysdb.m_bIsShowDisableTah;
39+ checkBoxBlockExtChange.Checked = sysdb.m_bIsBlockChangeExt;
40+
3041 // FileViewer, TAHViewerを登録
3142 splitContainerTAH.Panel1.Controls.Add(m_FileViewer);
3243 m_FileViewer.Size = splitContainerTAH.Panel1.PreferredSize;
@@ -33,10 +44,7 @@
3344 m_FileViewer.Dock = DockStyle.Fill;
3445 splitContainerTAH.Panel2.Controls.Add(m_TAHViewer);
3546 m_TAHViewer.Dock = DockStyle.Fill;
36- }
3747
38- private void MainForm_Load(object sender, EventArgs e)
39- {
4048 // 選択状態を確定
4149 comboBoxAa.SelectedIndex = 0;
4250 comboBoxPartsType.SelectedIndex = 0;
@@ -44,6 +52,8 @@
4452 // DB構築済みならツリーをアップデートする
4553 TDCGExplorer.IfReadyDbDisplayArcsDB();
4654
55+ // ブロック処理
56+ doBlockExtChange();
4757 }
4858
4959 /** ツリーボックスのクリア
@@ -322,6 +332,15 @@
322332 {
323333 get { return textBox1; }
324334 }
335+ public CheckBox CheckBoxBlockExtChange
336+ {
337+ get { return checkBoxBlockExtChange; }
338+ }
339+ public CheckBox CheckBoxShowDisableTAH
340+ {
341+ get { return checkBoxAtTAH; }
342+ }
343+
325344
326345 public void doAfterComboBoxPartsTypeChanged()
327346 {
@@ -328,6 +347,9 @@
328347 // update file list
329348 TDCGExplorer.insertFileViews();
330349 }
350+
351+ /** パーツコンボボックス変更時
352+ * */
331353 private void comboBoxPartsType_SelectedIndexChanged(object sender, EventArgs e)
332354 {
333355 m_nComboBoxPartTypeSelected = comboBoxPartsType.SelectedIndex;
@@ -340,6 +362,8 @@
340362 get { return pictureBox1; }
341363 }
342364
365+ /** PSDサムネ表示
366+ * */
343367 public void SetBitmap(Bitmap bitmap)
344368 {
345369 if (PictureBox.Image != null)
@@ -375,6 +399,161 @@
375399 }
376400
377401 }
402+
403+ public void makeTSOView()
404+ {
405+
406+ }
407+
408+ private void checkBoxAtTAH_CheckedChanged(object sender, EventArgs e)
409+ {
410+/* bool bIsChecked = checkBoxBlockExtChange.Checked;
411+ DataTable dataTable = m_FileViewer.DataGridView.DataSource as DataTable;
412+ dataTable.Columns[(int)FileViewer.ColumnType.ENABLE].ReadOnly = bIsChecked;
413+ * */
414+ SystemDatabase sysdb = TDCGExplorer.SystemDB;
415+ sysdb.m_bIsShowDisableTah = checkBoxAtTAH.Checked;
416+ // update fileviewer
417+ TDCGExplorer.insertFileViews();
418+ }
419+
420+ private void checkBoxBlockExtChange_CheckedChanged(object sender, EventArgs e)
421+ {
422+// DataTable dataTable = m_FileViewer.DataGridView.DataSource as DataTable;
423+// dataTable.Columns[(int)FileViewer.ColumnType.ENABLE].ReadOnly = CheckBoxBlockExtChange.Checked;
424+ doBlockExtChange();
425+ TDCGExplorer.SystemDB.m_bIsBlockChangeExt = checkBoxBlockExtChange.Checked;
426+ }
427+ private void doBlockExtChange()
428+ {
429+ if (m_FileViewer != null)
430+ {
431+ if (m_FileViewer.DataGridView.Columns.Count > 0)
432+ {
433+ m_FileViewer.DataGridView.Columns[(int)FileViewer.ColumnType.ENABLE].ReadOnly = CheckBoxBlockExtChange.Checked;
434+ }
435+ }
436+ }
437+
438+ /** 拡張子チェック
439+ * */
440+ private void toolStripMenuItemCheckExt_Click(object sender, EventArgs e)
441+ {
442+ updateExt();
443+ }
444+ public void updateExt() {
445+ SystemDatabase sysdb = TDCGExplorer.SystemDB;
446+
447+ try
448+ {
449+ SQLiteTransaction transaction = TDCGExplorer.ArcsDB.BeginTransaction();
450+ SQLiteTransaction tfile = TDCGExplorer.FileDB.BeginTransaction();
451+ updateExtRecursive(sysdb.m_strArcPath);
452+ tfile.Commit();
453+ transaction.Commit();
454+
455+ TDCGExplorer.SetToolTips(TextResource.SuccessCheckExt);
456+ }
457+ catch (Exception e)
458+ {
459+ Debug.Write(e.Message);
460+ TDCGExplorer.SetToolTips(TextResource.ErrorUpdateExtToolTip);
461+ }
462+
463+ // file viewer 更新
464+ TDCGExplorer.insertFileViews();
465+ }
466+
467+ /** ファイルを走査して拡張子の状態をチェック
468+ * */
469+ private void updateExtRecursive( string strDirPath ) {
470+ SystemDatabase sysdb = TDCGExplorer.SystemDB;
471+ ArcsDatabase arcsdb = TDCGExplorer.ArcsDB;
472+ FileDatabase filedb = TDCGExplorer.FileDB;
473+
474+ // ファイルをチェックし、拡張子が"@tah"か"tah"かをチェック。
475+ DirectoryInfo dir = new DirectoryInfo(strDirPath);
476+ FileInfo[] files = dir.GetFiles("*.*tah");
477+
478+ string strArcDirPath = sysdb.m_strArcPath; // arcsパス
479+
480+ foreach (FileInfo file in files)
481+ {
482+ // 例:hoge\piyo.tah
483+ string strPath = file.FullName.Substring(strArcDirPath.Length + 1); // 相対パス
484+ TDCGExplorer.SetToolTips(string.Format(TextResource.CheckExtFile, strPath));
485+ try
486+ {
487+ // get entry
488+ ArcsTahEntry tah = arcsdb.GetTah(strPath);
489+
490+ // NXXXXXXX_AXX
491+ // 実際のファイルの拡張子
492+ string strExt = Path.GetExtension(strPath);
493+
494+ // 変更されているか確認
495+ // arcs内の拡張子
496+ string strNewExt = ".tah";
497+ if (strExt.ToLower() == ".tah")
498+ {
499+ strNewExt = ".@tah";
500+ }
501+
502+ // 拡張子を変更してみる
503+ string strAnotherPath = Path.ChangeExtension(strPath, strNewExt);
504+ if (tah == null)
505+ {
506+
507+ ArcsTahEntry anotherTah = arcsdb.GetTah(strAnotherPath);
508+
509+ // if 変えた拡張子を持ったファイルが存在した...
510+ if (anotherTah != null)
511+ {
512+ // ...拡張子を実在するファイルのモノに変更する
513+ anotherTah.path = Path.ChangeExtension(anotherTah.path, strExt);
514+ anotherTah.shortname = Path.ChangeExtension(anotherTah.shortname, strExt);
515+
516+ arcsdb.UpdateArcsTahEntry(anotherTah);
517+ }
518+ else
519+ { // 存在しない...
520+ // 新規登録?
521+ TDCGExplorer.SetToolTips(TextResource.ErrorUpdateExt);
522+ }
523+ }
524+
525+ FileEntry fentry = filedb.getFileEntry(strPath);
526+ // 存在しない
527+ if (fentry == null)
528+ {
529+ FileEntry anotherFile = filedb.getFileEntry(strAnotherPath);
530+ if (anotherFile != null)
531+ {
532+ anotherFile.m_strPath = Path.ChangeExtension(anotherFile.m_strPath, strExt);
533+ anotherFile.m_strShortName = Path.ChangeExtension(anotherFile.m_strShortName, strExt);
534+
535+ int nFileRowID = filedb.getFileRowID(strAnotherPath);
536+ if (nFileRowID >= 0)
537+ {
538+ filedb.UpdateFileEntry(nFileRowID, anotherFile);
539+ }
540+ }
541+ }
542+ }catch( Exception e ) {
543+ Debug.WriteLine(e.Message);
544+ Debug.WriteLine("Checking Ext of {0} failed", strPath);
545+ }
546+ }
547+ // recursive
548+ DirectoryInfo[] dirs = dir.GetDirectories();
549+ foreach (DirectoryInfo subdir in dirs)
550+ {
551+ updateExtRecursive(subdir.FullName);
552+ }
553+
554+ }
555+
556+
378557 }
379558
380559 }
--- TSOSorter/Source/TSOViewer.cs (nonexistent)
+++ TSOSorter/Source/TSOViewer.cs (revision 5)
@@ -0,0 +1,48 @@
1+using System;
2+using System.Collections.Generic;
3+using System.ComponentModel;
4+using System.Data;
5+using System.Drawing;
6+using System.Linq;
7+using System.Text;
8+using System.Windows.Forms;
9+using TDCG;
10+
11+namespace TSOSorter
12+{
13+ public partial class TSOViewer : Form
14+ {
15+ private Viewer m_Viewer = null; // TSOViewer
16+ private bool m_bIsInitialTMOLoad = false;
17+ private bool m_bIsNeedCameraReset = true;
18+
19+ public TSOViewer()
20+ {
21+ InitializeComponent();
22+ }
23+ public Viewer Viewer
24+ {
25+ get { return m_Viewer; }
26+ }
27+ public void makeTSOViewer()
28+ {
29+ if (m_Viewer == null)
30+ {
31+ m_Viewer = new Viewer();
32+ m_Viewer.InitializeApplication(this);
33+
34+ m_bIsInitialTMOLoad = false;
35+ m_bIsNeedCameraReset = true;
36+ }
37+ }
38+ public void clearTSOViewer()
39+ {
40+ if (m_Viewer != null)
41+ {
42+ m_Viewer.ClearFigureList();
43+ m_bIsInitialTMOLoad = false;
44+ m_Viewer.BackColor = Color.LightGray;
45+ }
46+ }
47+ }
48+}
--- TSOSorter/Source/Options.cs (revision 4)
+++ TSOSorter/Source/Options.cs (revision 5)
@@ -5,6 +5,7 @@
55 using System.Drawing;
66 using System.Linq;
77 using System.Text;
8+using System.IO;
89 using System.Windows.Forms;
910
1011 namespace TSOSorter
@@ -16,14 +17,38 @@
1617 InitializeComponent();
1718 }
1819
19- private void buttonArcsFolderRef_Click(object sender, EventArgs e)
20+ private void commonFolderDlg(TextBox textBox, string strDesc)
2021 {
22+ // 現在のフォルダパス
23+ string strCurDirPath = textBox.Text;
24+ if (!Directory.Exists(strCurDirPath))
25+ {
26+ // アプリケーションのパスにする
27+ strCurDirPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
28+ }
29+ FolderBrowserDialog dlg = new FolderBrowserDialog();
30+ // 上に表示するテキスト
31+ dlg.Description = "Select Arcs Folder";
32+ // デスクトップをツリーノードのトップに。
33+ dlg.RootFolder = Environment.SpecialFolder.Desktop;
34+ // 選択を現在のモノに変更
35+ dlg.SelectedPath = strCurDirPath;
36+ // show new folder button
37+ dlg.ShowNewFolderButton = true;
2138
39+ if (dlg.ShowDialog(this) == DialogResult.OK)
40+ {
41+ textBox.Text = dlg.SelectedPath;
42+ }
2243 }
44+ private void buttonArcsFolderRef_Click(object sender, EventArgs e)
45+ {
46+ commonFolderDlg(textBoxArcsFolderPath, "Select Arcs Folder");
47+ }
2348
2449 private void buttonTahWorkFolderRef_Click(object sender, EventArgs e)
2550 {
26-
51+ commonFolderDlg(textBoxDBFolder, "Select Working Folder");
2752 }
2853
2954 private void button1_Click(object sender, EventArgs e)
@@ -44,10 +69,15 @@
4469 get { return trimdir(textBoxArcsFolderPath.Text); }
4570 set { textBoxArcsFolderPath.Text = value; }
4671 }
47- public string m_strTextTahWorkPath
72+ public string m_strTextDBFolder
4873 {
49- get { return trimdir(textBoxTahWorkFolder.Text); }
50- set { textBoxTahWorkFolder.Text = value; }
74+ get { return trimdir(textBoxDBFolder.Text); }
75+ set { textBoxDBFolder.Text = value; }
5176 }
77+
78+ private void button2_Click(object sender, EventArgs e)
79+ {
80+ commonFolderDlg(textBoxDBFolder, "Select Folder for DB files");
81+ }
5282 }
5383 }
--- TSOSorter/Source/TAHViewer.cs (revision 4)
+++ TSOSorter/Source/TAHViewer.cs (revision 5)
@@ -24,7 +24,7 @@
2424 private System.ComponentModel.IContainer components;
2525 private DataGridView dataGridView1;
2626
27- private string m_strTahDBPath; // 作業用DB
27+// private string m_strTahDBPath; // 作業用DB
2828 private GenericTahInfo info; // TAH情報
2929
3030 /** コンストラクタ
@@ -31,8 +31,8 @@
3131 * */
3232 public TAHViewer()
3333 {
34- m_strTahDBPath = Path.Combine(
35- TSOSorter.TDCGExplorer.SystemDB.m_strTahWorkPath, Path.GetRandomFileName() + ".db");
34+// m_strTahDBPath = Path.Combine(
35+// TSOSorter.TDCGExplorer.SystemDB.m_strTahWorkPath, Path.GetRandomFileName() + ".db");
3636 InitializeComponent();
3737 DataTable data = setupTable();
3838 dataGridView1.DataSource = data;
@@ -67,6 +67,7 @@
6767 this.dataGridView1.AllowUserToAddRows = false;
6868 this.dataGridView1.AllowUserToDeleteRows = false;
6969 this.dataGridView1.AllowUserToResizeRows = false;
70+ this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
7071 this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
7172 this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
7273 this.dataGridView1.Location = new System.Drawing.Point(0, 0);
--- TSOSorter/Source/FileDatabase.cs (revision 4)
+++ TSOSorter/Source/FileDatabase.cs (revision 5)
@@ -55,6 +55,28 @@
5555 }
5656 return entry;
5757 }
58+ /** arcsからの相対パス
59+ * */
60+ public FileEntry getFileEntry(string strRelPath)
61+ {
62+ FileEntry entry = null;
63+ using (SQLiteCommand cmd = cnn.CreateCommand())
64+ {
65+ cmd.CommandText = "SELECT PATH,SHORTNAME FROM Files WHERE PATH=@path";
66+ cmd.Parameters.AddWithValue("path", strRelPath);
67+ using (SQLiteDataReader reader = cmd.ExecuteReader())
68+ {
69+ while (reader.Read())
70+ {
71+ entry = new FileEntry();
72+ entry.m_strPath = reader[0].ToString();
73+ entry.m_strShortName = reader[1].ToString();
74+ break;
75+ }
76+ }
77+ }
78+ return entry;
79+ }
5880
5981 /* public FileEntry getFileEntry(string path, string shortname)
6082 {
@@ -115,7 +137,8 @@
115137 }
116138 public string GetFileDatabasePath()
117139 {
118- return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), TDCGExplorer.GetAppDataPath());
140+
141+ return TDCGExplorer.SystemDB.m_strDBFolderPath;// Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), TDCGExplorer.GetAppDataPath());
119142 }
120143
121144 public string GetFileDatabaseName()
@@ -209,7 +232,7 @@
209232 {
210233 while (reader.Read())
211234 {
212- nFileRowID = Int16.Parse(reader[0].ToString());
235+ nFileRowID = int.Parse(reader[0].ToString());
213236 break;
214237 }
215238 }
@@ -221,8 +244,22 @@
221244 }
222245 return nFileRowID;
223246 }
224- int getFileRowID(string strFilePath)
247+ /** 指定したFileRowIDのファイルを指定したエントリ情報に変更する
248+ * BeginTransactionとtransaction.Commitを忘れずに。
249+ * */
250+ public void UpdateFileEntry(int nRowID, FileEntry entry)
225251 {
252+ using (SQLiteCommand cmd = cnn.CreateCommand())
253+ {
254+ cmd.CommandText = "UPDATE Files SET PATH=@path,SHORTNAME=@shortname WHERE ROWID=@rowid";
255+ cmd.Parameters.AddWithValue("path", entry.m_strPath);
256+ cmd.Parameters.AddWithValue("shortname", entry.m_strShortName);
257+ cmd.Parameters.AddWithValue("rowid", nRowID);
258+ cmd.ExecuteNonQuery();
259+ }
260+ }
261+ public int getFileRowID(string strFilePath)
262+ {
226263 int nFileRowID = -1;
227264 using (SQLiteCommand cmd = cnn.CreateCommand())
228265 {
@@ -232,7 +269,7 @@
232269 {
233270 while (reader.Read())
234271 {
235- nFileRowID = Int16.Parse(reader[0].ToString());
272+ nFileRowID = int.Parse(reader[0].ToString());
236273 break;
237274 }
238275 }
@@ -260,7 +297,7 @@
260297 {
261298 while (reader.Read())
262299 {
263- nTbnRowID = Int16.Parse(reader[0].ToString());
300+ nTbnRowID = int.Parse(reader[0].ToString());
264301 break;
265302 }
266303 }
--- TSOSorter/Source/Program.cs (revision 4)
+++ TSOSorter/Source/Program.cs (revision 5)
@@ -14,10 +14,12 @@
1414 [STAThread]
1515 static void Main()
1616 {
17- TDCGExplorer.setup();
1817
1918 Application.EnableVisualStyles();
2019 Application.SetCompatibleTextRenderingDefault(false);
20+ // show splash
21+ StartSplash.ShowSplash();
22+ TDCGExplorer.setup();
2123 form = new MainForm();
2224 Application.Run(form);
2325
--- TSOSorter/Source/StartSplash.Designer.cs (nonexistent)
+++ TSOSorter/Source/StartSplash.Designer.cs (revision 5)
@@ -0,0 +1,63 @@
1+namespace TSOSorter
2+{
3+ partial class StartSplash
4+ {
5+ /// <summary>
6+ /// 必要なデザイナ変数です。
7+ /// </summary>
8+ private System.ComponentModel.IContainer components = null;
9+
10+ /// <summary>
11+ /// 使用中のリソースをすべてクリーンアップします。
12+ /// </summary>
13+ /// <param name="disposing">マネージ リソースが破棄される場合 true、破棄されない場合は false です。</param>
14+ protected override void Dispose(bool disposing)
15+ {
16+ if (disposing && (components != null))
17+ {
18+ components.Dispose();
19+ }
20+ base.Dispose(disposing);
21+ }
22+
23+ #region Windows フォーム デザイナで生成されたコード
24+
25+ /// <summary>
26+ /// デザイナ サポートに必要なメソッドです。このメソッドの内容を
27+ /// コード エディタで変更しないでください。
28+ /// </summary>
29+ private void InitializeComponent()
30+ {
31+ this.label1 = new System.Windows.Forms.Label();
32+ this.SuspendLayout();
33+ //
34+ // label1
35+ //
36+ this.label1.AutoSize = true;
37+ this.label1.Location = new System.Drawing.Point(31, 38);
38+ this.label1.Name = "label1";
39+ this.label1.Size = new System.Drawing.Size(101, 12);
40+ this.label1.TabIndex = 0;
41+ this.label1.Text = "TBNSorter起動中...";
42+ //
43+ // StartSplash
44+ //
45+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
46+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
47+ this.ClientSize = new System.Drawing.Size(266, 90);
48+ this.Controls.Add(this.label1);
49+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
50+ this.Name = "StartSplash";
51+ this.ShowInTaskbar = false;
52+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
53+ this.Text = "StartSplash";
54+ this.ResumeLayout(false);
55+ this.PerformLayout();
56+
57+ }
58+
59+ #endregion
60+
61+ private System.Windows.Forms.Label label1;
62+ }
63+}
\ No newline at end of file
--- TSOSorter/Source/StartSplash.cs (nonexistent)
+++ TSOSorter/Source/StartSplash.cs (revision 5)
@@ -0,0 +1,50 @@
1+using System;
2+using System.Collections.Generic;
3+using System.ComponentModel;
4+using System.Data;
5+using System.Drawing;
6+using System.Linq;
7+using System.Text;
8+using System.Windows.Forms;
9+
10+namespace TSOSorter
11+{
12+ public partial class StartSplash : Form
13+ {
14+ private static StartSplash _form = null; // 実体
15+ public static StartSplash Form
16+ {
17+ get { return _form; }
18+ }
19+ public StartSplash()
20+ {
21+ InitializeComponent();
22+ }
23+
24+ public static void ShowSplash()
25+ {
26+ if (_form == null)
27+ {
28+ Application.Idle += new EventHandler(Application_Idle);
29+ // show
30+ _form = new StartSplash();
31+ _form.Show();
32+ }
33+ _form.Update();
34+ }
35+ /** アプリケーションがアイドル状態になった時
36+ * */
37+ private static void Application_Idle(object sender, EventArgs e)
38+ {
39+ // if まだ開いている
40+ // and まだ閉じていない
41+ if (_form != null && _form.IsDisposed == false)
42+ {
43+ // 閉じる
44+ _form.Close();
45+ }
46+ _form = null;
47+ Application.Idle -= new EventHandler(Application_Idle);
48+ }
49+ }
50+}
--- TSOSorter/Source/SystemDatabase.cs (revision 4)
+++ TSOSorter/Source/SystemDatabase.cs (revision 5)
@@ -11,10 +11,24 @@
1111 class SystemDatabase : IDisposable
1212 {
1313 public string KEY_ARC_PATH = "arcpath";
14- public string KEY_TAH_WORK_PATH = "tahworkpath";
14+ public string KEY_DB_FOLDER_PATH = "dbfolderpath";
1515 public string KEY_DATABASE_BUILD = "databasebuild";
1616 public string KEY_FILE_DATABASE_BUILD = "filedatabasebuild";
17+ public string KEY_SHOW_DISABLE_TAH = "showdisabletah";
18+ public string KEY_BLOCK_CHANGE_EXT = "blockchangeext";
1719
20+ // @tahも表示するかどうか
21+ // デフォルト:true→表示する
22+ public bool m_bIsShowDisableTah{
23+ get{return GetSqlValue( KEY_SHOW_DISABLE_TAH, "yes") == "yes";}
24+ set{SetSqlValue( KEY_SHOW_DISABLE_TAH, value ? "yes" : "");}
25+ }
26+ // 拡張子変更をブロックするか
27+ // デフォルト:true →ブロックする
28+ public bool m_bIsBlockChangeExt{
29+ get{return GetSqlValue( KEY_BLOCK_CHANGE_EXT, "yes") == "yes";}
30+ set{SetSqlValue(KEY_BLOCK_CHANGE_EXT, value ? "yes" : "");}
31+ }
1832 private SQLiteConnection cnn; // SQLite コネクション
1933 Dictionary<string, string> cache = new Dictionary<string, string>(); // キャッシュデータ
2034 // dbを置く場所を準備する.
@@ -120,8 +134,11 @@
120134 public void setDefault()
121135 {
122136 m_strArcPath = m_strArcPath;
123- m_strTahWorkPath = m_strTahWorkPath;
137+// m_strTahWorkPath = m_strTahWorkPath;
138+ m_strDBFolderPath = m_strDBFolderPath;
124139 m_strDatabaseBuild = m_strDatabaseBuild;
140+ m_bIsBlockChangeExt = m_bIsBlockChangeExt;
141+ m_bIsShowDisableTah = m_bIsShowDisableTah;
125142 }
126143 // arcpathの取得設定
127144 public string m_strArcPath
@@ -136,8 +153,14 @@
136153 SetSqlValue(KEY_ARC_PATH, value);
137154 }
138155 }
139- public string m_strTahWorkPath
156+ // db ファイルを設置する場所(システムDBは除く
157+ public string m_strDBFolderPath
140158 {
159+ get { return GetSqlValue(KEY_DB_FOLDER_PATH, GetSystemDatabasePath()); }
160+ set { SetSqlValue(KEY_DB_FOLDER_PATH, value); }
161+ }
162+/* public string m_strTahWorkPath
163+ {
141164 get
142165 {
143166 return GetSqlValue(KEY_TAH_WORK_PATH, Path.Combine(GetSystemDatabasePath(),
@@ -147,7 +170,7 @@
147170 {
148171 SetSqlValue(KEY_TAH_WORK_PATH, value);
149172 }
150- }
173+ }*/
151174 public string m_strDatabaseBuild
152175 {
153176 get { return GetSqlValue(KEY_DATABASE_BUILD, ""); }
Show on old repository browser