Пример #1
0
        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();
        }