Skip to content

Commit

Permalink
Adding FileTree stuff.
Browse files Browse the repository at this point in the history
Added PDF Document for UPK format.
  • Loading branch information
stricq committed Feb 6, 2016
1 parent d9ca5de commit bcb1fee
Show file tree
Hide file tree
Showing 14 changed files with 302 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Blade and Soul UPK File Manager

Extract and re-integrate Texture2D and other object types.

Visual Studio 2015 .Net 4.6.1

# External NuGet Source

In Visual Studio:
Expand Down
Binary file added UPK_Format.pdf
Binary file not shown.
43 changes: 43 additions & 0 deletions UpkManager.Domain/Controllers/FileTreeController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System.ComponentModel.Composition;

using STR.Common.Messages;
using STR.MvvmCommon.Contracts;


namespace UpkManager.Domain.Controllers {

[Export(typeof(IController))]
public class FileTreeController : IController {

#region Private Fields

private readonly IMessenger messenger;

#endregion Private Fields

#region Constructor

[ImportingConstructor]
public FileTreeController(IMessenger Messenger) {
messenger = Messenger;

registerMessages();
}

#endregion Constructor

#region Messages

private void registerMessages() {
messenger.Register<ApplicationLoadedMessage>(this, onApplicationLoaded);
}

private void onApplicationLoaded(ApplicationLoadedMessage message) {

}

#endregion Messages

}

}
3 changes: 3 additions & 0 deletions UpkManager.Domain/UpkManager.Domain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
<Compile Include="Contracts\IAutoMapperConfiguration.cs" />
<Compile Include="Contracts\IUpkFileRepository.cs" />
<Compile Include="Controllers\FileHeaderController.cs" />
<Compile Include="Controllers\FileTreeController.cs" />
<Compile Include="Controllers\HeaderTablesController.cs" />
<Compile Include="Controllers\HexController.cs" />
<Compile Include="Controllers\ImageController.cs" />
Expand Down Expand Up @@ -124,6 +125,7 @@
<Compile Include="Models\Tables\DomainGenerationTableEntry.cs" />
<Compile Include="Models\DomainString.cs" />
<Compile Include="Models\Tables\DomainObjectTableEntry.cs" />
<Compile Include="ViewModels\FileTreeViewModel.cs" />
<Compile Include="ViewModels\HexDataViewModel.cs" />
<Compile Include="Models\Tables\DomainNameTableIndex.cs" />
<Compile Include="Models\Tables\DomainExportTableEntry.cs" />
Expand All @@ -148,6 +150,7 @@
<Compile Include="ViewModels\MainMenuViewModel.cs" />
<Compile Include="ViewModels\PropertyViewModel.cs" />
<Compile Include="ViewModels\StatusBarViewModel.cs" />
<Compile Include="ViewModels\UpkFileInfo.cs" />
<Compile Include="ViewModels\UpkManagerViewModel.cs" />
</ItemGroup>
<ItemGroup>
Expand Down
30 changes: 30 additions & 0 deletions UpkManager.Domain/ViewModels/FileTreeViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System.Collections.ObjectModel;
using System.ComponentModel.Composition;

using STR.MvvmCommon;


namespace UpkManager.Domain.ViewModels {

[Export]
[ViewModel("FileTreeViewModel")]
public class FileTreeViewModel : ObservableObject {

#region Private Fields

private ObservableCollection<UpkFileInfo> files;

#endregion Private Fields

#region Properties

public ObservableCollection<UpkFileInfo> Files {
get { return files; }
set { SetField(ref files, value, () => Files); }
}

#endregion Properties

}

}
58 changes: 58 additions & 0 deletions UpkManager.Domain/ViewModels/UpkFileInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using System.Collections.ObjectModel;
using System.ComponentModel.Composition;

using STR.Common.Contracts;
using STR.MvvmCommon;


namespace UpkManager.Domain.ViewModels {

[Export]
[PartCreationPolicy(CreationPolicy.NonShared)]
public class UpkFileInfo : ObservableObject, ITraversable<UpkFileInfo> {

#region Private Fields

private bool isChecked;

private int fileSize;

private string filename;
private string hasTextures;

private ObservableCollection<UpkFileInfo> children;

#endregion Private Fields

#region Properties

public bool IsChecked {
get { return isChecked; }
set { SetField(ref isChecked, value, () => IsChecked); }
}

public int FileSize {
get { return fileSize; }
set { SetField(ref fileSize, value, () => FileSize); }
}

public string Filename {
get { return filename; }
set { SetField(ref filename, value, () => Filename); }
}

public string HasTextures {
get { return hasTextures; }
set { SetField(ref hasTextures, value, () => HasTextures); }
}

public ObservableCollection<UpkFileInfo> Children {
get { return children; }
set { SetField(ref children, value, () => Children); }
}

#endregion Properties

}

}
1 change: 1 addition & 0 deletions UpkManager.Wpf/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<ResourceDictionary Source="Resources/TabItemStyle.xaml" />
<ResourceDictionary Source="Resources/HeaderedContentStyle.xaml" />
<ResourceDictionary Source="Resources/ListViewStyle.xaml" />
<ResourceDictionary Source="Resources/TreeListViewItemStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Expand Down
57 changes: 57 additions & 0 deletions UpkManager.Wpf/Resources/TreeListViewItemStyle.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tv="http://schemas.stricq.com/treelistview/">

<Style x:Key="TreeListViewItemStyle" TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="{Binding Path=IsExpanded, Mode=TwoWay}" />
<Setter Property="IsSelected" Value="{Binding Path=IsSelected, Mode=TwoWay}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TreeViewItem}">
<StackPanel>
<Border Name="Border" CornerRadius="3" Background="{StaticResource ListItemTransparent}">
<GridViewRowPresenter Name="Presenter" Content="{TemplateBinding Header}" Columns="{Binding Columns, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=tv:TreeListView}}" TextBlock.FontWeight="Bold" />
</Border>

<ItemsPresenter Name="ItemsPresenter" Visibility="Collapsed" />
</StackPanel>

<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="True">
<Setter TargetName="ItemsPresenter" Property="Visibility" Value="Visible" />
</Trigger>

<DataTrigger Binding="{Binding Path=UnreadItems}" Value="0">
<Setter TargetName="Presenter" Property="TextBlock.FontWeight" Value="Normal" />
</DataTrigger>

<DataTrigger Binding="{Binding Path=IsContextMenuOpen}" Value="True">
<Setter TargetName="Border" Property="Background" Value="LightGreen" />
<Setter Property="Foreground" Value="Black" />
</DataTrigger>

<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Border" Property="Background" Value="{StaticResource ListItemSelectedColor}" />
<Setter Property="Foreground" Value="{StaticResource ListItemSelectedForeColor}" />
</Trigger>

<DataTrigger Binding="{Binding Path=IsInError}" Value="True">
<Setter TargetName="Border" Property="Background" Value="{StaticResource ListItemErrorColor}" />
<Setter Property="Foreground" Value="{StaticResource ListItemErrorForeColor}" />
</DataTrigger>

<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=IsSelected}" Value="True" />
<Condition Binding="{Binding Path=IsInError}" Value="True" />
</MultiDataTrigger.Conditions>
<Setter TargetName="Border" Property="Background" Value="{StaticResource ListItemSelectedErrorColor}" />
<Setter Property="Foreground" Value="{StaticResource ListItemSelectedErrorForeColor}" />
</MultiDataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

</ResourceDictionary>
11 changes: 11 additions & 0 deletions UpkManager.Wpf/UpkManager.Wpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@
<Compile Include="Views\FileHeaderView.xaml.cs">
<DependentUpon>FileHeaderView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\FileTreeView.xaml.cs">
<DependentUpon>FileTreeView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\HeaderTablesView.xaml.cs">
<DependentUpon>HeaderTablesView.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -179,6 +182,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Resources\TreeListViewItemStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\ExportTableCleanView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand All @@ -191,6 +198,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\FileTreeView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\HeaderTablesView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down
66 changes: 66 additions & 0 deletions UpkManager.Wpf/Views/FileTreeView.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<UserControl x:Class="UpkManager.Wpf.Views.FileTreeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:tv="http://schemas.stricq.com/treelistview/"
xmlns:mvvm="http://schemas.stricq.com/mvvmcommon/"
mvvm:ViewModelLocator.ComposedViewModel="FileTreeViewModel"
mc:Ignorable="d" d:DesignWidth="300" d:DesignHeight="300">

<Grid Margin="-2">

<tv:TreeListView ItemsSource="{Binding Path=Files}" BorderThickness="0" BorderBrush="{StaticResource ContentControlBorderColor}" Background="{StaticResource BackgroundColor}" FontFamily="Tahoma" FontSize="12">
<tv:TreeListView.Resources>
<Style TargetType="TreeViewItem" BasedOn="{StaticResource TreeListViewItemStyle}" />
</tv:TreeListView.Resources>

<tv:TreeListView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Path=Children}" />
</tv:TreeListView.ItemTemplate>

<tv:TreeListView.Columns>

<GridViewColumn Header="File Name">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<tv:TreeListViewExpander Grid.Column="0" Focusable="False" />

<CheckBox Grid.Column="1" Content="{x:Null}" IsChecked="{Binding Path=IsChecked}" Focusable="False" />
<TextBlock Grid.Column="2" Text="{Binding Path=Filename}" HorizontalAlignment="Left" VerticalAlignment="Center" />

</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>

<GridViewColumn Header="Textures">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=HasTextures}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>

<GridViewColumn Header="File Size">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=FileSize, StringFormat={}{0:N0}}" HorizontalAlignment="Right" VerticalAlignment="Center" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>

</tv:TreeListView.Columns>

</tv:TreeListView>

</Grid>

</UserControl>
25 changes: 25 additions & 0 deletions UpkManager.Wpf/Views/FileTreeView.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace UpkManager.Wpf.Views {
/// <summary>
/// Interaction logic for FileTreeView.xaml
/// </summary>
public partial class FileTreeView : UserControl {
public FileTreeView() {
InitializeComponent();
}
}
}
4 changes: 4 additions & 0 deletions UpkManager.Wpf/Views/MainMenuView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
<MenuItem Header="_Settings" Foreground="White">
<MenuItem Header="Skip _Properties" Foreground="{StaticResource BackgroundColor}" IsCheckable="True" IsChecked="{Binding Path=IsSkipProperties}" />
<MenuItem Header="Skip _Object Parsing" Foreground="{StaticResource BackgroundColor}" IsCheckable="True" IsChecked="{Binding Path=IsSkipParsing}" />

<Separator />

<MenuItem Header="S_ettings..." Foreground="{StaticResource BackgroundColor}" />
</MenuItem>

</Menu>
Expand Down
1 change: 1 addition & 0 deletions UpkManager.Wpf/Views/UpkManagerView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
</TabControl.Resources>

<TabItem Header="File Listing">
<v:FileTreeView />
</TabItem>

<TabItem Header="File Header">
Expand Down
1 change: 1 addition & 0 deletions UpkManager.sln
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "00 Solution Items", "00 Solution Items", "{715DB300-AAD3-450A-8D14-F581CD02959C}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
UPK_Format.pdf = UPK_Format.pdf
UpkManager.sln.DotSettings = UpkManager.sln.DotSettings
EndProjectSection
EndProject
Expand Down

0 comments on commit bcb1fee

Please sign in to comment.