Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc. fixes #2025

Merged
merged 4 commits into from
May 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions Project-Aurora/Project-Aurora/Controls/KeySequence.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,7 @@
</UserControl.Resources>

<Grid>
<DockPanel VerticalAlignment="Stretch" >
<Label x:Name="key_sequence_title" HorizontalAlignment="Left" VerticalAlignment="Top" Content="{Binding Title}" Margin="0,0,0,0" Padding="0" DockPanel.Dock="Top">
<Label.Resources>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
</Label.Resources>
</Label>
<DockPanel VerticalAlignment="Stretch">
<Grid DockPanel.Dock="Bottom">
<ListBox x:Name="keys_keysequence" Margin="0,0,80,25" ItemTemplate="{Binding Source={StaticResource DeviceKeys}}" MinWidth="150" SelectionMode="Extended" SelectionChanged="keys_keysequence_SelectionChanged" VerticalAlignment="Stretch"/>
<Button x:Name="sequence_up" Margin="0,50,40,0" VerticalAlignment="Top" Click="sequence_up_keys_Click" HorizontalAlignment="Right" Width="35">&#x2191;</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protected override bool Execute(IGameState gameState) {
}

/// <summary>Creates a copy of this mathematical comparison.</summary>
public override Evaluatable<bool> Clone() => new BooleanMathsComparison { Operand1 = Operand1.Clone(), Operand2 = Operand2.Clone() };
public override Evaluatable<bool> Clone() => new BooleanMathsComparison { Operand1 = Operand1.Clone(), Operand2 = Operand2.Clone(), Operator = Operator };
}


Expand Down
13 changes: 9 additions & 4 deletions Project-Aurora/Project-Aurora/Settings/ProfileImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -734,12 +735,16 @@ private static void ImportJson(this Application app, string filepath)
// Create a new profile on the current application (so that profiles can be imported from different applications)
ApplicationProfile newProf = app.AddNewProfile(inProf.ProfileName);
newProf.TriggerKeybind = inProf.TriggerKeybind.Clone();
newProf.Layers.Clear();

// Copy any valid layers from the read profile to the new one
for (int i = 0; i < inProf.Layers.Count; i++)
if (app.IsAllowedLayer(inProf.Layers[i].Handler.GetType()))
newProf.Layers.Add((Layer)inProf.Layers[i].Clone());
void ImportLayers(ObservableCollection<Layer> source, ObservableCollection<Layer> target) {
target.Clear();
for (int i = 0; i < source.Count; i++)
if (app.IsAllowedLayer(source[i].Handler.GetType()))
target.Add((Layer)source[i].Clone());
}
ImportLayers(inProf.Layers, newProf.Layers);
ImportLayers(inProf.OverlayLayers, newProf.OverlayLayers);

// Force a save to write the new profile to disk in the appdata dir
app.SaveProfiles();
Expand Down