Skip to content

Commit

Permalink
3.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Crauzer committed Feb 16, 2020
1 parent fc6a5d3 commit 8664206
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 16 deletions.
20 changes: 20 additions & 0 deletions Obsidian/MVVM/ViewModels/WAD/WadFolderViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,26 @@ public WadFileViewModel Find(Func<WadFileViewModel, bool> predicate)
{
return GetAllFiles().FirstOrDefault(predicate);
}

public bool AreAllItemsSelected()
{
bool areAllItemsSelected = true;

foreach(WadItemViewModel child in this.Items)
{
if(child is WadFolderViewModel childFolder && !childFolder.AreAllItemsSelected())
{
return false;
}

if(!child.IsSelected)
{
return false;
}
}

return areAllItemsSelected;
}

public void Sort()
{
Expand Down
24 changes: 24 additions & 0 deletions Obsidian/MVVM/ViewModels/WAD/WadItemViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public bool IsSelected

this._wadViewModel.NotifySelectionChanged();
NotifyPropertyChanged();
NotifySelectionChanged();
}
}
public string Tooltip
Expand Down Expand Up @@ -143,6 +144,29 @@ public void Remove()
}
}

public void NotifySelectionChanged()
{
if (this.Type == WadItemType.Folder)
{
bool are = (this as WadFolderViewModel).AreAllItemsSelected();
if (are)
{
this._isSelected = true;
}
else
{
this._isSelected = false;
}
}

if (this.Parent != null)
{
(this.Parent as WadFolderViewModel).NotifySelectionChanged();
}

NotifyPropertyChanged(nameof(this.IsSelected));
}

public int CompareTo(WadItemViewModel other)
{
if (this.Type == WadItemType.Folder && other.Type == WadItemType.File)
Expand Down
18 changes: 4 additions & 14 deletions Obsidian/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -422,23 +422,13 @@ private async void SaveWad()
using (CommonSaveFileDialog dialog = new CommonSaveFileDialog())
{
dialog.InitialDirectory = Config.Get<string>("SaveWadInitialDirectory");
dialog.AlwaysAppendDefaultExtension = true;
dialog.DefaultExtension = ".client";
dialog.Filters.Add(new CommonFileDialogFilter("wad.client File", "*.client"));
dialog.Filters.Add(new CommonFileDialogFilter("wad File", "*.wad"));
dialog.Filters.Add(new CommonFileDialogFilter("WAD Client File", "*.wad.client"));
dialog.Filters.Add(new CommonFileDialogFilter("WAD Mobile File", "*.wad.mobile"));
dialog.Filters.Add(new CommonFileDialogFilter("WAD File", "*.wad"));

if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
{
string wadLocation = dialog.FileName;

//We need to change the extension because the dialog is stupid
//and can't handle extensions with multiple dots
if (PathIO.GetExtension(dialog.FileName) == ".client")
{
wadLocation = PathIO.ChangeExtension(dialog.FileName, ".wad.client");
}

await DialogHelper.ShowSaveWadOperationDialog(wadLocation, this.WAD);
await DialogHelper.ShowSaveWadOperationDialog(dialog.FileName, this.WAD);
}
}
}
Expand Down
Binary file added Obsidian/Microsoft.WindowsAPICodePack.Shell.dll
Binary file not shown.
Binary file added Obsidian/Microsoft.WindowsAPICodePack.dll
Binary file not shown.
12 changes: 10 additions & 2 deletions Obsidian/Obsidian.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ApplicationIcon>Resources\icon.ico</ApplicationIcon>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyVersion>3.1.1.0</AssemblyVersion>
<FileVersion>3.1.0.0</FileVersion>
<FileVersion>3.1.2.0</FileVersion>
<Configurations>Debug;Release;ReleasePortable</Configurations>
</PropertyGroup>

Expand Down Expand Up @@ -49,7 +49,6 @@
<PackageReference Include="Octokit" Version="0.36.0" />
<PackageReference Include="Serilog" Version="2.9.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="WindowsAPICodePack-Shell" Version="1.1.1" />
<PackageReference Include="ZstdNet" Version="1.3.3" />
</ItemGroup>

Expand All @@ -62,4 +61,13 @@
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<Reference Include="Microsoft.WindowsAPICodePack">
<HintPath>Microsoft.WindowsAPICodePack.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAPICodePack.Shell">
<HintPath>Microsoft.WindowsAPICodePack.Shell.dll</HintPath>
</Reference>
</ItemGroup>

</Project>

0 comments on commit 8664206

Please sign in to comment.