Skip to content

Commit

Permalink
implements all pages, build buttons work
Browse files Browse the repository at this point in the history
  • Loading branch information
Blu3wolf committed Dec 3, 2017
1 parent 1cc6cb3 commit 5913a1e
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 9 deletions.
32 changes: 29 additions & 3 deletions 3DDBBuilderGUI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<TabItem Header="List Parents">
<Grid Background="#FFE5E5E5">
<StackPanel>
<Label Content="Specify location of Object folder to extract:"/>
<Label Content="Specify database to List parents of:"/>
<DockPanel>
<Button Content="Select..." Click="SourceSelectButton_Click" Style="{StaticResource WFButton}"/>
<ComboBox ItemsSource="{Binding DBsList}" DisplayMemberPath="DirPath" SelectedItem="{Binding SelectedDB, Mode=TwoWay}" Margin="0,0,10,0"/>
Expand Down Expand Up @@ -84,10 +84,36 @@
</Grid>
</TabItem>
<TabItem Header="Update" >
<Grid Background="#FFE5E5E5"/>
<Grid Background="#FFE5E5E5">
<StackPanel>
<Label Content="Specify location of Object folder to Update:"/>
<DockPanel>
<Button Content="Select..." Click="SourceSelectButton_Click" Style="{StaticResource WFButton}"/>
<ComboBox ItemsSource="{Binding DBsList}" DisplayMemberPath="DirPath" SelectedItem="{Binding SelectedDB, Mode=TwoWay}" Margin="0,0,10,0"/>
</DockPanel>
<Label Content="Select folder to Update database from:"/>
<DockPanel>
<Button Content="Select..." Style="{StaticResource WFButton}" DockPanel.Dock="Right"/>
<TextBox TextWrapping="Wrap" Text="{Binding Mode=TwoWay, Path=CurExtractionPath}" />
</DockPanel>
<DockPanel LastChildFill="False">
<Button Content="Update" DockPanel.Dock="Right" Margin="10" Style="{StaticResource WFButton}"/>
<Button Content="Open Directory" DockPanel.Dock="Left" Margin="10" Style="{StaticResource WFButton}" />
<Button Content="Reset Directory" DockPanel.Dock="Left" Margin="10" Style="{StaticResource WFButton}" />
</DockPanel>
</StackPanel>
</Grid>
</TabItem>
<TabItem Header="Test DB" >
<Grid Background="#FFE5E5E5"/>
<Grid Background="#FFE5E5E5">
<StackPanel>
<Label Content="Specify location of Object folder to Test:"/>
<DockPanel>
<Button Content="Select..." Click="SourceSelectButton_Click" Style="{StaticResource WFButton}"/>
<ComboBox ItemsSource="{Binding DBsList}" DisplayMemberPath="DirPath" SelectedItem="{Binding SelectedDB, Mode=TwoWay}" Margin="0,0,10,0"/>
</DockPanel>
</StackPanel>
</Grid>
</TabItem>
</TabControl>
</DockPanel>
Expand Down
63 changes: 57 additions & 6 deletions 3DDBBuilderGUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,8 @@ private void ExtrButton_Click(object sender, RoutedEventArgs e)
{
if (SelectedDB.IsValid() && Directory.Exists(CurExtractionPath))
{
string command = @"/objectdir " + "\"" + SelectedDB.DirPath + "\"" + @" /extract " + "\"" + CurExtractionPath + "\"";
ExCommand(command);
BuildSource = CurExtractionPath;
ExCommand(DestParams.Extract, SelectedDB.DirPath, CurExtractionPath);
}
else
{
Expand Down Expand Up @@ -320,6 +319,16 @@ private void ListParents(object sender, RoutedEventArgs e)
}
}

enum DestParams
{
Extract, Build, Build_Old, Update
}

enum SourceParams
{
List, Test
}

private void ExCommand(string args)
{
// add a function to check to see if the exe is co-located here?
Expand All @@ -343,6 +352,46 @@ private void ExCommand(string args)
}
}

private void ExCommand(SourceParams parameter, string dbdir)
{
string args;
switch (parameter)
{
case SourceParams.List:
args = @"/objectdir " + "\"" + dbdir + "\"" + @" /parents";
break;
case SourceParams.Test:
args = @"/objectdir " + "\"" + dbdir + "\"" + @" /test";
break;
default:
return;
}
ExCommand(args);
}

private void ExCommand(DestParams parameter, string source, string dest)
{
string args;
switch (parameter)
{
case DestParams.Extract:
args = @"/objectdir " + "\"" + source + "\"" + @" /extract " + "\"" + dest + "\"";
break;
case DestParams.Build:
args = @"/objectdir " + "\"" + dest + "\"" + @" /build " + "\"" + source + "\"";
break;
case DestParams.Build_Old:
args = @"/objectdir " + "\"" + dest + "\"" + @" /build_old " + "\"" + source + "\"";
break;
case DestParams.Update:
args = @"/objectdir " + "\"" + dest + "\"" + @" /update " + "\"" + source + "\"";
break;
default:
return;
}
ExCommand(args);
}

private void ResetDirButton_Click(object sender, RoutedEventArgs e)
{
try
Expand All @@ -363,14 +412,16 @@ private void OpenDirButton_Click(object sender, RoutedEventArgs e)

private void BuildNewButton_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("This Function has not yet been implemented. Sorry!");
MessageBox.Show("The output of this function is a database which is incompatible with all legacy tools, including LOD Editor. Beware!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
string Message = "The output of this function is a database which is incompatible with all legacy tools, including LOD Editor. Do you wish to continue?";
if (MessageBox.Show(Message, "Warning", MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.OK)
{
ExCommand(DestParams.Build, BuildSource, BuildOutput);
}
}

private void BuildOldButton_Click(object sender, RoutedEventArgs e)
{
string command = @"/objectdir " + "\"" + BuildOutput + "\"" + @" /build_old " + "\"" + BuildSource + "\"";
ExCommand(command);
ExCommand(DestParams.Build_Old, BuildSource, BuildOutput);
}

private void BuildSourceSelectButton_Click(object sender, RoutedEventArgs e)
Expand Down

0 comments on commit 5913a1e

Please sign in to comment.