mirror of
https://github.com/ZuneDev/ZuneModdingHelper.git
synced 2026-07-27 13:12:21 -07:00
71 lines
2.3 KiB
C#
71 lines
2.3 KiB
C#
using OwlCore.AbstractUI.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ZuneModCore.Mods
|
|
{
|
|
public class VideoSyncMod : Mod
|
|
{
|
|
private readonly string WMVCORE_PATH = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "WMVCORE.dll");
|
|
|
|
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 Author => "ส็็็Codix#4833";
|
|
|
|
public override string Id => nameof(VideoSyncMod);
|
|
|
|
public override AbstractUIElementGroup? OptionsUI => null;
|
|
|
|
public override Task<string?> Apply()
|
|
{
|
|
try
|
|
{
|
|
// Make a backup of the file
|
|
File.Copy(WMVCORE_PATH, Path.Combine(StorageDirectory, "WMVCORE.original.dll"), true);
|
|
|
|
// NOTE: This is quite dangerous to do blindly, so let's not do this
|
|
// Kill processes that are using WMVCORE.dll
|
|
//foreach (System.Diagnostics.Process proc in FileUtil.WhoIsLocking(WMVCORE_PATH))
|
|
//{
|
|
// proc.Kill();
|
|
//}
|
|
|
|
// Get the working WMVCORE.dll
|
|
string sourcePath = Path.Combine(
|
|
Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)!, "Resources\\WMVCORE.dll");
|
|
|
|
// Copy the pre-Anniversary Update WMVCORE.dll
|
|
File.Copy(sourcePath, WMVCORE_PATH, true);
|
|
|
|
return Task.FromResult<string?>(null);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return Task.FromResult(ex.Message)!;
|
|
}
|
|
}
|
|
|
|
public override Task<string?> Reset()
|
|
{
|
|
try
|
|
{
|
|
// Copy backup to application folder
|
|
File.Copy(Path.Combine(StorageDirectory, "WMVCORE.original.dll"), WMVCORE_PATH, true);
|
|
|
|
return Task.FromResult<string?>(null);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return Task.FromResult(ex.Message)!;
|
|
}
|
|
}
|
|
|
|
public override IReadOnlyList<Type>? DependentMods => null;
|
|
}
|
|
}
|