Skip to content

Commit ff14cee

Browse files
committed
Implemented WMVCore mod; TODO fix UnauthorizedAccessException
1 parent 7161797 commit ff14cee

File tree

6 files changed

+43
-16
lines changed

6 files changed

+43
-16
lines changed

ZuneModCore/Mod.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,5 @@ public string StorageDirectory
4747
}
4848

4949
public abstract IReadOnlyList<Type>? DependentMods { get; }
50-
51-
internal FileStream OpenFileInStorageDirectory(string filename)
52-
{
53-
FileInfo info = new(Path.Combine(StorageDirectory, filename));
54-
return File.Create(info.FullName);
55-
}
5650
}
5751
}

ZuneModCore/Mods/VideoSyncMod.cs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ namespace ZuneModCore.Mods
88
{
99
public class VideoSyncMod : Mod
1010
{
11+
private const string WMVCORE_PATH = @"C:\Windows\System32\WMVCORE.dll";
12+
1113
public override string Title => "Fix Video Sync";
1214

1315
public override string Description =>
@@ -19,16 +21,27 @@ public class VideoSyncMod : Mod
1921

2022
public override Task<string?> Apply()
2123
{
22-
var writer = new StreamWriter(OpenFileInStorageDirectory("1.log"));
23-
writer.WriteLine("Hello world");
24-
writer.Flush();
25-
writer.Close();
26-
27-
return Task.FromResult<string?>(null);
24+
try
25+
{
26+
// Make a backup of the file
27+
File.Copy(WMVCORE_PATH, Path.Combine(StorageDirectory, "WMVCORE.original.dll"), true);
28+
29+
// Copy the pre-Anniversary Update WMVCORE.dll
30+
File.Copy("Resources\\WMVCORE.dll", WMVCORE_PATH, true);
31+
32+
return Task.FromResult<string?>(null);
33+
}
34+
catch (Exception ex)
35+
{
36+
return Task.FromResult(ex.Message)!;
37+
}
2838
}
2939

3040
public override Task<string?> Reset()
3141
{
42+
// Copy backup to application folder
43+
File.Copy(Path.Combine(StorageDirectory, "WMVCORE.original.dll"), WMVCORE_PATH, true);
44+
3245
return Task.FromResult<string?>(null);
3346
}
3447

ZuneModCore/Mods/WebservicesMod.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,21 @@ public class WebservicesMod : Mod
9292

9393
public override Task<string?> Reset()
9494
{
95-
throw new NotImplementedException();
95+
// Copy backup to application folder
96+
File.Copy(Path.Combine(StorageDirectory, "ZuneService.original.dll"), Path.Combine(ZuneInstallDir, "ZuneService.dll"), true);
97+
98+
// Disable all feature overrides affected by new servers
99+
SetFeatureOverride("Apps", false);
100+
SetFeatureOverride("Channels", false);
101+
SetFeatureOverride("Games", false);
102+
SetFeatureOverride("Marketplace", false);
103+
SetFeatureOverride("Music", false);
104+
SetFeatureOverride("MusicVideos", false);
105+
SetFeatureOverride("Podcasts", false);
106+
SetFeatureOverride("Social", false);
107+
SetFeatureOverride("Videos", false);
108+
109+
return Task.FromResult<string?>(null);
96110
}
97111
}
98112
}

ZuneModCore/Resources/WMVCORE.DLL

2.52 MB
Binary file not shown.

ZuneModCore/ZuneModCore.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,10 @@
1111
<PackageReference Include="OwlCore" Version="0.0.1" />
1212
</ItemGroup>
1313

14+
<ItemGroup>
15+
<None Update="Resources\WMVCORE.DLL">
16+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
17+
</None>
18+
</ItemGroup>
19+
1420
</Project>

ZuneModdingHelper/MainWindow.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@
5959

6060
<Border x:Name="ProgressBorder" Padding="8" Margin="8" Background="White" Visibility="Collapsed" Grid.RowSpan="2">
6161
<Grid>
62-
<StackPanel Margin="8" VerticalAlignment="Center" HorizontalAlignment="Center">
62+
<StackPanel Margin="50,8,50,8" VerticalAlignment="Center" HorizontalAlignment="Stretch">
6363
<TextBlock x:Name="ProgressDesc" Text="Preparing..." FontSize="14" FontWeight="SemiBold"
64-
HorizontalAlignment="Center" TextAlignment="Center"/>
65-
<mah:MetroProgressBar x:Name="Progress" Value="0" MinWidth="200"/>
64+
HorizontalAlignment="Stretch" TextAlignment="Center"/>
65+
<mah:MetroProgressBar x:Name="Progress" Value="0" HorizontalAlignment="Stretch"/>
6666
</StackPanel>
6767

6868
<Button x:Name="ProgressCloseButton" Content="Close" Visibility="Collapsed" Click="ProgressCloseButton_Click"

0 commit comments

Comments
 (0)