Profiles - Redesigned export file format

This commit is contained in:
Robert committed 2023-08-27 11:46:14 +02:00
1 parent 811917c1c9
commit e5c42ee228
10 files changed
+190 -119

No files matched your search

@@ -40,15 +40,6 @@ public class ProfileConfigurationIcon : CorePropertyChanged, IStorageModel
private set => SetAndNotify(ref _iconName, value);
}
/// <summary>
/// Gets the original file name of the icon (if applicable)
/// </summary>
public string? OriginalFileName
{
get => _originalFileName;
private set => SetAndNotify(ref _originalFileName, value);
}
/// <summary>
/// Gets or sets a boolean indicating whether or not this icon should be filled.
/// </summary>
@@ -69,7 +60,6 @@ public class ProfileConfigurationIcon : CorePropertyChanged, IStorageModel
_iconStream?.Dispose();
IconName = iconName;
OriginalFileName = null;
IconType = ProfileConfigurationIconType.MaterialIcon;
OnIconUpdated();
@@ -78,21 +68,19 @@ public class ProfileConfigurationIcon : CorePropertyChanged, IStorageModel
/// <summary>
/// Updates the stream returned by <see cref="GetIconStream" /> to the provided stream
/// </summary>
/// <param name="originalFileName">The original file name backing the stream, should include the extension</param>
/// <param name="stream">The stream to copy</param>
public void SetIconByStream(string originalFileName, Stream stream)
public void SetIconByStream(Stream stream)
{
if (originalFileName == null) throw new ArgumentNullException(nameof(originalFileName));
if (stream == null) throw new ArgumentNullException(nameof(stream));
_iconStream?.Dispose();
_iconStream = new MemoryStream();
stream.Seek(0, SeekOrigin.Begin);
if (stream.CanSeek)
stream.Seek(0, SeekOrigin.Begin);
stream.CopyTo(_iconStream);
_iconStream.Seek(0, SeekOrigin.Begin);
IconName = null;
OriginalFileName = originalFileName;
IconType = ProfileConfigurationIconType.BitmapImage;
OnIconUpdated();
}