mirror of
https://github.com/ZuneDev/ZuneModdingHelper.git
synced 2026-07-27 13:12:21 -07:00
Implemented WMVCore mod; TODO fix UnauthorizedAccessException
This commit is contained in:
@@ -47,11 +47,5 @@ namespace ZuneModCore
|
||||
}
|
||||
|
||||
public abstract IReadOnlyList<Type>? DependentMods { get; }
|
||||
|
||||
internal FileStream OpenFileInStorageDirectory(string filename)
|
||||
{
|
||||
FileInfo info = new(Path.Combine(StorageDirectory, filename));
|
||||
return File.Create(info.FullName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ namespace ZuneModCore.Mods
|
||||
{
|
||||
public class VideoSyncMod : Mod
|
||||
{
|
||||
private const string WMVCORE_PATH = @"C:\Windows\System32\WMVCORE.dll";
|
||||
|
||||
public override string Title => "Fix Video Sync";
|
||||
|
||||
public override string Description =>
|
||||
@@ -19,16 +21,27 @@ namespace ZuneModCore.Mods
|
||||
|
||||
public override Task<string?> Apply()
|
||||
{
|
||||
var writer = new StreamWriter(OpenFileInStorageDirectory("1.log"));
|
||||
writer.WriteLine("Hello world");
|
||||
writer.Flush();
|
||||
writer.Close();
|
||||
try
|
||||
{
|
||||
// Make a backup of the file
|
||||
File.Copy(WMVCORE_PATH, Path.Combine(StorageDirectory, "WMVCORE.original.dll"), true);
|
||||
|
||||
// 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)!;
|
||||
}
|
||||
}
|
||||
|
||||
public override Task<string?> Reset()
|
||||
{
|
||||
// Copy backup to application folder
|
||||
File.Copy(Path.Combine(StorageDirectory, "WMVCORE.original.dll"), WMVCORE_PATH, true);
|
||||
|
||||
return Task.FromResult<string?>(null);
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,21 @@ namespace ZuneModCore.Mods
|
||||
|
||||
public override Task<string?> Reset()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
// Copy backup to application folder
|
||||
File.Copy(Path.Combine(StorageDirectory, "ZuneService.original.dll"), Path.Combine(ZuneInstallDir, "ZuneService.dll"), true);
|
||||
|
||||
// Disable all feature overrides affected by new servers
|
||||
SetFeatureOverride("Apps", false);
|
||||
SetFeatureOverride("Channels", false);
|
||||
SetFeatureOverride("Games", false);
|
||||
SetFeatureOverride("Marketplace", false);
|
||||
SetFeatureOverride("Music", false);
|
||||
SetFeatureOverride("MusicVideos", false);
|
||||
SetFeatureOverride("Podcasts", false);
|
||||
SetFeatureOverride("Social", false);
|
||||
SetFeatureOverride("Videos", false);
|
||||
|
||||
return Task.FromResult<string?>(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -11,4 +11,10 @@
|
||||
<PackageReference Include="OwlCore" Version="0.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Resources\WMVCORE.DLL">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -59,10 +59,10 @@
|
||||
|
||||
<Border x:Name="ProgressBorder" Padding="8" Margin="8" Background="White" Visibility="Collapsed" Grid.RowSpan="2">
|
||||
<Grid>
|
||||
<StackPanel Margin="8" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<StackPanel Margin="50,8,50,8" VerticalAlignment="Center" HorizontalAlignment="Stretch">
|
||||
<TextBlock x:Name="ProgressDesc" Text="Preparing..." FontSize="14" FontWeight="SemiBold"
|
||||
HorizontalAlignment="Center" TextAlignment="Center"/>
|
||||
<mah:MetroProgressBar x:Name="Progress" Value="0" MinWidth="200"/>
|
||||
HorizontalAlignment="Stretch" TextAlignment="Center"/>
|
||||
<mah:MetroProgressBar x:Name="Progress" Value="0" HorizontalAlignment="Stretch"/>
|
||||
</StackPanel>
|
||||
|
||||
<Button x:Name="ProgressCloseButton" Content="Close" Visibility="Collapsed" Click="ProgressCloseButton_Click"
|
||||
|
||||
Reference in New Issue
Block a user