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


C# SourceFile类代码示例

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


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


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