///////////////////////////////////////////////////////////////////////////////////////////////////
/// DO NOT STORE YOUR MACROS IN THIS FILE!! 
/// THIS FILE WILL BE OVERWRITTEN BY SOFTWARE UPDATES 
///////////////////////////////////////////////////////////////////////////////////////////////////

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Globalization;
using Loxx;

// disabled extension API 
//public class SampleExtender : ViewExtender
//{
//  public SampleExtender()
//  {
//    // the file pattern (regex!) deciding if the extender shall be loaded
//	// all file matching the windows wild card "Log*.txt" will use this extender
//    FilePattern = @"XYLog.*\.txt";
//    Name = "SampleExtender";
//  }

//  // here you can connect handler functions for events. The function will be called when a handler is connected 
//  public override void Connect(ViewEventDispatcher dispatcher)
//  {
//    dispatcher._DisplayPopup += CreatePopupContent;
//    dispatcher._DisplayLine += DisplayLine;
//    dispatcher._OnClose += disconnect;
//    dispatcher._OnExpressionTrigger += TriggerMatched;
//  }

//  bool disconnect() 
//  {
//    _Application.WriteMessage("Disconnected extender " + Name);
//    return true;
//  }

//  // A sample display line handler, it shows the line in a reverse order 
//  public LineFormatInfo DisplayLine(string lineContent, long line)
//  {
//    if (lineContent.Length > 0 && lineContent[0] == '[')
//    {
//      int firstClose = lineContent.IndexOf(']');
//      if (firstClose > 0)
//      {
//        lineContent = lineContent.Substring(firstClose + 1);
//      }
//    }
//    var arr = lineContent.ToCharArray();
//    Array.Reverse(arr);
//    LineFormatInfo returnValue = new LineFormatInfo() { Content = new String(arr) };
//    for (int i = 0; i < returnValue.Content.Length; i += 5)
//    {

//    }
//    return returnValue;
//  }

//  public void TriggerMatched(long offset)
//  {
//    _Application.WriteMessage("Trigger matched at Offset " + offset.ToString());
//  }

//  public LineFormatInfo[] CreatePopupContent(string lineContent, long line, int width)
//  {
//    return new LineFormatInfo[1] { new LineFormatInfo() { Content = lineContent, Colors = new ColorInfo[1] { new ColorInfo() { BackColor = 0, ForeColor = 0xFF } } } };
//    var tmpString = lineContent.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
//    LineFormatInfo[] returnValue = new LineFormatInfo[tmpString.Length];
//    for (int i = 0; i < tmpString.Length; i++)
//    {
//      returnValue[i] = new LineFormatInfo() { Content = tmpString[i] };
//    }
//    if (returnValue.Length > 0)
//    {
//      returnValue[0].Colors = new ColorInfo[1];
//      returnValue[0].Colors[0] = new ColorInfo() { BackColor = 0, ForeColor = 0xFF };
//    }
//    return returnValue;
//  }
//}
