@@ -37,6 +37,7 @@ public partial class XmlInstallerWindow : DecoratableWindow
3737 string ModSettingsStoragePath = string . Empty ;
3838 string ModConfigPath = string . Empty ;
3939 string ModUnique = string . Empty ;
40+ Version ModVersion = null ;
4041 XmlDocument Document = new XmlDocument ( ) ;
4142 List < ComponentInfo > Prerequisites = new List < ComponentInfo > ( ) ;
4243 List < ComponentInfo > CompatFiles = new List < ComponentInfo > ( ) ;
@@ -243,6 +244,16 @@ private void PrepareInstaller()
243244 else
244245 ModDescription = string . Empty ;
245246
247+ if ( Document . SelectSingleNode ( "/mod" ) . Attributes [ "version" ] != null )
248+ {
249+ if ( Version . TryParse ( Document . SelectSingleNode ( "/mod" ) . Attributes [ "version" ] . Value , out Version parsedVersion ) )
250+ ModVersion = parsedVersion ;
251+ else
252+ throw new Exception ( "This mod has an invalid version. Please inform the mod's developer of this." ) ;
253+ }
254+ else
255+ ModVersion = null ;
256+
246257 NameTextBlock . Text = displayName ;
247258 DescriptionTextBlock . Text = ModDescription ;
248259
@@ -757,6 +768,7 @@ await Dispatcher.BeginInvoke(new Action(() =>
757768 ModConfiguration mod = new ModConfiguration ( ModName , ModUnique )
758769 {
759770 DisplayName = ModDisplayName ,
771+ Version = ModVersion ,
760772 ConfiguratorPath = Path . Combine ( ModConfigPath , "ModInfo.xml" )
761773 } ;
762774
@@ -780,7 +792,8 @@ await Dispatcher.BeginInvoke(new Action(() =>
780792 {
781793 ModConfiguration mod = new ModConfiguration ( ModName , ModUnique )
782794 {
783- DisplayName = ModDisplayName
795+ DisplayName = ModDisplayName ,
796+ Version = ModVersion ,
784797 } ;
785798
786799 foreach ( ComponentInfo c in Prerequisites )
0 commit comments