Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Login issues #211

Merged
merged 9 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@ jobs:
uses: actions/[email protected]
with:
dotnet-version: ${{vars.DOTNET_VERSION}}

- run: dotnet restore
- run: dotnet build ./FASTER.sln --configuration Debug

- name: Build Solution
run: dotnet build ./FASTER.sln --configuration Debug

- name: Execute unit tests
run: dotnet test

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
Expand Down
2 changes: 2 additions & 0 deletions FASTER.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.github\workflows\codeql-analysis.yml = .github\workflows\codeql-analysis.yml
FASTER_Version.xml = FASTER_Version.xml
NuGet.Config = NuGet.Config
.github\workflows\publish.yml = .github\workflows\publish.yml
README.md = README.md
.github\workflows\release.yml = .github\workflows\release.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FASTERTests", "FASTERTests\FASTERTests.csproj", "{65FDF864-BF9B-414A-A6E6-3473BCFB62BE}"
Expand Down
140 changes: 66 additions & 74 deletions FASTER/FASTER.csproj
Original file line number Diff line number Diff line change
@@ -1,86 +1,78 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<PublishSingleFile Condition="'$(Configuration)' == 'Release'">true</PublishSingleFile>
<PublishReadyToRun>true</PublishReadyToRun>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
<PublishReadyToRunComposite>false</PublishReadyToRunComposite>
<UseWPF>true</UseWPF>
<Version>1.9.5.3</Version>
<Authors>Keelah Fox</Authors>
<Company>FoxliCorp.</Company>
<Description>Fox's Arma Server Tool Extended Rewrite</Description>
<Copyright>Copyright © 2019</Copyright>
<PackageProjectUrl>https://forums.bohemia.net/forums/topic/224359-foxs-arma-server-tool-extended-rewrite-faster/</PackageProjectUrl>
<RepositoryUrl>https://github.com/Foxlider/FASTER</RepositoryUrl>
<ApplicationIcon>Resources\FASTER.ico</ApplicationIcon>
<StartupObject>FASTER.App</StartupObject>
<ApplicationManifest>Properties\FASTER.manifest</ApplicationManifest>
<LangVersion>9.0</LangVersion>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>FASTERKey.snk</AssemblyOriginatorKeyFile>
<EnforceCodeStyleInBuild>false</EnforceCodeStyleInBuild>
<EnableNETAnalyzers>false</EnableNETAnalyzers>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<NoWarn>1701;1702;NU1701;CS8002</NoWarn>
<PlatformTarget>x64</PlatformTarget>
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
<Optimize>True</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<NoWarn>1701;1702;NU1701;CS8002</NoWarn>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
<NoWarn>1701;1702;NU1701;CS8002</NoWarn>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702;NU1701;CS8002</NoWarn>
<Optimize>False</Optimize>
</PropertyGroup>
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
<ApplicationIcon>Resources\FASTER.ico</ApplicationIcon>
<ApplicationManifest>Properties\FASTER.manifest</ApplicationManifest>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>FASTERKey.snk</AssemblyOriginatorKeyFile>
<Authors>Keelah Fox, Jupster, Canno.n</Authors>
<Version>1.9.5.3</Version>
<Company>FoxliCorp.</Company>
<Description>Fox's Arma Server Tool Extended Rewrite</Description>
<Copyright>Copyright © 2019</Copyright>
<PackageProjectUrl>https://github.com/Foxlider/FASTER</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/Foxlider/FASTER</RepositoryUrl>
<PackageLicenseFile>LICENSE</PackageLicenseFile>

<PublishReadyToRun>true</PublishReadyToRun>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
<PublishReadyToRunComposite>false</PublishReadyToRunComposite>
</PropertyGroup>


<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>portable</DebugType>
<NoWarn>1701;1702;NU1701;CS8002;CS8618;CS8622</NoWarn>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>none</DebugType>
<NoWarn>1701;1702;NU1701;CS8002;CS8618;CS8622</NoWarn>
</PropertyGroup>

<ItemGroup>
<Resource Include="Resources\FASTER.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<ItemGroup>
<SplashScreen Include="Resources\FasterSplash.png" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Remove="Resources\FASTER.ico" />
<None Remove="Resources\FasterSplash.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Autoupdater.NET.Official" Version="1.8.2" />
<PackageReference Include="BytexDigital.Steam" Version="0.8.2-preview.1688347297" />
<PackageReference Include="Autoupdater.NET.Official" Version="1.9.2" />
<PackageReference Include="BytexDigital.Steam" Version="0.8.6-preview.1728774783" />
<PackageReference Include="FontAwesome.WPF" Version="4.7.0.9" />
<PackageReference Include="LiveCharts.Wpf" Version="0.9.7" />
<PackageReference Include="MahApps.Metro" Version="2.4.9" />
<PackageReference Include="MahApps.Metro.IconPacks.Material" Version="4.11.0" />
<PackageReference Include="MahApps.Metro.IconPacks.Modern" Version="4.11.0" />
<PackageReference Include="MahApps.Metro" Version="2.4.10" />
<PackageReference Include="MahApps.Metro.IconPacks.Material" Version="5.0.0" />
<PackageReference Include="MahApps.Metro.IconPacks.Modern" Version="5.0.0" />
<PackageReference Include="MahApps.Metro.SimpleChildWindow" Version="2.2.1" />
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="5.0.2" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="5.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="5.0.5" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="5.0.5" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
<PackageReference Include="WindowsAPICodePack-Shell" Version="1.1.1" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\FASTER.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<ItemGroup>
<SplashScreen Include="Resources\FasterSplash.png" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion FASTER/Models/ServerProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public string Executable
}
}

public string ArmaPath => Path.GetDirectoryName(_executable);
public string ArmaPath => Path.GetDirectoryName(_executable) ?? string.Empty;

public int Port
{
Expand Down
33 changes: 18 additions & 15 deletions FASTER/ViewModel/SteamUpdaterViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,11 @@

using Microsoft.AppCenter.Analytics;

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Threading;

namespace FASTER.ViewModel
Expand Down Expand Up @@ -446,7 +441,7 @@
{
ManifestId manifestId = default;

if(mod.LocalLastUpdated > mod.SteamLastUpdated)
if(mod.LocalLastUpdated > mod.SteamLastUpdated && mod.Size > 0)
{
mod.Status = ArmaModStatus.UpToDate;
Parameters.Output += $"\n Mod{mod.WorkshopId} already up to date. Ignoring...";
Expand All @@ -466,6 +461,11 @@

var downloadHandler = SteamContentClient.GetPublishedFileDataAsync(mod.WorkshopId, manifestId, tokenSource.Token);
DownloadForMultiple(downloadHandler.Result, mod.Path).Wait();

mod.Status = ArmaModStatus.UpToDate;
var nx = DateTime.UnixEpoch;
var ts = DateTime.UtcNow - nx;
mod.LocalLastUpdated = (ulong)ts.TotalSeconds;
}
catch (TaskCanceledException)
{
Expand All @@ -478,18 +478,12 @@
mod.Status = ArmaModStatus.NotComplete;
Parameters.Output += $"\nError: {ex.Message}{(ex.InnerException != null ? $" Inner Exception: {ex.InnerException.Message}" : "")}";
}

sw.Stop();
mod.Status = ArmaModStatus.UpToDate;
var nx = DateTime.UnixEpoch;
var ts = DateTime.UtcNow - nx;
mod.LocalLastUpdated = (ulong) ts.TotalSeconds;

mod.CheckModSize();

Parameters.Output += $"\n Download {mod.WorkshopId} completed, it took {sw.Elapsed.Minutes + sw.Elapsed.Hours*60}m {sw.Elapsed.Seconds}s {sw.Elapsed.Milliseconds}ms";


}, TaskCreationOptions.LongRunning).ContinueWith((_) =>
{
finished += 1;
Expand Down Expand Up @@ -611,8 +605,12 @@
if (tokenSource.IsCancellationRequested)
tokenSource = new CancellationTokenSource();

Task downloadTask = downloadHandler.DownloadToFolderAsync(targetDir, tokenSource.Token);

Task downloadTask = Task.Run(async () =>
{
await downloadHandler.SetupAsync(targetDir, file => true, tokenSource.Token);
await downloadHandler.VerifyAsync(tokenSource.Token);
await downloadHandler.DownloadAsync(tokenSource.Token);
});

Parameters.Output += "\nOK.";

Expand Down Expand Up @@ -694,7 +692,12 @@
};
downloadHandler.DownloadComplete += (_, _) => Parameters.Output += "\n Download completed";

Task downloadTask = downloadHandler.DownloadToFolderAsync(targetDir, tokenSource.Token);
Task downloadTask = Task.Run(async () =>
{
await downloadHandler.SetupAsync(targetDir, file => true, tokenSource.Token);
await downloadHandler.VerifyAsync(tokenSource.Token);
await downloadHandler.DownloadAsync(tokenSource.Token);
});

Parameters.Output += "\n OK.";

Expand Down Expand Up @@ -741,7 +744,7 @@
public async Task<MessageDialogResult> SteamGuardInputPhone()
{ return await DialogCoordinator.ShowMessageAsync(this, "Steam Guard", "Press OK after accepting authentification on mobile\nOr press Cancel to enter a 2FA Code", MessageDialogStyle.AffirmativeAndNegative); }

public event PropertyChangedEventHandler PropertyChanged;

Check warning on line 747 in FASTER/ViewModel/SteamUpdaterViewModel.cs

View workflow job for this annotation

GitHub Actions / Analyze with CodeQL (csharp)

Nullability of reference types in type of 'event PropertyChangedEventHandler SteamUpdaterViewModel.PropertyChanged' doesn't match implicitly implemented member 'event PropertyChangedEventHandler? INotifyPropertyChanged.PropertyChanged'.

private void RaisePropertyChanged(string property)
{
Expand Down
10 changes: 5 additions & 5 deletions FASTERTests/FASTERTests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand All @@ -19,13 +19,13 @@
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="nunit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.0">
<PackageReference Include="nunit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.3.261602">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.421302">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down
54 changes: 27 additions & 27 deletions FASTERTests/Models/Arma3ProfileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,33 @@ public void Arma3ProfileSetUp()
[Test()]
public void Arma3ProfileCorrectData()
{
Assert.IsTrue(ProfileCfgArrays.AiPresetStrings.Contains(_p.AiLevelPreset));
Assert.IsTrue(ProfileCfgArrays.ThirdPersonStrings.Contains(_p.ThirdPersonView));
Assert.IsTrue(ProfileCfgArrays.EnabledStrings.Contains(_p.ReducedDamage));
Assert.IsTrue(ProfileCfgArrays.LimitedDistanceStrings.Contains(_p.GroupIndicators));
Assert.IsTrue(ProfileCfgArrays.LimitedDistanceStrings.Contains(_p.FriendlyTags));
Assert.IsTrue(ProfileCfgArrays.LimitedDistanceStrings.Contains(_p.EnemyTags));
Assert.IsTrue(ProfileCfgArrays.LimitedDistanceStrings.Contains(_p.DetectedMines));
Assert.IsTrue(ProfileCfgArrays.FadeOutStrings.Contains(_p.Commands));
Assert.IsTrue(ProfileCfgArrays.FadeOutStrings.Contains(_p.Waypoints));
Assert.IsTrue(ProfileCfgArrays.FadeOutStrings.Contains(_p.WeaponInfo));
Assert.IsTrue(ProfileCfgArrays.FadeOutStrings.Contains(_p.StanceIndicator));
Assert.IsTrue(ProfileCfgArrays.EnabledStrings.Contains(_p.StaminaBar));
Assert.IsTrue(ProfileCfgArrays.EnabledStrings.Contains(_p.WeaponCrosshair));
Assert.IsTrue(ProfileCfgArrays.EnabledStrings.Contains(_p.VisionAid));
Assert.IsTrue(ProfileCfgArrays.EnabledStrings.Contains(_p.CameraShake));
Assert.IsTrue(ProfileCfgArrays.EnabledStrings.Contains(_p.ScoreTable));
Assert.IsTrue(ProfileCfgArrays.EnabledStrings.Contains(_p.DeathMessages));
Assert.IsTrue(ProfileCfgArrays.EnabledStrings.Contains(_p.VonID));
Assert.IsTrue(ProfileCfgArrays.EnabledStrings.Contains(_p.MapContentEnemy));
Assert.IsTrue(ProfileCfgArrays.EnabledStrings.Contains(_p.MapContentFriendly));
Assert.IsTrue(ProfileCfgArrays.EnabledStrings.Contains(_p.MapContentMines));
Assert.IsTrue(ProfileCfgArrays.EnabledStrings.Contains(_p.AutoReport));
Assert.IsTrue(ProfileCfgArrays.EnabledStrings.Contains(_p.MultipleSaves));
Assert.IsTrue(ProfileCfgArrays.TacticalPingStrings.Contains(_p.TacticalPing));
Assert.IsFalse(string.IsNullOrWhiteSpace(_p.ArmaProfileContent));
Assert.IsNotNull(_p.PrecisionAi);
Assert.IsNotNull(_p.SkillAi);
Assert.That(ProfileCfgArrays.AiPresetStrings.Contains(_p.AiLevelPreset));
Assert.That(ProfileCfgArrays.ThirdPersonStrings.Contains(_p.ThirdPersonView));
Assert.That(ProfileCfgArrays.EnabledStrings.Contains(_p.ReducedDamage));
Assert.That(ProfileCfgArrays.LimitedDistanceStrings.Contains(_p.GroupIndicators));
Assert.That(ProfileCfgArrays.LimitedDistanceStrings.Contains(_p.FriendlyTags));
Assert.That(ProfileCfgArrays.LimitedDistanceStrings.Contains(_p.EnemyTags));
Assert.That(ProfileCfgArrays.LimitedDistanceStrings.Contains(_p.DetectedMines));
Assert.That(ProfileCfgArrays.FadeOutStrings.Contains(_p.Commands));
Assert.That(ProfileCfgArrays.FadeOutStrings.Contains(_p.Waypoints));
Assert.That(ProfileCfgArrays.FadeOutStrings.Contains(_p.WeaponInfo));
Assert.That(ProfileCfgArrays.FadeOutStrings.Contains(_p.StanceIndicator));
Assert.That(ProfileCfgArrays.EnabledStrings.Contains(_p.StaminaBar));
Assert.That(ProfileCfgArrays.EnabledStrings.Contains(_p.WeaponCrosshair));
Assert.That(ProfileCfgArrays.EnabledStrings.Contains(_p.VisionAid));
Assert.That(ProfileCfgArrays.EnabledStrings.Contains(_p.CameraShake));
Assert.That(ProfileCfgArrays.EnabledStrings.Contains(_p.ScoreTable));
Assert.That(ProfileCfgArrays.EnabledStrings.Contains(_p.DeathMessages));
Assert.That(ProfileCfgArrays.EnabledStrings.Contains(_p.VonID));
Assert.That(ProfileCfgArrays.EnabledStrings.Contains(_p.MapContentEnemy));
Assert.That(ProfileCfgArrays.EnabledStrings.Contains(_p.MapContentFriendly));
Assert.That(ProfileCfgArrays.EnabledStrings.Contains(_p.MapContentMines));
Assert.That(ProfileCfgArrays.EnabledStrings.Contains(_p.AutoReport));
Assert.That(ProfileCfgArrays.EnabledStrings.Contains(_p.MultipleSaves));
Assert.That(ProfileCfgArrays.TacticalPingStrings.Contains(_p.TacticalPing));
Assert.That(!string.IsNullOrWhiteSpace(_p.ArmaProfileContent));
Assert.That(_p.PrecisionAi, Is.Not.Null);
Assert.That(_p.SkillAi, Is.Not.Null);
}

[Test()]
Expand Down
22 changes: 11 additions & 11 deletions FASTERTests/Models/ArmaModCollectionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ public void AddSteamModTest()
[Test]
public void TestSteamModGet()
{
Assert.IsFalse(string.IsNullOrEmpty(_mod.Author));
Assert.IsFalse(string.IsNullOrEmpty(_mod.Name));
Assert.IsFalse(string.IsNullOrEmpty(_mod.Path));
Assert.IsFalse(string.IsNullOrEmpty(_mod.Status));
Assert.IsNotNull(_mod.Size);
Assert.IsNotNull(_mod.LocalLastUpdated);
Assert.IsNotNull(_mod.WorkshopId);
Assert.IsNotNull(_mod.SteamLastUpdated);
Assert.IsNotNull(_mod.PrivateMod);
Assert.IsNotNull(_mod.IsLocal);
Assert.IsNotNull(_mod.IsLoading);
Assert.That(!string.IsNullOrEmpty(_mod.Author));
Assert.That(!string.IsNullOrEmpty(_mod.Name));
Assert.That(!string.IsNullOrEmpty(_mod.Path));
Assert.That(!string.IsNullOrEmpty(_mod.Status));
Assert.That(_mod.Size, Is.Not.Null);
Assert.That(_mod.LocalLastUpdated, Is.Not.Null);
Assert.That(_mod.WorkshopId, Is.Not.Null);
Assert.That(_mod.SteamLastUpdated, Is.Not.Null);
Assert.That(_mod.PrivateMod, Is.Not.Null);
Assert.That(_mod.IsLocal, Is.Not.Null);
Assert.That(_mod.IsLoading, Is.Not.Null);
}

[Test]
Expand Down
Loading
Loading