OSDN Git Service

a25eff4685f96c789e020c17b4c977bab67c13d7
[dtxmania/dtxmania.git] / DTXCreatorプロジェクト / コード / 00.全体 / AppSetting.cs
1 using System;\r
2 using System.Collections.Generic;\r
3 using System.Text;\r
4 using System.IO;\r
5 \r
6 namespace DTXCreator\r
7 {\r
8         // 使い方\r
9         //\r
10         // 保存方法:\r
11         //  var xmlsl = new System.Xml.Serialization.XmlSerializer(typeof(AppSetting));\r
12         //  FileStream fs = new FileStream(設定ファイル名, FileMode.Create);\r
13         //  xmlsl.Serialize(fs, this.アプリ設定);\r
14         //  fs.Close();\r
15         // \r
16         // 読み込み方法:\r
17         //   try\r
18         //   {\r
19         //       var xmlsl = new System.Xml.Serialization.XmlSerializer(typeof(AppSetting));\r
20         //       FileStream fs = new FileStream(設定ファイル名, FileMode.Open);\r
21         //       this.アプリ設定 = (AppSetting)xmlsl.Deserialize(fs);\r
22         //       fs.Close();\r
23         //   }\r
24         //   catch (Exception)\r
25         //   {\r
26         //       Debug.WriteLine("アプリ設定ファイルの読み込みに失敗しました。");\r
27         //       return;\r
28         //   }\r
29 \r
30         public class AppSetting\r
31         {\r
32                 #region [ コンストラクタ ]\r
33                 //-----------------\r
34                 public AppSetting()\r
35                 {\r
36                         this._SoundListColumnWidth[ 0 ] = 80;\r
37                         this._SoundListColumnWidth[ 1 ] = 28;\r
38                         this._SoundListColumnWidth[ 2 ] = 80;\r
39                         this._SoundListColumnWidth[ 3 ] = 40;\r
40                         this._SoundListColumnWidth[ 4 ] = 60;\r
41                         this._GraphicListColumnWidth[ 0 ] = 34;\r
42                         this._GraphicListColumnWidth[ 1 ] = 127;\r
43                         this._GraphicListColumnWidth[ 2 ] = 28;\r
44                         this._GraphicListColumnWidth[ 3 ] = 120;\r
45                         this._MovieListColumnWidth[ 0 ] = 127;\r
46                         this._MovieListColumnWidth[ 1 ] = 28;\r
47                         this._MovieListColumnWidth[ 2 ] = 120;\r
48                         this._LastWorkFolder = Directory.GetCurrentDirectory();\r
49                         this._ViewerInfo = new Viewer();\r
50                 }\r
51                 //-----------------\r
52                 #endregion\r
53 \r
54                 // プロパティ(1) オプション項目関連\r
55 \r
56                 #region [ List<string> RecentUsedFile - 最近使ったファイル名のリスト ]\r
57                 //-----------------\r
58                 public List<string> RecentUsedFile\r
59                 {\r
60                         get; \r
61                         set;\r
62                 }\r
63                 private List<string> _RecentUsedFile = new List<string>();\r
64                 //-----------------\r
65                 #endregion\r
66 \r
67                 public void AddRecentUsedFile( string fileName )\r
68                 {\r
69                         for( int i = 0; i < this._RecentUsedFile.Count; i++ )\r
70                         {\r
71                                 if( this._RecentUsedFile[ i ].Equals( fileName ) )\r
72                                 {\r
73                                         this._RecentUsedFile.RemoveAt( i );\r
74                                         break;\r
75                                 }\r
76                         }\r
77                         this._RecentUsedFile.Insert( 0, fileName );\r
78                         if( this._RecentUsedFile.Count > 10 )\r
79                         {\r
80                                 int num2 = this._RecentUsedFile.Count - 10;\r
81                                 for( int j = 0; j < num2; j++ )\r
82                                 {\r
83                                         this._RecentUsedFile.RemoveAt( 10 + j );\r
84                                 }\r
85                         }\r
86                 }\r
87                 public bool bSameVersion()\r
88                 {\r
89                         return ( this._ConfigVersion == _ConfigSchemaVersion );\r
90                 }\r
91                 public void Confirm()\r
92                 {\r
93                         if( this._RecentFilesNum <= 0 )\r
94                         {\r
95                                 this._RecentFilesNum = 5;\r
96                                 this._ShowRecentFiles = false;\r
97                         }\r
98                         else if( this._RecentFilesNum > 10 )\r
99                         {\r
100                                 this._RecentFilesNum = 10;\r
101                         }\r
102                 }\r
103 \r
104                 public bool AutoFocus\r
105                 {\r
106                         get\r
107                         {\r
108                                 return this._AutoFocus;\r
109                         }\r
110                         set\r
111                         {\r
112                                 this._AutoFocus = value;\r
113                         }\r
114                 }\r
115                 public int ConfigVersion\r
116                 {\r
117                         get\r
118                         {\r
119                                 return this._ConfigVersion;\r
120                         }\r
121                         set\r
122                         {\r
123                                 this._ConfigVersion = value;\r
124                         }\r
125                 }\r
126                 public int[] GraphicListColumnWidth\r
127                 {\r
128                         get\r
129                         {\r
130                                 return this._GraphicListColumnWidth;\r
131                         }\r
132                         set\r
133                         {\r
134                                 this._GraphicListColumnWidth = value;\r
135                         }\r
136                 }\r
137                 public int GuideIndex\r
138                 {\r
139                         get\r
140                         {\r
141                                 return this._GuideIndex;\r
142                         }\r
143                         set\r
144                         {\r
145                                 this._GuideIndex = value;\r
146                                 if( this._GuideIndex < 0 )\r
147                                 {\r
148                                         this._GuideIndex = 0;\r
149                                 }\r
150                                 else if( this._GuideIndex > 8 )\r
151                                 {\r
152                                         this._GuideIndex = 8;\r
153                                 }\r
154                         }\r
155                 }\r
156                 public int Height\r
157                 {\r
158                         get\r
159                         {\r
160                                 return this._Height;\r
161                         }\r
162                         set\r
163                         {\r
164                                 this._Height = value;\r
165                                 if( this._Height < 0 )\r
166                                 {\r
167                                         this._Height = 10;\r
168                                 }\r
169                         }\r
170                 }\r
171                 public int HViewScaleIndex\r
172                 {\r
173                         get\r
174                         {\r
175                                 return this._HViewScaleIndex;\r
176                         }\r
177                         set\r
178                         {\r
179                                 this._HViewScaleIndex = value;\r
180                                 if( this._HViewScaleIndex < 0 )\r
181                                 {\r
182                                         this._HViewScaleIndex = 0;\r
183                                 }\r
184                                 else if( this._HViewScaleIndex > 9 )\r
185                                 {\r
186                                         this._HViewScaleIndex = 9;\r
187                                 }\r
188                         }\r
189                 }\r
190                 public string LastWorkFolder\r
191                 {\r
192                         get\r
193                         {\r
194                                 return this._LastWorkFolder;\r
195                         }\r
196                         set\r
197                         {\r
198                                 this._LastWorkFolder = value;\r
199                         }\r
200                 }\r
201                 public bool Maximized\r
202                 {\r
203                         get\r
204                         {\r
205                                 return this._Maximized;\r
206                         }\r
207                         set\r
208                         {\r
209                                 this._Maximized = value;\r
210                         }\r
211                 }\r
212                 public int[] MovieListColumnWidth\r
213                 {\r
214                         get\r
215                         {\r
216                                 return this._MovieListColumnWidth;\r
217                         }\r
218                         set\r
219                         {\r
220                                 this._MovieListColumnWidth = value;\r
221                         }\r
222                 }\r
223                 public bool NoPreviewBGM\r
224                 {\r
225                         get\r
226                         {\r
227                                 return this._NoPreviewBGM;\r
228                         }\r
229                         set\r
230                         {\r
231                                 this._NoPreviewBGM = value;\r
232                         }\r
233                 }\r
234                 public bool PlaySoundOnWAVChipAllocated\r
235                 {\r
236                         get\r
237                         {\r
238                                 return this._PlaySoundOnWAVChipAllocated;\r
239                         }\r
240                         set\r
241                         {\r
242                                 this._PlaySoundOnWAVChipAllocated = value;\r
243                         }\r
244                 }\r
245                 public int RecentFilesNum\r
246                 {\r
247                         get\r
248                         {\r
249                                 return this._RecentFilesNum;\r
250                         }\r
251                         set\r
252                         {\r
253                                 this._RecentFilesNum = value;\r
254                         }\r
255                 }\r
256                 public bool ShowRecentFiles\r
257                 {\r
258                         get\r
259                         {\r
260                                 return this._ShowRecentFiles;\r
261                         }\r
262                         set\r
263                         {\r
264                                 this._ShowRecentFiles = value;\r
265                         }\r
266                 }\r
267                 public int[] SoundListColumnWidth\r
268                 {\r
269                         get\r
270                         {\r
271                                 return this._SoundListColumnWidth;\r
272                         }\r
273                         set\r
274                         {\r
275                                 this._SoundListColumnWidth = value;\r
276                         }\r
277                 }\r
278                 public int SplitterDistance\r
279                 {\r
280                         get\r
281                         {\r
282                                 return this._SplitterDistance;\r
283                         }\r
284                         set\r
285                         {\r
286                                 this._SplitterDistance = value;\r
287                         }\r
288                 }\r
289                 public Viewer ViewerInfo\r
290                 {\r
291                         get\r
292                         {\r
293                                 return this._ViewerInfo;\r
294                         }\r
295                         set\r
296                         {\r
297                                 this._ViewerInfo = value;\r
298                         }\r
299                 }\r
300                 public int Width\r
301                 {\r
302                         get\r
303                         {\r
304                                 return this._Width;\r
305                         }\r
306                         set\r
307                         {\r
308                                 this._Width = value;\r
309                                 if( this._Width < 0 )\r
310                                 {\r
311                                         this._Width = 10;\r
312                                 }\r
313                         }\r
314                 }\r
315                 public int X\r
316                 {\r
317                         get\r
318                         {\r
319                                 return this._X;\r
320                         }\r
321                         set\r
322                         {\r
323                                 this._X = value;\r
324                         }\r
325                 }\r
326                 public int Y\r
327                 {\r
328                         get\r
329                         {\r
330                                 return this._Y;\r
331                         }\r
332                         set\r
333                         {\r
334                                 this._Y = value;\r
335                         }\r
336                 }\r
337 \r
338                 public class Viewer\r
339                 {\r
340                         public string Path = "DTXV.exe";\r
341                         public string PlayStartFromOption = "-N";\r
342                         public string PlayStartOption = "-N-1";\r
343                         public string PlayStopOption = "-S";\r
344                 }\r
345 \r
346                 #region [ private ]\r
347                 //-----------------\r
348                 private bool _AutoFocus = true;\r
349                 private static int _ConfigSchemaVersion = 0x69;\r
350                 private int _ConfigVersion = _ConfigSchemaVersion;\r
351                 private int[] _GraphicListColumnWidth = new int[ 4 ];\r
352                 private int _GuideIndex = 3;\r
353                 private int _Height = 0x1db;\r
354                 private int _HViewScaleIndex;\r
355                 private string _LastWorkFolder = "";\r
356                 private bool _Maximized;\r
357                 private int[] _MovieListColumnWidth = new int[ 3 ];\r
358                 private bool _NoPreviewBGM = true;\r
359                 private bool _PlaySoundOnWAVChipAllocated = true;\r
360                 private int _RecentFilesNum = 5;\r
361                 private bool _ShowRecentFiles = true;\r
362                 private int[] _SoundListColumnWidth = new int[ 5 ];\r
363                 private int _SplitterDistance = 0x128;\r
364                 private Viewer _ViewerInfo;\r
365                 private int _Width = 600;\r
366                 private int _X;\r
367                 private int _Y;\r
368                 //-----------------\r
369                 #endregion\r
370         }\r
371 }\r