Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/Somali/Util/Util.IO.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 95 - (show annotations) (download)
Sun Nov 28 06:24:47 2010 UTC (13 years, 5 months ago) by juan
File size: 2628 byte(s)
mod ExplorerForm with able to open dirTree
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Windows.Forms;
6 using System.IO;
7
8 namespace Somali
9 {
10 static partial class Util
11 {
12 /// <summary>
13 /// フォルダセレクター
14 /// </summary>
15 /// <returns></returns>
16 public delegate string FolderSelector();
17
18 #region getPathMethod
19 /// <summary>
20 /// フォルダパス取得
21 /// </summary>
22 /// <param name="folderSelector"></param>
23 /// <returns>フォルダパス</returns>
24 /// <remarks>フォルダパス取得します。フォルダが存在しない場合は、ディレクトリを生成します。</remarks>
25 public static string GetDirPathWithCreate( FolderSelector folderSelector )
26 {
27 string strDirPath = folderSelector();
28
29 //フォルダの存在検査
30 if ( !Directory.Exists( strDirPath ) )
31 {
32 //存在しない場合、ディレクトリを生成する
33 Directory.CreateDirectory( strDirPath );
34 }
35
36 return strDirPath;
37 }
38
39 /// <summary>
40 /// 設定データ保存フォルダパス取得
41 /// </summary>
42 /// <returns>設定データ保存フォルダパス</returns>
43 public static string GetAppSettingDir()
44 {
45 return GetAppDefaultDir() + @"\Settings";
46 }
47
48 /// <summary>
49 /// プロジェクトデータ保存フォルダパス取得
50 /// </summary>
51 /// <returns>プロジェクトデータ保存フォルダパス</returns>
52 public static string GetAppProjectDir()
53 {
54 return GetAppDefaultDir() + @"\Project";
55 }
56
57 /// <summary>
58 /// Tempデータ保存フォルダパス取得
59 /// </summary>
60 /// <returns>Tempデータ保存フォルダパス</returns>
61 public static string GetAppTempDir()
62 {
63 return GetAppDefaultDir() + @"\Temp";
64 }
65
66 /// <summary>
67 /// データ保存デフォルトフォルダパス取得
68 /// </summary>
69 /// <returns>デフォルトフォルダパス</returns>
70 private static string GetAppDefaultDir()
71 {
72 return String.Format( @"{0}\{1}"
73 , Environment.GetFolderPath( Environment.SpecialFolder.ApplicationData )
74 , Application.ProductName );
75 }
76 #endregion
77
78
79 }
80 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26