public static ProjectElement Load(Stream s) { var factory = ElementFactory.Instance; var elements = new List <ElementBase>(); using (var sr = new StreamReader(s)) { var currLine = ""; while (String.IsNullOrEmpty(currLine)) { currLine = sr.ReadLine(); } var projectElement = new ProjectElement(currLine); projectElement.Read(sr); return(projectElement); } /* * line = line.TrimStart(); * * var isNewFx = * line.StartsWith("BYPASS") && * currElement != null && * currElement.ElementName == "FXCHAIN"; * * var startNewElement = * line.StartsWith("<") || * isNewFx; * * if (startNewElement) * { * if (isNewFx) * currElement = currElement.ParentElement; * if (currElementContent != null) * { * currElement = factory.CreateElement(currElement, currElementContent.ToString()); * elements.Add(currElement); * } * currElementContent = new StringBuilder(); * } * * currElementContent?.AppendLine(line); * if (line.StartsWith(">")) * currElement = currElement?.ParentElement; * } * * var rootElement = elements[0]; * return rootElement as ProjectElement; */ }