Skip to content

Commit

Permalink
Updated the options to show version number
Browse files Browse the repository at this point in the history
  • Loading branch information
FFMG committed Nov 12, 2016
1 parent b647391 commit 7f56afa
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 2 deletions.
20 changes: 19 additions & 1 deletion Classifier.Outlook/core/engine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,29 @@ public void LogEventInformation(string sEvent)
/// Get the current version number of the engine.
/// </summary>
/// <returns>int the engine version number</returns>
public int GetEngineVersion()
public int GetEngineVersionNumber()
{
return ClassifyEngine.GetEngineVersion();
}

/// <summary>
/// Get the current version number of the engine.
/// </summary>
/// <returns>Version the engine version number</returns>
public Version GetEngineVersion()
{
// get the version
var engineVersion = GetEngineVersionNumber();
var major = (int)(engineVersion / 1000000.0);

engineVersion -= (major * 1000000);
var minor = (int)(engineVersion / 1000.0);

engineVersion -= (minor * 1000);
var build = engineVersion;
return new Version( major, minor, build, 0 );
}

public string GetConfig(string configName )
{
string configValue;
Expand Down
17 changes: 17 additions & 0 deletions Classifier.Outlook/forms/OptionsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using myoddweb.classifier.core;
using System.Collections.Generic;
using System.Drawing;
using System.Diagnostics;

namespace myoddweb.classifier.forms
{
Expand Down Expand Up @@ -194,8 +195,24 @@ private void Magnets_Click(object sender, EventArgs e)
}
}

private Version GetFileVersion()
{
var assembly = System.Reflection.Assembly.GetExecutingAssembly();
var fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
return new Version(fvi.FileMajorPart, fvi.FileMinorPart, fvi.FileBuildPart, fvi.FilePrivatePart);
}

private void OnLoad(object sender, EventArgs e)
{
// get the file version
var version = GetFileVersion();

// get the engine version.
var engineVersion = _engine.GetEngineVersion();

//Version version = Assembly.GetEntryAssembly().GetName().Version;
Text = $"Options - [{version.Major}.{version.Minor}.{version.Build}.{version.Revision}] - (Engine [{engineVersion.Major}.{engineVersion.Minor}.{engineVersion.Build}])";

// check if we want to re-check all categories.
reCheckCategories.Checked = _options.ReCheckCategories;

Expand Down
Binary file modified bin/x64/Classifier.Engine.dll
Binary file not shown.
Binary file modified bin/x86/Classifier.Engine.dll
Binary file not shown.
10 changes: 9 additions & 1 deletion common/myoddweb.classifierUnitTest/TestGeneral.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace myoddweb.classifierUnitTest
{
Expand All @@ -25,8 +26,15 @@ public static void ClassCleanup()
[TestMethod]
public void TestGetVersionNumber()
{
var versionNumber = TheEngine.GetEngineVersion();
var versionNumber = TheEngine.GetEngineVersionNumber();
Assert.AreEqual(1005002, versionNumber );
}

[TestMethod]
public void TestGetVersion()
{
var version = TheEngine.GetEngineVersion();
Assert.AreEqual( new Version(1, 5, 2, 0), version);
}
}
}
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ But it does not take that long, really, invest a couple of day creating good Mag
- Option to automatically train classified mail using magnet, (true by default)
- Updated to 1.5.2 engine, ( has better/faster classification)
- Classifications are now threaded.
- Options text now gives the version number + engine version number.

#### 0.4.0.1 - 0.4.0.2 (02/11/2016)
- Fixed a few issues in the tokenizer.
Expand Down

0 comments on commit 7f56afa

Please sign in to comment.