Esempio n. 1
0
        /// <summary>
        /// Writes dialog with given writer.
        /// </summary>
        /// <param name="dialog">Dialog to write.</param>
        /// <param name="targetWriter">Target file for a dialog.</param>
        private void writeDialog(AnnotatedDialog dialog, TextWriter targetWriter)
        {
            var jsonDialog = dialog.ToJson();

            if (jsonDialog.Contains('\n'))
            {
                throw new NotSupportedException("json cannot contain new lines");
            }

            targetWriter.WriteLine(jsonDialog);
        }
Esempio n. 2
0
        /// <summary>
        /// Determine whether requirements set by this description are met.
        /// </summary>
        /// <param name="dialog">Dialog tested for the requirements.</param>
        /// <returns><c>true</c> whether requirements are met, <c>false</c> otherwise.</returns>
        internal bool MeetRequirements(AnnotatedDialog dialog)
        {
            if (!_allowAllTaskTypes)
            {
                if (!_allowedTaskTypes.Contains(dialog.TaskType))
                {
                    return(false);
                }
            }

            if (!_allowAllSubstitutions)
            {
                if (!_allowedSubstitutionsData.Contains(dialog.SubstitutionData))
                {
                    return(false);
                }
            }

            //no requirement has been violated
            return(true);
        }