Skip to content

Commit

Permalink
Add "Scanning..." and "Failed" messages to downloads and misc changes (
Browse files Browse the repository at this point in the history
…#222)

* Add "Scanning..." message, add "Failed" message, clean up Codacy warnings, and set project to treat warnings as errors

* Fix GoodFilesBaseUrl having an extra /

* Change ApiUrls and fix merge conflicts

* Split the code scanner into smaller modules where easy to do so, and fix small bug with the server view model not clearing old Downloads

* Remove unused file and using statements

* Comment out unused code paths, if we want these in the future we can uncomment them but for now its easier to just not include them

* Split MemberReferenceScanner into smaller methods where possible

* Split one more part of MemberReferenceScanner into its own method

* Split MTypeReferenced.IsTypeAccessAllowed method into 2 smaller methods

* Add additional logging, rename IlScanner to ILScanner, and remove unneeded Task.Run
  • Loading branch information
CorruptComputer authored Nov 28, 2023
1 parent 54cf525 commit 781526c
Show file tree
Hide file tree
Showing 79 changed files with 1,722 additions and 1,526 deletions.
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"ms-dotnettools.csharp",
"ms-dotnettools.csdevkit",
"ms-dotnettools.vscodeintellicode-csharp",
"avaloniateam.vscode-avalonia"
]
}
26 changes: 26 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/UnitystationLauncher/bin/Debug/net7.0/StationHub.dll",
"args": [],
"cwd": "${workspaceFolder}/UnitystationLauncher",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}
41 changes: 41 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/UnitystationLauncher.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/UnitystationLauncher.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/UnitystationLauncher.sln"
],
"problemMatcher": "$msCompile"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using UnitystationLauncher.Models;
using UnitystationLauncher.Models.Api;
using UnitystationLauncher.Services.Interface;
Expand All @@ -22,7 +23,7 @@ public List<Installation> GetInstallations()
return null;
}

public (Download?, string) DownloadInstallation(Server server)
public Task<(Download?, string)> DownloadInstallationAsync(Server server)
{
throw new NotImplementedException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace UnitystationLauncher.Tests.MocksRepository.PingService;

public class MockPingReturnsNull : IPingService
{
public Task<string> GetPing(Server server)
public Task<string> GetPingAsync(Server server)
{
return Task.FromResult(null as string)!;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public MockPingStaticPingTime(int pingInMilliseconds)
{
_pingTime = $"{pingInMilliseconds}ms";
}
public Task<string> GetPing(Server server)
public Task<string> GetPingAsync(Server server)
{
return Task.FromResult(_pingTime);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace UnitystationLauncher.Tests.MocksRepository.PingService;

public class MockPingThrowsException : IPingService
{
public Task<string> GetPing(Server server)
public Task<string> GetPingAsync(Server server)
{
throw new();
}
Expand Down
1 change: 0 additions & 1 deletion UnitystationLauncher.Tests/Models/Api/ServerTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using UnitystationLauncher.Models.Api;
using UnitystationLauncher.Tests.MocksRepository;
using UnitystationLauncher.Tests.MocksRepository.EnvironmentService;

namespace UnitystationLauncher.Tests.Models.Api;
Expand Down
1 change: 1 addition & 0 deletions UnitystationLauncher.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IL/@EntryIndexedValue">IL</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Avalonia/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Patreon/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Unitystation/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
25 changes: 16 additions & 9 deletions UnitystationLauncher/Constants/ApiUrls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@ namespace UnitystationLauncher.Constants;

public static class ApiUrls
{
public const string ApiBaseUrl = "https://api.unitystation.org";
public const string ServerListUrl = $"{ApiBaseUrl}/serverlist";
public const string ValidateUrl = $"{ApiBaseUrl}/validatehubclient";
public const string ValidateTokenUrl = $"{ApiBaseUrl}/validatetoken?data=";
public const string SignOutUrl = $"{ApiBaseUrl}/signout?data=";

public const string ChangelogBaseUrl = "https://changelog.unitystation.org";
public const string Latest10VersionsUrl = $"{ChangelogBaseUrl}/all-changes?format=json&limit=10";
public const string LatestBlogPosts = $"{ChangelogBaseUrl}/posts/?format=json";
private static string ApiBaseUrl => "https://api.unitystation.org";
public static string ServerListUrl => $"{ApiBaseUrl}/serverlist";
public static string ValidateUrl => $"{ApiBaseUrl}/validatehubclient";
public static string ValidateTokenUrl => $"{ApiBaseUrl}/validatetoken?data=";
public static string SignOutUrl => $"{ApiBaseUrl}/signout?data=";

private static string ChangelogBaseUrl => "https://changelog.unitystation.org";
public static string Latest10VersionsUrl => $"{ChangelogBaseUrl}/all-changes?format=json&limit=10";
public static string LatestBlogPosts => $"{ChangelogBaseUrl}/posts/?format=json";

private static string CdnBaseUrl => "https://unitystationfile.b-cdn.net";
public static string GoodFilesBaseUrl => $"{CdnBaseUrl}/GoodFiles";
public static string AllowedGoodFilesUrl => $"{GoodFilesBaseUrl}/AllowGoodFiles.json";

private static string RawGitHubFileBaseUrl => "https://raw.githubusercontent.com/unitystation/unitystation/develop";
public static string CodeScanListUrl => $"{RawGitHubFileBaseUrl}/CodeScanList.json";
}
6 changes: 6 additions & 0 deletions UnitystationLauncher/Constants/AssemblyNames.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace UnitystationLauncher.Constants;

public static class AssemblyNames
{
public const string SystemAssemblyName = "mscorlib";
}
8 changes: 8 additions & 0 deletions UnitystationLauncher/Constants/FolderNames.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace UnitystationLauncher.Constants;

public static class FolderNames
{
public const string Managed = "Managed";
public const string Plugins = "Plugins";
public const string UnitystationData = "Unitystation_Data";
}
Loading

0 comments on commit 781526c

Please sign in to comment.