本文整理汇总了C#中RecorderContext类的典型用法代码示例。如果您正苦于以下问题:C# RecorderContext类的具体用法?C# RecorderContext怎么用?C# RecorderContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RecorderContext类属于命名空间,在下文中一共展示了RecorderContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnFieldMatch
protected override NextInstruction OnFieldMatch(RecorderContext context, string source, ref Match match)
{
var ins=baseRecorder.OnFieldMatchPublic(context, source, ref match);
if (ins == NextInstruction.Return)
context.FieldBuffer[context.SourceHeaderInfo["__full_text"]] = source;
return ins;
}
示例2: OnBeforeProcessRecordInput
protected override NextInstruction OnBeforeProcessRecordInput(RecorderContext context)
{
if (context.HeaderInfo != null) return base.OnBeforeProcessRecordInput(context);
Exception error = null;
var ins = GetHeaderInfo(context, ref error);
return (ins & NextInstruction.Continue) != NextInstruction.Continue ? ins : base.OnBeforeProcessRecordInput(context);
}
示例3: InputTextType
public override RecordInputType InputTextType(RecorderContext context, ref Exception error)
{
var rec = context.InputRecord as TextRecord;
if (rec == null || rec.RecordText == null)
return RecordInputType.Unknown;
return RecordInputType.Record;
}
示例4: TerminalRemoteFileSystemInfo
public TerminalRemoteFileSystemInfo(RecorderContext context, string fullName, string name)
{
Context = context;
this.fullName = fullName;
this.name = name;
exists = new ObjectValue<int>(-1);
directory = new ObjectValue<RecorderFileSystemInfo>();
}
示例5: GetHeaderInfo
public override NextInstruction GetHeaderInfo(RecorderContext context, ref Exception error)
{
var ins = base.GetHeaderInfo(context, ref error);
if ((ins & NextInstruction.Do) == NextInstruction.Do)
{
context.FieldMappingIndexLookup = CreateFieldMappingIndexLookup(context.HeaderInfo, context, GetFieldMappingsFields());
}
return ins;
}
示例6: GetHeaderInfo
public override NextInstruction GetHeaderInfo(RecorderContext context, ref Exception error)
{
if (MappingInfos == null) return NextInstruction.Do;
foreach (var mappingInfo in MappingInfos)
{
context.SourceHeaderInfo = MimicMappingInfo(mappingInfo.Mappings);
context.HeaderInfo = RecordFields2Info(MappingInfos, context.SourceHeaderInfo);
break;
}
return NextInstruction.Do;
}
示例7: OnFieldMatch
protected override NextInstruction OnFieldMatch(RecorderContext context, string source, ref Match match)
{
if (!match.Success) return NextInstruction.Skip;
var groupCollection = match.Groups;
foreach (var key in RegSplitForValue.GetGroupNames())
{
int tmp;
if (int.TryParse(key, out tmp)) continue;
if (context.SourceHeaderInfo.ContainsKey(key))
context.FieldBuffer[context.SourceHeaderInfo[key]] = groupCollection[key].Value;
}
return NextInstruction.Return;
}
示例8: InputTextType
public override RecordInputType InputTextType(RecorderContext context, ref Exception error)
{
var ctx = context as TerminalRecorderContext;
if (ctx == null)
{
error = new Exception("Context is not TerminalRecorderContext or null");
return RecordInputType.Error;
}
var line = context.InputRecord.ToString();
if (line == ctx.Keyword)
{
if (ctx.WaitBegin)
{
ctx.Keyword = "END" + ctx.Keyword.Substring(5);
ctx.WaitBegin = false;
return RecordInputType.Comment;
}
return RecordInputType.EndOfStream;
}
if (ctx.WaitBegin)
return RecordInputType.Comment;
if (line.StartsWith("0;"))
{
var index = line.IndexOf(';', 2);
if (++index < line.Length)
{
context.InputRecord.SetValue(line.Substring(index));
return RecordInputType.Record;
}
error = new Exception("Unexpected record line. No Record order after 0;");
}
else
{
var regErr = new Regex("^[0-9]+;[0-9]+;.", RegexOptions.Compiled);
var sb = new StringBuilder();
do
{
var m = regErr.Match(line);
sb.Append(m.Success ? line.Substring(m.Length) : line);
if (context.ReadRecord(ref error) <= 0)
break;
line = context.InputRecord.ToString();
if (line == ctx.Keyword)
break;
} while (true);
context.InputRecord.SetValue(sb.ToString());
}
return RecordInputType.Error;
}
示例9: InputTextType
public override RecordInputType InputTextType(RecorderContext context, ref Exception error)
{
var rec = context.InputRecord as TextRecord;
if (rec == null || rec.RecordText == null)
return RecordInputType.Unknown;
if (rec.RecordText.Length == 0)
return RecordInputType.Comment;
if (context.InputRecord.ToString().StartsWith("#"))
{
if (context.InputRecord.ToString().StartsWith("#Fields: "))
return RecordInputType.Header;
return RecordInputType.Comment;
}
return RecordInputType.Record;
}
示例10: OnFieldMatch
protected override NextInstruction OnFieldMatch(RecorderContext context, string source, ref Match match)
{
if (!match.Success) return NextInstruction.Skip;
var groupCollection = match.Groups;
foreach (var key in RegSplitForAll.GetGroupNames())
{
try
{
int tmp;
if (int.TryParse(key, out tmp)) continue;
int fieldBufferKey;
if (context.SourceHeaderInfo.TryGetValue(key, out fieldBufferKey))
context.FieldBuffer[context.SourceHeaderInfo[key]] = groupCollection[key].Value;
}
catch (Exception exception)
{
Console.Out.WriteLine(exception.Message);
}
}
return NextInstruction.Return;
}
示例11: CreateFileSystemInfo
protected override RecorderFileSystemInfo CreateFileSystemInfo(RecorderContext context, string fullName)
{
return new TerminalRemoteFileSystemInfo(context, fullName, FileSystemHelper.FileNameOf(fullName, context.DirectorySeparatorChar));
}
示例12: OnFieldMatch
protected override NextInstruction OnFieldMatch(RecorderContext context, string source, ref Match match)
{
while (match.Success)
{
if (context.SourceHeaderInfo.ContainsKey(match.Groups[1].Value))
context.FieldBuffer[context.SourceHeaderInfo[match.Groups[1].Value]] = match.Groups[2].Value;
match = match.NextMatch();
}
return NextInstruction.Return;
}
示例13: OnFieldMatch
protected override NextInstruction OnFieldMatch(RecorderContext context, string source, ref Match match)
{
if (!match.Success) return NextInstruction.Skip;
var groupCollection = match.Groups;
foreach (var key in RegSplitForAll.GetGroupNames())
{
int tmp;
if (int.TryParse(key, out tmp)) continue;
if (!context.SourceHeaderInfo.ContainsKey(key)) continue;
if (groupCollection[key].Value.Length > 0)
context.FieldBuffer[context.SourceHeaderInfo[key]] = groupCollection[key].Value;
}
match = match.NextMatch();
while (match.Success)
{
if (context.SourceHeaderInfo.ContainsKey(match.Groups["x"].Value))
context.FieldBuffer[context.SourceHeaderInfo[match.Groups["x"].Value]] = match.Groups["y"].Value;
match = match.NextMatch();
}
context.FieldBuffer[context.SourceHeaderInfo["Description"]] = source;
return NextInstruction.Return;
}
示例14: GetHeaderText
protected override string GetHeaderText(RecorderContext context)
{
return string.Empty;
}
示例15: GetHeaderText
protected override string GetHeaderText(RecorderContext context)
{
return baseRecorder.GetHeaderTextPublic(context);
}