Browse Source

Switch to using config file for installer

We will just build separate installers with the two different config
files and publish once
Eric Reed 12 years ago
parent
commit
e43f66ef07

+ 4 - 0
MediaBrowser.Installer/App.config

@@ -1,5 +1,9 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <configuration>
+  <appSettings>
+    <add key="product" value="server" />
+    <add key="class" value="Release" />
+  </appSettings>
     <startup> 
         <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
     </startup>

BIN
MediaBrowser.Installer/Icon.ico


+ 18 - 20
MediaBrowser.Installer/MainWindow.xaml.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Configuration;
 using System.Diagnostics;
 using System.IO;
 using System.Net;
@@ -19,7 +20,7 @@ namespace MediaBrowser.Installer
     public partial class MainWindow : Window
     {
         protected PackageVersionClass PackageClass = PackageVersionClass.Release;
-        protected Version PackageVersion = new Version(10,0,0,0);
+        protected Version PackageVersion = new Version(4,0,0,0);
         protected string PackageName = "MBServer";
         protected string RootSuffix = "-Server";
         protected string TargetExe = "MediaBrowser.ServerApplication.exe";
@@ -64,29 +65,26 @@ namespace MediaBrowser.Installer
 
         protected void GetArgs()
         {
-            var args = Environment.GetCommandLineArgs();
+            var product = ConfigurationManager.AppSettings["product"] ?? "server";
+            PackageClass = (PackageVersionClass) Enum.Parse(typeof (PackageVersionClass), ConfigurationManager.AppSettings["class"] ?? "Release");
 
-
-            var parameters = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
-            foreach (var arg in args)
+            switch (product.ToLower())
             {
-                var nameValue = arg.Split('=');
-                try
-                {
-                    parameters[nameValue[0]] = nameValue[1];
-                }
-                catch // let it default below
-                {
-                }
+                case "mbt":
+                    PackageName = "MBTheater";
+                    RootSuffix = "-UI";
+                    TargetExe = "MediaBrowser.UI.exe";
+                    FriendlyName = "Media Browser Theater";
+                    break;
+
+                default:
+                    PackageName = "MBServer";
+                    RootSuffix = "-Server";
+                    TargetExe = "MediaBrowser.ServerApplication.exe";
+                    FriendlyName = "Media Browser Server";
+                    break;
             }
 
-            // fill in our arguments if there
-            PackageName = parameters.GetValueOrDefault("package","MBServer");
-            PackageClass = (PackageVersionClass)Enum.Parse(typeof(PackageVersionClass), parameters.GetValueOrDefault("class","Release"));
-            PackageVersion = new Version(parameters.GetValueOrDefault("version","10.0.0.0"));
-            RootSuffix = parameters.GetValueOrDefault("suffix", "-Server");
-            TargetExe = parameters.GetValueOrDefault("target", "MediaBrowser.ServerApplication.exe");
-            FriendlyName = parameters.GetValueOrDefault("name", PackageName);
             RootPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MediaBrowser" + RootSuffix);
 
         }

+ 11 - 3
MediaBrowser.Installer/MediaBrowser.Installer.csproj

@@ -28,8 +28,8 @@
     <ProductName>Media Browser Installer</ProductName>
     <PublisherName>Media Browser Team</PublisherName>
     <SuiteName>Media Browser</SuiteName>
-    <TrustUrlParameters>true</TrustUrlParameters>
-    <ApplicationRevision>10</ApplicationRevision>
+    <OpenBrowserOnPublish>false</OpenBrowserOnPublish>
+    <ApplicationRevision>11</ApplicationRevision>
     <ApplicationVersion>0.1.1.%2a</ApplicationVersion>
     <UseApplicationTrust>false</UseApplicationTrust>
     <PublishWizardCompleted>true</PublishWizardCompleted>
@@ -61,7 +61,7 @@
     <ManifestKeyFile>MediaBrowser.Installer_1_TemporaryKey.pfx</ManifestKeyFile>
   </PropertyGroup>
   <PropertyGroup>
-    <GenerateManifests>false</GenerateManifests>
+    <GenerateManifests>true</GenerateManifests>
   </PropertyGroup>
   <PropertyGroup>
     <SignManifests>true</SignManifests>
@@ -72,6 +72,9 @@
   <PropertyGroup>
     <ApplicationManifest>Properties\app.manifest</ApplicationManifest>
   </PropertyGroup>
+  <PropertyGroup>
+    <ApplicationIcon>Icon.ico</ApplicationIcon>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="Ionic.Zip">
       <HintPath>..\packages\DotNetZip.1.9.1.8\lib\net20\Ionic.Zip.dll</HintPath>
@@ -80,6 +83,7 @@
       <HintPath>..\packages\ServiceStack.Text.3.9.37\lib\net35\ServiceStack.Text.dll</HintPath>
     </Reference>
     <Reference Include="System" />
+    <Reference Include="System.Configuration" />
     <Reference Include="System.Data" />
     <Reference Include="System.Web" />
     <Reference Include="System.Xml" />
@@ -145,6 +149,7 @@
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     </EmbeddedResource>
+    <None Include="mbt.config" />
     <None Include="MediaBrowser.Installer_1_TemporaryKey.pfx" />
     <None Include="Properties\app.manifest" />
     <None Include="Properties\Settings.settings">
@@ -196,6 +201,9 @@
       <EmbedInteropTypes>True</EmbedInteropTypes>
     </COMReference>
   </ItemGroup>
+  <ItemGroup>
+    <Resource Include="Icon.ico" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.

+ 1 - 1
MediaBrowser.Installer/Properties/app.manifest

@@ -19,8 +19,8 @@
         <requestedExecutionLevel level="asInvoker" uiAccess="false" />
       </requestedPrivileges>
       <applicationRequestMinimum>
-        <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
         <defaultAssemblyRequest permissionSetReference="Custom" />
+        <PermissionSet class="System.Security.PermissionSet" version="1" ID="Custom" SameSite="site" Unrestricted="true" />
       </applicationRequestMinimum>
     </security>
   </trustInfo>

+ 10 - 0
MediaBrowser.Installer/mbt.config

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+  <appSettings>
+    <add key="product" value="mbt" />
+    <add key="class" value="Release" />
+  </appSettings>
+    <startup> 
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
+    </startup>
+</configuration>