当前位置: 首页>>代码示例>>C#>>正文


C# Include类代码示例

本文整理汇总了C#中Include的典型用法代码示例。如果您正苦于以下问题:C# Include类的具体用法?C# Include怎么用?C# Include使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Include类属于命名空间,在下文中一共展示了Include类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Visit

		public override void Visit(Document document)
		{
			var directoryAttribute = document.Attributes.FirstOrDefault(a => a.Name == "docdir");
			if (directoryAttribute != null)
			{
				document.Attributes.Remove(directoryAttribute);
			}

			// check if this document has generated includes to other files
			var includeAttribute = document.Attributes.FirstOrDefault(a => a.Name == "includes-from-dirs");

			if (includeAttribute != null)
			{
				var thisFileUri = new Uri(_destination.FullName);
				var directories = includeAttribute.Value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

				foreach (var directory in directories)
				{
					foreach (var file in Directory.EnumerateFiles(Path.Combine(Program.OutputDirPath, directory), "*.asciidoc", SearchOption.AllDirectories))
					{
						var fileInfo = new FileInfo(file);
						var referencedFileUri = new Uri(fileInfo.FullName);
						var relativePath = thisFileUri.MakeRelativeUri(referencedFileUri);
						var include = new Include(relativePath.OriginalString);

						document.Add(include);
					}
				}
			}

			base.Visit(document);
		}
开发者ID:RossLieberman,项目名称:NEST,代码行数:32,代码来源:RawAsciidocVisitor.cs

示例2: CreateFromFile

        public void CreateFromFile(string strFileName)
        {
            var fs = new FileStream(strFileName, FileMode.Open);
            var len = (int)fs.Length;

            var data = new byte[len];
            fs.Read(data, 0, len);

            // create the #include handler
            m_IncludeHandler = new IncludeFx(strFileName);
            CreateFromMemory(data);
        }
开发者ID:aik6980,项目名称:GameFramework,代码行数:12,代码来源:EffectExD3d11.cs

示例3: EffectCompiler

        /// <summary>
        /// Initializes a new instance of the <see cref="EffectCompiler"/> class.
        /// </summary>
        /// <param name="data">The data.</param>
        /// <param name="defines">The defines.</param>
        /// <param name="includeFile">The include file.</param>
        /// <param name="flags">The flags.</param>
        /// <unmanaged>HRESULT D3DXCreateEffectCompiler([In] const char* pSrcData,[In] unsigned int SrcDataLen,[In, Buffer] const D3DXMACRO* pDefines,[In] ID3DXInclude* pInclude,[In] unsigned int Flags,[In] ID3DXEffectCompiler** ppCompiler,[In] ID3DXBuffer** ppParseErrors)</unmanaged>
        public EffectCompiler(string data, Macro[] defines, Include includeFile, ShaderFlags flags) : base(IntPtr.Zero)
        {
            IntPtr dataPtr = Marshal.StringToHGlobalAnsi(data);
            try
            {

                CreateEffectCompiler(dataPtr, data.Length, defines, includeFile, flags, this);
            }
            finally
            {
                Marshal.FreeHGlobal(dataPtr);
            }
        }
开发者ID:alexey-bez,项目名称:SharpDX,代码行数:21,代码来源:EffectCompiler.cs

示例4: Visit

		public override void Visit(Document document)
		{
			var directoryAttribute = document.Attributes.FirstOrDefault(a => a.Name == "docdir");
			if (directoryAttribute != null)
			{
				document.Attributes.Remove(directoryAttribute);
			}

			var github = "https://github.com/elastic/elasticsearch-net";
			var originalFile = Regex.Replace(_source.FullName.Replace("\\", "/"), @"^(.*Tests/)", $"{github}/tree/master/src/Tests/");
			document.Insert(0, new Comment
			{
				Style = CommentStyle.MultiLine,
				Text = $"IMPORTANT NOTE\r\n==============\r\nThis file has been generated from {originalFile}. \r\n" +
					   "If you wish to submit a PR for any spelling mistakes, typos or grammatical errors for this file,\r\n" +
					   "please modify the original csharp file found at the link and submit the PR with that change. Thanks!"
			});

			// check if this document has generated includes to other files
			var includeAttribute = document.Attributes.FirstOrDefault(a => a.Name == "includes-from-dirs");

			if (includeAttribute != null)
			{
				var thisFileUri = new Uri(_destination.FullName);
				var directories = includeAttribute.Value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

				foreach (var directory in directories)
				{
					foreach (var file in Directory.EnumerateFiles(Path.Combine(Program.OutputDirPath, directory), "*.asciidoc", SearchOption.AllDirectories))
					{
						var fileInfo = new FileInfo(file);
						var referencedFileUri = new Uri(fileInfo.FullName);
						var relativePath = thisFileUri.MakeRelativeUri(referencedFileUri);
						var include = new Include(relativePath.OriginalString);

						document.Add(include);
					}
				}
			}

			base.Visit(document);
		}
开发者ID:niemyjski,项目名称:elasticsearch-net,代码行数:42,代码来源:RawAsciidocVisitor.cs

示例5: Compile

        private static ShaderBytecode Compile(string content, bool isfile, Include include,string profile,string entrypoint)
        {
            try
            {
                string errors;

                if (isfile)
                {
                    return ShaderBytecode.CompileFromFile(content,entrypoint, profile, ShaderFlags.OptimizationLevel2, EffectFlags.None, null, include, out errors);
                }
                else
                {
                    return ShaderBytecode.Compile(content,entrypoint, profile, ShaderFlags.OptimizationLevel2, EffectFlags.None, null, include, out errors);
                }

            }
            catch (Exception ex)
            {
                return null;
            }
        }
开发者ID:arturoc,项目名称:FeralTic,代码行数:21,代码来源:DX11Shader.cs

示例6: FromMemory

        /// <summary>
        /// Compiles an effect from a memory buffer.
        /// </summary>
        /// <param name="device">The device.</param>
        /// <param name="memory">The buffer.</param>
        /// <param name="preprocessorDefines">The preprocessor defines.</param>
        /// <param name="includeFile">The include file.</param>
        /// <param name="skipConstants">The skip constants.</param>
        /// <param name="flags">The flags.</param>
        /// <param name="pool">The pool.</param>
        /// <returns>An <see cref="Effect"/></returns>
        /// <unmanaged>HRESULT D3DXCreateEffectEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataLen,[In, Buffer] const D3DXMACRO* pDefines,[In] ID3DXInclude* pInclude,[In] const char* pSkipConstants,[In] unsigned int Flags,[In] ID3DXEffectPool* pPool,[In] ID3DXEffect** ppEffect,[In] ID3DXBuffer** ppCompilationErrors)</unmanaged>
        public static Effect FromMemory(Device device, byte[] memory, Macro[] preprocessorDefines, Include includeFile, string skipConstants, ShaderFlags flags, EffectPool pool)
        {
           unsafe
            {
                Effect effect = null;
                Blob blobForErrors = null;

                try
                {
                    fixed (void* pData = memory)
                        D3DX9.CreateEffectEx(
                            device,
                            (IntPtr)pData,
                            memory.Length,
                            PrepareMacros(preprocessorDefines),
                            IncludeShadow.ToIntPtr(includeFile),
                            skipConstants,
                            (int)flags,
                            pool,
                            out effect,
                            out blobForErrors);
                }
                catch (SharpDXException ex)
                {
                    if (blobForErrors != null)
                        throw new CompilationException(ex.ResultCode, Utilities.BlobToString(blobForErrors));
                    throw;
                }
                return effect;
            }
        }
开发者ID:alexey-bez,项目名称:SharpDX,代码行数:43,代码来源:Effect.cs

示例7: FromStream

        /// <summary>
        /// Compiles an effect from a stream.
        /// </summary>
        /// <param name="device">The device.</param>
        /// <param name="stream">The stream.</param>
        /// <param name="preprocessorDefines">The preprocessor defines.</param>
        /// <param name="includeFile">The include file.</param>
        /// <param name="skipConstants">The skip constants.</param>
        /// <param name="flags">The flags.</param>
        /// <param name="pool">The pool.</param>
        /// <returns>An <see cref="Effect"/></returns>
        /// <unmanaged>HRESULT D3DXCreateEffectEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataLen,[In, Buffer] const D3DXMACRO* pDefines,[In] ID3DXInclude* pInclude,[In] const char* pSkipConstants,[In] unsigned int Flags,[In] ID3DXEffectPool* pPool,[In] ID3DXEffect** ppEffect,[In] ID3DXBuffer** ppCompilationErrors)</unmanaged>
        public static Effect FromStream(Device device, Stream stream, Macro[] preprocessorDefines, Include includeFile, string skipConstants, ShaderFlags flags, EffectPool pool)
        {
            unsafe
            {
                Effect effect = null;
                Blob blobForErrors = null;

                try
                {
                    if (stream is DataStream)
                    {
                        D3DX9.CreateEffectEx(
                            device,
                            ((DataStream)stream).PositionPointer,
                            (int)(stream.Length - stream.Position),
                            PrepareMacros(preprocessorDefines),
                            IncludeShadow.ToIntPtr(includeFile),
                            skipConstants,
                            (int)flags,
                            pool,
                            out effect,
                            out blobForErrors);
                    } 
                    else
                    {
                        var data = Utilities.ReadStream(stream);
                        fixed (void* pData = data)
                        D3DX9.CreateEffectEx(
                            device,
                            (IntPtr)pData,
                            data.Length,
                            PrepareMacros(preprocessorDefines),
                            IncludeShadow.ToIntPtr(includeFile),
                            skipConstants,
                            (int)flags,
                            pool,
                            out effect,
                            out blobForErrors);
                        
                    }
                    stream.Position = stream.Length;
                }
                catch (SharpDXException ex)
                {
                    if (blobForErrors != null)
                        throw new CompilationException(ex.ResultCode, Utilities.BlobToString(blobForErrors));
                    throw;
                }
                return effect;
            }
        }
开发者ID:alexey-bez,项目名称:SharpDX,代码行数:63,代码来源:Effect.cs

示例8: CreateEffectCompiler

 private static void CreateEffectCompiler(IntPtr data, int length, Macro[] defines, Include includeFile, ShaderFlags flags, EffectCompiler instance)
 {
     Blob blobForErrors = null;
     try
     {
         D3DX9.CreateEffectCompiler(data, length, defines, IncludeShadow.ToIntPtr(includeFile), (int)flags, instance, out blobForErrors);
     }
     catch (SharpDXException ex)
     {
         if (blobForErrors != null)
             throw new CompilationException(ex.ResultCode, Utilities.BlobToString(blobForErrors));
         throw;
     }
 }
开发者ID:alexey-bez,项目名称:SharpDX,代码行数:14,代码来源:EffectCompiler.cs

示例9: Compile

 /// <summary>
 /// Compiles the provided shader or effect source.
 /// </summary>
 /// <param name="shaderSource">A string containing the source of the shader or effect to compile.</param>
 /// <param name="entryPoint">The name of the shader entry-point function, or <c>null</c> for an effect file.</param>
 /// <param name="profile">The shader target or set of shader features to compile against.</param>
 /// <param name="shaderFlags">Shader compilation options.</param>
 /// <param name="effectFlags">Effect compilation options.</param>
 /// <param name="defines">A set of macros to define during compilation.</param>
 /// <param name="include">An interface for handling include files.</param>
 /// <param name="sourceFileName">Name of the source file.</param>
 /// <param name="secondaryDataFlags">The secondary data flags.</param>
 /// <param name="secondaryData">The secondary data.</param>
 /// <returns>
 /// The compiled shader bytecode, or <c>null</c> if the method fails.
 /// </returns>
 public static CompilationResult Compile(string shaderSource, string entryPoint, string profile,
                                      ShaderFlags shaderFlags, EffectFlags effectFlags, ShaderMacro[] defines,
                                      Include include, string sourceFileName = "unknown", SecondaryDataFlags secondaryDataFlags = SecondaryDataFlags.None, DataStream secondaryData = null)
 {
     if (string.IsNullOrEmpty(shaderSource))
     {
         throw new ArgumentNullException("shaderSource");
     }
     var shaderSourcePtr = Marshal.StringToHGlobalAnsi(shaderSource);
     try
     {
         return Compile(shaderSourcePtr, shaderSource.Length, entryPoint, profile, shaderFlags, effectFlags, defines,
                        include, sourceFileName, secondaryDataFlags, secondaryData);
     }
     finally
     {
         if (shaderSourcePtr != IntPtr.Zero) Marshal.FreeHGlobal(shaderSourcePtr);
     }
 }
开发者ID:pH200,项目名称:SharpDX,代码行数:35,代码来源:ShaderBytecode.cs

示例10: Compile

		/// <summary>
		/// 
		/// </summary>
		/// <param name="buildContext"></param>
		/// <param name="sourceFile"></param>
		/// <param name="profile"></param>
		/// <param name="entryPoint"></param>
		/// <param name="defines"></param>
		/// <param name="output"></param>
		/// <param name="listing"></param>
		/// <returns></returns>
		byte[] Compile ( BuildContext buildContext, Include include, string shaderSource, string sourceFile, string profile, string entryPoint, string defines, string output, string listing )
		{
			Log.Debug("{0} {1} {2} {3}", sourceFile, profile, entryPoint, defines );

			var	flags	=	FX.ShaderFlags.None;

			if ( DisableOptimization)	flags |= FX.ShaderFlags.OptimizationLevel0;
			// (!DisableOptimization)	flags |= FX.ShaderFlags.OptimizationLevel3;
			if ( PreferFlowControl)		flags |= FX.ShaderFlags.PreferFlowControl;
			if ( AvoidFlowControl)		flags |= FX.ShaderFlags.AvoidFlowControl;

			if ( MatrixPacking==ShaderMatrixPacking.ColumnMajor )	flags |= FX.ShaderFlags.PackMatrixColumnMajor;
			if ( MatrixPacking==ShaderMatrixPacking.RowMajor )		flags |= FX.ShaderFlags.PackMatrixRowMajor;

			var defs = defines.Split(new[]{' ','\t'}, StringSplitOptions.RemoveEmptyEntries)	
						.Select( entry => new SharpDX.Direct3D.ShaderMacro( entry, "1" ) )
						.ToArray();

			try {
			
				var sourceBytes = Encoding.UTF8.GetBytes(shaderSource);
				var result = FX.ShaderBytecode.Compile( sourceBytes, entryPoint, profile, flags, FX.EffectFlags.None, defs, include, sourceFile );
			
				if ( result.Message!=null ) {
					Log.Warning( result.Message );
				}

				File.WriteAllText( listing, result.Bytecode.Disassemble( FX.DisassemblyFlags.EnableColorCode, "" ) );

				return result.Bytecode.Data;

			} catch ( Exception ex ) {

				if (ex.Message.Contains("error X3501")) {
					Log.Debug("No entry point '{0}'. It's ok", entryPoint );
					return new byte[0];
				}

				throw;
			}
		}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:52,代码来源:UbershaderProcessor.cs

示例11: FromMemory

 /// <summary>
 /// Creates an effect compiler from a memory buffer containing an ASCII effect description .
 /// </summary>
 /// <param name="data">The data.</param>
 /// <param name="defines">The defines.</param>
 /// <param name="includeFile">The include file.</param>
 /// <param name="flags">The flags.</param>
 /// <returns>
 /// An instance of <see cref="EffectCompiler"/>
 /// </returns>
 /// <unmanaged>HRESULT D3DXCreateEffectCompiler([In] const void* pSrcData,[In] unsigned int SrcDataLen,[In, Buffer] const D3DXMACRO* pDefines,[In] ID3DXInclude* pInclude,[In] unsigned int Flags,[Out, Fast] ID3DXEffectCompiler** ppCompiler,[In] ID3DXBuffer** ppParseErrors)</unmanaged>
 public static EffectCompiler FromMemory(byte[] data, Macro[] defines, Include includeFile, ShaderFlags flags)
 {
     unsafe
     {
         var compiler = new EffectCompiler(IntPtr.Zero);
         fixed (void* pData = data)
             CreateEffectCompiler((IntPtr)pData, data.Length, defines, includeFile, flags, compiler);
         return compiler;
     }
 }
开发者ID:alexey-bez,项目名称:SharpDX,代码行数:21,代码来源:EffectCompiler.cs

示例12: CompileFromFile

        /// <summary>
        /// Compiles a shader or effect from a file on disk.
        /// </summary>
        /// <param name="fileName">The name of the source file to compile.</param>
        /// <param name="entryPoint">The name of the shader entry-point function, or <c>null</c> for an effect file.</param>
        /// <param name="profile">The shader target or set of shader features to compile against.</param>
        /// <param name="shaderFlags">Shader compilation options.</param>
        /// <param name="effectFlags">Effect compilation options.</param>
        /// <param name="defines">A set of macros to define during compilation.</param>
        /// <param name="include">An interface for handling include files.</param>
        /// <returns>
        /// The compiled shader bytecode, or <c>null</c> if the method fails.
        /// </returns>
        public static CompilationResult CompileFromFile(string fileName, string entryPoint, string profile, ShaderFlags shaderFlags = ShaderFlags.None, EffectFlags effectFlags = EffectFlags.None, ShaderMacro[] defines = null, Include include = null)
        {
            if (fileName == null)
            {
                throw new ArgumentNullException("fileName");
            }
            if (profile == null)
            {
                throw new ArgumentNullException("profile");
            }
            if (!File.Exists(fileName))
            {
                throw new FileNotFoundException("Could not open the shader or effect file.", fileName);
            }

            unsafe
            {
                var resultCode = Result.Ok;

                Blob blobForCode = null;
                Blob blobForErrors = null;

#if DIRECTX11_1
                resultCode = D3D.CompileFromFile(
                    fileName,
                    PrepareMacros(defines),
                    IncludeShadow.ToIntPtr(include),
                    entryPoint,
                    profile,
                    shaderFlags,
                    effectFlags,
                    out blobForCode,
                    out blobForErrors);

                if (resultCode.Failure)
                {
                    if (blobForErrors != null)
                    {
                        if (Configuration.ThrowOnShaderCompileError) throw new CompilationException(resultCode, Utilities.BlobToString(blobForErrors));
                    }
                    else
                    {
                        throw new SharpDXException(resultCode);
                    }
                }

                return new CompilationResult(blobForCode != null ? new ShaderBytecode(blobForCode) : null, resultCode, Utilities.BlobToString(blobForErrors));
#else
                return Compile(File.ReadAllText(fileName), entryPoint, profile, shaderFlags, effectFlags,
                                PrepareMacros(defines), include, fileName);
#endif
            }


        }
开发者ID:pH200,项目名称:SharpDX,代码行数:68,代码来源:ShaderBytecode.cs

示例13: FromFile

 /// <summary>
 /// Compiles an effect from a file.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="fileName">Name of the file.</param>
 /// <param name="preprocessorDefines">The preprocessor defines.</param>
 /// <param name="includeFile">The include file.</param>
 /// <param name="skipConstants">The skip constants.</param>
 /// <param name="flags">The flags.</param>
 /// <returns>
 /// An <see cref="Effect"/>
 /// </returns>
 /// <unmanaged>HRESULT D3DXCreateEffectEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataLen,[In, Buffer] const D3DXMACRO* pDefines,[In] ID3DXInclude* pInclude,[In] const char* pSkipConstants,[In] unsigned int Flags,[In] ID3DXEffectPool* pPool,[In] ID3DXEffect** ppEffect,[In] ID3DXBuffer** ppCompilationErrors)</unmanaged>
 public static Effect FromFile(Device device, string fileName, Macro[] preprocessorDefines, Include includeFile, string skipConstants, ShaderFlags flags)
 {
     return FromFile(device, fileName, preprocessorDefines, includeFile, skipConstants, flags, null);
 }
开发者ID:alexey-bez,项目名称:SharpDX,代码行数:17,代码来源:Effect.cs

示例14: FromString

 /// <summary>
 /// Compiles an effect from a string.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="sourceData">The source data.</param>
 /// <param name="preprocessorDefines">The preprocessor defines.</param>
 /// <param name="includeFile">The include file.</param>
 /// <param name="skipConstants">The skip constants.</param>
 /// <param name="flags">The flags.</param>
 /// <returns>
 /// An <see cref="Effect"/>
 /// </returns>
 /// <unmanaged>HRESULT D3DXCreateEffectEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataLen,[In, Buffer] const D3DXMACRO* pDefines,[In] ID3DXInclude* pInclude,[In] const char* pSkipConstants,[In] unsigned int Flags,[In] ID3DXEffectPool* pPool,[In] ID3DXEffect** ppEffect,[In] ID3DXBuffer** ppCompilationErrors)</unmanaged>
 public static Effect FromString(Device device, string sourceData, Macro[] preprocessorDefines, Include includeFile, string skipConstants, ShaderFlags flags)
 {
     return FromString(device, sourceData, preprocessorDefines, includeFile, skipConstants, flags, null);
 }
开发者ID:alexey-bez,项目名称:SharpDX,代码行数:17,代码来源:Effect.cs

示例15: Preprocess

 /// <summary>
 ///   Preprocesses the provided shader or effect source.
 /// </summary>
 /// <param name = "shaderSource">A string containing the source of the shader or effect to preprocess.</param>
 /// <param name = "defines">A set of macros to define during preprocessing.</param>
 /// <param name = "include">An interface for handling include files.</param>
 /// <returns>The preprocessed shader source.</returns>
 public static string Preprocess(string shaderSource, ShaderMacro[] defines = null, Include include = null, string sourceFileName = "")
 {
     string errors = null;
     if (string.IsNullOrEmpty(shaderSource))
     {
         throw new ArgumentNullException("shaderSource");
     }
     var shaderSourcePtr = Marshal.StringToHGlobalAnsi(shaderSource);
     try
     {
         return Preprocess(shaderSourcePtr, shaderSource.Length, defines, include, out errors, sourceFileName);
     } 
     finally
     {
         if (shaderSourcePtr != IntPtr.Zero) 
             Marshal.FreeHGlobal(shaderSourcePtr);
     }
 }
开发者ID:pH200,项目名称:SharpDX,代码行数:25,代码来源:ShaderBytecode.cs


注:本文中的Include类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。