mirror of
https://github.com/ZuneDev/ZuneShell.dll.git
synced 2026-07-27 13:11:51 -07:00
Updated hosts to prevent crash when Zune is not installed
This commit is contained in:
+17
-16
@@ -6,34 +6,35 @@ namespace ZuneHost
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static string _zuneProgramFolder;
|
||||
static DirectoryInfo _zuneProgramDir;
|
||||
|
||||
[STAThread]
|
||||
static int 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("Copying Zune files...");
|
||||
_zuneProgramFolder = Path.Combine(
|
||||
_zuneProgramDir = new(Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
|
||||
"Zune");
|
||||
foreach (var info in new DirectoryInfo(_zuneProgramFolder).GetFileSystemInfos())
|
||||
"Zune"));
|
||||
if (_zuneProgramDir.Exists)
|
||||
{
|
||||
if (info is DirectoryInfo dirInfo)
|
||||
foreach (var info in _zuneProgramDir.GetFileSystemInfos())
|
||||
{
|
||||
CopyAll(dirInfo, new DirectoryInfo(Path.Combine(Environment.CurrentDirectory, dirInfo.Name)));
|
||||
}
|
||||
else if (info is FileInfo fileInfo)
|
||||
{
|
||||
string fileName = fileInfo.Name;
|
||||
if (fileInfo.Extension == ".dll")
|
||||
if (info is DirectoryInfo dirInfo)
|
||||
{
|
||||
string targetPath = Path.Combine(Environment.CurrentDirectory, fileName);
|
||||
if (!File.Exists(targetPath) || fileName == "ZuneDbApi.dll")
|
||||
fileInfo.CopyTo(targetPath);
|
||||
CopyAll(dirInfo, new DirectoryInfo(Path.Combine(Environment.CurrentDirectory, dirInfo.Name)));
|
||||
}
|
||||
else if (info is FileInfo fileInfo)
|
||||
{
|
||||
string fileName = fileInfo.Name;
|
||||
if (fileInfo.Extension == ".dll")
|
||||
{
|
||||
string targetPath = Path.Combine(Environment.CurrentDirectory, fileName);
|
||||
if (!File.Exists(targetPath) || fileName == "ZuneDbApi.dll")
|
||||
fileInfo.CopyTo(targetPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user