public setRange ( float uMin, float uMax, float uValue ) : void | ||
uMin | float | |
uMax | float | |
uValue | float | |
Результат | void |
public List <CsoundChannelController> parseCsdFile(string filename) { string[] fullCsdText = File.ReadAllLines(filename); List <CsoundChannelController> locaChannelControllers; locaChannelControllers = new List <CsoundChannelController>(); foreach (string line in fullCsdText) { if (line.Contains("</")) { break; } string newLine = line; string control = line.Substring(0, line.IndexOf(" ") > -1 ? line.IndexOf(" ") : 0); if (control.Length > 0) { newLine = newLine.Replace(control, ""); } if (control.Contains("slider") || control.Contains("button") || control.Contains("checkbox") || control.Contains("groupbox") || control.Contains("form")) { CsoundChannelController controller = new CsoundChannelController(); controller.type = control; if (line.IndexOf("caption(") > -1) { string infoText = line.Substring(line.IndexOf("caption(") + 9); infoText = infoText.Substring(0, infoText.IndexOf(")") - 1); controller.caption = infoText; } if (line.IndexOf("text(") > -1) { string text = line.Substring(line.IndexOf("text(") + 6); text = text.Substring(0, text.IndexOf(")") - 1); controller.text = text; } if (line.IndexOf("channel(") > -1) { string channel = line.Substring(line.IndexOf("channel(") + 9); channel = channel.Substring(0, channel.IndexOf(")") - 1); controller.channel = channel; } if (line.IndexOf("range(") > -1) { string range = line.Substring(line.IndexOf("range(") + 6); range = range.Substring(0, range.IndexOf(")")); char[] delimiterChars = { ',' }; string[] tokens = range.Split(delimiterChars); controller.setRange(float.Parse(tokens[0]), float.Parse(tokens[1]), float.Parse(tokens[2])); } if (line.IndexOf("value(") > -1) { string value = line.Substring(line.IndexOf("value(") + 6); value = value.Substring(0, value.IndexOf(")")); controller.value = value.Length > 0 ? float.Parse(value) : 0; } locaChannelControllers.Add(controller); } } return(locaChannelControllers); }
public List<CsoundChannelController> parseCsdFile(string filename) { string[] fullCsdText = File.ReadAllLines(filename); List<CsoundChannelController> locaChannelControllers; locaChannelControllers = new List<CsoundChannelController>(); foreach (string line in fullCsdText) { if (line.Contains("</")) break; string newLine = line; string control = line.Substring(0, line.IndexOf(" ") > -1 ? line.IndexOf(" ") : 0); if (control.Length > 0) newLine = newLine.Replace(control, ""); if (control.Contains("slider") || control.Contains("button") || control.Contains("checkbox") || control.Contains("groupbox") || control.Contains("form")) { CsoundChannelController controller = new CsoundChannelController(); controller.type = control; if (line.IndexOf("caption(") > -1) { string infoText = line.Substring(line.IndexOf("caption(") + 9); infoText = infoText.Substring(0, infoText.IndexOf(")") - 1); controller.caption = infoText; } if (line.IndexOf("text(") > -1) { string text = line.Substring(line.IndexOf("text(") + 6); text = text.Substring(0, text.IndexOf(")") - 1); controller.text = text; } if (line.IndexOf("channel(") > -1) { string channel = line.Substring(line.IndexOf("channel(") + 9); channel = channel.Substring(0, channel.IndexOf(")") - 1); controller.channel = channel; } if (line.IndexOf("range(") > -1) { string range = line.Substring(line.IndexOf("range(") + 6); range = range.Substring(0, range.IndexOf(")")); char[] delimiterChars = { ',' }; string[] tokens = range.Split(delimiterChars); controller.setRange(float.Parse(tokens[0]), float.Parse(tokens[1]), float.Parse(tokens[2])); } if (line.IndexOf("value(") > -1) { string value = line.Substring(line.IndexOf("value(") + 6); value = value.Substring(0, value.IndexOf(")")); controller.value = value.Length > 0 ? float.Parse(value) : 0; } locaChannelControllers.Add(controller); } } return locaChannelControllers; }