Skip to content

Commit

Permalink
Merge pull request #2025 from Wibble199/fix/arithmetic-comparison-clone
Browse files Browse the repository at this point in the history
Misc. fixes
  • Loading branch information
diogotr7 authored May 21, 2020
2 parents c1658ac + bf3443c commit becaab2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
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

0 comments on commit becaab2

Please sign in to comment.