private string GenerateJson() { JObject json = new JObject(); JArray earray = new JArray(); foreach (UIElement el in EffectsHolder.Children) { if (el.GetType() == typeof(Grid)) { continue; } EffectController ct = (EffectController)el; JObject effectInfo = new JObject(); effectInfo.Add("index", AssemblyHelper.IndexOf(ct.effect)); effectInfo.Add("enabled", ct.effect.Enabled); JArray effectParams = new JArray(); if (ct.effect.param != null) { for (int i = 0; i < ct.effect.param.Length; i++) { effectParams.Add(ct.GetValue(i)); } } effectInfo.Add("parameters", effectParams); earray.Add(effectInfo); } JArray sarray = new JArray(); foreach (UIElement el in SongsHolder.Children) { if (el.GetType() == typeof(Grid)) { continue; } SoundController ct = (SoundController)el; JObject soundInfo = new JObject(); soundInfo.Add("path", ct.SoundPath); soundInfo.Add("bind", ct.KeyBind); sarray.Add(soundInfo); } json.Add("effects", earray); json.Add("sounds", sarray); return(json.ToString()); }