10 public sealed class Env
\r
24 private static NaGetLibPref pref;
\r
27 /// 設定ファイルを読み込む。一回のみ呼ばれる。
\r
29 private static void loadPref()
\r
31 string path = Path.Combine(Environment.CurrentDirectory, "pref.xml");
\r
33 if (! File.Exists(path)) throw new FileNotFoundException(string.Empty, path);
\r
34 pref = NaGet.Utils.GetDeserializedObject<NaGetLibPref>(path);
\r
35 } catch(Exception) {
\r
36 pref = new NaGetLibPref();
\r
45 /// ファイルリスト提供サーバのリストファイル
\r
48 public static readonly string ProviderListFile = "provider.list.txt";
\r
51 /// ファイルリスト提供レポジトリリストのファイル
\r
53 public static readonly string RepositoriesListFile = "repos.list.xml";
\r
56 /// ファイルリストから読み込まれたパッケージのリストファイル
\r
58 public static readonly string PackageListFile = "packages.list.xml";
\r
61 /// 本ソフトウェアを介してインストールされたパッケージのリストファイル
\r
63 public static readonly string ArchiveInstalledPackageListFile = "packages.envinstalled.xml";
\r
66 /// システムから検出されたパッケージのリストファイル
\r
68 public static readonly string SystemInstalledPackageListFile = "packages.sysinstalled.xml";
\r
73 public static readonly string SystemInstalledPackageLogFile = "packages.sysinstalled.log.xml";
\r
76 /// アプリケーションデータを保存するフォルダのパス
\r
78 public static string AppDataFolderPath
\r
81 if (pref == null) loadPref();
\r
83 if (! string.IsNullOrEmpty(pref.AppDataFolder)) {
\r
84 return pref.AppDataFolder;
\r
87 return Environment.CurrentDirectory;
\r
92 /// インストーラの一時置き場の親ディレクトリ
\r
94 public static string ArchiveFolderPath
\r
96 get { return Path.Combine(AppDataFolderPath, "Cache"); }
\r
100 /// アーカイバ方式のパッケージのインストール先フォルダ
\r
102 public static string ArchiveProgramFiles {
\r
104 return Path.Combine(AppDataFolderPath, "progs");
\r
109 /// アーカイバ方式のパッケージのプログラムグループフォルダ
\r
111 public static string ArchiveProgramGroup {
\r
113 return Path.Combine(AppDataFolderPath, "programs");
\r
118 /// アーカイバ方式のパッケージのSystem32のフォルダ
\r
120 public static string ArchiveSystem32 {
\r
122 return Path.Combine(ArchiveProgramFiles, ".system32");
\r
131 /// ウェブアクセスのためのプロキシを取得する。
\r
133 /// <returns>プロキシ</returns>
\r
134 public static IWebProxy WebProxy
\r
137 if (pref == null) loadPref();
\r
139 if (string.IsNullOrEmpty(pref.ProxyAddress)) {
\r
140 // 設定されていないときはシステムのデフォルトを使う
\r
141 return WebRequest.GetSystemWebProxy();
\r
142 } else if (pref.ProxyAddress == "-") {
\r
146 // host:portが設定されているならば、それをもとに設定
\r
147 return new WebProxy(pref.ProxyAddress);
\r