Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
goaaats committed Jan 1, 2024
1 parent a1072b0 commit 5655826
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 27 deletions.
4 changes: 2 additions & 2 deletions src/CodeAnalysis/xl.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@
</Rules>
<Rules AnalyzerId="Microsoft.NetCore.CSharp.Analyzers" RuleNamespace="Microsoft.NetCore.CSharp.Analyzers">
<Rule Id="CA1309" Action="Warning" />
<Rule Id="CA2201" Action="Warning" />
<Rule Id="CA2201" Action="None" /> <!-- System.Exception is not specific enough -->
</Rules>
</RuleSet>
</RuleSet>
12 changes: 5 additions & 7 deletions src/XIVLauncher/Accounts/XivAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,13 @@ public static async Task<JObject> GetCharacterSearch(string name, string world)

public static async Task<dynamic> Get(string endpoint)
{
using var client = new WebClient();

using (var client = new WebClient())
{
var result = client.DownloadString(URL + endpoint);
var result = await client.DownloadStringTaskAsync(URL + endpoint);

var parsedObject = JObject.Parse(result);
var parsedObject = JObject.Parse(result);

return parsedObject;
}
return parsedObject;
}
}
}
}
2 changes: 1 addition & 1 deletion src/XIVLauncher/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public App()
#endif
}

private static void OnSerilogLogLine(object sender, (string Line, LogEventLevel Level, DateTimeOffset TimeStamp, Exception? Exception) e)
private static void OnSerilogLogLine(object sender, (string Line, LogEventLevel Level, DateTimeOffset TimeStamp, Exception Exception) e)
{
if (e.Exception == null)
return;
Expand Down
6 changes: 3 additions & 3 deletions src/XIVLauncher/Game/ProblemCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ public static void RunCheck(Window parentWindow)

if ((d3d11.Exists || dinput8.Exists) && !App.Settings.HasComplainedAboutGShadeDxgi.GetValueOrDefault(false))
{
FileVersionInfo? d3d11Info = null;
FileVersionInfo? dinput8Info = null;
FileVersionInfo d3d11Info = null;
FileVersionInfo dinput8Info = null;

if (d3d11.Exists)
d3d11Info = FileVersionInfo.GetVersionInfo(d3d11.FullName);
Expand Down Expand Up @@ -335,4 +335,4 @@ private static bool CheckSymlinkValid(FileInfo file)
return true;
}
}
}
}
4 changes: 2 additions & 2 deletions src/XIVLauncher/Support/Troubleshooting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static class Troubleshooting
/// <summary>
/// Gets the most recent exception to occur.
/// </summary>
public static Exception? LastException { get; private set; }
public static Exception LastException { get; private set; }

/// <summary>
/// Log the last exception in a parseable format to serilog.
Expand Down Expand Up @@ -198,4 +198,4 @@ public enum IndexIntegrityResult
public IndexIntegrityResult IndexIntegrity { get; set; }
}
}
}
}
4 changes: 1 addition & 3 deletions src/XIVLauncher/Windows/AdvancedSettingsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ public partial class AdvancedSettingsWindow : Window
{
public bool WasCompleted { get; private set; } = false;

private readonly string actPath;

public AdvancedSettingsWindow()
{
InitializeComponent();
Expand Down Expand Up @@ -47,4 +45,4 @@ private void ResetCacheButton_OnClick(object sender, RoutedEventArgs e)
App.UniqueIdCache.Reset();
}
}
}
}
12 changes: 6 additions & 6 deletions src/XIVLauncher/Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ await Headlines.GetMessage(_launcher, App.Settings.Language.GetValueOrDefault(Cl

_bannerDotList[0].Active = true;

Dispatcher.BeginInvoke(new Action(() =>
_ = this.Dispatcher.BeginInvoke(new Action(() =>
{
BannerImage.Source = _bannerBitmaps[0];
BannerDot.ItemsSource = _bannerDotList;
this.BannerImage.Source = this._bannerBitmaps[0];
this.BannerDot.ItemsSource = this._bannerDotList;
}));

_bannerChangeTimer = new Timer {Interval = 5000};
Expand All @@ -181,12 +181,12 @@ await Headlines.GetMessage(_launcher, App.Settings.Language.GetValueOrDefault(Cl
_bannerChangeTimer.AutoReset = true;
_bannerChangeTimer.Start();

Dispatcher.BeginInvoke(new Action(() => { NewsListView.ItemsSource = _headlines.News; }));
_ = Dispatcher.BeginInvoke(new Action(() => { NewsListView.ItemsSource = _headlines.News; }));
}
catch (Exception ex)
{
Log.Error(ex, "Could not get news");
Dispatcher.BeginInvoke(new Action(() =>
_ = Dispatcher.BeginInvoke(new Action(() =>
{
NewsListView.ItemsSource = new List<News> {new News {Title = Loc.Localize("NewsDlFailed", "Could not download news data."), Tag = "DlError"}};
}));
Expand Down Expand Up @@ -627,4 +627,4 @@ protected override void OnSourceInitialized(EventArgs e)
}
}
}
}
}
6 changes: 3 additions & 3 deletions src/XIVLauncher/Windows/ViewModel/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ private async Task Login(string username, string password, bool isOtp, bool isSt

private async Task<bool> CheckGateStatus()
{
GateStatus? gateStatus = null;
GateStatus gateStatus = null;

try
{
Expand Down Expand Up @@ -1093,7 +1093,7 @@ private void InstallerOnFail()
Environment.Exit(0);
}

public async Task<Process?> StartGameAndAddon(Launcher.LoginResult loginResult, bool isSteam, bool forceNoDalamud, bool noThird, bool noPlugins)
public async Task<Process> StartGameAndAddon(Launcher.LoginResult loginResult, bool isSteam, bool forceNoDalamud, bool noThird, bool noPlugins)
{
var dalamudLauncher = new DalamudLauncher(new WindowsDalamudRunner(), App.DalamudUpdater, App.Settings.InGameAddonLoadMethod.GetValueOrDefault(DalamudLoadMethod.DllInject),
App.Settings.GamePath,
Expand Down Expand Up @@ -1247,7 +1247,7 @@ public void OnWindowClosing(object sender, CancelEventArgs args)

private void PersistAccount(string username, string password)
{
if (AccountManager.CurrentAccount != null && AccountManager.CurrentAccount.UserName.Equals(username) &&
if (AccountManager.CurrentAccount != null && AccountManager.CurrentAccount.UserName.Equals(username, StringComparison.Ordinal) &&
AccountManager.CurrentAccount.Password != password &&
AccountManager.CurrentAccount.SavePassword)
AccountManager.UpdatePassword(AccountManager.CurrentAccount, password);
Expand Down

0 comments on commit 5655826

Please sign in to comment.