public void Initialize(Config config)
 {
     if (config == null) throw new ArgumentNullException("config");
     HarmonicKeyDisplayMode = config.HarmonicKeyDisplayMode;
     RestrictBpmCompatibility = config.RestrictBpmCompatibility;
     StripMixedInKeyPrefixes = config.StripMixedInKeyPrefixes;
     SuggestBpmAdjustedTracks = config.SuggestBpmAdjustedTracks;
     AutoAdjustBpm = config.AutoAdjustBpm;
     ParseKeyAndBpmFromFilename = config.ParseKeyAndBpmFromFilename;
 }
예제 #2
0
 public async Task InitializeAsync()
 {
     config = await reader.ReadAsync(filename);
     
     if (config == null)
     {
         log.Debug("Initializing MixPlanner with default config settings.");
         config = Config.DefaultConfig;
         await writer.WriteAsync(config, filename);
     }
 }
예제 #3
0
        public async Task WriteAsync(Config config, string filename)
        {
            if (config == null) throw new ArgumentNullException("config");
            if (filename == null) throw new ArgumentNullException("filename");

            try
            {
                using (FileStream file = File.Open(filename, FileMode.Create, FileAccess.Write))
                using (var writer = new StreamWriter(file))
                {
                    string json = await JsonConvert.SerializeObjectAsync(
                        config, GlobalJsonSettings.Formatting, GlobalJsonSettings.Settings);

                    await writer.WriteAsync(json);
                }
            }
            catch (Exception e)
            {
                Log.Error(String.Format("Error saving config {0}.", filename), e);
            }
        }
예제 #4
0
 public async Task SaveAsync(Config config)
 {
     Config = config;
     await writer.WriteAsync(Config, filename);
     await Task.Run(() => messenger.SendToUI(new ConfigSavedEvent(config)));
 }
예제 #5
0
 public ConfigSavedEvent(Config config)
 {
     if (config == null) throw new ArgumentNullException("config");
     Config = config;
 }
예제 #6
0
 public Task SaveAsync(Config config)
 {
     throw new System.NotImplementedException();
 }