• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# SourceFile类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Process

		public virtual void Process(SourceFile file)
		{
			foreach (var step in internalSteps)
			{
				step.Process(file);
			}
		}
开发者ID:smoothdeveloper,项目名称:Castle.MonoRail,代码行数:7,代码来源:ChainingStep.cs


示例2: Process

		public void Process(SourceFile file)	{
			file.RenderBody = Internal.RegularExpressions.ContentTag.Replace(
				file.RenderBody,
				delegate(Match match) 
				{
					var parsedAttributes = match.Groups["attributes"].Value;
					var attributes = Utilities.GetAttributesDictionaryFrom(parsedAttributes);
					if (attributes.Contains("runat") && String.Equals("server", (attributes["runat"] as string), StringComparison.InvariantCultureIgnoreCase)) 
					{
						if (!attributes.Contains("contentplaceholderid"))
							throw new AspViewException(ExceptionMessages.ContentPlaceHolderIdAttributeNotFound);
						if (String.IsNullOrEmpty((string)attributes["contentplaceholderid"]))
							throw new AspViewException(ExceptionMessages.ContentPlaceHolderIdAttributeEmpty);
						var contentplaceholderid = (string)attributes["contentplaceholderid"];

						// handle ViewContents special case
						if (contentplaceholderid == "ViewContents")
							return match.Groups["content"].Value;
						var capturefortagformat = @"<component:capturefor id=""{0}"">{1}</component:capturefor>";
						return string.Format(capturefortagformat, contentplaceholderid, match.Groups["content"].Value);
					}
					else
						return match.Value;
				                      
				}
				);
		}
开发者ID:smoothdeveloper,项目名称:Castle.MonoRail,代码行数:27,代码来源:ContentSubstitutionStep.cs


示例3: tokenize_file

		void tokenize_file (SourceFile sourceFile, ModuleContainer module, ParserSession session)
		{
			Stream input;

			try {
				input = File.OpenRead (sourceFile.Name);
			} catch {
				Report.Error (2001, "Source file `" + sourceFile.Name + "' could not be found");
				return;
			}

			using (input){
				SeekableStreamReader reader = new SeekableStreamReader (input, ctx.Settings.Encoding);
				var file = new CompilationSourceFile (module, sourceFile);

				Tokenizer lexer = new Tokenizer (reader, file, session, ctx.Report);
				int token, tokens = 0, errors = 0;

				while ((token = lexer.token ()) != Token.EOF){
					tokens++;
					if (token == Token.ERROR)
						errors++;
				}
				Console.WriteLine ("Tokenized: " + tokens + " found " + errors + " errors");
			}
			
			return;
		}
开发者ID:furesoft,项目名称:NRefactory,代码行数:28,代码来源:driver.cs


示例4: Process

		public virtual void Process(SourceFile file)
		{
			foreach (IPreCompilationStep step in internalSteps)
			{
				step.Process(file);
			}
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:7,代码来源:ChainingStep.cs


示例5: ItemTests

        public void ItemTests()
        {
            var sourceFile = new SourceFile(Services.FileSystem, "test.txt", "test.txt");

            var doc = Services.CompositionService.Resolve<JsonTextSnapshot>().With(SnapshotParseContext.Empty, sourceFile, "{ \"Item\": { \"Fields\": [ { \"Name\": \"Text\", \"Value\": \"123\" } ] } }");
            var root = doc.Root;
            Assert.IsNotNull(root);
            Assert.AreEqual("Item", root.Key);
            Assert.AreEqual(1, root.ChildNodes.Count());

            var fields = root.ChildNodes.First();
            Assert.AreEqual(1, fields.ChildNodes.Count());

            var field = fields.ChildNodes.First();
            Assert.AreEqual("Text", field.GetAttributeValue("Name"));
            Assert.AreEqual("123", field.GetAttributeValue("Value"));
            Assert.AreEqual(0, field.ChildNodes.Count());

            var attribute = field.GetAttribute("Name");
            Assert.IsNotNull(attribute);
            Assert.AreEqual("Text", attribute.Value);
            Assert.AreEqual(0, attribute.Attributes.Count());
            Assert.AreEqual(0, attribute.ChildNodes.Count());
            Assert.AreEqual(field.Snapshot, attribute.Snapshot);
            Assert.AreEqual(doc, attribute.Snapshot);
        }
开发者ID:pveller,项目名称:Sitecore.Pathfinder,代码行数:26,代码来源:JsonDocumentTests.cs


示例6: CodeIssueFile

        internal CodeIssueFile(CodeIssue codeIssue, SourceFile file, string message)
        {
            this.codeIssue = codeIssue;
            this.file = file;
            this.message = message;

        }
开发者ID:kevinmiles,项目名称:dxcorecommunityplugins,代码行数:7,代码来源:CodeIssueFile.cs


示例7: Process

		public void Process(SourceFile file)
		{
			file.RenderBody = Internal.RegularExpressions.LayoutContentPlaceHolder.Replace(
				file.RenderBody,
				delegate(Match match) 
				{
					string parsedAttributes = match.Groups["attributes"].Value;
					IDictionary attributes = Utilities.GetAttributesDictionaryFrom(parsedAttributes);
					if(attributes.Contains("runat") && String.Equals("server",(attributes["runat"] as string), StringComparison.InvariantCultureIgnoreCase))
					{
						if (!attributes.Contains("id"))
							throw new AspViewException(ExceptionMessages.IdAttributeNotFound);
						if (String.IsNullOrEmpty((string)attributes["id"]))
							throw new AspViewException(ExceptionMessages.IdAttributeEmpty);

						string placeholderid = (string) attributes["id"];
						if(!file.Properties.ContainsKey(placeholderid))
						{
							// handle ViewContents special case
							if (placeholderid != "ViewContents")
								file.Properties.Add(placeholderid, new ViewProperty(placeholderid, "string", @""""""));
						}
						else if(!String.Equals(file.Properties[placeholderid].Type, "string", StringComparison.InvariantCultureIgnoreCase))
						{
							throw new AspViewException(String.Format(ExceptionMessages.ViewPropertyAllreadyRegisteredWithOtherTypeFormat, placeholderid));
						}
						return String.Format("<%={0}%>", placeholderid);
					}
					else
					{
						return match.Value;
					}
				});
		}
开发者ID:ralescano,项目名称:castle,代码行数:34,代码来源:LayoutContentPlaceHolderSubstitutionStep.cs


示例8: RunSteps

		private void RunSteps(SourceFile file)
		{
			foreach (IPreCompilationStep step in provider.GetSteps())
			{
				step.Process(file);
			}
		}
开发者ID:ralescano,项目名称:castle,代码行数:7,代码来源:DefaultStepsProviderIntegrationTestFixture.cs


示例9: AddNewImport

 public void AddNewImport(SourcePoint start, string namespaceName, SourceFile sourceFile, bool isLast)
 {
     string newImportCall = CodeRush.Language.GenerateElement(new NamespaceReference(namespaceName), sourceFile.Project.Language);
     if (isLast && newImportCall.EndsWith(Environment.NewLine))		// Remove cr/lf from last entry.
         newImportCall = newImportCall.Remove(newImportCall.Length - Environment.NewLine.Length);
     _NewImportCalls.Add(new FileChange(sourceFile.Name, start, newImportCall));
 }
开发者ID:modulexcite,项目名称:CR_SyncNamespacesToFolder,代码行数:7,代码来源:FileChangeGroup.cs


示例10: CheckFile

 internal CheckFile(IssueServices issueService, 
                     SourceFile file, 
                     IssueProcessor issueProcessor)
 {
     this.issueService = issueService;
     this.file = file;
     this.issueProcessor = issueProcessor;
 }
开发者ID:kevinmiles,项目名称:dxcorecommunityplugins,代码行数:8,代码来源:CheckFile.cs


示例11: TokenInfo

 public TokenInfo(Token token, string value, SourceFile sourceFile, int ln, int col)
 {
     this.token = token;
     this.value = value;
     this.ln = ln;
     this.col = col;
     this.sourceFile = sourceFile;
 }
开发者ID:robertsundstrom,项目名称:vb-lite-compiler,代码行数:8,代码来源:TokenInfo.cs


示例12:

		/// <summary>
		/// Performs server side comment stripping
		/// </summary>
		/// <param name="file">The source file object to act upon.</param>
		void IPreCompilationStep.Process(SourceFile file) 
		{
			file.RenderBody = Internal.RegularExpressions.ServerSideComment.Replace(
				file.RenderBody,
				string.Empty
			);
			
		}
开发者ID:rambo-returns,项目名称:MonoRail,代码行数:12,代码来源:ServerSideCommentStripperStep.cs


示例13: RegisterSectionHandler

		private void RegisterSectionHandler(string handlerName, string sectionContent, SourceFile file)
		{
			var processedSection = sectionContent;
			if (Internal.RegularExpressions.ViewComponentTags.IsMatch(sectionContent))
				processedSection = Process(sectionContent, file);
			processedSection = scriptTransformer.Transform(processedSection);
			file.ViewComponentSectionHandlers[handlerName] = processedSection;
		}
开发者ID:smoothdeveloper,项目名称:Castle.MonoRail,代码行数:8,代码来源:ViewComponentTagsStep.cs


示例14: Process

		public void Process(SourceFile file)
		{
			file.RenderBody = Internal.RegularExpressions.ImportDirective.Replace(file.RenderBody, delegate(Match match)
			{
				file.Imports.Add(match.Groups["namespace"].Value);
				return string.Empty;
			});
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:8,代码来源:ExtractImportStatementsStep.cs


示例15: Process

		public void Process(SourceFile file)
		{
			file.Imports.Add("System");
			file.Imports.Add("System.IO");
			file.Imports.Add("System.Collections");
			file.Imports.Add("System.Collections.Generic");
			file.Imports.Add("Castle.MonoRail.Framework");
			file.Imports.Add("Castle.MonoRail.Views.AspView");
		}
开发者ID:rambo-returns,项目名称:MonoRail,代码行数:9,代码来源:DefaultImportStatementsStep.cs


示例16: ReportItem

 /// <summary>
 /// Initializes an instance of the ReportItem class.
 /// </summary>
 /// <param name="descriptor">A message descriptor.</param>
 /// <param name="sourceFile">A source file.</param>
 /// <param name="sourceSpan">A source span.</param>
 /// <param name="sourceLine">A source line.</param>
 /// <param name="args">Some arguments required by the message descriptor.</param>
 public ReportItem(MessageDescriptor descriptor, SourceFile sourceFile, SourceSpan sourceSpan,
                   TokenList sourceLine, params string[] args)
 {
     MessageDescriptor = descriptor;
     SourceFile = sourceFile;
     SourceSpan = sourceSpan;
     SourceLine = sourceLine;
     Arguments = args;
 }
开发者ID:robertsundstrom,项目名称:vb-lite-compiler,代码行数:17,代码来源:ReportItem.cs


示例17: ConvertSequencePoints

		void ConvertSequencePoints (PdbFunction function, SourceFile file, SourceMethodBuilder builder)
		{
			foreach (var line in function.lines.SelectMany (lines => lines.lines))
				builder.MarkSequencePoint (
					(int) line.offset,
					file.CompilationUnit.SourceFile,
					(int) line.lineBegin,
					(int) line.colBegin, line.lineBegin == 0xfeefee);
		}
开发者ID:kumpera,项目名称:mono,代码行数:9,代码来源:Driver.cs


示例18: InvalidXmlTests

        public void InvalidXmlTests()
        {
            var sourceFile = new SourceFile(Services.FileSystem, "test.txt", "test.txt");

            var doc = Services.CompositionService.Resolve<XmlTextSnapshot>().With(SnapshotParseContext.Empty, sourceFile, "<Item>", string.Empty, string.Empty);
            Assert.AreEqual(TextNode.Empty, doc.Root);

            doc = Services.CompositionService.Resolve<XmlTextSnapshot>().With(SnapshotParseContext.Empty, sourceFile, string.Empty, string.Empty, string.Empty);
            Assert.AreEqual(TextNode.Empty, doc.Root);
        }
开发者ID:pveller,项目名称:Sitecore.Pathfinder,代码行数:10,代码来源:XmlDocumentTests.cs


示例19: SourceReference

        /// <summary>
        /// 
        /// </summary>
        /// <param name="provider"></param>
        /// <param name="sourceFile"></param>
        protected SourceReference(SourceProvider provider, SourceFile sourceFile)
        {
            if (provider == null)
                throw new ArgumentNullException("provider");
            else if (sourceFile == null)
                throw new ArgumentNullException("sourceFile");

            _provider = provider;
            _sourceFile = sourceFile;
        }
开发者ID:riiiqpl,项目名称:sharpsvn,代码行数:15,代码来源:SourceReference.cs


示例20: Process

		public void Process(SourceFile file)
		{
			file.RenderBody = Internal.RegularExpressions.PageDirective.Replace(file.RenderBody, delegate(Match match)
			{
				file.BaseClassName = GetBaseClass(match.Groups["base"]);
				file.TypedViewName = GetTypedViewName(match.Groups["view"]);
				if (file.TypedViewName != null)
					file.BaseClassName += "<" + file.TypedViewName + ">";
				return string.Empty;
			}, 1);
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:11,代码来源:DetermineBaseClassStep.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SourceGrid类代码示例发布时间:2022-05-24
下一篇:
C# SourceCodeKind类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap