2021-04-25 22:59:36 -05:00
|
|
|
using OwlCore.AbstractUI.Models;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace ZuneModCore.Mods
|
|
|
|
|
{
|
|
|
|
|
public class VideoSyncMod : Mod
|
|
|
|
|
{
|
2021-04-26 05:09:48 -05:00
|
|
|
private const string WMVCORE_PATH = @"C:\Windows\System32\WMVCORE.dll";
|
|
|
|
|
|
2021-04-25 22:59:36 -05:00
|
|
|
public override string Title => "Fix Video Sync";
|
|
|
|
|
|
|
|
|
|
public override string Description =>
|
|
|
|
|
"Resolves \"Error C00D11CD\" when attempting to sync video to a Zune device using Windows 10 1607 (Anniversary Update) or newer";
|
|
|
|
|
|
|
|
|
|
public override string Id => nameof(VideoSyncMod);
|
|
|
|
|
|
2021-04-26 04:28:43 -05:00
|
|
|
public override AbstractUIElementGroup? OptionsUI => null;
|
2021-04-25 22:59:36 -05:00
|
|
|
|
2021-04-26 04:28:43 -05:00
|
|
|
public override Task<string?> Apply()
|
2021-04-25 22:59:36 -05:00
|
|
|
{
|
2021-04-26 05:09:48 -05:00
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// Make a backup of the file
|
|
|
|
|
File.Copy(WMVCORE_PATH, Path.Combine(StorageDirectory, "WMVCORE.original.dll"), true);
|
2021-04-26 04:28:43 -05:00
|
|
|
|
2021-04-26 05:18:40 -05:00
|
|
|
// NOTE: This is quite dangerous to do blindly, so let's not
|
|
|
|
|
// Kill processes that are using WMVCORE.dll
|
|
|
|
|
//foreach (System.Diagnostics.Process proc in FileUtil.WhoIsLocking(WMVCORE_PATH))
|
|
|
|
|
//{
|
|
|
|
|
// proc.Kill();
|
|
|
|
|
//}
|
|
|
|
|
|
2021-04-26 05:09:48 -05:00
|
|
|
// Copy the pre-Anniversary Update WMVCORE.dll
|
|
|
|
|
File.Copy("Resources\\WMVCORE.dll", WMVCORE_PATH, true);
|
|
|
|
|
|
|
|
|
|
return Task.FromResult<string?>(null);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
return Task.FromResult(ex.Message)!;
|
|
|
|
|
}
|
2021-04-25 22:59:36 -05:00
|
|
|
}
|
|
|
|
|
|
2021-04-26 04:28:43 -05:00
|
|
|
public override Task<string?> Reset()
|
2021-04-25 22:59:36 -05:00
|
|
|
{
|
2021-04-26 17:02:21 -05:00
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// Copy backup to application folder
|
|
|
|
|
File.Copy(Path.Combine(StorageDirectory, "WMVCORE.original.dll"), WMVCORE_PATH, true);
|
2021-04-26 05:09:48 -05:00
|
|
|
|
2021-04-26 17:02:21 -05:00
|
|
|
return Task.FromResult<string?>(null);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
return Task.FromResult(ex.Message)!;
|
|
|
|
|
}
|
2021-04-25 22:59:36 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override IReadOnlyList<Type>? DependentMods => null;
|
|
|
|
|
}
|
|
|
|
|
}
|