instruction

This commit is contained in:
4sval
2022-08-07 14:40:18 +02:00
parent 947d5011c2
commit 73151eaf38
6 changed files with 42 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using FModel.Extensions;
using FModel.Framework;
using FModel.ViewModels.ApiEndpoints.Models;
using Newtonsoft.Json.Linq;
@@ -34,7 +35,11 @@ public class DynamicApiEndpoint : AbstractApiProvider
if (dynamicKey["guid"] is not { } guid || dynamicKey["key"] is not { } key)
continue;
ret.DynamicKeys.Add(new DynamicKey{Guid = guid.ToString(), Key = Helper.FixKey(key.ToString())});
ret.DynamicKeys.Add(new DynamicKey
{
Name = dynamicKey["name"]?.ToString(),
Guid = guid.ToString(), Key = Helper.FixKey(key.ToString())
});
}
}
return ret;
@@ -58,7 +63,9 @@ public class DynamicApiEndpoint : AbstractApiProvider
var tokens = body.SelectTokens(path);
var ret = new MappingsResponse[] {new()};
ret[0].Url = tokens.ElementAtOrDefault(0).ToString();
ret[0].FileName = tokens.ElementAtOrDefault(1).ToString();
if (tokens.ElementAtOrDefault(1) is not { } fileName)
fileName = ret[0].Url.SubstringAfterLast("/");
ret[0].FileName = fileName.ToString();
return ret;
}

View File

@@ -12,13 +12,12 @@ public class MappingsResponse
[I][J] public string Hash { get; private set; }
[I][J] public long Length { get; private set; }
[I][J] public string Uploaded { get; private set; }
[J] public Meta Meta { get; set; }
[I][J] public Meta Meta { get; set; }
public MappingsResponse()
{
Url = string.Empty;
FileName = string.Empty;
Meta = new Meta();
}
[I] public bool IsValid => !string.IsNullOrEmpty(Url) &&

View File

@@ -29,7 +29,7 @@
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Vertical" Margin="10 5 10 10">
<TextBlock Text="What to do?" HorizontalAlignment="Center" FontSize="20" FontWeight="SemiBold" />
<TextBlock Text="Instruction" HorizontalAlignment="Center" FontSize="20" FontWeight="SemiBold" />
<TextBlock TextAlignment="Center" TextWrapping="Wrap" HorizontalAlignment="Center" MaxWidth="576"
Text="In order to decipher archives' information, an AES key, in most cases, is needed. Here you can set the key for your static and dynamic archives. If you don't know what key to use for your set game, simply Google it. Keys must start with &quot;0x&quot; and contains 64 more characters." />
</StackPanel>

View File

@@ -28,7 +28,7 @@
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Vertical" Margin="10 5 10 10">
<TextBlock Text="What to do?" HorizontalAlignment="Center" FontSize="20" FontWeight="SemiBold" />
<TextBlock Text="Instruction" HorizontalAlignment="Center" FontSize="20" FontWeight="SemiBold" />
<TextBlock TextAlignment="Center" TextWrapping="Wrap" HorizontalAlignment="Center"
Text="We like to make things as simple as possible. Choose between the detected games or manually add your own. FModel will use this information to automatically find archives to load and decrypt if needed. Make sure to not skip this step!" />
</StackPanel>

View File

@@ -8,7 +8,7 @@
xmlns:adonisExtensions="clr-namespace:AdonisUI.Extensions;assembly=AdonisUI"
WindowStartupLocation="CenterScreen" IconVisibility="Collapsed" ResizeMode="NoResize" Closing="OnClosing"
Width="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenWidth}, Converter={converters:RatioConverter}, ConverterParameter='0.50'}"
Height="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenWidth}, Converter={converters:RatioConverter}, ConverterParameter='0.30'}">
Height="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenWidth}, Converter={converters:RatioConverter}, ConverterParameter='0.35'}">
<adonisControls:AdonisWindow.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
@@ -57,12 +57,18 @@
<Grid Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="5"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="{adonisUi:Space 1, 0.5}">
<StackPanel Grid.Row="0" Orientation="Vertical" Margin="10 5 10 10">
<TextBlock Text="Instruction" HorizontalAlignment="Center" FontSize="20" FontWeight="SemiBold" />
<TextBlock x:Name="InstructionBox" TextAlignment="Justify" TextWrapping="Wrap" HorizontalAlignment="Center" />
</StackPanel>
<Grid Grid.Row="1" Margin="{adonisUi:Space 1, 0.5}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
@@ -77,7 +83,7 @@
Style="{DynamicResource {x:Static adonisUi:Styles.AccentButton}}" Click="OnTest"/>
</Grid>
<avalonEdit:TextEditor x:Name="TargetResponse" Grid.Row="2" Background="{DynamicResource {x:Static adonisUi:Brushes.Layer3BackgroundBrush}}"
<avalonEdit:TextEditor x:Name="TargetResponse" Grid.Row="3" Background="{DynamicResource {x:Static adonisUi:Brushes.Layer3BackgroundBrush}}"
FontFamily="Consolas" FontSize="8pt" IsReadOnly="True" ShowLineNumbers="True" Foreground="#DAE5F2" />
</Grid>
</Grid>

View File

@@ -28,6 +28,27 @@ public partial class EndpointEditor
Title = title;
TargetResponse.SyntaxHighlighting =
EndpointResponse.SyntaxHighlighting = AvalonExtensions.HighlighterSelector("json");
InstructionBox.Text = type switch
{
EEndpointType.Aes =>
@"In order to make this work, you first need to understand JSON and its query language. If you don't, please close this window. If your game never changes its AES keys or is not even encrypted, please close this window. If you do understand what you are doing, you have to know that the AES path supports up to 2 tokens.
The first token is mandatory and will be assigned to the main AES key. It has to be looking like a key, else your configuration will not be valid (the key validity against your files will not be checked). Said key must be hexadecimal and can start without ""0x"".
If your game uses several AES keys, you can specify a second token that will be your list of dynamic keys. The format needed is a list of objects with, at least, the next 2 variables:
{
""guid"": ""the archive guid"",
""key"": ""the archive aes key""
}",
EEndpointType.Mapping =>
@"In order to make this work, you first need to understand JSON and its query language. If you don't, please close this window. If your game does not have unversioned package properties, please close this window. If you do understand what you are doing, you have to know that the Mapping path supports up to 2 tokens.
The first token is mandatory and will be assigned to the mapping download URL, which can be all kinds of mapping but not Brotli compressed.
The second token is optional and will be assigned to the mapping file name. If unspecified, said file name will be grabbed from the URL.",
_ => ""
};
}
private void OnClick(object sender, RoutedEventArgs e)