Skip to content

Commit

Permalink
Complete removal of ark-tools
Browse files Browse the repository at this point in the history
Removed ark-tools from Welcome screen and Settings.
Reduced default font size slightly.
  • Loading branch information
coldino committed Nov 15, 2018
1 parent 23aaa74 commit 3fbe8d0
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 108 deletions.
16 changes: 4 additions & 12 deletions LarkatorGUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,9 @@ private async Task<bool> FetchArkData(string targetFile)

using (var response = await client.GetAsync(Properties.Resources.ArkDataURL))
{
Debug.WriteLine("Response status = ", response.StatusCode);

// Throw exception on failure
response.EnsureSuccessStatusCode();

Debug.WriteLine("Response was successful");

// Don't do anything if the file hasn't changed
if (response.StatusCode == HttpStatusCode.NotModified)
return true;
Expand Down Expand Up @@ -583,19 +579,15 @@ private void AdjustableGender_MouseWheel(object sender, MouseWheelEventArgs e)

private void Result_MouseEnter(object sender, MouseEventArgs e)
{
var fe = sender as FrameworkElement;
if (fe == null) return;
var dino = fe.DataContext as DinoViewModel;
if (dino == null) return;
if (!(sender is FrameworkElement fe)) return;
if (!(fe.DataContext is DinoViewModel dino)) return;
//dino.Highlight = true;
}

private void Result_MouseLeave(object sender, MouseEventArgs e)
{
var fe = sender as FrameworkElement;
if (fe == null) return;
var dino = fe.DataContext as DinoViewModel;
if (dino == null) return;
if (!(sender is FrameworkElement fe)) return;
if (!(fe.DataContext is DinoViewModel dino)) return;
//dino.ClearValue(DinoViewModel.HighlightProperty);
}

Expand Down
4 changes: 2 additions & 2 deletions LarkatorGUI/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion LarkatorGUI/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<Value Profile="(Default)">2000</Value>
</Setting>
<Setting Name="ListFontSize" Type="System.Int32" Scope="User">
<Value Profile="(Default)">15</Value>
<Value Profile="(Default)">14</Value>
</Setting>
<Setting Name="PinScale" Type="System.Double" Scope="User">
<Value Profile="(Default)">0.9</Value>
Expand Down
8 changes: 0 additions & 8 deletions LarkatorGUI/SettingsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>

<Border Grid.Row="0" Grid.Column="0">
<TextBlock VerticalAlignment="Center" Margin="0,0,4,0">ARK Tools (ark-tools.exe)</TextBlock>
</Border>
<Border Grid.Column="1" Grid.Row="0">
<local:FileEntryBox Value="{Binding Source={StaticResource Model}, Path=Settings.ArkTools, Mode=TwoWay}"
Filter="ARK Tools Executable|ark-tools.exe" DefaultExt="ark-tools.exe" Title="Locate ark-tools.exe"/>
</Border>

<Border Grid.Row="1" Grid.Column="0">
<TextBlock VerticalAlignment="Center" Margin="0,0,4,0">Save file (.ark)</TextBlock>
</Border>
Expand Down
44 changes: 7 additions & 37 deletions LarkatorGUI/Welcome.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,47 +111,17 @@
<StackPanel Margin="16,32">
<TextBlock><Run FontWeight="Bold" FontSize="20" Text="L"/><Run FontStyle="Italic" FontSize="24" Text="ARK"/><Run FontWeight="Bold" FontSize="20" Text="ator"/><Run FontSize="18" Text=" Dino Hunter"/><LineBreak/><Run Foreground="#FF292424" FontStyle="Italic" Text="Find dinos within your local saved ARK"/></TextBlock>
<TextBlock MinHeight="32"/>
<TextBlock Padding="0,8" FontSize="16">To get started we need to configure a few items...</TextBlock>
<Border Height="10"></Border>
<TextBlock Padding="0,4" FontSize="16"><Run Text="To get started we need to "/><Run Text="locate your savegame"/><Run Text="..."/></TextBlock>
<TextBlock>e.g. SteamLibrary\steamapps\common\ARK\Shooter Game\Saved\SavedArksLocal\TheIsland.ark</TextBlock>
<Border Height="20"></Border>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Grid.Row="0" Padding="8,0" FontSize="16">1)</TextBlock>
<StackPanel Grid.Column="1" Grid.Row="0">
<TextBlock FontSize="16">ARKTools is used to read from the saved ARK.</TextBlock>
<TextBlock FontSize="16">Please locate ark-tools.exe:</TextBlock>
<TextBlock>Or download it from here: <Hyperlink Foreground="{DynamicResource HypertextBrush}" NavigateUri="https://survivetheark.com/index.php?/forums/topic/80750-ark-tools-v064-tools-for-reading-and-manipulating-ark-savegame-files/" Click="LaunchHyperlink_Click">https://survivetheark.com/index.php?/forums/topic/80750...</Hyperlink></TextBlock>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" Padding="4,2" Style="{DynamicResource TextBoxChromelessStyle}" Text="{Binding ArkToolsPath, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Welcome}}}"/>
<Button Grid.Column="1" Padding="8,2" Margin="2,0" Click="BrowseArkTools_Click">...</Button>
</Grid>
<Border Height="20"></Border>
</StackPanel>
<TextBlock Grid.Column="0" Grid.Row="1" Padding="8,0" FontSize="16">2)</TextBlock>
<StackPanel Grid.Column="1" Grid.Row="1">
<TextBlock FontSize="16">Locate the ARK you wish to search within:</TextBlock>
<TextBlock>e.g. SteamLibrary\steamapps\common\ARK\Shooter Game\Saved\SavedArksLocal\TheIsland.ark</TextBlock>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" Padding="4,2" Style="{DynamicResource TextBoxChromelessStyle}" Text="{Binding SaveFilePath, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Welcome}}}"/>
<Button Grid.Column="1" Padding="8,2" Margin="2,0" Click="BrowseSaveFile_Click">...</Button>
</Grid>
</StackPanel>
<TextBox Grid.Column="0" Padding="4,2" Style="{DynamicResource TextBoxChromelessStyle}" Text="{Binding SaveFilePath, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Welcome}}}"/>
<Button Grid.Column="1" Padding="8,2" Margin="6,0,0,0" Click="BrowseSaveFile_Click">...</Button>
</Grid>
<Button x:Name="LetsGoButton" HorizontalAlignment="Right" Margin="0,26,0,0" FontSize="18" Padding="6,2" IsEnabled="False" Style="{DynamicResource ButtonChromelessStyle}" Click="LetsGoButton_Click">Let's go!</Button>
<Button x:Name="LetsGoButton" HorizontalAlignment="Right" Margin="0,32,0,0" FontSize="18" Padding="6,2" IsEnabled="False" Style="{DynamicResource ButtonChromelessStyle}" Click="LetsGoButton_Click">Let's go!</Button>
</StackPanel>
</Window>
48 changes: 1 addition & 47 deletions LarkatorGUI/Welcome.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using Microsoft.Win32;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Windows;
using System.Windows.Documents;

namespace LarkatorGUI
{
Expand All @@ -13,34 +11,21 @@ namespace LarkatorGUI
/// </summary>
public partial class Welcome : Window
{
public string ArkToolsPath
{
get { return (string)GetValue(ArkToolsPathProperty); }
set { SetValue(ArkToolsPathProperty, value); }
}

// Using a DependencyProperty as the backing store for ArkToolsPath. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ArkToolsPathProperty =
DependencyProperty.Register("ArkToolsPath", typeof(string), typeof(Welcome), new PropertyMetadata(""));

public string SaveFilePath
{
get { return (string)GetValue(SaveFilePathProperty); }
set { SetValue(SaveFilePathProperty, value); }
}

// Using a DependencyProperty as the backing store for SaveFilePath. This enables animation, styling, binding, etc...
public static readonly DependencyProperty SaveFilePathProperty =
DependencyProperty.Register("SaveFilePath", typeof(string), typeof(Welcome), new PropertyMetadata(""));

public Welcome()
{
InitializeComponent();

DependencyPropertyDescriptor.FromProperty(ArkToolsPathProperty, GetType()).AddValueChanged(this, (_, __) => UpdateValidation());
DependencyPropertyDescriptor.FromProperty(SaveFilePathProperty, GetType()).AddValueChanged(this, (_, __) => UpdateValidation());

ArkToolsPath = Properties.Settings.Default.ArkTools;
SaveFilePath = Properties.Settings.Default.SaveFile;

// Skip the Welcome window if we're already configured
Expand All @@ -50,10 +35,9 @@ public Welcome()

private void UpdateValidation()
{
var toolsGood = File.Exists(ArkToolsPath);
var saveGood = File.Exists(SaveFilePath) && SaveFilePath.EndsWith(".ark");

LetsGoButton.IsEnabled = toolsGood && saveGood;
LetsGoButton.IsEnabled = saveGood;
}

private string CheckFile(string fullpath)
Expand All @@ -64,29 +48,6 @@ private string CheckFile(string fullpath)
return Path.GetDirectoryName(fullpath);
}

private void BrowseArkTools_Click(object sender, RoutedEventArgs e)
{
var dialog = new OpenFileDialog()
{
AddExtension = true,
CheckFileExists = true,
CheckPathExists = true,
DereferenceLinks = false,
Multiselect = false,
DefaultExt = "ark-tools.exe",
Filter = "ARK Tools Executable|ark-tools.exe",
Title = "Locate ark-tools.exe...",
FileName = ArkToolsPath,
InitialDirectory = CheckFile(ArkToolsPath),
};

var result = dialog.ShowDialog(this);
if (result == true)
{
ArkToolsPath = dialog.FileName;
}
}

private void BrowseSaveFile_Click(object sender, RoutedEventArgs e)
{
var dialog = new OpenFileDialog()
Expand All @@ -112,9 +73,7 @@ private void BrowseSaveFile_Click(object sender, RoutedEventArgs e)

private void LetsGoButton_Click(object sender, RoutedEventArgs e)
{
Properties.Settings.Default.ArkTools = ArkToolsPath;
Properties.Settings.Default.SaveFile = SaveFilePath;

Properties.Settings.Default.Save();

SwitchToMainWindow();
Expand All @@ -126,10 +85,5 @@ private void SwitchToMainWindow()

Close();
}

private void LaunchHyperlink_Click(object sender, RoutedEventArgs e)
{
Process.Start((sender as Hyperlink).NavigateUri.ToString());
}
}
}
2 changes: 1 addition & 1 deletion LarkatorGUI/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<value>2000</value>
</setting>
<setting name="ListFontSize" serializeAs="String">
<value>15</value>
<value>14</value>
</setting>
<setting name="PinScale" serializeAs="String">
<value>0.9</value>
Expand Down

0 comments on commit 3fbe8d0

Please sign in to comment.