Skip to content

Commit

Permalink
fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Crauzer committed Apr 29, 2021
1 parent baa5c2c commit 9c4c348
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Fantome/MVVM/ViewModels/ModListViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public async Task AddMod(ModManager modManager, ModFile mod, bool install)
{
ModListItemViewModel modListItem = new ModListItemViewModel(mod, this);
this.Items.Add(modListItem);
this.Categories.First(x => x.Category == mod.Info.Category)?.Items.Add(modListItem);

if (install)
{
Expand All @@ -117,6 +118,7 @@ public void RemoveMod(ModListItemViewModel mod)
this.ModManager.RemoveMod(mod.Mod);

this.Items.Remove(mod);
this.Categories.First(x => x.Category == mod.Mod.Info.Category).Items.Remove(mod);
}

public async Task InstallMod(ModListItemViewModel modItem, bool forceInstall = false)
Expand Down
8 changes: 5 additions & 3 deletions Fantome/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@
<ListView x:Name="ModsListBox" ItemsSource="{Binding ModList.Categories}" HorizontalContentAlignment="Stretch">
<ListView.ItemTemplate>
<DataTemplate>
<Expander Header="{Binding Category}" IsExpanded="True">
<ListView Style="{StaticResource ModListStyle}" ItemsSource="{Binding Items}" HorizontalContentAlignment="Stretch"/>
</Expander>
<MaterialDesign:Card>
<Expander Header="{Binding Category}" IsExpanded="True">
<ListView Style="{StaticResource ModListStyle}" ItemsSource="{Binding Items}" HorizontalContentAlignment="Stretch"/>
</Expander>
</MaterialDesign:Card>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Expand Down
4 changes: 3 additions & 1 deletion Fantome/ModManagement/IO/ModFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public ModFile(string fileLocation)
}
public ModFile(LeagueFileIndex index, IEnumerable<string> wadFilePaths, IEnumerable<string> wadFolderPaths, ModInfo info, Image image)
{
using (FileStream fileStream = new FileStream(string.Format(@"{0}\{1}.fantome", ModManager.MOD_FOLDER, info.CreateID()), FileMode.Create))
this._file = string.Format(@"{0}\{1}.fantome", ModManager.MOD_FOLDER, info.CreateID());

using (FileStream fileStream = new FileStream(this._file, FileMode.Create))
{
using (this.Content = new ZipArchive(fileStream, ZipArchiveMode.Update))
{
Expand Down

0 comments on commit 9c4c348

Please sign in to comment.