private static NaGetLibPref pref;\r
\r
/// <summary>\r
- /// 設定ファイルを読み込む。一回のみ呼ばれる。\r
+ /// 設定(のクローンオブジェクト)を返す。\r
/// </summary>\r
- private static void loadPref()\r
+ public static NaGetLibPref Pref {\r
+ get {\r
+ NaGetLibPref prefCopied = new NaGetLibPref();\r
+ \r
+ if (pref == null) {\r
+ LoadPref();\r
+ }\r
+ NaGet.Utils.FieldCopy(pref, ref prefCopied);\r
+ \r
+ return prefCopied;\r
+ }\r
+ }\r
+ \r
+ /// <summary>\r
+ /// 設定ファイルのある場所を取得する\r
+ /// </summary>\r
+ public static string PrefPath {\r
+ get {\r
+ return Path.Combine(Environment.CurrentDirectory, "pref.xml");\r
+ }\r
+ }\r
+ \r
+ /// <summary>\r
+ /// 設定ファイルを読み込む。または再読み込みする。\r
+ /// </summary>\r
+ public static void LoadPref()\r
{\r
- string path = Path.Combine(Environment.CurrentDirectory, "pref.xml");\r
+ string path = PrefPath;\r
try {\r
if (! File.Exists(path)) throw new FileNotFoundException(string.Empty, path);\r
pref = NaGet.Utils.GetDeserializedObject<NaGetLibPref>(path);\r
}\r
}\r
\r
+ \r
#endregion\r
\r
#region ファイルパス\r
public static string AppDataFolderPath\r
{\r
get {\r
- if (pref == null) loadPref();\r
+ if (pref == null) LoadPref();\r
\r
if (! string.IsNullOrEmpty(pref.AppDataFolder)) {\r
return pref.AppDataFolder;\r
public static IWebProxy WebProxy\r
{\r
get {\r
- if (pref == null) loadPref();\r
+ if (pref == null) LoadPref();\r
\r
if (string.IsNullOrEmpty(pref.ProxyAddress)) {\r
// 設定されていないときはシステムのデフォルトを使う\r