public void RegisterTactFileStrReflected(string key, string tactFileStr) { var file = CommonUtils.ConvertJsonStringToTactosyFile(tactFileStr); List <string> v = new List <string>(); bool finished = false; foreach (var projectTrack in file.Project.Tracks) { foreach (var projectTrackEffect in projectTrack.Effects) { if (finished) { continue; } foreach (var it in projectTrackEffect.Modes) { v.Add(it.Key); } finished = true; } } if (v.Count != 2) { RegisterTactFileStr(key, tactFileStr); return; } string TypeRight = v[0]; string TypeLeft = v[1]; for (int track_index = 0; track_index < file.Project.Tracks.Length; track_index++) { var projectTrack = file.Project.Tracks[track_index]; for (int effect_index = 0; effect_index < projectTrack.Effects.Length; effect_index++) { var projectTrackEffect = projectTrack.Effects[effect_index]; if (projectTrackEffect.Modes.ContainsKey(TypeRight)) { file.Project.Tracks[track_index].Effects[effect_index].Modes[TypeLeft] = projectTrackEffect.Modes[TypeRight]; } if (projectTrackEffect.Modes.ContainsKey(TypeLeft)) { file.Project.Tracks[track_index].Effects[effect_index].Modes[TypeRight] = projectTrackEffect.Modes[TypeLeft]; } } } Register(key, file.Project); }
public void RegisterTactFileStr(string key, string tactFileStr) { var file = CommonUtils.ConvertJsonStringToTactosyFile(tactFileStr); Register(key, file.Project); }