GradsSharp.Dimension.parse_output C# (CSharp) Method

parse_output() private method

private parse_output ( string output ) : void
output string
return void
        private void parse_output(string[] output)
        {
            foreach (string line in output)
            {
                string s = line.Replace("  ", "\t");
                while (s.Contains("  "))
                    s = s.Replace("  ", " ");
                while (s.Contains("\t\t"))
                    s = s.Replace("\t\t", "\t");
                s = s.Replace("\t ", "\t").Replace(" \t", "\t");
                string[] splitted = s.Split('\t');
                if (splitted.Length != 3)
                    continue;
                varying = splitted[0].Substring(splitted[0].LastIndexOf(' ') + 1).Equals("varying");
                if (splitted[1].StartsWith(name + " "))
                    s = splitted[1];
                else if (splitted[2].StartsWith(name + " "))
                    s = splitted[2];
                else continue;
                s = s.Substring(s.IndexOf('=') + 2);
                if (!varying)
                {
                    start = double.Parse(s);
                    end = start;
                }
                else
                {
                    start = double.Parse(s.Substring(0, s.IndexOf(' ')));
                    s = s.Substring(s.LastIndexOf(' ') + 1);
                    end = double.Parse(s);
                }
                return;
            }
            throw new Exception("Dimension " + name + " not found!");
        }