mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-14 07:43:31 -07:00
Clean up warnings
This commit is contained in:
parent
378f0a20db
commit
70a1c9db8c
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
<Target Name="Format XAML" AfterTargets="BeforeBuild">
|
<Target Name="Format XAML" AfterTargets="BeforeBuild">
|
||||||
<Exec Command="dotnet tool restore" />
|
<Exec Command="dotnet tool restore" />
|
||||||
<Exec Command="dotnet xstyler -r -d "$(MSBuildProjectDirectory)"" />
|
<Exec Command="dotnet xstyler -r -d ." />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -5,13 +5,13 @@ namespace DiscordChatExporter.Gui.ViewModels.Components
|
||||||
{
|
{
|
||||||
public partial class ChannelViewModel : PropertyChangedBase
|
public partial class ChannelViewModel : PropertyChangedBase
|
||||||
{
|
{
|
||||||
public Channel Model { get; set; }
|
public Channel? Model { get; set; }
|
||||||
|
|
||||||
public string? Category { get; set; }
|
public string? Category { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class ChannelViewModel
|
public partial class ChannelViewModel
|
||||||
{
|
{
|
||||||
public static implicit operator Channel(ChannelViewModel viewModel) => viewModel.Model;
|
public static implicit operator Channel?(ChannelViewModel? viewModel) => viewModel?.Model;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -6,13 +6,13 @@ namespace DiscordChatExporter.Gui.ViewModels.Components
|
||||||
{
|
{
|
||||||
public partial class GuildViewModel : PropertyChangedBase
|
public partial class GuildViewModel : PropertyChangedBase
|
||||||
{
|
{
|
||||||
public Guild Model { get; set; }
|
public Guild? Model { get; set; }
|
||||||
|
|
||||||
public IReadOnlyList<ChannelViewModel> Channels { get; set; }
|
public IReadOnlyList<ChannelViewModel>? Channels { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class GuildViewModel
|
public partial class GuildViewModel
|
||||||
{
|
{
|
||||||
public static implicit operator Guild(GuildViewModel viewModel) => viewModel.Model;
|
public static implicit operator Guild?(GuildViewModel? viewModel) => viewModel?.Model;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -14,11 +14,11 @@ namespace DiscordChatExporter.Gui.ViewModels.Dialogs
|
||||||
private readonly DialogManager _dialogManager;
|
private readonly DialogManager _dialogManager;
|
||||||
private readonly SettingsService _settingsService;
|
private readonly SettingsService _settingsService;
|
||||||
|
|
||||||
public GuildViewModel Guild { get; set; }
|
public GuildViewModel? Guild { get; set; }
|
||||||
|
|
||||||
public IReadOnlyList<ChannelViewModel> Channels { get; set; }
|
public IReadOnlyList<ChannelViewModel>? Channels { get; set; }
|
||||||
|
|
||||||
public bool IsSingleChannel => Channels.Count == 1;
|
public bool IsSingleChannel => Channels == null || Channels.Count == 1;
|
||||||
|
|
||||||
public string? OutputPath { get; set; }
|
public string? OutputPath { get; set; }
|
||||||
|
|
||||||
|
|
@ -62,7 +62,7 @@ namespace DiscordChatExporter.Gui.ViewModels.Dialogs
|
||||||
var channel = Channels.Single();
|
var channel = Channels.Single();
|
||||||
|
|
||||||
// Generate default file name
|
// Generate default file name
|
||||||
var defaultFileName = ExportLogic.GetDefaultExportFileName(SelectedFormat, Guild, channel, After, Before);
|
var defaultFileName = ExportLogic.GetDefaultExportFileName(SelectedFormat, Guild!, channel!, After, Before);
|
||||||
|
|
||||||
// Generate filter
|
// Generate filter
|
||||||
var ext = SelectedFormat.GetFileExtension();
|
var ext = SelectedFormat.GetFileExtension();
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@ namespace DiscordChatExporter.Gui.ViewModels.Framework
|
||||||
{
|
{
|
||||||
public abstract class DialogScreen<T> : PropertyChangedBase
|
public abstract class DialogScreen<T> : PropertyChangedBase
|
||||||
{
|
{
|
||||||
public T DialogResult { get; private set; }
|
// ReSharper disable once RedundantDefaultMemberInitializer
|
||||||
|
public T DialogResult { get; private set; } = default!;
|
||||||
|
|
||||||
public event EventHandler? Closed;
|
public event EventHandler? Closed;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ namespace DiscordChatExporter.Gui.ViewModels
|
||||||
// Create guild view model
|
// Create guild view model
|
||||||
var guildViewModel = _viewModelFactory.CreateGuildViewModel(guild,
|
var guildViewModel = _viewModelFactory.CreateGuildViewModel(guild,
|
||||||
channelViewModels.OrderBy(c => c.Category)
|
channelViewModels.OrderBy(c => c.Category)
|
||||||
.ThenBy(c => c.Model.Name)
|
.ThenBy(c => c.Model!.Name)
|
||||||
.ToArray());
|
.ToArray());
|
||||||
|
|
||||||
// Add to list
|
// Add to list
|
||||||
|
|
@ -210,7 +210,7 @@ namespace DiscordChatExporter.Gui.ViewModels
|
||||||
// Create guild view model
|
// Create guild view model
|
||||||
var guildViewModel = _viewModelFactory.CreateGuildViewModel(guild,
|
var guildViewModel = _viewModelFactory.CreateGuildViewModel(guild,
|
||||||
channelViewModels.OrderBy(c => c.Category)
|
channelViewModels.OrderBy(c => c.Category)
|
||||||
.ThenBy(c => c.Model.Name)
|
.ThenBy(c => c.Model!.Name)
|
||||||
.ToArray());
|
.ToArray());
|
||||||
|
|
||||||
// Add to list
|
// Add to list
|
||||||
|
|
@ -256,7 +256,7 @@ namespace DiscordChatExporter.Gui.ViewModels
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Create a progress operation for each channel to export
|
// Create a progress operation for each channel to export
|
||||||
var operations = ProgressManager.CreateOperations(dialog.Channels.Count);
|
var operations = ProgressManager.CreateOperations(dialog.Channels!.Count);
|
||||||
|
|
||||||
// Export channels
|
// Export channels
|
||||||
var successfulExportCount = 0;
|
var successfulExportCount = 0;
|
||||||
|
|
@ -267,7 +267,7 @@ namespace DiscordChatExporter.Gui.ViewModels
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _exportService.ExportChatLogAsync(token, dialog.Guild, channel,
|
await _exportService.ExportChatLogAsync(token, dialog.Guild!, channel!,
|
||||||
dialog.OutputPath!, dialog.SelectedFormat, dialog.PartitionLimit,
|
dialog.OutputPath!, dialog.SelectedFormat, dialog.PartitionLimit,
|
||||||
dialog.After, dialog.Before, operation);
|
dialog.After, dialog.Before, operation);
|
||||||
|
|
||||||
|
|
@ -275,11 +275,11 @@ namespace DiscordChatExporter.Gui.ViewModels
|
||||||
}
|
}
|
||||||
catch (HttpErrorStatusCodeException ex) when (ex.StatusCode == HttpStatusCode.Forbidden)
|
catch (HttpErrorStatusCodeException ex) when (ex.StatusCode == HttpStatusCode.Forbidden)
|
||||||
{
|
{
|
||||||
Notifications.Enqueue($"You don't have access to channel [{channel.Model.Name}]");
|
Notifications.Enqueue($"You don't have access to channel [{channel.Model!.Name}]");
|
||||||
}
|
}
|
||||||
catch (HttpErrorStatusCodeException ex) when (ex.StatusCode == HttpStatusCode.NotFound)
|
catch (HttpErrorStatusCodeException ex) when (ex.StatusCode == HttpStatusCode.NotFound)
|
||||||
{
|
{
|
||||||
Notifications.Enqueue($"Channel [{channel.Model.Name}] doesn't exist");
|
Notifications.Enqueue($"Channel [{channel.Model!.Name}] doesn't exist");
|
||||||
}
|
}
|
||||||
catch (DomainException ex)
|
catch (DomainException ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue