示例#1
0
 public OptionsForm( Engine engine, Options options, Categories categories )
 {
   _engine = engine;
   _categories = categories;
   _options = options;
   InitializeComponent();
 }
示例#2
0
    public Categories( Engine engine )
    {
      // the engine.
      _engine = engine;

      // (re)load the categories
      ReloadCategories();
    }
示例#3
0
    public CustomUI(Engine engine, Categories categories, Options options )
    {
      // the engine.
      _engine = engine;

      // the categories.
      _categories = categories;

      // the options
      _options = options;
    }
示例#4
0
    public CategoryForm( Engine engine, Category category  )
    {
      // 
      InitializeComponent();

      // the engine to create new categories.
      _engine = engine;

      // the category we working with.
      GivenCategory = category;
    }
    public MagnetMailItemForm( Engine engine, Outlook._MailItem mailItem, Categories categories )
    {
      // 
      InitializeComponent();

      // the engine to create new categories.
      _engine = engine;

      // the categories
      _categories = categories;

      // the mail item
      _mailItem = mailItem;
    }
示例#6
0
    public MagnetForm( Engine engine, Categories categories, Magnet magnet  )
    {
      // 
      InitializeComponent();

      // the engine to create new categories.
      _engine = engine;

      // the category we working with.
      GivenMagnet = magnet;

      // the categories
      _Categories = categories;
    }
示例#7
0
    public DetailsForm(Engine classifyEngine, string rawText )
    {
      // the classifier engine
      _classifyEngine = classifyEngine;

      // the raw text
      _rawText = rawText;

      // we can now init everything.
      InitializeComponent();

      // maximized the window.
      WindowState = FormWindowState.Maximized;
    }
示例#8
0
    protected static Engine CreateEngine()
    {
      // the paths we will be using.
      DirectoryPath = GetDirectory();
      if (null == DirectoryPath)
      {
        throw new Exception("I could not find the current working path.");
      }

      //  the database path
      DatabaseFullPath = $"{DirectoryPath}\\{DbName}";

      // if the file exists, then we need to remove it.
      if (File.Exists(DatabaseFullPath))
      {
        // just in case it does exist.
        File.Delete(DatabaseFullPath);

        if (File.Exists(DatabaseFullPath))
        {
          Assert.Fail("Could not remove the old db from previous tests.");
        }
      }

      CleanDatabaseFullPath = $"{DirectoryPath}\\{CleandbName}";
      if (!File.Exists(CleanDatabaseFullPath))
      {
        var e = new Engine(DirectoryPath, CleanDatabaseFullPath);
        e.SetConfig("Option.CommonWordsMinPercent", "100");
        e.Release();
      }

      // make sure that we have a clean database.
      File.Copy(CleanDatabaseFullPath, DatabaseFullPath);
      if (!File.Exists(DatabaseFullPath))
      {
        Assert.Fail( "Could not create the new db from the clean db." );
      }

      //create the engine
      return new Engine(DirectoryPath, DatabaseFullPath);
    }
示例#9
0
    protected static void ReleaseEngine( bool removeCleanDb )
    {
      // don't do it more than once...
      if (null != _engine)
      {
        // release the engine
        _engine.Release();

        // free the memory, (but the gc might not do it right away).
        _engine = null;
      }

      // try and remove the database.
      try
      {
        File.Delete(DatabaseFullPath);
      }
      catch (Exception)
      {
        // ignore the Exception ...
        // the file will be deleted later.
      }

      try
      {
        // if the file exists, then we need to remove it.
        if (removeCleanDb == true && File.Exists(CleanDatabaseFullPath))
        {
          // just in case it does exist.
          File.Delete(CleanDatabaseFullPath);
        }
      }
      catch (Exception)
      {
        // ignore the Exception ...
        // the file will be deleted later.
      }
    }
示例#10
0
 public CategoriesForm( Categories categories, Engine engine)
 {
   _engine = engine;
   _categories = categories;
   InitializeComponent();
 }
示例#11
0
 public Options(Engine engine)
 {
   _engine = engine;
 }