Beispiel #1
0
 private void frm_TurboUnit_Load(object sender, EventArgs e)
 {
     _config = LoadOrCreateConfig();
     if (_config.IsFirstRun)
     {
         DoFirstRunSetup();
     }
 }
Beispiel #2
0
        private TurboUnitConfig LoadOrCreateConfig()
        {
            TurboUnitConfig config;
            string          directory      = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            string          configFilePath = Path.Combine(directory, "TurboUnitSettings.json");

            if (File.Exists(configFilePath))
            {
                config = TurboUnitObject.Load <TurboUnitConfig>(configFilePath);
            }
            else
            {
                config = new TurboUnitConfig()
                {
                    ConfigFilePath = configFilePath,
                    IsFirstRun     = true
                };
                config.Save(configFilePath);
            }
            return(config);
        }