コード例 #1
0
ファイル: AppInit.cs プロジェクト: suh4s/BitShelter
        public static void Initialize(IAppHost appHost)
        {
            appHost.OnPreInitialize();

            try
            {
                string appDataFolder = Const.GetAppDataFolderPath();

                Directory.CreateDirectory(appDataFolder);

                Logger.Instance.Initialize();
            }
            catch (Exception ex)
            {
                string tmpFilePath = Path.GetTempFileName();

                using (Stream s = File.OpenWrite(tmpFilePath))
                    using (StreamWriter sw = new StreamWriter(s))
                        sw.Write(ex.Message);

                throw new Exception(
                          String.Format(LoggerInitErrorMsg, Logger.GetLogFilePath(), tmpFilePath, ex.Message),
                          ex
                          );
            }

            appHost.OnPostInitialize();
        }