Ejemplo n.º 1
0
        public ExternalDBApplicationResult OnStartup(
            ControlledApplication a)
        {
            string path = Assembly.GetExecutingAssembly().Location;

            _logger = new JtLogger();
            _logger.Init(Path.ChangeExtension(path, "log"));

            JtSettings.Init(Path.ChangeExtension(path, "config"));
            _settings = JtSettings.Load();

            a.ApplicationInitialized += OnApplicationInitialized;
            return(ExternalDBApplicationResult.Succeeded);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Load settings from file, if found
        /// </summary>
        /// <returns></returns>
        public static JtSettings Load()
        {
            Debug.Assert(null != _filename,
                         "did you forget to call Init?");

            JtSettings settings = new JtSettings();

            if (File.Exists(_filename))
            {
                settings = (new JavaScriptSerializer())
                           .Deserialize <JtSettings>(
                    File.ReadAllText(_filename));
            }
            return(settings);
        }