Пример #1
0
        /// <summary>
        /// Parse chat definitions from a file (or folder of files) ending with
        /// '*.gs', or the specified extension
        /// </summary>
        /// <param name="fileOrFolder">File (or folder of files) to parse</param>
        /// <param name="disableValidators">If set to <c>true</c> disable app-specific validators (default=false).</param>
        /// <param name="fileExt">File extension to load (empty-string for all files, default is ".gs")</param>
        public void ParseFile(FileInfo fileOrFolder,
                              bool disableValidators = false, string fileExt = null)
        {
            var file  = fileOrFolder.FullName;
            var files = Directory.Exists(file) ? Directory.GetFiles
                            (file, '*' + (fileExt ?? ".gs")) : new[] { file };

            this.validatorsDisabled = disableValidators;

            foreach (var f in files)
            {
                var text = File.ReadAllText(f);
                parser.Parse(ChatParser.StripComments(text));
            }
            //Chats().ForEach(c => Console.WriteLine(c.ToTree()));
        }