本文整理汇总了C#中IParser类的典型用法代码示例。如果您正苦于以下问题:C# IParser类的具体用法?C# IParser怎么用?C# IParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IParser类属于命名空间,在下文中一共展示了IParser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ReadYaml
public object ReadYaml(IParser parser, Type type)
{
var scalar = (YamlDotNet.Core.Events.Scalar)parser.Current;
var bytes = Convert.FromBase64String(scalar.Value);
parser.MoveNext();
return bytes;
}
开发者ID:aaubry,项目名称:YamlDotNet,代码行数:7,代码来源:RepresentationModelSerializationTests.cs
示例2: Download
public void Download(Uri uri, object metaData, IParser parser)
{
uriParserPairs.Add(metaData, parser);
var request = (HttpWebRequest)WebRequest.Create(uri);
var state = new RequestState { Request = request, Metadata = metaData };
request.BeginGetResponse(GetData, state);
}
开发者ID:gracepig,项目名称:SmartReader,代码行数:7,代码来源:HttpContentDownloader.cs
示例3: ExpEvaluator
public ExpEvaluator(IParser _parser)
{
//Use IParser to parse it
_exp_parser = _parser;
// TODO: Add constructor logic here
}
开发者ID:NerdsRUs,项目名称:Summer2014,代码行数:7,代码来源:Evaluator.cs
示例4: StartParsing
public StartParsing(IFilePaths filePaths, ILogFileReaderList logfileReaderList, ILogStatisticsRepository logStatisticsRepository, IParser parser)
{
_filePaths = filePaths;
_logfileReaderList = logfileReaderList;
_logStatisticsRepository = logStatisticsRepository;
_parser = parser;
}
开发者ID:myhreman,项目名称:LogParser,代码行数:7,代码来源:StartParsing.cs
示例5: Setup
public void Setup()
{
ccu = new CodeCompileUnit();
mocks = new MockRepository();
engine = Engine.GlobalEngine;
engine.BinPath = @"C:\Program Files (x86)\MSBuild";
project = new Project();
buildEngine = mocks.DynamicMock<MockBuildEngine>(project);
logger = new NullLogger();
parserService = mocks.DynamicMock<ISiteTreeGeneratorService>();
naming = mocks.DynamicMock<INamingService>();
sourceStorage = mocks.DynamicMock<IParsedSourceStorageService>();
source = mocks.DynamicMock<ISourceGenerator>();
typeResolver = mocks.DynamicMock<ITypeResolver>();
treeService = mocks.DynamicMock<ITreeCreationService>();
viewSourceMapper = mocks.DynamicMock<IViewSourceMapper>();
generator = mocks.DynamicMock<IGenerator>();
task = new GenerateMonoRailSiteTreeTask(logger, parserService, naming, source, sourceStorage, typeResolver,
treeService, viewSourceMapper, generator);
item = mocks.DynamicMock<ITaskItem>();
parsedSource = mocks.DynamicMock<IParser>();
}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:25,代码来源:GenerateMonoRailSiteTreeTaskTests.cs
示例6: EnumerationOf
private IEnumerable<ParsingEvent> EnumerationOf(IParser parser)
{
while (parser.MoveNext())
{
yield return parser.Current;
}
}
开发者ID:pablinos,项目名称:YamlDotNet,代码行数:7,代码来源:EmitterTests.cs
示例7: ParserAnalyzer
/// <summary>
/// Initializes a new instance of the <see cref="ParserAnalyzer" /> with the specified weight.
/// </summary>
/// <param name="parser">The parser.</param>
/// <param name="weight">The analyzer weight.</param>
/// <exception cref="System.ArgumentNullException">parser</exception>
public ParserAnalyzer(IParser parser, float weight)
: base(weight) {
if (parser == null)
throw new ArgumentNullException("parser");
Parser = parser;
}
开发者ID:lovethisgame,项目名称:SharpNL,代码行数:13,代码来源:ParserAnalyzer.cs
示例8: ReportBuilder
/// <summary>
/// Initializes a new instance of the <see cref="ReportBuilder"/> class.
/// </summary>
/// <param name="parser">The IParser to use.</param>
/// <param name="rendererFactory">The renderer factory.</param>
/// <param name="targetDirectory">The directory where the generated report should be saved.</param>
/// <param name="assemblyFilter">The assembly filter.</param>
public ReportBuilder(IParser parser, IRendererFactory rendererFactory, string targetDirectory, IAssemblyFilter assemblyFilter)
{
if (parser == null)
{
throw new ArgumentNullException("parser");
}
if (rendererFactory == null)
{
throw new ArgumentNullException("rendererFactory");
}
if (targetDirectory == null)
{
throw new ArgumentNullException("targetDirectory");
}
if (assemblyFilter == null)
{
throw new ArgumentNullException("assemblyFilter");
}
this.parser = parser;
this.rendererFactory = rendererFactory;
this.targetDirectory = targetDirectory;
this.assemblyFilter = assemblyFilter;
}
开发者ID:JamesPinkard,项目名称:Support_Packages,代码行数:34,代码来源:ReportBuilder.cs
示例9: ParserUi
public ParserUi(IParser parser,ICGunitHost host)
{
InitializeComponent();
m_parser = parser;
m_Host = host;
m_Host.evProjectStatus += new onProjectStatus(Owner_evProjectStatus);
}
开发者ID:ajithpadman,项目名称:GoogleUnitTestIDE,代码行数:7,代码来源:ParserUi.cs
示例10: ScriptFile
/// <summary>
/// Instantiates a build script object.
/// </summary>
/// <remarks>
/// This constructor will attempt to parse the given SQL and determine whether it is valid
/// and whether the script creates the object specified by the given identifier. If the
/// script is invalid in anyway, the <see cref="ScriptError"/> property will reflect that.
/// </remarks>
/// <param name="scriptObject">The identifier of the database object to build.</param>
/// <param name="scriptContent">The build script SQL content.</param>
/// <param name="parser">The sql script parser for reading the SQL script content.</param>
public ScriptFile(TypedDatabaseObject scriptObject, string scriptContent, IParser parser)
{
ScriptObject = scriptObject;
Content = scriptContent;
existingDependencies = new HashSet<TypedDatabaseObject>();
try
{
Sql = parser.ParseSqlScript(scriptContent);
AssertMatchingContent();
}
catch (SqlParseException ex)
{
ScriptError = new SqlParseError(ex.Message);
Sql = null;
}
catch(EmptyTextException)
{
ScriptError = new EmptyTextError();
Sql = null;
}
catch(MultipleStatementException ex)
{
ScriptError = new MultipleStatementError(ex.Count, ex.Allotment);
Sql = null;
}
catch(UnexpectedObjectTypeException ex)
{
ScriptError = new UnexpectedObjectTypeError(ex.TypeName);
Sql = null;
}
}
开发者ID:Zocdoc,项目名称:ZocBuild.Database,代码行数:42,代码来源:ScriptFile.cs
示例11: RazorMailSender
public RazorMailSender(MailAddress sender, Uri baseUri, SmtpClient client, IParser parser)
{
Sender = sender;
BaseUri = baseUri;
Client = client ?? new SmtpClient("127.0.0.1");
Parser = parser ?? new HtmlAgilityPackParser(baseUri);
}
开发者ID:wduffy,项目名称:RazorMail,代码行数:7,代码来源:RazorMailSender.cs
示例12: DeserializeValue
public object DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
{
var nodeEvent = parser.Peek<NodeEvent>();
var nodeType = GetTypeFromEvent(nodeEvent, expectedType);
try
{
foreach (var deserializer in deserializers)
{
object value;
if (deserializer.Deserialize(parser, nodeType, (r, t) => nestedObjectDeserializer.DeserializeValue(r, t, state, nestedObjectDeserializer), out value))
{
return value;
}
}
}
catch (YamlException)
{
throw;
}
catch (Exception ex)
{
throw new YamlException(nodeEvent.Start, nodeEvent.End, "Exception during deserialization", ex);
}
throw new YamlException(
nodeEvent.Start,
nodeEvent.End,
string.Format(
"No node deserializer was able to deserialize the node into type {0}",
expectedType.AssemblyQualifiedName
)
);
}
开发者ID:aaubry,项目名称:YamlDotNet,代码行数:35,代码来源:NodeValueDeserializer.cs
示例13: DoTestEnums
void DoTestEnums (IParser parser)
{
ICompilationUnit unit = parser.Parse (null, "a.cs",
@"enum TestEnum {
A,
B,
C
}").CompilationUnit;
Assert.AreEqual (1, unit.Types.Count);
IType type = unit.Types[0];
Assert.AreEqual (ClassType.Enum, type.ClassType);
Assert.AreEqual ("TestEnum", type.Name);
Assert.AreEqual (3, type.FieldCount);
foreach (IField f in type.Fields) {
Assert.IsTrue (f.IsConst);
Assert.IsTrue (f.IsSpecialName);
Assert.IsTrue (f.IsPublic);
if (f.Name == "A") {
Assert.AreEqual (2, f.Location.Line);
} else if (f.Name == "B") {
Assert.AreEqual (3, f.Location.Line);
} else if (f.Name == "C") {
Assert.AreEqual (4, f.Location.Line);
} else {
Assert.Fail ("Unknown field: " + f.Name);
}
}
}
开发者ID:nickname100,项目名称:monodevelop,代码行数:28,代码来源:TopLevelTests.cs
示例14: ReportGenerator
/// <summary>
/// Initializes a new instance of the <see cref="ReportGenerator" /> class.
/// </summary>
/// <param name="parser">The IParser to use.</param>
/// <param name="assemblyFilter">The assembly filter.</param>
/// <param name="classFilter">The class filter.</param>
/// <param name="renderers">The renderers.</param>
internal ReportGenerator(IParser parser, IFilter assemblyFilter, IFilter classFilter, IEnumerable<IReportBuilder> renderers)
{
if (parser == null)
{
throw new ArgumentNullException("parser");
}
if (assemblyFilter == null)
{
throw new ArgumentNullException("assemblyFilter");
}
if (classFilter == null)
{
throw new ArgumentNullException("classFilter");
}
if (renderers == null)
{
throw new ArgumentNullException("renderers");
}
this.parser = parser;
this.assemblyFilter = assemblyFilter;
this.classFilter = classFilter;
this.renderers = renderers;
}
开发者ID:andyTsing,项目名称:ReportGenerator,代码行数:34,代码来源:ReportGenerator.cs
示例15: FileReader
public FileReader(IParser parser, string path )
{
this.parser = parser;
//TODO make this more generic
icdString = File.ReadAllText(path);
parser.ParseIcdCatalog(icdString);
}
开发者ID:S1riU5,项目名称:ICD,代码行数:7,代码来源:FileReader.cs
示例16: ExecutionContext
public ExecutionContext(IParser parser)
{
Parser = parser;
CaseSensitive = false;
Store = CaseSensitive ? new Dictionary<string, ContextValue>() : new Dictionary<string, ContextValue>(StringComparer.InvariantCultureIgnoreCase);
Dependencies = CaseSensitive ? new Dictionary<string, HashSet<string>>() : new Dictionary<string, HashSet<string>>(StringComparer.InvariantCultureIgnoreCase);
}
开发者ID:RushuiGuan,项目名称:expression,代码行数:7,代码来源:ExecutionContext.cs
示例17: Add
public void Add(string path, IParser parser)
{
if (cache.ContainsKey(path))
throw new ArgumentException(String.Format("Source for {0} already cached!", path));
cache[path] = parser;
}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:7,代码来源:DefaultSourceStorageService.cs
示例18: Create
public Database Create(FileInfo pathToGit, IParser sqlParser)
{
var connectionStr = ConnectionString;
Func<SqlConnection> connection = () => new SqlConnection(connectionStr);
var repo = new GitScriptRepository(ScriptsPath, ServerName, DatabaseName, pathToGit, sqlParser);
return new Database(ServerName, DatabaseName, connection, repo);
}
开发者ID:dwayne-bent-zocdoc,项目名称:ZocBuild.Database,代码行数:7,代码来源:DatabaseSetting.cs
示例19: ConsumerUnit
/// <summary>
/// Constructor.
/// </summary>
/// <param name="parser">Parser implementation</param>
/// <param name="printResults">Action to be invoked after the processing has finished</param>
public ConsumerUnit(IParser<string> parser, Action<IEnumerable<string>> printResults)
{
Parser = parser;
PrintResults = printResults;
Results = new List<string>();
}
开发者ID:podskalicky,项目名称:software-task,代码行数:12,代码来源:ConsumerUnit.cs
示例20: Calculator
public Calculator(ICollection<IExportFactory<IOperation, OperationMetadata>> operationFactories, IParser parser)
{
this.parser = parser;
this.OperationsDictionary = operationFactories.ToDictionary(
e => e.Metadata.Operation,
e => e.CreateExport().Value);
}
开发者ID:raimu,项目名称:kephas,代码行数:7,代码来源:Calculator.cs
注:本文中的IParser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论