private static void BeforeReadRecord(EngineBase engine, BeforeReadRecordEventArgs e) { Console.WriteLine("--> Before read line: " + e.RecordLine); if (e.LineNumber == 2) { e.SkipThisRecord = true; Console.WriteLine("--> skiping line 2"); } }
//-> {/Example.File} //-> {Example.File:EventHandler.cs} private void BeforeEvent(EngineBase engine, BeforeReadEventArgs<OrdersFixed> e) { if (e.RecordLine.StartsWith(" ") || e.RecordLine.StartsWith("-")) e.SkipThisRecord = true; // Sometimes changing the record line can be useful, for example to correct for // a bad data layout. Here is an example of this, commented out for this example //if (e.RecordLine.StartsWith(" ")) // e.RecordLine = "Be careful!"; }
private void BeforeEvent2(EngineBase sender, BeforeReadEventArgs<object> e) { e.SkipThisRecord = true; before++; }
private void BeforeEvent(EngineBase sender, BeforeReadEventArgs<object> e) { if (e.RecordLine.StartsWith(" ") || e.RecordLine.StartsWith("-")) e.SkipThisRecord = true; before++; }
private void AfterEvent2(EngineBase sender, AfterReadEventArgs<object> e) { e.SkipThisRecord = true; after++; }
private static void AfterWriteRecord(EngineBase engine, AfterWriteRecordEventArgs e) { Console.WriteLine("--> After write record: " + e.RecordLine); }
private void AfterWriteEvent(EngineBase engine, AfterWriteEventArgs<OrdersFixed> e) { // Hide a line if (e.Record.CustomerID == "HANAR") e.RecordLine = "Insufficient Access"; }
static void engine_AfterReadRecord(EngineBase engine, FileHelpers.Events.AfterReadEventArgs<FixedSampleRecord> e) { }
private void engine_AfterWriteRecord(EngineBase sender, AfterWriteEventArgs<SampleType> e) { after++; }
private void AfterEvent(EngineBase sender, AfterReadEventArgs<SampleType> e) { after++; }
private void BeforeEvent2(EngineBase sender, BeforeReadRecordEventArgs<SampleType> e) { e.SkipThisRecord = true; before++; }
private void AfterEvent2(EngineBase sender, AfterReadRecordEventArgs<SampleType> e) { e.SkipThisRecord = true; after++; }
private void AfterEvent(EngineBase sender, AfterReadRecordEventArgs e) { after++; }
public void BeforeWrite(EngineBase engine) { BeforeWriteNotif = true; }
public void AfterRead(EngineBase engine, string line) { AfterReadNotif = true; }
private void engine_AfterWriteRecord(EngineBase sender, AfterWriteEventArgs<object> e) { after++; }
private void engine_BeforeWriteRecord(EngineBase sender, BeforeWriteEventArgs<object> e) { before++; }
private void engine_BeforeWriteRecord(EngineBase sender, BeforeWriteEventArgs<SampleType> e) { before++; }
static void engine_BeforeWriteRecord(EngineBase engine, FileHelpers.Events.BeforeWriteEventArgs<FixedSampleRecord> e) { }
private void AfterWriteEvent(EngineBase engine, AfterWriteEventArgs<OrdersFixed> e) { // We only want clients with large frieght values if (e.Record.CustomerID == "HANAR" ) e.RecordLine = "Insufficient Access"; }
private void BeforeWriteEvent(EngineBase engine, BeforeWriteEventArgs<OrdersFixed> e) { // We only want clients with large frieght values if (e.Record.Freight < 40) e.SkipThisRecord = true; }
private static void BeforeEventChange(EngineBase engine, BeforeReadEventArgs<object> e) { Assert.IsFalse(e.RecordLineChanged); e.RecordLine = "11121314901234"; Assert.IsTrue(e.RecordLineChanged); }
private void AfterEvent(EngineBase engine, AfterReadEventArgs<OrdersFixed> e) { // we want to drop all records with no freight if (e.Record.Freight == 0) e.SkipThisRecord = true; }
private void AfterEvent(EngineBase sender, AfterReadEventArgs<object> e) { after++; }