@@ -25,9 +25,10 @@ internal class ComInterfaceAssemblyBuilder
25
25
// Now using assembly version even though regenerating our DLL won't strictly be needed for every new version this is the safest option
26
26
// Otherwise people will surely forget to increment a specific version here
27
27
private static readonly Version ? _requireVersion = Assembly . GetExecutingAssembly ( ) . GetName ( ) . Version ;
28
- private static readonly Regex _assemblyRegex = new ( @"VirtualDesktop\.(?<build>\d{5}\.\d{4}?)(\.\w*|)\.dll" ) ;
29
- private static readonly Regex _buildNumberRegex = new ( @"\.Build(?<build>\d{5}\.\d{4})\." ) ;
30
- private static readonly double osBuild = OS . Build ( ) ;
28
+ private static readonly Regex _assemblyRegex = new ( @"VirtualDesktop\.10\.0\.(?<build>\d+\.\d+)(\.\w*|)\.dll" ) ;
29
+ private static readonly Regex _buildNumberRegex = new ( @"\.Build(?<build>\d+\.\d+)\." ) ;
30
+ private static readonly Version osBuild = OS . Build ;
31
+
31
32
private static ComInterfaceAssembly ? _assembly ;
32
33
33
34
private readonly VirtualDesktopCompilerConfiguration _configuration ;
@@ -46,7 +47,7 @@ public ComInterfaceAssembly GetAssembly()
46
47
{
47
48
foreach ( var file in this . _configuration . CompiledAssemblySaveDirectory . GetFiles ( ) )
48
49
{
49
- if ( double . TryParse ( _assemblyRegex . Match ( file . Name ) . Groups [ "build" ] . ToString ( ) , out var build )
50
+ if ( Version . TryParse ( OS . VersionPrefix + _assemblyRegex . Match ( file . Name ) . Groups [ "build" ] . ToString ( ) , out var build )
50
51
&& build == osBuild )
51
52
{
52
53
try
@@ -57,6 +58,8 @@ public ComInterfaceAssembly GetAssembly()
57
58
Debug . WriteLine ( $ "Assembly found: { file . FullName } ") ;
58
59
#if ! DEBUG
59
60
return Assembly . LoadFile ( file . FullName ) ;
61
+ #else
62
+ Debug . WriteLine ( $ "Debug force assembly creation") ;
60
63
#endif
61
64
}
62
65
else
@@ -110,19 +113,19 @@ private Assembly CreateAssembly()
110
113
// └── 22000, VirtualDesktop.Interop.Build22000..interfaces.IVirtualDesktop.cs
111
114
// IVirtualDesktopPinnedApps
112
115
// └── 10240, VirtualDesktop.Interop.Build10240..interfaces.IVirtualDesktopPinnedApps.cs
113
- var interfaceSourceFiles = new Dictionary < string , SortedList < double , string > > ( ) ;
116
+ var interfaceSourceFiles = new Dictionary < string , SortedList < Version , string > > ( ) ;
114
117
115
118
// This is where we decide which interface variant goes into our generated DLL assembly
116
119
foreach ( var name in executingAssembly . GetManifestResourceNames ( ) )
117
120
{
118
121
var interfaceName = Path . GetFileNameWithoutExtension ( name ) . Split ( '.' ) . LastOrDefault ( ) ;
119
122
if ( interfaceName != null
120
123
&& interfaceNames . Contains ( interfaceName )
121
- && double . TryParse ( _buildNumberRegex . Match ( name . Replace ( '_' , '.' ) ) . Groups [ "build" ] . ToString ( ) , out var build ) )
124
+ && Version . TryParse ( OS . VersionPrefix + _buildNumberRegex . Match ( name . Replace ( '_' , '.' ) ) . Groups [ "build" ] . ToString ( ) , out var build ) )
122
125
{
123
126
if ( interfaceSourceFiles . TryGetValue ( interfaceName , out var sourceFiles ) == false )
124
127
{
125
- sourceFiles = new SortedList < double , string > ( ) ;
128
+ sourceFiles = new SortedList < Version , string > ( ) ;
126
129
interfaceSourceFiles . Add ( interfaceName , sourceFiles ) ;
127
130
}
128
131
0 commit comments