@@ -77,9 +77,14 @@ static void Main(string[] args)
77
77
if ( args . Length > 1 )
78
78
outputfilename = args [ 1 ] ;
79
79
80
+ string exepath = Path . GetFullPath ( path ) + Path . DirectorySeparatorChar + "MissionPlanner.exe" ;
81
+ string version = Assembly . LoadFile ( exepath ) . GetName ( ) . Version . ToString ( ) ;
82
+
83
+ System . Diagnostics . FileVersionInfo fvi = FileVersionInfo . GetVersionInfo ( exepath ) ;
84
+
80
85
sw = new StreamWriter ( file ) ;
81
86
82
- header ( ) ;
87
+ header ( fvi . ProductVersion ) ;
83
88
84
89
sw . WriteLine ( " <Directory Id=\" INSTALLDIR\" Name=\" Mission Planner\" >" ) ;
85
90
@@ -96,10 +101,7 @@ static void Main(string[] args)
96
101
97
102
sw . Close ( ) ;
98
103
99
- string exepath = Path . GetFullPath ( path ) + Path . DirectorySeparatorChar + "MissionPlanner.exe" ;
100
- string version = Assembly . LoadFile ( exepath ) . GetName ( ) . Version . ToString ( ) ;
101
-
102
- System . Diagnostics . FileVersionInfo fvi = FileVersionInfo . GetVersionInfo ( exepath ) ;
104
+
103
105
104
106
string fn = outputfilename + "-" + fvi . ProductVersion ;
105
107
@@ -147,28 +149,12 @@ static void runProgram(string run)
147
149
P . Start ( ) ;
148
150
}
149
151
150
- static void header ( )
152
+ static void header ( string version )
151
153
{
152
154
string newid = System . Guid . NewGuid ( ) . ToString ( ) ;
153
155
154
156
newid = "*" ;
155
157
156
- StreamReader sr = new StreamReader ( File . OpenRead ( "../MissionPlanner.csproj" ) ) ;
157
-
158
- string version = "0" ;
159
-
160
- while ( ! sr . EndOfStream )
161
- {
162
- string line = sr . ReadLine ( ) ;
163
- if ( line . Contains ( "<Version>" ) )
164
- {
165
- string [ ] items = line . Split ( new char [ ] { ' ' , '"' , '<' , '>' } , StringSplitOptions . RemoveEmptyEntries ) ;
166
- version = items [ 1 ] ;
167
- break ;
168
- }
169
- }
170
- sr . Close ( ) ;
171
-
172
158
string data = @"<?xml version=""1.0"" encoding=""utf-8""?>
173
159
<Wix xmlns=""http://schemas.microsoft.com/wix/2006/wi"" xmlns:netfx=""http://schemas.microsoft.com/wix/NetFxExtension"" xmlns:difx=""http://schemas.microsoft.com/wix/DifxAppExtension"" xmlns:iis='http://schemas.microsoft.com/wix/IIsExtension' >
174
160
0 commit comments