コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the FileInputMechanism class.
        /// </summary>
        /// <param name="baseDirectoryPath"> The base input directory path. </param>
        /// <param name="xpe"> The XML persist engine in-effect. </param>
        /// <param name="sourceStrategy"> The source strategy in-effect. </param>
        public FileInputMechanism(string baseDirectoryPath, IXmlPersistEngine xpe, ISourceStrategy sourceStrategy)
        {
            if ((object)baseDirectoryPath == null)
            {
                throw new ArgumentNullException(nameof(baseDirectoryPath));
            }

            if ((object)xpe == null)
            {
                throw new ArgumentNullException(nameof(xpe));
            }

            if ((object)sourceStrategy == null)
            {
                throw new ArgumentNullException(nameof(sourceStrategy));
            }

            if (!Path.HasExtension(baseDirectoryPath) &&
                !baseDirectoryPath.EndsWith(Path.DirectorySeparatorChar.ToString()))
            {
                baseDirectoryPath = baseDirectoryPath + Path.DirectorySeparatorChar;
            }

            this.baseDirectoryPath = Path.GetDirectoryName(Path.GetFullPath(baseDirectoryPath));
            this.xpe            = xpe;
            this.sourceStrategy = sourceStrategy;
        }
コード例 #2
0
ファイル: FileOutputMechanism.cs プロジェクト: textmetal/main
		/// <summary>
		/// Initializes a new instance of the FileOutputMechanism class.
		/// </summary>
		/// <param name="baseDirectoryPath"> The base output directory path. </param>
		/// <param name="logFileName"> The file name of the log file (relative to base directory path) or empty string for console output. </param>
		/// <param name="logFileEncoding"> The encoding of the log file. </param>
		/// <param name="xpe"> The XML persist engine in-effect. </param>
		public FileOutputMechanism(string baseDirectoryPath, string logFileName, Encoding logFileEncoding, IXmlPersistEngine xpe)
		{
			if ((object)baseDirectoryPath == null)
				throw new ArgumentNullException(nameof(baseDirectoryPath));

			if ((object)logFileName == null)
				throw new ArgumentNullException(nameof(logFileName));

			if ((object)logFileEncoding == null)
				throw new ArgumentNullException(nameof(logFileEncoding));

			if ((object)xpe == null)
				throw new ArgumentNullException(nameof(xpe));

			if (!Path.HasExtension(baseDirectoryPath) &&
				!baseDirectoryPath.EndsWith(Path.DirectorySeparatorChar.ToString()))
				baseDirectoryPath = baseDirectoryPath + Path.DirectorySeparatorChar;

			this.baseDirectoryPath = Path.GetDirectoryName(Path.GetFullPath(baseDirectoryPath));
			this.logFileName = logFileName;
			this.logFileEncoding = logFileEncoding;
			this.xpe = xpe;

			this.SetupLogger();
			this.EnsureOutputDirectory(false);
		}
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the TemplatingContext class.
        /// </summary>
        /// <param name="xpe"> The XML persist engine in-effect. </param>
        /// <param name="tokenizer"> The tokenizer in-efect. </param>
        /// <param name="input"> The input mechanism in-effect. </param>
        /// <param name="output"> The output mechanism in-effect. </param>
        /// <param name="properties"> The properties in-effect. </param>
        public TemplatingContext(IXmlPersistEngine xpe, Tokenizer tokenizer, IInputMechanism input, IOutputMechanism output, IDictionary <string, IList <string> > properties)
        {
            if ((object)xpe == null)
            {
                throw new ArgumentNullException(nameof(xpe));
            }

            if ((object)tokenizer == null)
            {
                throw new ArgumentNullException(nameof(tokenizer));
            }

            if ((object)input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            if ((object)output == null)
            {
                throw new ArgumentNullException(nameof(output));
            }

            if ((object)properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            this.xpe        = xpe;
            this.tokenizer  = tokenizer;
            this.input      = input;
            this.output     = output;
            this.properties = properties;
        }
        public XpeSerializationStrategy(IXmlPersistEngine xpe)
        {
            if ((object)xpe == null)
            {
                throw new ArgumentNullException(nameof(xpe));
            }

            this.xpe = xpe;
        }
コード例 #5
0
		/// <summary>
		/// Initializes a new instance of the TextWriterOutputMechanism class.
		/// </summary>
		public TextWriterOutputMechanism(TextWriter textWriter, IXmlPersistEngine xpe)
		{
			if ((object)textWriter == null)
				throw new ArgumentNullException(nameof(textWriter));

			if ((object)xpe == null)
				throw new ArgumentNullException(nameof(xpe));

			this.TextWriters.Push(textWriter);
			this.xpe = xpe;
		}
コード例 #6
0
        /// <summary>
        /// Initializes a new instance of the FileInputMechanism class.
        /// </summary>
        /// <param name="baseDirectoryPath"> The base input directory path. </param>
        /// <param name="xpe"> The XML persist engine in-effect. </param>
        public FileInputMechanism(string baseDirectoryPath, IXmlPersistEngine xpe)
        {
            if ((object)baseDirectoryPath == null)
                throw new ArgumentNullException("baseDirectoryPath");

            if ((object)xpe == null)
                throw new ArgumentNullException("xpe");

            this.baseDirectoryPath = baseDirectoryPath;
            this.xpe = xpe;
        }
		/// <summary>
		/// Quickly register all well-known constructs within this framework.
		/// </summary>
		/// <param name="xpe"> The target XML Persist Engine instance. </param>
		public static void RegisterWellKnownConstructs(this IXmlPersistEngine xpe)
		{
			if ((object)xpe == null)
				throw new ArgumentNullException(nameof(xpe));

			xpe.RegisterKnownXmlTextObject<TemplateXmlTextObject>();

			xpe.RegisterKnownXmlObject<DebuggerBreakpointConstruct>();

			xpe.RegisterKnownXmlObject<AssociativeContainerConstruct>();
			xpe.RegisterKnownXmlObject<ArrayConstruct>();
			xpe.RegisterKnownXmlObject<ObjectConstruct>();
			xpe.RegisterKnownXmlObject<PropertyConstruct>();
			xpe.RegisterKnownXmlObject<ProxyConstruct>();

			xpe.RegisterKnownXmlObject<AspectConstruct>();
			xpe.RegisterKnownXmlObject<BinaryExpressionConstruct>();
			xpe.RegisterKnownXmlObject<ExpressionContainerConstruct>();
			xpe.RegisterKnownXmlObject<FacetConstruct>();
			xpe.RegisterKnownXmlObject<JavaScriptConstruct>();
			xpe.RegisterKnownXmlObject<NullaryExpressionConstruct>();
			xpe.RegisterKnownXmlObject<UnaryExpressionConstruct>();
			xpe.RegisterKnownXmlObject<ValueConstruct>();

			xpe.RegisterKnownXmlObject<AscendingConstruct>();
			xpe.RegisterKnownXmlObject<DescendingConstruct>();
			xpe.RegisterKnownXmlObject<SortContainerConstruct>();

			xpe.RegisterKnownXmlObject<AliasConstruct>();
			xpe.RegisterKnownXmlObject<AllocConstruct>();
			xpe.RegisterKnownXmlObject<AssignConstruct>();
			xpe.RegisterKnownXmlObject<DoUntilConstruct>();
			xpe.RegisterKnownXmlObject<DoWhileConstruct>();
			xpe.RegisterKnownXmlObject<ExpandoConstruct>();
			xpe.RegisterKnownXmlObject<ForConstruct>();
			xpe.RegisterKnownXmlObject<ForEachConstruct>();
			xpe.RegisterKnownXmlObject<FreeConstruct>();
			xpe.RegisterKnownXmlObject<IfConstruct>();
			xpe.RegisterKnownXmlObject<ImportConstruct>();
			xpe.RegisterKnownXmlObject<IncludeConstruct>();
			xpe.RegisterKnownXmlObject<InvokeSourceStrategyConstruct>();
			xpe.RegisterKnownXmlObject<LogConstruct>();
			xpe.RegisterKnownXmlObject<OutputScopeConstruct>();
			xpe.RegisterKnownXmlObject<ReferenceConstruct>();
			xpe.RegisterKnownXmlObject<TemplateConstruct>();
			xpe.RegisterKnownXmlObject<TemplateContainerConstruct>();
			xpe.RegisterKnownXmlObject<UnlessConstruct>();
			xpe.RegisterKnownXmlObject<UntilConstruct>();
			xpe.RegisterKnownXmlObject<WhileConstruct>();
			xpe.RegisterKnownXmlObject<WriteConstruct>();
		}
        /// <summary>
        /// Initializes a new instance of the TextWriterOutputMechanism class.
        /// </summary>
        public TextWriterOutputMechanism(TextWriter textWriter, IXmlPersistEngine xpe)
        {
            if ((object)textWriter == null)
            {
                throw new ArgumentNullException(nameof(textWriter));
            }

            if ((object)xpe == null)
            {
                throw new ArgumentNullException(nameof(xpe));
            }

            this.TextWriters.Push(textWriter);
            this.xpe = xpe;
        }
コード例 #9
0
ファイル: FileInputMechanism.cs プロジェクト: textmetal/main
		/// <summary>
		/// Initializes a new instance of the FileInputMechanism class.
		/// </summary>
		/// <param name="baseDirectoryPath"> The base input directory path. </param>
		/// <param name="xpe"> The XML persist engine in-effect. </param>
		/// <param name="sourceStrategy"> The source strategy in-effect. </param>
		public FileInputMechanism(string baseDirectoryPath, IXmlPersistEngine xpe, ISourceStrategy sourceStrategy)
		{
			if ((object)baseDirectoryPath == null)
				throw new ArgumentNullException(nameof(baseDirectoryPath));

			if ((object)xpe == null)
				throw new ArgumentNullException(nameof(xpe));

			if ((object)sourceStrategy == null)
				throw new ArgumentNullException(nameof(sourceStrategy));

			if (!Path.HasExtension(baseDirectoryPath) &&
				!baseDirectoryPath.EndsWith(Path.DirectorySeparatorChar.ToString()))
				baseDirectoryPath = baseDirectoryPath + Path.DirectorySeparatorChar;

			this.baseDirectoryPath = Path.GetDirectoryName(Path.GetFullPath(baseDirectoryPath));
			this.xpe = xpe;
			this.sourceStrategy = sourceStrategy;
		}
コード例 #10
0
        /// <summary>
        /// Initializes a new instance of the TemplatingContext class.
        /// </summary>
        /// <param name="xpe"> The XML persist engine in-effect. </param>
        /// <param name="tokenizer"> The tokenizer in-efect. </param>
        /// <param name="input"> The input mechanism in-effect. </param>
        /// <param name="output"> The output mechanism in-effect. </param>
        public TemplatingContext(IXmlPersistEngine xpe, Tokenizer tokenizer, IInputMechanism input, IOutputMechanism output)
        {
            if ((object)xpe == null)
                throw new ArgumentNullException("xpe");

            if ((object)tokenizer == null)
                throw new ArgumentNullException("tokenizer");

            if ((object)input == null)
                throw new ArgumentNullException("input");

            if ((object)output == null)
                throw new ArgumentNullException("output");

            this.xpe = xpe;
            this.tokenizer = tokenizer;
            this.input = input;
            this.output = output;
        }
コード例 #11
0
ファイル: TemplatingContext.cs プロジェクト: textmetal/main
		/// <summary>
		/// Initializes a new instance of the TemplatingContext class.
		/// </summary>
		/// <param name="xpe"> The XML persist engine in-effect. </param>
		/// <param name="tokenizer"> The tokenizer in-efect. </param>
		/// <param name="input"> The input mechanism in-effect. </param>
		/// <param name="output"> The output mechanism in-effect. </param>
		/// <param name="properties"> The properties in-effect. </param>
		public TemplatingContext(IXmlPersistEngine xpe, Tokenizer tokenizer, IInputMechanism input, IOutputMechanism output, IDictionary<string, IList<string>> properties)
		{
			if ((object)xpe == null)
				throw new ArgumentNullException(nameof(xpe));

			if ((object)tokenizer == null)
				throw new ArgumentNullException(nameof(tokenizer));

			if ((object)input == null)
				throw new ArgumentNullException(nameof(input));

			if ((object)output == null)
				throw new ArgumentNullException(nameof(output));

			if ((object)properties == null)
				throw new ArgumentNullException(nameof(properties));

			this.xpe = xpe;
			this.tokenizer = tokenizer;
			this.input = input;
			this.output = output;
			this.properties = properties;
		}
コード例 #12
0
        /// <summary>
        /// Initializes a new instance of the FileOutputMechanism class.
        /// </summary>
        /// <param name="baseDirectoryPath"> The base output directory path. </param>
        /// <param name="logFileName"> The file name of the log file (relative to base directory path) or empty string for console output. </param>
        /// <param name="logFileEncoding"> The encoding of the log file. </param>
        /// <param name="xpe"> The XML persist engine in-effect. </param>
        public FileOutputMechanism(string baseDirectoryPath, string logFileName, Encoding logFileEncoding, IXmlPersistEngine xpe)
        {
            if ((object)baseDirectoryPath == null)
            {
                throw new ArgumentNullException(nameof(baseDirectoryPath));
            }

            if ((object)logFileName == null)
            {
                throw new ArgumentNullException(nameof(logFileName));
            }

            if ((object)logFileEncoding == null)
            {
                throw new ArgumentNullException(nameof(logFileEncoding));
            }

            if ((object)xpe == null)
            {
                throw new ArgumentNullException(nameof(xpe));
            }

            if (!Path.HasExtension(baseDirectoryPath) &&
                !baseDirectoryPath.EndsWith(Path.DirectorySeparatorChar.ToString()))
            {
                baseDirectoryPath = baseDirectoryPath + Path.DirectorySeparatorChar;
            }

            this.baseDirectoryPath = Path.GetDirectoryName(Path.GetFullPath(baseDirectoryPath));
            this.logFileName       = logFileName;
            this.logFileEncoding   = logFileEncoding;
            this.xpe = xpe;

            this.SetupLogger();
            this.EnsureOutputDirectory(false);
        }