Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
flabbet committed May 22, 2024
2 parents 500331e + e2e6700 commit 440cffb
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 9 deletions.
21 changes: 20 additions & 1 deletion src/PixiEditor/Models/DataProviders/LocalPalettesFetcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using PixiEditor.Extensions.Common.UserPreferences;
using PixiEditor.Extensions.Palettes;
using PixiEditor.Extensions.Palettes.Parsers;
using PixiEditor.Helpers;
using PixiEditor.Models.DataHolders;
using PixiEditor.Models.DataHolders.Palettes;
using PixiEditor.Models.IO;
Expand Down Expand Up @@ -150,7 +151,7 @@ public async Task RefreshCacheAll()
{
string[] files = DirectoryExtensions.GetFiles(
Paths.PathToPalettesFolder,
string.Join("|", AvailableParsers.SelectMany(x => x.SupportedFileExtensions)),
string.Join("|", AvailableParsers.SelectMany(x => x.SupportedFileExtensions).Distinct()),
SearchOption.TopDirectoryOnly);
cachedPalettes = await ParseAll(files);
CacheUpdated?.Invoke(RefreshType.All, null, null);
Expand Down Expand Up @@ -219,6 +220,24 @@ private async Task RefreshCache(RefreshType refreshType, string file)
default:
throw new ArgumentOutOfRangeException(nameof(refreshType), refreshType, null);
}

if (refreshType is RefreshType.Created or RefreshType.Updated && updated == null)
{
await RefreshCacheAll();

// Using try-catch to generate stack trace
try
{
throw new NullReferenceException($"The '{nameof(updated)}' was null even though the refresh type was '{refreshType}'.");
}
catch (Exception e)
{
await CrashHelper.SendExceptionInfoToWebhookAsync(e);
}

return;
}

CacheUpdated?.Invoke(refreshType, updated, affectedFileName);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.IO;
using PixiEditor.DrawingApi.Core.ColorsImpl;
using PixiEditor.Extensions.Palettes;
using PixiEditor.Extensions.Palettes.Parsers;

Expand All @@ -10,7 +9,7 @@ namespace PixiEditor.Models.IO.PaletteParsers.JascPalFile;
/// </summary>
internal class JascFileParser : PaletteFileParser
{
private static readonly string[] _supportedFileExtensions = new string[] { ".pal" };
private static readonly string[] _supportedFileExtensions = new string[] { ".pal", ".psppalette" };
public override string[] SupportedFileExtensions => _supportedFileExtensions;
public override string FileName => "Jasc Palette";

Expand Down
4 changes: 2 additions & 2 deletions src/PixiEditor/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.4.0")]
[assembly: AssemblyFileVersion("1.2.4.0")]
[assembly: AssemblyVersion("1.2.5.0")]
[assembly: AssemblyFileVersion("1.2.5.0")]
4 changes: 2 additions & 2 deletions src/PixiEditor/Views/Dialogs/PalettesBrowser.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
<DockPanel Background="{StaticResource MainColor}" Grid.Row="1">
<StackPanel HorizontalAlignment="Left" Margin="10" Orientation="Horizontal" VerticalAlignment="Center">
<Label ui:Translator.Key="SORT_BY" Style="{StaticResource BaseLabel}" VerticalAlignment="Center"/>
<ComboBox x:Name="sortingComboBox" VerticalAlignment="Center" SelectionChanged="SortingComboBox_SelectionChanged">
<ComboBoxItem IsSelected="True" ui:Translator.Key="DEFAULT"/>
<ComboBox x:Name="sortingComboBox" SelectedIndex="0" VerticalAlignment="Center" SelectionChanged="SortingComboBox_SelectionChanged">
<ComboBoxItem ui:Translator.Key="DEFAULT"/>
<ComboBoxItem ui:Translator.Key="ALPHABETICAL"/>
<ComboBoxItem ui:Translator.Key="COLOR_COUNT"/>
</ComboBox>
Expand Down
12 changes: 10 additions & 2 deletions src/PixiEditor/Views/Dialogs/PalettesBrowser.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,16 @@ private void HandleCacheItemUpdated(Palette updatedItem)

private void HandleCachePaletteCreated(Palette updatedItem)
{
SortedResults.Add(updatedItem);
PaletteList.Palettes.Add(updatedItem);
if (!SortedResults.Contains(updatedItem))
{
SortedResults.Add(updatedItem);
}

if(!PaletteList.Palettes.Contains(updatedItem))
{
PaletteList.Palettes.Add(updatedItem);
}

Sort();
}

Expand Down

0 comments on commit 440cffb

Please sign in to comment.