Beispiel #1
0
        public ParseLoader(string path)
        {
            this._Paths        = new Dictionary <string, string>();
            this._LoadedParses = new Dictionary <string, ParseSchemaFile>();

            foreach (var inputPath in Directory.GetFiles(path, "*.parse.xml", SearchOption.AllDirectories))
            {
                var name = ParseSchemaFile.GetNameFromFile(inputPath);
                if (name == "ReferenceEArrayTemplate")
                {
                    continue;
                }

                this._Paths.Add(name, inputPath);
            }
        }
Beispiel #2
0
        public ParseSchemaFile LoadParse(string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (this._Paths.ContainsKey(name) == false)
            {
                throw new ArgumentException("no such parse", nameof(name));
            }

            if (this._LoadedParses.ContainsKey(name) == true)
            {
                return(this._LoadedParses[name]);
            }

            var parse = ParseSchemaFile.LoadFile(this._Paths[name]);

            this._LoadedParses.Add(name, parse);
            ResolveParse(parse.Table);
            return(parse);
        }