diff options
Diffstat (limited to 'MediaBrowser.Installer')
| -rw-r--r-- | MediaBrowser.Installer/Code/ModelExtensions.cs | 23 | ||||
| -rw-r--r-- | MediaBrowser.Installer/MainWindow.xaml.cs | 34 | ||||
| -rw-r--r-- | MediaBrowser.Installer/MediaBrowser.Installer.csproj | 11 | ||||
| -rw-r--r-- | MediaBrowser.Installer/Properties/app.manifest | 52 |
4 files changed, 106 insertions, 14 deletions
diff --git a/MediaBrowser.Installer/Code/ModelExtensions.cs b/MediaBrowser.Installer/Code/ModelExtensions.cs index 5a3051164c..66e51ec117 100644 --- a/MediaBrowser.Installer/Code/ModelExtensions.cs +++ b/MediaBrowser.Installer/Code/ModelExtensions.cs @@ -1,4 +1,6 @@ +using System.Collections.Generic; + namespace MediaBrowser.Installer.Code { /// <summary> @@ -16,5 +18,26 @@ namespace MediaBrowser.Installer.Code { return string.IsNullOrEmpty(str) ? def : str; } + + /// <summary> + /// Helper method for Dictionaries since they throw on not-found keys + /// </summary> + /// <typeparam name="T"></typeparam> + /// <typeparam name="U"></typeparam> + /// <param name="dictionary">The dictionary.</param> + /// <param name="key">The key.</param> + /// <param name="defaultValue">The default value.</param> + /// <returns>``1.</returns> + public static U GetValueOrDefault<T, U>(this Dictionary<T, U> dictionary, T key, U defaultValue) + { + U val; + if (!dictionary.TryGetValue(key, out val)) + { + val = defaultValue; + } + return val; + + } + } } diff --git a/MediaBrowser.Installer/MainWindow.xaml.cs b/MediaBrowser.Installer/MainWindow.xaml.cs index 8924ddb5d3..efa2c71774 100644 --- a/MediaBrowser.Installer/MainWindow.xaml.cs +++ b/MediaBrowser.Installer/MainWindow.xaml.cs @@ -5,7 +5,6 @@ using System.IO; using System.Net; using System.Threading.Tasks; using System.Windows; -using System.Web; using System.Linq; using Ionic.Zip; using MediaBrowser.Installer.Code; @@ -65,20 +64,29 @@ namespace MediaBrowser.Installer protected void GetArgs() { - var args = AppDomain.CurrentDomain.SetupInformation.ActivationArguments; + var args = Environment.GetCommandLineArgs(); - if (args == null || args.ActivationData == null || args.ActivationData.Length <= 0) return; - var url = new Uri(args.ActivationData[0], UriKind.Absolute); - var parameters = HttpUtility.ParseQueryString(url.Query); + var parameters = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); + foreach (var arg in args) + { + var nameValue = arg.Split('='); + try + { + parameters[nameValue[0]] = nameValue[1]; + } + catch // let it default below + { + } + } // fill in our arguments if there - PackageName = parameters["package"] ?? "MBServer"; - PackageClass = (PackageVersionClass)Enum.Parse(typeof(PackageVersionClass), parameters["class"] ?? "Release"); - PackageVersion = new Version(parameters["version"].ValueOrDefault("10.0.0.0")); - RootSuffix = parameters["suffix"] ?? "-Server"; - TargetExe = parameters["target"] ?? "MediaBrowser.ServerApplication.exe"; - FriendlyName = parameters["name"] ?? PackageName; + 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); } @@ -210,7 +218,8 @@ namespace MediaBrowser.Installer product.Save(); var uninstall = (IWshShortcut)shell.CreateShortcut(Path.Combine(startMenu, "Uninstall " + FriendlyName + ".lnk")); - uninstall.TargetPath = Path.Combine(Path.GetDirectoryName(targetExe),"MediaBrowser.Uninstall.exe "+(PackageName == "MBServer" ? "server" : "mbt")); + uninstall.TargetPath = Path.Combine(Path.GetDirectoryName(targetExe),"MediaBrowser.Uninstaller.exe"); + uninstall.Arguments = (PackageName == "MBServer" ? "server" : "mbt"); uninstall.Description = "Uninstall " + FriendlyName; uninstall.Save(); @@ -238,5 +247,6 @@ namespace MediaBrowser.Installer Directory.Delete(location, true); } } + } } diff --git a/MediaBrowser.Installer/MediaBrowser.Installer.csproj b/MediaBrowser.Installer/MediaBrowser.Installer.csproj index 036340be7e..ff6537b21f 100644 --- a/MediaBrowser.Installer/MediaBrowser.Installer.csproj +++ b/MediaBrowser.Installer/MediaBrowser.Installer.csproj @@ -29,7 +29,7 @@ <PublisherName>Media Browser Team</PublisherName> <SuiteName>Media Browser</SuiteName> <TrustUrlParameters>true</TrustUrlParameters> - <ApplicationRevision>8</ApplicationRevision> + <ApplicationRevision>10</ApplicationRevision> <ApplicationVersion>0.1.1.%2a</ApplicationVersion> <UseApplicationTrust>false</UseApplicationTrust> <PublishWizardCompleted>true</PublishWizardCompleted> @@ -61,11 +61,17 @@ <ManifestKeyFile>MediaBrowser.Installer_1_TemporaryKey.pfx</ManifestKeyFile> </PropertyGroup> <PropertyGroup> - <GenerateManifests>true</GenerateManifests> + <GenerateManifests>false</GenerateManifests> </PropertyGroup> <PropertyGroup> <SignManifests>true</SignManifests> </PropertyGroup> + <PropertyGroup> + <TargetZone>LocalIntranet</TargetZone> + </PropertyGroup> + <PropertyGroup> + <ApplicationManifest>Properties\app.manifest</ApplicationManifest> + </PropertyGroup> <ItemGroup> <Reference Include="Ionic.Zip"> <HintPath>..\packages\DotNetZip.1.9.1.8\lib\net20\Ionic.Zip.dll</HintPath> @@ -140,6 +146,7 @@ <LastGenOutput>Resources.Designer.cs</LastGenOutput> </EmbeddedResource> <None Include="MediaBrowser.Installer_1_TemporaryKey.pfx" /> + <None Include="Properties\app.manifest" /> <None Include="Properties\Settings.settings"> <Generator>SettingsSingleFileGenerator</Generator> <LastGenOutput>Settings.Designer.cs</LastGenOutput> diff --git a/MediaBrowser.Installer/Properties/app.manifest b/MediaBrowser.Installer/Properties/app.manifest new file mode 100644 index 0000000000..f499e6ab6d --- /dev/null +++ b/MediaBrowser.Installer/Properties/app.manifest @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="utf-8"?> +<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <assemblyIdentity version="1.0.0.0" name="MyApplication.app" /> + <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> + <security> + <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> + <!-- UAC Manifest Options + If you want to change the Windows User Account Control level replace the + requestedExecutionLevel node with one of the following. + + <requestedExecutionLevel level="asInvoker" uiAccess="false" /> + <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> + <requestedExecutionLevel level="highestAvailable" uiAccess="false" /> + + Specifying requestedExecutionLevel node will disable file and registry virtualization. + If you want to utilize File and Registry Virtualization for backward + compatibility then delete the requestedExecutionLevel node. + --> + <requestedExecutionLevel level="asInvoker" uiAccess="false" /> + </requestedPrivileges> + <applicationRequestMinimum> + <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" /> + <defaultAssemblyRequest permissionSetReference="Custom" /> + </applicationRequestMinimum> + </security> + </trustInfo> + <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> + <application> + <!-- A list of all Windows versions that this application is designed to work with. + Windows will automatically select the most compatible environment.--> + <!-- If your application is designed to work with Windows Vista, uncomment the following supportedOS node--> + <!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>--> + <!-- If your application is designed to work with Windows 7, uncomment the following supportedOS node--> + <!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>--> + <!-- If your application is designed to work with Windows 8, uncomment the following supportedOS node--> + <!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>--> + </application> + </compatibility> + <!-- Enable themes for Windows common controls and dialogs (Windows XP and later) --> + <!-- <dependency> + <dependentAssembly> + <assemblyIdentity + type="win32" + name="Microsoft.Windows.Common-Controls" + version="6.0.0.0" + processorArchitecture="*" + publicKeyToken="6595b64144ccf1df" + language="*" + /> + </dependentAssembly> + </dependency>--> +</asmv1:assembly>
\ No newline at end of file |
