Example #1
0
        public SchemaFile Deserialize(SourceReader source)
        {
            using (source)
            {
                var file   = new SchemaFile();
                var reader = source.GetReader();

                string line = null;
                while ((line = reader.ReadLine()) != null)
                {
                    if (line.TrimStart().StartsWith("#"))
                    {
                        var text = line.Trim();
                        text = text.Substring(1);
                        file.AddComment(text);
                    }
                    else if (line.Trim().Length == 0)
                    {
                        file.AddEmptyLine();
                    }
                    else if (line.StartsWith(" "))
                    {
                        var value = line.Trim();
                        if (value == "(null)")
                        {
                            value = null;
                        }
                        file.AddValue(value);
                    }
                    else
                    {
                        file.AddProperty(line.Trim());
                    }
                }

                return(file);
            }
        }
Example #2
0
 public Schema(SchemaFile file)
 {
     this.file = file;
 }
Example #3
0
        public static Schema Parse(SourceReader source)
        {
            var file = SchemaFile.Parse(source);

            return(new Schema(file));
        }
Example #4
0
 public Schema()
 {
     this.file = new SchemaFile();
 }