Skip to content

Commit

Permalink
Fixed #37 to restore legacy archives
Browse files Browse the repository at this point in the history
Added test archives
Added better archive fail handling
  • Loading branch information
sanmadjack committed Aug 15, 2012
1 parent ba3a081 commit c0bee5f
Show file tree
Hide file tree
Showing 15 changed files with 200 additions and 155 deletions.
Binary file added DifferentPathTest.gb7
Binary file not shown.
2 changes: 1 addition & 1 deletion Libs/GameSave.Info
Binary file modified MASGAU.NET.suo
Binary file not shown.
2 changes: 1 addition & 1 deletion MASGAU.Restore.WPF/MASGAU.Restore.WPF.csproj.user
Expand Up @@ -4,6 +4,6 @@
<StartArguments>"C:\Documents and Settings\tkmayn9\My Documents\Downloads\Civilization5«Windows«Matthew@9-20-2011 11-47-25 PM.gb7"</StartArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<StartArguments>"C:\Documents and Settings\support1\Desktop\Test\BeneathASteelSky«ScummVM«Settings«2BFFC0D7.gb7"</StartArguments>
<StartArguments>"Y:\Desktop\Projects\MASGAU\ObsoletePlatformText.gb7"</StartArguments>
</PropertyGroup>
</Project>
177 changes: 90 additions & 87 deletions MASGAU.WPF/RestoreWindow.xaml
Expand Up @@ -10,96 +10,99 @@
<w:CustomWindowBorder>
<w:CustomWindowBorder.BorderContent>
<Grid Margin="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<GroupBox Grid.Row="0" Margin="5" Name="ProgressBox">
<w:SuperProgressBar Height="25" Name="restoreProgress" StatusVisible="false" />
</GroupBox>
<Grid Margin="3" Grid.Row="1" Name="LocationGrid" Visibility="Collapsed">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<GroupBox Grid.ColumnSpan="2" Header="$RestoreLocationChoice" Margin="3" Name="pathBox">
<ComboBox Height="23" Margin="1" Name="pathCombo" SelectionChanged="pathCombo_SelectionChanged" TabIndex="2" />
</GroupBox>
<GroupBox Grid.ColumnSpan="2" Grid.Row="2" Header="$RestoreUserChoice" Margin="3" Name="userBox">
<ComboBox Height="23" Margin="1" Name="userCombo" TabIndex="3" />
</GroupBox>
<GroupBox Grid.ColumnSpan="2" Grid.Row="1" Header="$RestoreLocation" Margin="3" Name="singlePathBox">
<Label Content="{Binding only_path}" Margin="1" Name="pathLabel" />
</GroupBox>
<GroupBox Grid.ColumnSpan="2" Grid.Row="3" Header="$RestoreUser" Margin="3" Name="singleUserBox">
<Label Content="{Binding only_user}" Margin="1" Name="userLabel" />
</GroupBox>
</Grid>
<GroupBox Header="$RestoreSelectFiles" Margin="5" Grid.Row="2" Name="selectFilesGroup" Visibility="Collapsed">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ListView Name="listView1" VerticalAlignment="Top" MinWidth="75" MinHeight="200" Margin="3" ItemsSource="{Binding}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" MaxHeight="500" Grid.ColumnSpan="3">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</ListView.ItemContainerStyle>
<ListView.Resources>
<Style TargetType="{x:Type CheckBox}" x:Key="DataGridCheckBox">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Margin" Value="2" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
</ListView.Resources>
<ListView.View>
<GridView AllowsColumnReorder="False">
<GridViewColumn x:Name="restoreColumn" Header="$Restore" Width="50">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox HorizontalAlignment="Center" IsChecked="{Binding IsSelected, Mode=TwoWay}" Style="{StaticResource DataGridCheckBox}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn x:Name="fileColumn" Header="$File">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding name}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
<Button Content="$SelectAll" Grid.Row="1" Height="23" Name="selectAllBtn" Padding="3,0" Click="button1_Click" Margin="3" />
<Button Content="$SelectNone" Grid.Column="1" Grid.Row="1" Height="23" Name="selectNoneBtn" Padding="3,0" Click="button2_Click" Margin="3" />
</Grid>
</GroupBox>
<GroupBox Grid.Row="0" Margin="5" Name="ProgressBox">
<w:SuperProgressBar Height="25" Name="restoreProgress" StatusVisible="false" />
</GroupBox>
<Grid Margin="3" Grid.Row="1" Name="LocationGrid" Visibility="Collapsed">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Name="noGameLabel" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="1" Visibility="Collapsed">
<TextBlock Name="noGameText" TextAlignment="Center">$ArchiveGameNotFound</TextBlock>
</Label>
<GroupBox Grid.Row="1" Grid.ColumnSpan="2" Header="$RestoreLocationChoice" Margin="3" Name="pathBox">
<ComboBox Height="23" Margin="1" Name="pathCombo" SelectionChanged="pathCombo_SelectionChanged" TabIndex="2" />
</GroupBox>
<GroupBox Grid.ColumnSpan="2" Grid.Row="2" Header="$RestoreUserChoice" Margin="3" Name="userBox">
<ComboBox Height="23" Margin="1" Name="userCombo" TabIndex="3" />
</GroupBox>
<GroupBox Grid.ColumnSpan="2" Grid.Row="3" Header="$RestoreLocation" Margin="3" Name="singlePathBox">
<Label Content="{Binding only_path}" Margin="1" Name="pathLabel" />
</GroupBox>
<GroupBox Grid.ColumnSpan="2" Grid.Row="4" Header="$RestoreUser" Margin="3" Name="singleUserBox">
<Label Content="{Binding only_user}" Margin="1" Name="userLabel" />
</GroupBox>
</Grid>
<GroupBox Header="$RestoreSelectFiles" Margin="5" Grid.Row="2" Name="selectFilesGroup" Visibility="Collapsed">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ListView Name="listView1" VerticalAlignment="Top" MinWidth="75" MinHeight="200" Margin="3" ItemsSource="{Binding}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" MaxHeight="500" Grid.ColumnSpan="3">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</ListView.ItemContainerStyle>
<ListView.Resources>
<Style TargetType="{x:Type CheckBox}" x:Key="DataGridCheckBox">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Margin" Value="2" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
</ListView.Resources>
<ListView.View>
<GridView AllowsColumnReorder="False">
<GridViewColumn x:Name="restoreColumn" Header="$Restore" Width="50">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox HorizontalAlignment="Center" IsChecked="{Binding IsSelected, Mode=TwoWay}" Style="{StaticResource DataGridCheckBox}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn x:Name="fileColumn" Header="$File">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding name}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
<Button Content="$SelectAll" Grid.Row="1" Height="23" Name="selectAllBtn" Padding="3,0" Click="button1_Click" Margin="3" />
<Button Content="$SelectNone" Grid.Column="1" Grid.Row="1" Height="23" Name="selectNoneBtn" Padding="3,0" Click="button2_Click" Margin="3" />
</Grid>
</GroupBox>

<Label Grid.Row="3" Name="restoreDoneLabel" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="5" Visibility="Collapsed">
<TextBlock Name="restoreDoneText" TextAlignment="Center">$RestoreComplete</TextBlock>
</Label>
</Grid>
<Label Grid.Row="3" Name="restoreDoneLabel" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="5" Visibility="Collapsed">
<TextBlock Name="restoreDoneText" TextAlignment="Center">$RestoreComplete</TextBlock>
</Label>
</Grid>
</w:CustomWindowBorder.BorderContent>

<w:CustomWindowBorder.BottomGrid>
Expand All @@ -117,7 +120,7 @@
<w:SuperButton Grid.Column="3" ImageSource="/WPF;Component/Images/16px/gtk-edit.png" ImageHeight="16" Text="$SelectFiles" Name="selectFilesButton" TabIndex="5" Margin="3" Click="selectFilesButton_Click" />
<w:SuperButton Grid.Column="4" ImageSource="/WPF;Component/Images/20px/gtk-ok.png" ImageHeight="16" Click="restoreButton_Click" Text="$Restore" Name="restoreButton" TabIndex="4" Visibility="Collapsed" Margin="3" />
<w:SuperButton Grid.Column="5" ImageSource="/WPF;Component/Images/20px/gtk-cancel.png" ImageHeight="16" Click="cancelButton_Click" Text="$Cancel" Name="cancelButton" TabIndex="5" Margin="3" />
</Grid>
</Grid>
</w:CustomWindowBorder.BottomGrid>
</w:CustomWindowBorder>
</src:AProgramWindow>
7 changes: 5 additions & 2 deletions MASGAU.WPF/RestoreWindow.xaml.cs
Expand Up @@ -81,8 +81,8 @@ public RestoreWindow(ACommunicationWindow owner)
restoreButton.Visibility = System.Windows.Visibility.Visible;
choosePathButton.Visibility = System.Windows.Visibility.Visible;

if (restore.game_data.RestoreComment != null) {
restoreDoneText.Text = restore.game_data.RestoreComment + Environment.NewLine + Environment.NewLine + Strings.GetLabelString("RestoreCompleteWithComment");
if (restore.RestoreComment != null) {
restoreDoneText.Text = restore.RestoreComment + Environment.NewLine + Environment.NewLine + Strings.GetLabelString("RestoreCompleteWithComment");
}

refreshPaths();
Expand Down Expand Up @@ -129,6 +129,9 @@ public RestoreWindow(ACommunicationWindow owner)
}

private void refreshPaths() {
if (restore.GameNotDetected)
noGameLabel.Visibility = System.Windows.Visibility.Visible;

if (restore.path_candidates.Count == 0) {
pathBox.Visibility = System.Windows.Visibility.Collapsed;
singlePathBox.Visibility = System.Windows.Visibility.Visible;
Expand Down
1 change: 1 addition & 0 deletions MASGAU/Archive/ArchiveID.cs
Expand Up @@ -60,6 +60,7 @@ public class ArchiveID : AIdentifier {
Owner = element.GetAttribute("name");
break;
case "original_path_hash":
case "original_drive":
break;
default:
throw new NotSupportedException(element.Name);
Expand Down
2 changes: 1 addition & 1 deletion MASGAU/Data
Submodule Data updated 3 files
+3 −1 deprecated.xml
+2 −1 games.xml
+2 −1 system.xml
4 changes: 2 additions & 2 deletions MASGAU/Location/ALocationHandler.cs
Expand Up @@ -75,15 +75,15 @@ public abstract class ALocationHandler : Model<StringID, UserData> {
add_me = new DetectedLocationPathHolder(get_me);
add_me.owner = user.name;
add_me.AbsoluteRoot = user.getFolder(get_me.EV);
if (add_me.exists) {
if (add_me.Exists) {
return_me.Add(add_me);
}
}
if (global.hasFolderFor(get_me.EV)) {
add_me = new DetectedLocationPathHolder(get_me);
add_me.owner = null;
add_me.AbsoluteRoot = global.getFolder(get_me.EV);
if (add_me.exists)
if (add_me.Exists)
return_me.Add(add_me);
}
return return_me;
Expand Down
5 changes: 4 additions & 1 deletion MASGAU/Location/Holders/DetectedLocationPathHolder.cs
Expand Up @@ -48,7 +48,7 @@ public DetectedLocationPathHolder(EnvironmentVariable ev, string absolute_root,
}
}

public bool exists {
public bool Exists {
get {
return Directory.Exists(full_dir_path);
}
Expand Down Expand Up @@ -93,6 +93,9 @@ public DetectedLocationPathHolder(EnvironmentVariable ev, string absolute_root,
if (Path != null)
return_me = System.IO.Path.Combine(return_me, Path);

if (MatchesOriginalPath)
return_me += " (This Archive Originally Came From This Folder)";

return return_me;
}

Expand Down

0 comments on commit c0bee5f

Please sign in to comment.