Added prototype ZuneHost console app

This commit is contained in:
Yoshi Askharoun
2022-06-03 01:24:53 -05:00
parent 321e353ef8
commit ef5de4ca94
5 changed files with 154 additions and 9 deletions
+76
View File
@@ -0,0 +1,76 @@
using Silk.NET.Windowing;
using System;
using System.IO;
using System.Reflection;
using System.Threading;
namespace ZuneHost
{
internal class Program
{
static string? _zuneProgramFolder;
static void Main(string[] args)
{
Console.WriteLine("Creating splash window...");
string strArgs = string.Join(' ', args);
// Make sure that ZuneDBApi can find all the Zune native libraries
Console.WriteLine("Setting up dependency resolver...");
_zuneProgramFolder = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
"Zune");
foreach (string file in Directory.GetFiles(_zuneProgramFolder))
{
string fileName = Path.GetFileName(file);
if ((fileName.StartsWith("Zune") || fileName.StartsWith("UIX"))
&& file.EndsWith(".dll")
&& fileName != "ZuneDbApi.dll")
{
string targetPath = Path.Combine(Environment.CurrentDirectory, fileName);
if (!File.Exists(targetPath))
File.Copy(file, targetPath);
}
}
//AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
Console.WriteLine("Starting Zune...");
Thread zuneThread = new Thread(new ThreadStart(() =>
{
Microsoft.Zune.Shell.ZuneApplication.Launch(strArgs, IntPtr.Zero);
}));
zuneThread.SetApartmentState(ApartmentState.STA);
zuneThread.Start();
//Thread t = new(() =>
// Microsoft.Zune.Shell.ZuneApplication.Launch(strArgs, IntPtr.Zero));
//t.SetApartmentState(ApartmentState.STA);
//t.Start();
}
private static Assembly? CurrentDomain_AssemblyResolve(object? sender, ResolveEventArgs args)
{
string fileName = args.Name[..args.Name.IndexOf(",")];
if (fileName == "ZuneDBApi")
{
string assemblyPath = Path.Combine(Directory.GetCurrentDirectory(), "ZuneDBApi.dll");
bool exists = File.Exists(assemblyPath);
return Assembly.LoadFrom(assemblyPath);
}
else if (!fileName.StartsWith("Zune"))
{
return null;
}
else
{
string assemblyPath = Path.Combine(
_zuneProgramFolder ?? throw new ArgumentNullException(),
fileName + ".dll");
return Assembly.Load(assemblyPath);
}
}
}
}
+17
View File
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<Platforms>AnyCPU;x64;x86;ARM32</Platforms>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Silk.NET.Windowing" Version="2.15.0" />
<ProjectReference Include="..\ZuneShell\ZuneShell.csproj" />
</ItemGroup>
</Project>
+49 -3
View File
@@ -6,42 +6,88 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZuneShell", "ZuneShell\Zune
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{7640D6FE-600E-44BE-A59F-E90602FA7754}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UIX", "libs\MicrosoftIris\UIX\UIX.csproj", "{78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UIX", "libs\MicrosoftIris\UIX\UIX.csproj", "{78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UIX.RenderApi", "libs\MicrosoftIris\UIX.RenderApi\UIX.RenderApi.csproj", "{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZuneHost", "ZuneHost\ZuneHost.csproj", "{4041A91F-EF2A-4C47-9EBE-F4E862532345}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM32 = Debug|ARM32
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|ARM32 = Release|ARM32
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Debug|Any CPU.ActiveCfg = Debug|x64
{E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Debug|Any CPU.Build.0 = Debug|x64
{E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Debug|ARM32.ActiveCfg = Debug|x64
{E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Debug|ARM32.Build.0 = Debug|x64
{E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Debug|x64.ActiveCfg = Debug|x64
{E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Debug|x64.Build.0 = Debug|x64
{E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Debug|x86.ActiveCfg = Debug|x86
{E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Debug|x86.Build.0 = Debug|x86
{E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Release|Any CPU.ActiveCfg = Release|x64
{E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Release|Any CPU.Build.0 = Release|x64
{E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Release|ARM32.ActiveCfg = Release|x64
{E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Release|ARM32.Build.0 = Release|x64
{E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Release|x64.ActiveCfg = Release|x64
{E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Release|x64.Build.0 = Release|x64
{E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Release|x86.ActiveCfg = Release|x86
{E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Release|x86.Build.0 = Release|x86
{78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Debug|ARM32.ActiveCfg = Debug|Any CPU
{78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Debug|ARM32.Build.0 = Debug|Any CPU
{78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Debug|x64.ActiveCfg = Debug|x64
{78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Debug|x64.Build.0 = Debug|x64
{78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Debug|x86.ActiveCfg = Debug|x86
{78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Debug|x86.Build.0 = Debug|x86
{78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Release|Any CPU.Build.0 = Release|Any CPU
{78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Release|ARM32.ActiveCfg = Release|Any CPU
{78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Release|ARM32.Build.0 = Release|Any CPU
{78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Release|x64.ActiveCfg = Release|x64
{78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Release|x64.Build.0 = Release|x64
{78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Release|x86.ActiveCfg = Release|x86
{78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Release|x86.Build.0 = Release|x86
{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Debug|x64.ActiveCfg = Debug|Any CPU
{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Debug|x64.Build.0 = Debug|Any CPU
{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Debug|ARM32.ActiveCfg = Debug|Any CPU
{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Debug|ARM32.Build.0 = Debug|Any CPU
{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Debug|x64.ActiveCfg = Debug|x64
{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Debug|x64.Build.0 = Debug|x64
{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Debug|x86.ActiveCfg = Debug|x86
{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Debug|x86.Build.0 = Debug|x86
{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Release|Any CPU.Build.0 = Release|Any CPU
{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Release|ARM32.ActiveCfg = Release|Any CPU
{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Release|ARM32.Build.0 = Release|Any CPU
{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Release|x64.ActiveCfg = Release|Any CPU
{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Release|x64.Build.0 = Release|Any CPU
{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Release|x86.ActiveCfg = Release|x86
{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Release|x86.Build.0 = Release|x86
{4041A91F-EF2A-4C47-9EBE-F4E862532345}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4041A91F-EF2A-4C47-9EBE-F4E862532345}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4041A91F-EF2A-4C47-9EBE-F4E862532345}.Debug|ARM32.ActiveCfg = Debug|ARM32
{4041A91F-EF2A-4C47-9EBE-F4E862532345}.Debug|ARM32.Build.0 = Debug|ARM32
{4041A91F-EF2A-4C47-9EBE-F4E862532345}.Debug|x64.ActiveCfg = Debug|x64
{4041A91F-EF2A-4C47-9EBE-F4E862532345}.Debug|x64.Build.0 = Debug|x64
{4041A91F-EF2A-4C47-9EBE-F4E862532345}.Debug|x86.ActiveCfg = Debug|x86
{4041A91F-EF2A-4C47-9EBE-F4E862532345}.Debug|x86.Build.0 = Debug|x86
{4041A91F-EF2A-4C47-9EBE-F4E862532345}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4041A91F-EF2A-4C47-9EBE-F4E862532345}.Release|Any CPU.Build.0 = Release|Any CPU
{4041A91F-EF2A-4C47-9EBE-F4E862532345}.Release|ARM32.ActiveCfg = Release|ARM32
{4041A91F-EF2A-4C47-9EBE-F4E862532345}.Release|ARM32.Build.0 = Release|ARM32
{4041A91F-EF2A-4C47-9EBE-F4E862532345}.Release|x64.ActiveCfg = Release|Any CPU
{4041A91F-EF2A-4C47-9EBE-F4E862532345}.Release|x64.Build.0 = Release|Any CPU
{4041A91F-EF2A-4C47-9EBE-F4E862532345}.Release|x86.ActiveCfg = Release|x86
{4041A91F-EF2A-4C47-9EBE-F4E862532345}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+11 -5
View File
@@ -9,9 +9,7 @@
<AssemblyName>ZuneShell</AssemblyName>
<ApplicationVersion>4.7.0.0</ApplicationVersion>
<TargetFramework>net35</TargetFramework>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworks>net35;net6.0</TargetFrameworks>
<Platforms>x64;x86</Platforms>
<FileAlignment>512</FileAlignment>
@@ -22,16 +20,24 @@
<DelaySign>True</DelaySign>
</PropertyGroup>
<ItemGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net35' ">
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<OldToolsVersion>3.5</OldToolsVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net35' ">
<Reference Include="Accessibility" />
<Reference Include="System" />
<Reference Include="System.Xml" />
<ProjectReference Include="..\libs\MicrosoftIris\UIX\UIX.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="ZuneDBApi">
<HintPath>C:\Program Files\Zune\ZuneDBApi.dll</HintPath>
</Reference>
<Reference Include="UIXControls">
<HintPath>C:\Program Files\Zune\UIXcontrols.dll</HintPath>
</Reference>
<ProjectReference Include="..\libs\MicrosoftIris\UIX\UIX.csproj" />
</ItemGroup>
</Project>