Skip to content

Commit 1b0fe40

Browse files
committed
Switched to .NET 4.0, added AI model matching options
1 parent 72e2b45 commit 1b0fe40

23 files changed

+551
-95
lines changed

VSPC.Common/AIModelRule.cs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
 using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
namespace VSPC.Common
7+
{
8+
/// <summary>
9+
/// Class describing a rule used for AI model matching
10+
/// </summary>
11+
[Serializable]
12+
public class AIModelRule
13+
{
14+
public string Airline { get; set; } // Airline code (NAX, SAS, DLH etc.)
15+
public string PlaneType { get; set; } // Plane type (B738)
16+
public string Model { get; set; } // Model name from aircraft.cfg
17+
18+
public string RuleDescription()
19+
{
20+
string description = "";
21+
22+
if(!string.IsNullOrEmpty(Airline))
23+
{
24+
description = string.Format("When airline is {0}", Airline);
25+
}
26+
27+
if(!string.IsNullOrEmpty(PlaneType))
28+
{
29+
if (!string.IsNullOrEmpty(description))
30+
description += " and ";
31+
32+
description += string.Format("plane type is {0}", PlaneType);
33+
description = description.Substring(0, 1).ToUpper() + description.Substring(1);
34+
}
35+
36+
if(string.IsNullOrEmpty(description))
37+
{
38+
description = "For all airlines and plane types";
39+
}
40+
41+
description += string.Format(", model name is {0}", Model);
42+
43+
return description;
44+
}
45+
}
46+
}

VSPC.Common/AIModelRuleRepository.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Xml;
7+
using System.Xml.Serialization;
8+
9+
namespace VSPC.Common
10+
{
11+
public class AIModelRuleRepository
12+
{
13+
private const string filename = "aimodelrules.xml";
14+
15+
public List<AIModelRule> GetAllRules()
16+
{
17+
try
18+
{
19+
var xmlSerializer = new XmlSerializer(typeof(List<AIModelRule>));
20+
var rules = (List<AIModelRule>)xmlSerializer.Deserialize(XmlReader.Create(filename));
21+
22+
return rules;
23+
}
24+
catch (FileNotFoundException)
25+
{
26+
return new List<AIModelRule>();
27+
}
28+
}
29+
}
30+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("VSPC.Common")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("VSPC.Common")]
13+
[assembly: AssemblyCopyright("Copyright © 2013")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("33dd8b0d-ccba-4b61-bc72-bba065eecc18")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

VSPC.Common/VSPC.Common.csproj

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{4A9A5A81-2BB4-4E13-899D-D07C8AC4F278}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>VSPC.Common</RootNamespace>
12+
<AssemblyName>VSPC.Common</AssemblyName>
13+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
14+
<FileAlignment>512</FileAlignment>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<DebugType>pdbonly</DebugType>
27+
<Optimize>true</Optimize>
28+
<OutputPath>bin\Release\</OutputPath>
29+
<DefineConstants>TRACE</DefineConstants>
30+
<ErrorReport>prompt</ErrorReport>
31+
<WarningLevel>4</WarningLevel>
32+
</PropertyGroup>
33+
<ItemGroup>
34+
<Reference Include="System" />
35+
<Reference Include="System.Core" />
36+
<Reference Include="System.Xml.Linq" />
37+
<Reference Include="System.Data.DataSetExtensions" />
38+
<Reference Include="Microsoft.CSharp" />
39+
<Reference Include="System.Data" />
40+
<Reference Include="System.Xml" />
41+
</ItemGroup>
42+
<ItemGroup>
43+
<Compile Include="AIModelRule.cs" />
44+
<Compile Include="AIModelRuleRepository.cs" />
45+
<Compile Include="Properties\AssemblyInfo.cs" />
46+
</ItemGroup>
47+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
48+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
49+
Other similar extension points exist, see Microsoft.Common.targets.
50+
<Target Name="BeforeBuild">
51+
</Target>
52+
<Target Name="AfterBuild">
53+
</Target>
54+
-->
55+
</Project>

VSPC.Core.Test/MessageBrokerTestFixture.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using NUnit.Framework;
1+
using NUnit.Framework;
62

73
using VSPC.Core.MessageHandlers;
8-
using VSPC.Core.Messages;
94
using Moq;
105
using VSPC.Core.Messages.FSD;
116

VSPC.Core.Test/VSPC.Core.Test.csproj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
<AppDesignerFolder>Properties</AppDesignerFolder>
1111
<RootNamespace>VSPC.Core.Test</RootNamespace>
1212
<AssemblyName>VSPC.Core.Test</AssemblyName>
13-
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
13+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
1414
<FileAlignment>512</FileAlignment>
15-
<TargetFrameworkProfile />
15+
<TargetFrameworkProfile>
16+
</TargetFrameworkProfile>
1617
</PropertyGroup>
1718
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1819
<DebugSymbols>true</DebugSymbols>
@@ -53,7 +54,8 @@
5354
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
5455
</PropertyGroup>
5556
<ItemGroup>
56-
<Reference Include="Moq">
57+
<Reference Include="Moq, Version=4.0.10827.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
58+
<SpecificVersion>False</SpecificVersion>
5759
<HintPath>..\deps\Moq.dll</HintPath>
5860
</Reference>
5961
<Reference Include="nunit.framework, Version=2.6.0.12051, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">

VSPC.Core/VSPC.Core.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
<AppDesignerFolder>Properties</AppDesignerFolder>
1111
<RootNamespace>VSPC.Core</RootNamespace>
1212
<AssemblyName>VSPC.Core</AssemblyName>
13-
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
13+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
1414
<FileAlignment>512</FileAlignment>
15-
<TargetFrameworkProfile />
15+
<TargetFrameworkProfile>
16+
</TargetFrameworkProfile>
1617
</PropertyGroup>
1718
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1819
<DebugSymbols>true</DebugSymbols>

VSPC.Loader/App.xaml.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
using System.Reflection;
77
using VSPC.Core;
88
using VSPC.Loader.Config;
9-
using System.Windows.Interop;
10-
using System.Windows.Threading;
119

1210
namespace VSPC.Loader
1311
{

VSPC.Loader/VSPC.Loader.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<AppDesignerFolder>Properties</AppDesignerFolder>
1111
<RootNamespace>VSPC.Loader</RootNamespace>
1212
<AssemblyName>VSPC.Loader</AssemblyName>
13-
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
13+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
1414
<TargetFrameworkProfile>
1515
</TargetFrameworkProfile>
1616
<FileAlignment>512</FileAlignment>
@@ -61,6 +61,7 @@
6161
<Reference Include="PresentationFramework" />
6262
<Reference Include="System" />
6363
<Reference Include="System.configuration" />
64+
<Reference Include="System.Xaml" />
6465
<Reference Include="WindowsBase" />
6566
</ItemGroup>
6667
<ItemGroup>

VSPC.Loader/app.config

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?xml version="1.0"?>
2-
32
<configuration>
43
<configSections>
5-
<section name="vspcmodules" type="VSPC.Loader.Config.ModuleConfiguration, VSPC.Loader" />
4+
<section name="vspcmodules" type="VSPC.Loader.Config.ModuleConfiguration, VSPC.Loader"/>
65
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
76
</configSections>
87
<vspcmodules>
@@ -14,20 +13,19 @@
1413
</modules>
1514
</vspcmodules>
1615

17-
<startup><supportedRuntime version="v2.0.50727"/></startup>
18-
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
19-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
16+
<startup useLegacyV2RuntimeActivationPolicy="true"><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
17+
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
2018
<targets>
2119
<target name="mc" xsi:type="MethodCall" className="VSPC.Loader.App, VSPC.Loader" methodName="LogMethod">
22-
<parameter layout="${level}" />
23-
<parameter layout="${message}" />
20+
<parameter layout="${level}"/>
21+
<parameter layout="${message}"/>
2422
</target>
2523
<target xsi:type="File" name="file" fileName="vspc.log" autoFlush="true" archiveAboveSize="100000" maxArchiveFiles="5"/>
2624
</targets>
2725

2826
<rules>
29-
<logger name="*" minlevel="Debug" writeTo="mc" />
30-
<logger name="*" minlevel="Debug" writeTo="file" />
27+
<logger name="*" minlevel="Debug" writeTo="mc"/>
28+
<logger name="*" minlevel="Debug" writeTo="file"/>
3129
</rules>
3230
</nlog>
3331

0 commit comments

Comments
 (0)